TempleOSCD_150216.ISO
This commit is contained in:
1 parent
64f679eeb9
commit
401601816c
531 files changed
+23341
-22071
No files matched your search
@@ -1,7 +1,7 @@
|
||||
#help_index "Debugging/Dump"
|
||||
Bool ClassRep2(CDoc *doc,U8 *_d,U8 *class_name=lastclass,I64 depth,I64 max_depth,Bool dynamic,I64 types=HTT_CLASS,I64 offset=0)
|
||||
{//See $LK,"::/Demo/LastClass.CPP"$.
|
||||
I64 i,j,*ptr;
|
||||
I64 i,j,stars,*ptr;
|
||||
CMemberLst *ml;
|
||||
CDocEntry *doc_e;
|
||||
Bool unlock;
|
||||
@@ -24,12 +24,12 @@ Bool ClassRep2(CDoc *doc,U8 *_d,U8 *class_name=lastclass,I64 depth,I64 max_depth
|
||||
tempc2=ml->member_class;
|
||||
ptr=_d(U8 *)+ml->offset;
|
||||
DocPrint(doc,"%08X ",ptr(U8 *)+offset);
|
||||
j=tempc2->ptr_cnt;
|
||||
stars=tempc2->ptr_stars_cnt;
|
||||
tempc2=OptClassFwd(tempc2);
|
||||
tempc2-=tempc2->ptr_cnt;
|
||||
tempc2-=tempc2->ptr_stars_cnt;
|
||||
if (tempc2->type & HTT_INTERNAL_TYPE) {
|
||||
DocPrint(doc,"$$GREEN$$%-20ts:$$FG$$",ml->str);
|
||||
if (j==1 && (tempc2->raw_type==RT_I8 || tempc2->raw_type==RT_U8)) {
|
||||
if (stars==1 && (tempc2->raw_type==RT_I8 || tempc2->raw_type==RT_U8)) {
|
||||
ptr=*ptr;
|
||||
if (ChkPtr(ptr)) {
|
||||
if (dynamic) {
|
||||
@@ -39,7 +39,7 @@ Bool ClassRep2(CDoc *doc,U8 *_d,U8 *class_name=lastclass,I64 depth,I64 max_depth
|
||||
} else
|
||||
DocPrint(doc,"%40ts\n",ptr);
|
||||
}
|
||||
} else if (!j) {
|
||||
} else if (!stars) {
|
||||
j=MinI64(ml->dim.total_cnt,32);
|
||||
if (tempc2->raw_type==RT_I8 || tempc2->raw_type==RT_U8) {
|
||||
if (j==1) {
|
||||
@@ -128,14 +128,14 @@ Bool ClassRep2(CDoc *doc,U8 *_d,U8 *class_name=lastclass,I64 depth,I64 max_depth
|
||||
DocPrint(doc,"\n");
|
||||
} else {
|
||||
if (depth<2) {
|
||||
if (j==1 && !ChkPtr(*ptr))
|
||||
if (stars==1 && !ChkPtr(*ptr))
|
||||
DocPrint(doc,"%-20ts:%016X\n",ml->str,*ptr);
|
||||
else {
|
||||
DocPrint(doc,"$$TR,\"%s\"$$\n",ml->str);
|
||||
DocPrint(doc,"$$ID,2$$");
|
||||
if (!j)
|
||||
if (!stars)
|
||||
ClassRep2(doc,ptr,tempc2->str,depth+1,max_depth,dynamic);
|
||||
else if (j==1)
|
||||
else if (stars==1)
|
||||
ClassRep2(doc,*ptr,tempc2->str,depth+1,max_depth,dynamic);
|
||||
DocPrint(doc,"$$ID,-2$$");
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
#help_index "Define;Char/Define"
|
||||
|
||||
U0 LoadDocDefines()
|
||||
{
|
||||
CBinFile *bfh=sys_boot_base-sizeof(CBinFile);
|
||||
|
||||
DefinePrint(
|
||||
"DD_OS_NAME_VERSION","TempleOS V%0.2f",os_version);
|
||||
DefinePrint(
|
||||
"DD_TEMPLEOS_AGE","%0.1f",(Now-Str2Date("8/1/2003"))/ToF64(1<<32)/CDATE_YEAR_DAYS);
|
||||
|
||||
//This is cut and replaced when I generate a distro.
|
||||
//See $LK,"DD_TEMPLEOS_LOC",A="FF:::/Demo/AcctExample/TOSDistro.CPP,DD_TEMPLEOS_LOC"$.
|
||||
$TR-C,"LineRep"$
|
||||
$ID,4$DefinePrint("DD_TEMPLEOS_LOC","120,789");
|
||||
DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","79,959");
|
||||
$ID,-4$
|
||||
DefinePrint(
|
||||
"DD_KERNEL","%08X",bfh);
|
||||
bfh(I64)+=bfh->file_size-1;
|
||||
DefinePrint(
|
||||
"DD_KERNEL_END","%08X",bfh);
|
||||
DefinePrint(
|
||||
"DD_PROTECTED_LOW","%08X",MEM_PROTECTED_LOW_LIMIT);
|
||||
|
||||
//$LK,"DD_BOOT_HIGH_LOC_CD",A="FF:::/Adam/Boot/BootCD.CPP,DD_BOOT_HIGH_LOC_CD"$
|
||||
|
||||
DefinePrint(
|
||||
"DD_MP_VECT","%08X",MP_VECT_ADDR);
|
||||
DefinePrint(
|
||||
"DD_MP_VECT_END","%08X",MP_VECT_ADDR+AP_16BIT_INIT_END-AP_16BIT_INIT-1);
|
||||
|
||||
DefinePrint(
|
||||
"DD_SYS_FIXED_AREA_BASE","%08X",SYS_FIXED_AREA);
|
||||
DefinePrint(
|
||||
"DD_SYS_FIXED_AREA_END","%08X",SYS_FIXED_AREA+sizeof(CSysFixedArea)-1);
|
||||
DefinePrint(
|
||||
"DD_SYS_HEAP_BASE","%08X",sys_heap_base);
|
||||
DefinePrint(
|
||||
"DD_SYS_HEAP_LIMIT","%08X",sys_heap_limit);
|
||||
DefinePrint(
|
||||
"DD_MEM_MIN_MEG","%d Meg",MEM_MIN_MEG);
|
||||
DefinePrint(
|
||||
"DD_MEM_MAPPED_SPACE_GIG","%d Gig",MEM_MAPPED_SPACE/0x40000000);
|
||||
DefinePrint(
|
||||
"DD_MEM_MAPPED_SPACE_END","%010X",MEM_MAPPED_SPACE-1);
|
||||
DefinePrint(
|
||||
"DD_JIFFY_HZ","%d Hz",JIFFY_FREQ);
|
||||
}
|
||||
|
||||
LoadDocDefines;
|
||||
@@ -1,13 +1,20 @@
|
||||
extern U0 ACDDef(I64 n,CTask *parent=NULL);
|
||||
extern U0 ACDDefsPut(CDoc *doc,U8 *st,I64 num=-1);
|
||||
extern U0 ACDFillin(I64 n);
|
||||
extern U0 ACFillIn(I64 n);
|
||||
extern U0 ACFindMisspelled(CDoc *doc);
|
||||
extern U0 ACMan(I64 n,CTask *parent=NULL);
|
||||
extern U0 AcctOneTimePopUp(I64 flag_num,U8 *msg);
|
||||
extern I64 AdamFile(U8 *filename,Bool warn_ext=TRUE);
|
||||
extern I64 BMPFileWrite(U8 *filename,CDC *dc,I64 bits=4);
|
||||
extern Bool AutoComplete(Bool val=OFF);
|
||||
extern I64 BMPWrite(U8 *filename,CDC *dc,I64 bits=4);
|
||||
extern I64 CDFileCreate(U8 *_filename=NULL,U8 *src_files_find_mask,U8 *fu_flags=NULL,
|
||||
U8 *_stage2_filename=NULL);
|
||||
extern U0 ClipboardDel();
|
||||
extern CCtrl *CtrlFindUnique(CTask *haystack_task,I64 needle_type);
|
||||
extern Bool CtrlInside(CCtrl *c,I64 x,I64 y);
|
||||
extern U8 *DC2Sprite(CDC *tempb);
|
||||
extern U0 DocBMPFile(CDoc *doc=NULL,U8 *filename,Bool use_ms_paint_palette=FALSE);
|
||||
extern U0 DocBMP(CDoc *doc=NULL,U8 *filename,Bool dither_probability=FALSE,Bool use_ms_paint_palette=FALSE);
|
||||
extern U0 DocBinDel(CDoc *doc,CDocBin *b);
|
||||
extern U0 DocBinsValidate(CDoc *doc);
|
||||
extern U0 DocBottom(CDoc *doc=NULL);
|
||||
@@ -52,8 +59,7 @@ extern CMenu *MenuFilePush(U8 *filename);
|
||||
extern U0 MenuPop();
|
||||
extern CMenu *MenuPush(U8 *st);
|
||||
extern CTask *Noise(I64 mS,I64 min_freq,I64 max_freq);
|
||||
extern Bool Plain(U8 *filename);
|
||||
extern I64 PopUp(U8 *msg,CTask *parent=NULL,CTask **_pu_task=NULL);
|
||||
extern Bool Plain(U8 *filename,I64 edf_dof_flags=0);
|
||||
extern Bool PopUpCancelOk(U8 *header=NULL,U8 *footer=NULL);
|
||||
extern I64 PopUpColor(U8 *header=NULL,Bool allow_transpant=TRUE,Bool allow_dft=TRUE);
|
||||
extern I64 PopUpColorDither(U8 *header=NULL);
|
||||
@@ -67,27 +73,20 @@ extern Bool PopUpNoYes(U8 *header=NULL,U8 *footer=NULL);
|
||||
extern Bool PopUpOk(U8 *header=NULL,U8 *footer=NULL);
|
||||
extern I64 PopUpRangeI64(I64 lo,I64 hi,I64 step=1,U8 *header=NULL,U8 *footer=NULL);
|
||||
extern Bool PopUpTransform(I64 *r);
|
||||
extern CDoc *SetCursorPos(CTask *task,I64 ip_text_x,I64 ip_text_y,Bool set_cursor=TRUE);
|
||||
extern Bool SetWinHorz(I64 left,I64 right,CTask *task=NULL);
|
||||
extern Bool SetWinVert(I64 top,I64 bottom,CTask *task=NULL);
|
||||
extern U0 SettingsPop(CTask *task=NULL,I64 flags=0);
|
||||
extern CTaskSettings *SettingsPush(CTask *task=NULL,I64 flags=0);
|
||||
extern U0 TemplateSliderCtrl(CDoc *doc);
|
||||
extern U0 TemplateCtrlSlider(CDoc *doc);
|
||||
extern Bool View();
|
||||
extern U0 ViewAnglesDel(CTask *task=NULL);
|
||||
extern CCtrl *ViewAnglesNew(CTask *task=NULL);
|
||||
extern U0 WSDDef(I64 n,CTask *parent=NULL);
|
||||
extern U0 WSDDefsPut(CDoc *doc,U8 *st,I64 num=-1);
|
||||
extern U0 WSDFillin(I64 n);
|
||||
extern U0 WSFillIn(I64 n);
|
||||
extern U0 WSFindMisspelled(CDoc *doc);
|
||||
extern U0 WSMan(I64 n,CTask *parent=NULL);
|
||||
extern Bool WinBorder(Bool val,CTask *task=NULL);
|
||||
extern CDoc *WinCursorPosSet(CTask *task,I64 ip_text_x,I64 ip_text_y,Bool set_cursor=TRUE);
|
||||
extern Bool WinHorz(I64 left,I64 right,CTask *task=NULL);
|
||||
extern U0 WinMax(CTask *task=NULL);
|
||||
extern U0 WinMgrSync(I64 cnt=1,Bool force=FALSE);
|
||||
extern U0 WinScrollNull(CTask *task,CD3I64 *s);
|
||||
extern U0 WinScrollRestore(CTask *task,CD3I64 *s);
|
||||
extern U0 WinScrollsInit(CTask *task);
|
||||
extern Bool WinToTop(CTask *task=NULL,Bool update_z_buf=TRUE);
|
||||
extern Bool WordStat(Bool val=OFF);
|
||||
extern Bool WinVert(I64 top,I64 bottom,CTask *task=NULL);
|
||||
extern CWinMgrGlbls winmgr;
|
||||
@@ -144,8 +144,8 @@ public U0 Who(U8 *fu_flags=NULL,CHashTable *h=NULL,
|
||||
U8 *outname=NULL,U8 mapfile_drv=0,U8 *index=NULL,CDoc *_doc=NULL)
|
||||
{//Dump hash symbol table.
|
||||
// "+p" for only public symbols
|
||||
// "+m" to order by number (normally alphabetical)
|
||||
// "-r" just local hash table
|
||||
// "+m" to order by number (normally alphabetical)
|
||||
// "-r" just local hash table
|
||||
CHashTable *table;
|
||||
CHashSrcSym *temph;
|
||||
CHashGeneric *ptr;
|
||||
@@ -177,7 +177,7 @@ public U0 Who(U8 *fu_flags=NULL,CHashTable *h=NULL,
|
||||
doc=NULL;
|
||||
|
||||
if (index) {
|
||||
task=SpawnUser;
|
||||
task=User;
|
||||
TaskWait(task);
|
||||
LBtr(&task->display_flags,DISPLAYf_SHOW);
|
||||
} else
|
||||
@@ -186,16 +186,18 @@ public U0 Who(U8 *fu_flags=NULL,CHashTable *h=NULL,
|
||||
cnt=0;
|
||||
table=h;
|
||||
while (table) {
|
||||
temph=table->next_added;
|
||||
while (temph!=table) {
|
||||
if (!(temph->type & (HTF_IMPORT | HTF_PRIVATE)) &&
|
||||
(temph->type & HTF_PUBLIC || !publics)) {
|
||||
if (!index)
|
||||
cnt++;
|
||||
else if (temph->type&HTG_SRC_SYM && (cur_index=temph->index))
|
||||
cnt+=HelpIndexCnt(cur_index,index);
|
||||
for (i=0;i<=table->mask;i++) {
|
||||
temph=table->body[i];
|
||||
while (temph) {
|
||||
if (!(temph->type & (HTF_IMPORT | HTF_PRIVATE)) &&
|
||||
(temph->type & HTF_PUBLIC || !publics)) {
|
||||
if (!index)
|
||||
cnt++;
|
||||
else if (temph->type&HTG_SRC_SYM && (cur_index=temph->index))
|
||||
cnt+=HelpIndexCnt(cur_index,index);
|
||||
}
|
||||
temph=temph->next;
|
||||
}
|
||||
temph=temph->next_added;
|
||||
}
|
||||
if (recurse)
|
||||
table=table->next;
|
||||
@@ -208,19 +210,21 @@ public U0 Who(U8 *fu_flags=NULL,CHashTable *h=NULL,
|
||||
j=0;
|
||||
table=h;
|
||||
while (table) {
|
||||
temph=table->next_added;
|
||||
while (temph!=table) {
|
||||
if (!(temph->type & (HTF_IMPORT | HTF_PRIVATE)) &&
|
||||
(temph->type & HTF_PUBLIC || !publics))
|
||||
if (!index)
|
||||
lst[j++].h=temph;
|
||||
else if (temph->type&HTG_SRC_SYM && (cur_index=temph->index) &&
|
||||
(k=HelpIndexCnt(cur_index,index)))
|
||||
while (k--) {
|
||||
lst[j].index=HelpIndexStr(&cur_index,index);
|
||||
for (i=0;i<=table->mask;i++) {
|
||||
temph=table->body[i];
|
||||
while (temph) {
|
||||
if (!(temph->type & (HTF_IMPORT | HTF_PRIVATE)) &&
|
||||
(temph->type & HTF_PUBLIC || !publics))
|
||||
if (!index)
|
||||
lst[j++].h=temph;
|
||||
}
|
||||
temph=temph->next_added;
|
||||
else if (temph->type&HTG_SRC_SYM && (cur_index=temph->index) &&
|
||||
(k=HelpIndexCnt(cur_index,index)))
|
||||
while (k--) {
|
||||
lst[j].index=HelpIndexStr(&cur_index,index);
|
||||
lst[j++].h=temph;
|
||||
}
|
||||
temph=temph->next;
|
||||
}
|
||||
}
|
||||
if (recurse)
|
||||
table=table->next;
|
||||
@@ -347,7 +351,7 @@ public U0 Who(U8 *fu_flags=NULL,CHashTable *h=NULL,
|
||||
if (index)
|
||||
progress1=progress1_max=0;
|
||||
|
||||
wh_done:
|
||||
wh_done:
|
||||
Preempt(old_preempt);
|
||||
if (doc) {
|
||||
DocBinsValidate(doc);
|
||||
@@ -376,11 +380,7 @@ public I64 HashDepthRep(CHashTable *table=NULL)
|
||||
for (i=0;i<=table->mask;i++) {
|
||||
temph=table->body[i];
|
||||
if (temph) {
|
||||
j=1;
|
||||
while (temph->next) {
|
||||
temph=temph->next;
|
||||
j++;
|
||||
}
|
||||
j=LinkedLstCnt(temph);
|
||||
if (j<HDR_MAX)
|
||||
a[j]++;
|
||||
cnt+=j;
|
||||
@@ -444,7 +444,7 @@ public U0 MapFileLoad(U8 *filename)
|
||||
|
||||
ptr=temph->src_link;
|
||||
if (ptr[0] && ptr[1] && ptr[2]==':' && ptr[3]==':')
|
||||
ptr[3]=*sys_acct;
|
||||
ptr[3]=dsk.boot_drv_let;
|
||||
|
||||
doc_e->aux_str=NULL;
|
||||
}
|
||||
File renamed without changes.
@@ -1,7 +1,7 @@
|
||||
#help_index "Math/ODE"
|
||||
#help_file "::/Doc/ODE"
|
||||
|
||||
//See $LK,"::/Doc/Acknowledgements.TXT"$.
|
||||
//See $LK,"::/Doc/Credits.TXT"$.
|
||||
|
||||
F64 LowPass1(F64 a,F64 y0,F64 y,F64 dt=1.0)
|
||||
{//First order low pass filter
|
||||
@@ -56,14 +56,12 @@ public CMathODE *ODENew(I64 n,F64 max_tolerance=1e-6,I64 flags=0)
|
||||
ode->state=CAlloc(s);
|
||||
ode->array_base=MAlloc(12*s);
|
||||
ODERstPtrs(ode);
|
||||
ode->ode_signature=ODE_SIGNATURE_VAL;
|
||||
return ode;
|
||||
}
|
||||
|
||||
public U0 ODEDel(CMathODE *ode)
|
||||
{//Free ODE node, but not masses or springs.
|
||||
if (!ode) return;
|
||||
ode->ode_signature=0;
|
||||
Free(ode->state);
|
||||
Free(ode->array_base);
|
||||
Free(ode);
|
||||
@@ -158,13 +156,13 @@ public U0 ODERenum(CMathODE *ode)
|
||||
public CMass *MassFind(CMathODE *ode,F64 x,F64 y,F64 z=0)
|
||||
{//Search for mass nearest to x,y,z.
|
||||
CMass *tempm,*best_mass=NULL;
|
||||
F64 d,best_d=MAX_F64;
|
||||
F64 dd,best_dd=MAX_F64;
|
||||
|
||||
tempm=ode->next_mass;
|
||||
while (tempm!=&ode->next_mass) {
|
||||
d=Sqr(tempm->x-x)+Sqr(tempm->y-y)+Sqr(tempm->z-z);
|
||||
if (d<best_d) {
|
||||
best_d=d;
|
||||
dd=Sqr(tempm->x-x)+Sqr(tempm->y-y)+Sqr(tempm->z-z);
|
||||
if (dd<best_dd) {
|
||||
best_dd=dd;
|
||||
best_mass=tempm;
|
||||
}
|
||||
tempm=tempm->next;
|
||||
@@ -175,15 +173,15 @@ public CMass *MassFind(CMathODE *ode,F64 x,F64 y,F64 z=0)
|
||||
public CSpring *SpringFind(CMathODE *ode,F64 x,F64 y,F64 z=0)
|
||||
{//Find spring midpoint nearest x,y,z.
|
||||
CSpring *temps,*best_spring=NULL;
|
||||
F64 d,best_d=MAX_F64;
|
||||
F64 dd,best_dd=MAX_F64;
|
||||
|
||||
temps=ode->next_spring;
|
||||
while (temps!=&ode->next_spring) {
|
||||
d=Sqr((temps->end1->x+temps->end2->x)/2-x)+
|
||||
dd=Sqr((temps->end1->x+temps->end2->x)/2-x)+
|
||||
Sqr((temps->end1->y+temps->end2->y)/2-y)+
|
||||
Sqr((temps->end1->z+temps->end2->z)/2-z);
|
||||
if (d<best_d) {
|
||||
best_d=d;
|
||||
if (dd<best_dd) {
|
||||
best_dd=dd;
|
||||
best_spring=temps;
|
||||
}
|
||||
temps=temps->next;
|
||||
@@ -196,13 +194,13 @@ public U0 MassOrSpringFind(CMathODE *ode,CMass **result_mass,CSpring **result_sp
|
||||
{//Find spring or mass nearest x,y,z.
|
||||
CMass *tempm,*best_mass=NULL;
|
||||
CSpring *temps,*best_spring=NULL;
|
||||
F64 d,best_d=MAX_F64;
|
||||
F64 dd,best_dd=MAX_F64;
|
||||
|
||||
tempm=ode->next_mass;
|
||||
while (tempm!=&ode->next_mass) {
|
||||
d=Sqr(tempm->x-x)+Sqr(tempm->y-y)+Sqr(tempm->z-z);
|
||||
if (d<best_d) {
|
||||
best_d=d;
|
||||
dd=Sqr(tempm->x-x)+Sqr(tempm->y-y)+Sqr(tempm->z-z);
|
||||
if (dd<best_dd) {
|
||||
best_dd=dd;
|
||||
best_mass=tempm;
|
||||
}
|
||||
tempm=tempm->next;
|
||||
@@ -210,11 +208,11 @@ public U0 MassOrSpringFind(CMathODE *ode,CMass **result_mass,CSpring **result_sp
|
||||
|
||||
temps=ode->next_spring;
|
||||
while (temps!=&ode->next_spring) {
|
||||
d=Sqr((temps->end1->x+temps->end2->x)/2-x)+
|
||||
dd=Sqr((temps->end1->x+temps->end2->x)/2-x)+
|
||||
Sqr((temps->end1->y+temps->end2->y)/2-y)+
|
||||
Sqr((temps->end1->z+temps->end2->z)/2-z);
|
||||
if (d<best_d) {
|
||||
best_d=d;
|
||||
if (dd<best_dd) {
|
||||
best_dd=dd;
|
||||
best_spring=temps;
|
||||
best_mass=NULL;
|
||||
}
|
||||
@@ -491,7 +489,7 @@ U0 ODERK5OneStep(CMathODE *ode)
|
||||
MemCpy(ode->state_internal,tempstate,sizeof(F64)*ode->n_internal);
|
||||
}
|
||||
|
||||
F64 ode_allocated_factor=0.75;
|
||||
F64 ode_alloced_factor=0.75;
|
||||
|
||||
U0 ODEsUpdate(CTask *task)
|
||||
{/* This routine is called by the $LK,"window mgr",A="FF:::/Adam/Gr/GrScreen.CPP,ODEsUpdate"$ on a continuous
|
||||
@@ -510,105 +508,100 @@ it has a timeout.
|
||||
|
||||
if (task->next_ode==&task->next_ode)
|
||||
task->last_ode_time=0;
|
||||
else {
|
||||
else if (!Bt(&task->win_inhibit,WIf_SELF_ODE)) {
|
||||
//See $LK,"GrUpdateWins",A="MN:GrUpdateWins"$()
|
||||
if (!Bt(&task->win_inhibit,WIf_SELF_ODE)) {
|
||||
//TODO: Being preempted here woulds be bad
|
||||
if (task!=Fs)
|
||||
old_suspend=Suspend(task);
|
||||
//We will not pick a time limit based on
|
||||
//how busy the CPU is, what percent of the
|
||||
//last refresh cycle was spent on ODE's
|
||||
//and what the refresh cycle rate was.
|
||||
start_time=tS;
|
||||
d=1.0/winmgr.fps;
|
||||
timeout_time=start_time+
|
||||
(task->last_ode_time/d+0.1)/(winmgr.last_ode_time/d+0.1)*
|
||||
ode_allocated_factor*d;
|
||||
ode=task->next_ode;
|
||||
while (ode!=&task->next_ode) {
|
||||
if (ode->ode_signature==ODE_SIGNATURE_VAL) {
|
||||
t_initial=ode->t;
|
||||
d=tS;
|
||||
if (!(ode->flags&ODEF_STARTED)) {
|
||||
ode->base_t=d;
|
||||
ode->flags|=ODEF_STARTED;
|
||||
}
|
||||
d-=ode->base_t+t_initial;
|
||||
t_desired=ode->t_scale*d+t_initial;
|
||||
if (ode->flags&ODEF_PAUSED)
|
||||
//TODO: Being preempted here woulds be bad
|
||||
if (task!=Fs)
|
||||
old_suspend=Suspend(task);
|
||||
//We will not pick a time limit based on
|
||||
//how busy the CPU is, what percent of the
|
||||
//last refresh cycle was spent on ODE's
|
||||
//and what the refresh cycle rate was.
|
||||
start_time=tS;
|
||||
d=1.0/winmgr.fps;
|
||||
timeout_time=start_time+
|
||||
(task->last_ode_time/d+0.1)/(winmgr.last_ode_time/d+0.1)*
|
||||
ode_alloced_factor*d;
|
||||
ode=task->next_ode;
|
||||
while (ode!=&task->next_ode) {
|
||||
t_initial=ode->t;
|
||||
d=tS;
|
||||
if (!(ode->flags&ODEF_STARTED)) {
|
||||
ode->base_t=d;
|
||||
ode->flags|=ODEF_STARTED;
|
||||
}
|
||||
d-=ode->base_t+t_initial;
|
||||
t_desired=ode->t_scale*d+t_initial;
|
||||
if (ode->flags&ODEF_PAUSED)
|
||||
ode->base_t+=t_desired-ode->t; //Slip
|
||||
else if (ode->derivative) {
|
||||
ODEState2Internal(ode);
|
||||
MemCpy(ode->initial_state,ode->state_internal,ode->n_internal*sizeof(F64));
|
||||
while (ode->t<t_desired) {
|
||||
ode->h_max=t_desired-ode->t;
|
||||
ODECallDerivative(ode,ode->t,ode->state_internal,ode->DstateDt);
|
||||
for (i=0;i<ode->n_internal;i++)
|
||||
ode->state_scale[i]=Abs(ode->state_internal[i])+
|
||||
Abs(ode->DstateDt[i]*ode->h)+ode->tolerance_internal;
|
||||
ODERK5OneStep(ode);
|
||||
if (tS>timeout_time) {
|
||||
ode->base_t+=t_desired-ode->t; //Slip
|
||||
else if (ode->derivative) {
|
||||
ODEState2Internal(ode);
|
||||
MemCpy(ode->initial_state,ode->state_internal,ode->n_internal*sizeof(F64));
|
||||
while (ode->t<t_desired) {
|
||||
ode->h_max=t_desired-ode->t;
|
||||
ODECallDerivative(ode,ode->t,ode->state_internal,ode->DstateDt);
|
||||
goto ode_done;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//Interpolate if end time was not exact.
|
||||
if (ode->t!=t_desired) {
|
||||
if (interpolation=ode->t-t_initial) {
|
||||
interpolation=(t_desired-t_initial)/interpolation;
|
||||
if (interpolation!=1.0)
|
||||
for (i=0;i<ode->n_internal;i++)
|
||||
ode->state_scale[i]=Abs(ode->state_internal[i])+
|
||||
Abs(ode->DstateDt[i]*ode->h)+ode->tolerance_internal;
|
||||
ODERK5OneStep(ode);
|
||||
if (tS>timeout_time) {
|
||||
ode->base_t+=t_desired-ode->t; //Slip
|
||||
goto ode_done;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//Interpolate if end time was not exact.
|
||||
if (ode->t!=t_desired) {
|
||||
if (interpolation=ode->t-t_initial) {
|
||||
interpolation=(t_desired-t_initial)/interpolation;
|
||||
if (interpolation!=1.0)
|
||||
for (i=0;i<ode->n_internal;i++)
|
||||
ode->state_internal[i]=(ode->state_internal[i]-
|
||||
ode->initial_state[i])*interpolation+
|
||||
ode->initial_state[i];
|
||||
}
|
||||
ode->t=t_desired;
|
||||
}
|
||||
ode->state_internal[i]=(ode->state_internal[i]-
|
||||
ode->initial_state[i])*interpolation+
|
||||
ode->initial_state[i];
|
||||
}
|
||||
ode->t=t_desired;
|
||||
}
|
||||
ode_done:
|
||||
ODEInternal2State(ode);
|
||||
ODEInternal2State(ode);
|
||||
|
||||
//Convenience call to set vals
|
||||
ODECallDerivative(ode,ode->t,ode->state_internal,ode->DstateDt);
|
||||
}
|
||||
ode->base_t+=(1.0-ode->t_scale)*d;
|
||||
}
|
||||
ode=ode->next;
|
||||
//Convenience call to set vals
|
||||
ODECallDerivative(ode,ode->t,ode->state_internal,ode->DstateDt);
|
||||
}
|
||||
|
||||
//Now, we will dynamically adjust tolerances.
|
||||
|
||||
//We will regulate the tolerances
|
||||
//to fill the time we decided was
|
||||
//okay to devote to ODE's.
|
||||
//Since we might have multiple ODE's
|
||||
//active we scale them by the same factor.
|
||||
|
||||
//This algorithm is probably not stable or very good, but it's something.
|
||||
|
||||
//Target is 75% of allocated time.
|
||||
d=(tS-start_time)/(timeout_time-start_time)-0.75;
|
||||
|
||||
ode=task->next_ode;
|
||||
while (ode!=&task->next_ode) {
|
||||
if (ode->ode_signature==ODE_SIGNATURE_VAL &&
|
||||
!(ode->flags&ODEF_PAUSED) && ode->derivative) {
|
||||
if (ode->min_tolerance!=ode->max_tolerance) {
|
||||
if (d>0)
|
||||
ode->tolerance_internal*=10.0`d;
|
||||
else
|
||||
ode->tolerance_internal*=2.0`d;
|
||||
}
|
||||
ode->tolerance_internal=Clamp(ode->tolerance_internal,ode->min_tolerance,ode->max_tolerance);
|
||||
}
|
||||
ode=ode->next;
|
||||
}
|
||||
winmgr.ode_time+=task->last_ode_time=tS-start_time;
|
||||
//See $LK,"GrUpdateWins",A="MN:GrUpdateWins"$()
|
||||
if (task!=Fs)
|
||||
Suspend(task,old_suspend);
|
||||
ode->base_t+=(1.0-ode->t_scale)*d;
|
||||
ode=ode->next;
|
||||
}
|
||||
|
||||
//Now, we will dynamically adjust tolerances.
|
||||
|
||||
//We will regulate the tolerances
|
||||
//to fill the time we decided was
|
||||
//okay to devote to ODE's.
|
||||
//Since we might have multiple ODE's
|
||||
//active we scale them by the same factor.
|
||||
|
||||
//This algorithm is probably not stable or very good, but it's something.
|
||||
|
||||
//Target is 75% of alloced time.
|
||||
d=(tS-start_time)/(timeout_time-start_time)-0.75;
|
||||
|
||||
ode=task->next_ode;
|
||||
while (ode!=&task->next_ode) {
|
||||
if (!(ode->flags&ODEF_PAUSED) && ode->derivative) {
|
||||
if (ode->min_tolerance!=ode->max_tolerance) {
|
||||
if (d>0)
|
||||
ode->tolerance_internal*=10.0`d;
|
||||
else
|
||||
ode->tolerance_internal*=2.0`d;
|
||||
}
|
||||
ode->tolerance_internal=Clamp(ode->tolerance_internal,ode->min_tolerance,ode->max_tolerance);
|
||||
}
|
||||
ode=ode->next;
|
||||
}
|
||||
winmgr.ode_time+=task->last_ode_time=tS-start_time;
|
||||
//See $LK,"GrUpdateWins",A="MN:GrUpdateWins"$()
|
||||
if (task!=Fs)
|
||||
Suspend(task,old_suspend);
|
||||
}
|
||||
}
|
||||
+211
@@ -0,0 +1,211 @@
|
||||
#help_index "Memory/Task"
|
||||
public I64 TaskMemAlloced(CTask *task=NULL,Bool override_validate=FALSE)
|
||||
{//Count of bytes alloced to a task, used+unused.
|
||||
I64 result;
|
||||
if (!task) task=Fs;
|
||||
if (override_validate || TaskValidate(task)) {
|
||||
result=task->code_heap->alloced_u8s;
|
||||
if (task->code_heap!=task->data_heap)
|
||||
result+=task->data_heap->alloced_u8s;
|
||||
return result;
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
public I64 TaskMemUsed(CTask *task=NULL,Bool override_validate=FALSE)
|
||||
{//Count of bytes alloced to a task and in use.
|
||||
I64 result;
|
||||
if (!task) task=Fs;
|
||||
if (override_validate || TaskValidate(task)) {
|
||||
result=task->code_heap->used_u8s;
|
||||
if (task->data_heap!=task->code_heap)
|
||||
result+=task->data_heap->used_u8s;
|
||||
return result;
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Bool HeapRep(CTask *task)
|
||||
{//Report status of task's heap.
|
||||
I64 i,cnt;
|
||||
CMemUnused *uum;
|
||||
|
||||
if (!task || task==Fs) {
|
||||
"Task can't HeapRep on self.\n";
|
||||
return FALSE;
|
||||
}
|
||||
if (!TaskValidate(task)) return FALSE;
|
||||
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&task->code_heap->locked_flags,HClf_LOCKED))
|
||||
PAUSE
|
||||
if (task->data_heap!=task->code_heap)
|
||||
while (LBts(&task->data_heap->locked_flags,HClf_LOCKED))
|
||||
PAUSE
|
||||
|
||||
for (i=0;i<HEAP_HASH_SIZE>>3;i++) {
|
||||
cnt=0;
|
||||
uum=task->code_heap->heap_hash[i];
|
||||
while (uum) {
|
||||
cnt+=uum->size;
|
||||
uum=uum->next;
|
||||
}
|
||||
if (task->data_heap!=task->code_heap) {
|
||||
uum=task->data_heap->heap_hash[i];
|
||||
while (uum) {
|
||||
cnt+=uum->size;
|
||||
uum=uum->next;
|
||||
}
|
||||
}
|
||||
if (cnt)
|
||||
"%03X:%08X\n",i<<3,cnt;
|
||||
}
|
||||
'\n';
|
||||
|
||||
uum=task->code_heap->malloc_free_lst;
|
||||
while (uum) {
|
||||
"%X, ",uum->size;
|
||||
uum=uum->next;
|
||||
}
|
||||
if (task->data_heap!=task->code_heap) {
|
||||
uum=task->data_heap->malloc_free_lst;
|
||||
while (uum) {
|
||||
"%X, ",uum->size;
|
||||
uum=uum->next;
|
||||
}
|
||||
}
|
||||
|
||||
if (task->data_heap!=task->code_heap)
|
||||
LBtr(&task->data_heap->locked_flags,HClf_LOCKED);
|
||||
LBtr(&task->code_heap->locked_flags,HClf_LOCKED);
|
||||
POPFD
|
||||
|
||||
'\n';
|
||||
}
|
||||
|
||||
#help_index "Memory/HeapCtrl;Debugging/Heap"
|
||||
public Bool IsInHeapCtrl(U8 *a,CHeapCtrl *hc,Bool lock=TRUE)
|
||||
{//Check addr if on heap.
|
||||
CMemBlk *m;
|
||||
PUSHFD
|
||||
CLI
|
||||
if (lock)
|
||||
while (LBts(&hc->locked_flags,HClf_LOCKED))
|
||||
PAUSE
|
||||
m=hc->next_mem_blk;
|
||||
while (m!=&hc->next_mem_blk) {
|
||||
if (a>=m && a<m(U8 *)+m->pages*PAGE_SIZE) {
|
||||
if (lock)
|
||||
LBtr(&hc->locked_flags,HClf_LOCKED);
|
||||
POPFD
|
||||
return TRUE;
|
||||
}
|
||||
m=m->next;
|
||||
}
|
||||
if (lock)
|
||||
LBtr(&hc->locked_flags,HClf_LOCKED);
|
||||
POPFD
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
public Bool HeapCtrlWalk(CHeapCtrl *hc)
|
||||
{//Check integrity of HeapCtrl.
|
||||
I64 i;
|
||||
CMemUnused *uum;
|
||||
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&hc->locked_flags,HClf_LOCKED))
|
||||
PAUSE
|
||||
|
||||
for (i=0;i<HEAP_HASH_SIZE>>3;i++) {
|
||||
uum=hc->heap_hash[i];
|
||||
while (uum) {
|
||||
if (!IsInHeapCtrl(uum,hc,FALSE))
|
||||
goto hc_false;
|
||||
uum=uum->next;
|
||||
}
|
||||
}
|
||||
uum=hc->malloc_free_lst;
|
||||
while (uum) {
|
||||
if (!IsInHeapCtrl(uum,hc,FALSE))
|
||||
goto hc_false;
|
||||
uum=uum->next;
|
||||
}
|
||||
|
||||
#if _CFG_HEAP_DBG
|
||||
CMemUsed *um,*um1;
|
||||
um1=(&hc->next_um)(U8 *)-offset(CMemUsed.next);
|
||||
um=um1->next;
|
||||
while (um!=um1) {
|
||||
if (!IsInHeapCtrl(um,hc,FALSE))
|
||||
goto hc_false;
|
||||
um=um->next;
|
||||
}
|
||||
#endif
|
||||
|
||||
LBtr(&hc->locked_flags,HClf_LOCKED);
|
||||
POPFD
|
||||
return TRUE;
|
||||
|
||||
hc_false:
|
||||
LBtr(&hc->locked_flags,HClf_LOCKED);
|
||||
POPFD
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#help_index "Memory/Task;Debugging/Heap"
|
||||
public Bool IsInHeap(U8 *a,CTask *task=NULL,Bool lock=TRUE)
|
||||
{//Check addr if on heap.
|
||||
if (!task) task=Fs;
|
||||
if (TaskValidate(task) && (IsInHeapCtrl(a,task->code_heap,lock)||
|
||||
task->data_heap!=task->code_heap && IsInHeapCtrl(a,task->data_heap,lock)))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
public Bool HeapWalk(CTask *task=NULL)
|
||||
{//Check integrity of task's heaps.
|
||||
if (!task) task=Fs;
|
||||
if (!TaskValidate(task) || !HeapCtrlWalk(task->code_heap) ||
|
||||
task->data_heap!=task->code_heap && !HeapCtrlWalk(task->data_heap))
|
||||
return FALSE;
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#help_index "Info;Task"
|
||||
U0 TaskRepTask(CTask *task,I64 indent)
|
||||
{
|
||||
CTask *task1;
|
||||
U8 *st,*desc=MStrUtil(task->task_title,SUF_SAFE_DOLLAR);
|
||||
st=MStrPrint("$$MA,T=\"%08X\",LM=\"Kill(0x%X);\n\",$$",task,task,task);
|
||||
"%h*c%s $$TX,\"%Q...\",SCX=16$$ Mem:%08X\n",indent,CH_SPACE,
|
||||
st,desc,TaskMemAlloced(task);
|
||||
"%h*cFlags:%04X:%04X Time:%0.2fm\n",indent+2,CH_SPACE,
|
||||
task->task_flags,task->display_flags,
|
||||
task->total_time/60.0/cnts.time_stamp_freq_initial;
|
||||
Free(st);
|
||||
Free(desc);
|
||||
task1=task->next_child_task;
|
||||
while (task1!=(&task->next_child_task)(U8 *)-offset(CTask.next_sibling_task)) {
|
||||
TaskRepTask(task1,indent+2);
|
||||
task1=task1->next_sibling_task;
|
||||
}
|
||||
}
|
||||
|
||||
public U0 TaskRep()
|
||||
{//Report current tasks on all cores.
|
||||
I64 i;
|
||||
CCPU *c;
|
||||
PUSHFD
|
||||
CLI
|
||||
for (i=0;i<mp_cnt;i++) {
|
||||
c=&cpu_structs[i];
|
||||
"$$RED$$CPU:%d$$FG$$\n",i;
|
||||
TaskRepTask(c->seth_task,2);
|
||||
}
|
||||
POPFD
|
||||
}
|
||||
@@ -1,66 +1,5 @@
|
||||
#help_index "Misc/Accts"
|
||||
|
||||
U0 UserStartUp()
|
||||
{//Temporary until defined in $LK,"HOME/Adam3eSys.CPP"$.
|
||||
//Run each time a user a spawned
|
||||
DocTermNew;
|
||||
Type("::/Doc/Start.TXT");
|
||||
LBts(&Fs->display_flags,DISPLAYf_SHOW);
|
||||
WinToTop;
|
||||
WinZBufUpdate;
|
||||
Preempt(ON);
|
||||
}
|
||||
|
||||
U0 SrvStartUp()
|
||||
{//Temporary until defined in $LK,"HOME/Adam3eSys.CPP"$.
|
||||
//Run each time a srv task is spawned.
|
||||
DocTermNew;
|
||||
LBts(&Fs->display_flags,DISPLAYf_SHOW);
|
||||
WinToTop;
|
||||
WinZBufUpdate;
|
||||
Preempt(ON);
|
||||
}
|
||||
|
||||
U8 *PopUpSysAcct()
|
||||
{
|
||||
U8 *result,*st;
|
||||
CDoc *doc=DocNew;
|
||||
CDirEntry *tempde=FilesFind("/Accts/*",FUF_RECURSE|FUF_JUST_DIRS|FUF_FLATTEN_TREE),
|
||||
*tempde1=tempde;
|
||||
DocPrint(doc,"$$CM+CX-LE,10$$");
|
||||
DocSprite(doc,$IB,"<1>",BI=1,BP="::/Misc/StockSprites.TXT,TempleOSLogo"$,"$$SP+SIF,\"\",BI=%d$$");
|
||||
DocPrint(doc,"$$CM+LX,0,12$$Select Account.\nCursor down and press <SPACE>.\n");
|
||||
while (tempde) {
|
||||
if (*tempde->name!='.') {
|
||||
st=tempde->full_name;
|
||||
if (!StrNCmp(st+2,"/Accts/",7))
|
||||
st+=9;
|
||||
DocPrint(doc,"$$CM+LX,2,3$$$$BT,\"%s\",LE=%d$$",st,tempde);
|
||||
}
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DocPrint(doc,"\n\n\n\nLog-in as USER if you are new and get familiar\n"
|
||||
"before you try to install.\n");
|
||||
do tempde=PopUpMenu(doc,DOF_WIN_MAX);
|
||||
while (tempde<=0);
|
||||
|
||||
DocDel(doc);
|
||||
result=AStrNew(tempde->full_name);
|
||||
DirTreeDel(tempde1);
|
||||
return result;
|
||||
}
|
||||
|
||||
U0 SysLogin()
|
||||
{
|
||||
U8 *st;
|
||||
if (!FileFind(sys_acct)||!StrCmp(sys_acct+2,"/Accts")) {
|
||||
st=sys_acct;
|
||||
sys_acct=PopUpSysAcct;
|
||||
Free(st);
|
||||
}
|
||||
}
|
||||
|
||||
#define ACCT_REGISTRY_FILENAME "HOME/Registry.CPP.Z"
|
||||
#define ACCT_REGISTRY_FILENAME "::/Home/Registry.CPP.Z"
|
||||
CDoc *sys_registry_doc=NULL;
|
||||
I64 sys_msg_flags[1]={0};
|
||||
F64 registry_version;
|
||||
@@ -69,7 +8,7 @@ Bool AcctCacheRegistry()
|
||||
{
|
||||
Bool old_silent;
|
||||
if (!sys_registry_doc) {
|
||||
old_silent=Silent(ON);
|
||||
old_silent=Silent;
|
||||
sys_registry_doc=DocRead(ACCT_REGISTRY_FILENAME);
|
||||
Silent(old_silent);
|
||||
return FALSE;
|
||||
@@ -91,7 +30,7 @@ public Bool AcctRegSetDftEntry(U8 *path,U8 *val,Bool is_adam_entry=FALSE)
|
||||
else
|
||||
Adam("%s",val);
|
||||
}
|
||||
if (IsDrvWritable(*sys_acct))
|
||||
if (IsDrvWritable(':'))
|
||||
DocWrite(sys_registry_doc);
|
||||
result=FALSE;
|
||||
} else
|
||||
@@ -118,7 +57,7 @@ public Bool AcctRegWriteBranch(U8 *path,U8 *fmt,...)
|
||||
DocCut(sys_registry_doc,tree_branch,end_indent);
|
||||
DocTreeMake(sys_registry_doc,path);
|
||||
DocPrint(sys_registry_doc,"%s",buf);
|
||||
if (IsDrvWritable(*sys_acct))
|
||||
if (IsDrvWritable(':'))
|
||||
DocWrite(sys_registry_doc);
|
||||
if (unlock_doc)
|
||||
DocUnlock(sys_registry_doc);
|
||||
@@ -147,8 +86,7 @@ public Bool OneTimePopUp(U8 *_flags,I64 flag_num,U8 *msg)
|
||||
U0 AcctOneTimePopUp(I64 flag_num,U8 *msg)
|
||||
{//You're not supposed to make system pop-up flags, only me.
|
||||
if (OneTimePopUp(sys_msg_flags,flag_num,msg))
|
||||
AcctRegWriteBranch("Adam/SysMsgFlags",
|
||||
"sys_msg_flags[0]=0x%X;\n",
|
||||
AcctRegWriteBranch("Adam/SysMsgFlags","sys_msg_flags[0]=0x%X;\n",
|
||||
sys_msg_flags[0]);
|
||||
}
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
#exe {OptOn(OPTf_WARN_PAREN);};
|
||||
#exe {OptOn(OPTf_WARN_DUP_TYPES);};
|
||||
|
||||
HashTablePurge(adam_task->hash_table);
|
||||
|
||||
#help_index "Misc"
|
||||
|
||||
//Use Dbg("Type 'G;'"); to debug before window mgr is running.
|
||||
|
||||
public F64 os_version=2.11;//Operating system version.
|
||||
//Fix here, too: $LK,"::/Demo/AcctExample/DbgAdam2.CPP"$
|
||||
|
||||
#include "AdamExts.HPP"
|
||||
#include "Math2a"
|
||||
#include "Training"
|
||||
#include "Utils2a"
|
||||
#include "MathODE"
|
||||
Cd("::/Adam/Gr");;
|
||||
#include "Gr"
|
||||
|
||||
Cd("::/Adam/Snd");;
|
||||
#include "Snd"
|
||||
|
||||
Cd("::/Adam/Dsk");;
|
||||
#include "Dsk2"
|
||||
|
||||
Cd("::/Adam");;
|
||||
#include "Menu"
|
||||
#include "Win2a"
|
||||
#include "Win2b"
|
||||
#include "Dbg2a"
|
||||
|
||||
#include "::/Adam/God/GodExt"
|
||||
|
||||
Cd("::/Adam/DolDoc");;
|
||||
#include "Doc"
|
||||
LBts(&sys_run_level,RLf_DOC);
|
||||
|
||||
Cd("::/Adam/Ctrls");;
|
||||
#include "Ctrls"
|
||||
|
||||
Cd("::/Adam");;
|
||||
#include "AutoFile2a"
|
||||
#include "LogIn"
|
||||
|
||||
Cd("::/Adam/WordStat");;
|
||||
#include "WordStat"
|
||||
|
||||
Cd("::/Adam/God");;
|
||||
#include "God"
|
||||
|
||||
Cd("::/Adam");;
|
||||
#include "Hash2a"
|
||||
#include "TaskSettings"
|
||||
#include "DevInfo"
|
||||
#include "DocDefines"
|
||||
|
||||
//Dbg("Type 'G;'");
|
||||
|
||||
DocTermNew;
|
||||
SetWinVert(2,10);
|
||||
|
||||
sys_winmgr_task=Spawn(&WinMgrTask,NULL,"Window Mgr");
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_BORDER-WIF_SELF_GRAB_SCROLL-WIF_SELF_CTRLS;
|
||||
LBts(&Fs->display_flags,DISPLAYf_CHILDREN_NOT_ON_TOP);
|
||||
LBts(&Fs->display_flags,DISPLAYf_SHOW);
|
||||
SysLogin;
|
||||
LBts(&sys_run_level,RLf_LOGIN);
|
||||
RegistryInit;
|
||||
LBts(&sys_run_level,RLf_REGISTRY);
|
||||
|
||||
Cd("::/Adam");;
|
||||
#include "WallPaper"
|
||||
#exe {OptOff(OPTf_WARN_PAREN);};
|
||||
#exe {OptOff(OPTf_WARN_DUP_TYPES);};
|
||||
LBts(&sys_run_level,RLf_ADAM2);
|
||||
|
||||
#help_index ""
|
||||
Cd("HOME");;
|
||||
#include "Adam3"
|
||||
File renamed without changes.
@@ -1,21 +1,21 @@
|
||||
#help_index "WordStat/Dictionary"
|
||||
#help_index "AutoComplete/Dictionary"
|
||||
|
||||
public U0 WSDWordsLoad()
|
||||
public U0 ACDWordsLoad()
|
||||
{//Put words from word list into hash table.
|
||||
I64 size;
|
||||
CHashGeneric *temph;
|
||||
U8 *in_ptr,*in_start,*st2;
|
||||
U16 *d;
|
||||
wsd.num_words=0;
|
||||
if (in_ptr=FileRead(WSD_WORD_FILENAME,&size)) {
|
||||
acd.num_words=0;
|
||||
if (in_ptr=FileRead(ACD_WORD_FILENAME,&size)) {
|
||||
in_start=in_ptr;
|
||||
Free(wsd.word_lst);
|
||||
wsd.word_lst=AMAlloc(size);
|
||||
MemCpy(wsd.word_lst,in_start,size);
|
||||
wsd.word_lst_size=size;
|
||||
Free(acd.word_lst);
|
||||
acd.word_lst=AMAlloc(size);
|
||||
MemCpy(acd.word_lst,in_start,size);
|
||||
acd.word_lst_size=size;
|
||||
|
||||
while (in_ptr<in_start+size) {
|
||||
if (*in_ptr==WSD_WORD_CHAR)
|
||||
if (*in_ptr==ACD_WORD_CHAR)
|
||||
in_ptr++;
|
||||
if (*in_ptr) {
|
||||
st2=MStrUtil(in_ptr,SUF_TO_UPPER);
|
||||
@@ -29,8 +29,8 @@ public U0 WSDWordsLoad()
|
||||
d=in_ptr;
|
||||
temph->user_data0=*d;
|
||||
in_ptr+=2;
|
||||
HashAdd(temph,ws.hash_table);
|
||||
wsd.num_words++;
|
||||
HashAdd(temph,ac.hash_table);
|
||||
acd.num_words++;
|
||||
} else
|
||||
in_ptr+=3;
|
||||
}
|
||||
@@ -38,29 +38,29 @@ public U0 WSDWordsLoad()
|
||||
}
|
||||
}
|
||||
|
||||
public U8 *WSDDefGet(U8 *st,I64 def_num=1)
|
||||
public U8 *ACDDefGet(U8 *st,I64 def_num=1)
|
||||
{//MAlloc str holding single dict definition of word.
|
||||
CFile *f;
|
||||
CHashGeneric *temph;
|
||||
U8 *result=NULL,*buf,*in_ptr,
|
||||
*st2=MStrUtil(st,SUF_TO_UPPER);
|
||||
temph=HashFind(st2,ws.hash_table,HTT_DICT_WORD);
|
||||
temph=HashFind(st2,ac.hash_table,HTT_DICT_WORD);
|
||||
Free(st2);
|
||||
if (temph) {
|
||||
if (f=FOpen(WSD_DEF_FILENAME,"r")) {
|
||||
buf=MAlloc(WSD_BLK_SIZE*2+1);
|
||||
buf[WSD_BLK_SIZE*2]=0; //terminate
|
||||
FRBlks(f,buf,temph->user_data0*WSD_BLK_SIZE/BLK_SIZE,WSD_BLK_SIZE*2/BLK_SIZE);
|
||||
if (f=FOpen(ACD_DEF_FILENAME,"r")) {
|
||||
buf=MAlloc(ACD_BLK_SIZE*2+1);
|
||||
buf[ACD_BLK_SIZE*2]=0; //terminate
|
||||
FRBlks(f,buf,temph->user_data0*ACD_BLK_SIZE/BLK_SIZE,ACD_BLK_SIZE*2/BLK_SIZE);
|
||||
FClose(f);
|
||||
in_ptr=buf;
|
||||
while (in_ptr<buf+WSD_BLK_SIZE*2) {
|
||||
while (*in_ptr!=WSD_WORD_CHAR && in_ptr<buf+WSD_BLK_SIZE*2)
|
||||
while (in_ptr<buf+ACD_BLK_SIZE*2) {
|
||||
while (*in_ptr!=ACD_WORD_CHAR && in_ptr<buf+ACD_BLK_SIZE*2)
|
||||
in_ptr++;
|
||||
if (*in_ptr++==WSD_WORD_CHAR) {
|
||||
if (*in_ptr++==ACD_WORD_CHAR) {
|
||||
if (!StrICmp(st,in_ptr)) {
|
||||
while (def_num && *in_ptr!=WSD_WORD_CHAR
|
||||
&& in_ptr<buf+WSD_BLK_SIZE*2) {
|
||||
if (*in_ptr==WSD_DEF_CHAR) {
|
||||
while (def_num && *in_ptr!=ACD_WORD_CHAR
|
||||
&& in_ptr<buf+ACD_BLK_SIZE*2) {
|
||||
if (*in_ptr==ACD_DEF_CHAR) {
|
||||
if (!--def_num)
|
||||
break;
|
||||
else
|
||||
@@ -68,7 +68,7 @@ public U8 *WSDDefGet(U8 *st,I64 def_num=1)
|
||||
} else
|
||||
in_ptr++;
|
||||
}
|
||||
if (*in_ptr++==WSD_DEF_CHAR) {
|
||||
if (*in_ptr++==ACD_DEF_CHAR) {
|
||||
result=StrNew(in_ptr);
|
||||
break;
|
||||
}
|
||||
@@ -81,35 +81,35 @@ public U8 *WSDDefGet(U8 *st,I64 def_num=1)
|
||||
return result;
|
||||
}
|
||||
|
||||
public U8 *WSDDefsGet(U8 *st)
|
||||
public U8 *ACDDefsGet(U8 *st)
|
||||
{//MAlloc str with all dict definitions of word.
|
||||
CFile *f;
|
||||
CHashGeneric *temph;
|
||||
U8 *result=NULL,*buf,*in_ptr,*in_ptr2,
|
||||
*st2=MStrUtil(st,SUF_TO_UPPER);
|
||||
temph=HashFind(st2,ws.hash_table,HTT_DICT_WORD);
|
||||
temph=HashFind(st2,ac.hash_table,HTT_DICT_WORD);
|
||||
Free(st2);
|
||||
if (temph) {
|
||||
if (f=FOpen(WSD_DEF_FILENAME,"r")) {
|
||||
buf=MAlloc(WSD_BLK_SIZE*2+1);
|
||||
buf[WSD_BLK_SIZE*2]=0; //terminate
|
||||
FRBlks(f,buf,temph->user_data0*WSD_BLK_SIZE/BLK_SIZE,WSD_BLK_SIZE*2/BLK_SIZE);
|
||||
if (f=FOpen(ACD_DEF_FILENAME,"r")) {
|
||||
buf=MAlloc(ACD_BLK_SIZE*2+1);
|
||||
buf[ACD_BLK_SIZE*2]=0; //terminate
|
||||
FRBlks(f,buf,temph->user_data0*ACD_BLK_SIZE/BLK_SIZE,ACD_BLK_SIZE*2/BLK_SIZE);
|
||||
FClose(f);
|
||||
in_ptr=buf;
|
||||
while (in_ptr<buf+WSD_BLK_SIZE*2) {
|
||||
while (*in_ptr!=WSD_WORD_CHAR && in_ptr<buf+WSD_BLK_SIZE*2)
|
||||
while (in_ptr<buf+ACD_BLK_SIZE*2) {
|
||||
while (*in_ptr!=ACD_WORD_CHAR && in_ptr<buf+ACD_BLK_SIZE*2)
|
||||
in_ptr++;
|
||||
if (*in_ptr++==WSD_WORD_CHAR) {
|
||||
if (*in_ptr++==ACD_WORD_CHAR) {
|
||||
if (!StrICmp(st,in_ptr)) {
|
||||
in_ptr2=in_ptr;
|
||||
in_ptr--;
|
||||
while (*in_ptr2!=WSD_WORD_CHAR
|
||||
&& in_ptr2<buf+WSD_BLK_SIZE*2) {
|
||||
while (*in_ptr2!=ACD_WORD_CHAR
|
||||
&& in_ptr2<buf+ACD_BLK_SIZE*2) {
|
||||
in_ptr2++;
|
||||
}
|
||||
result=MAlloc(in_ptr2+1-in_ptr);
|
||||
MemCpy(result,in_ptr,in_ptr2-in_ptr);
|
||||
result[in_ptr2-in_ptr]=WSD_END_CHAR;
|
||||
result[in_ptr2-in_ptr]=ACD_END_CHAR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -121,29 +121,29 @@ public U8 *WSDDefsGet(U8 *st)
|
||||
}
|
||||
|
||||
/*Fmt of word lst entry:
|
||||
U8 WSD_WORD_CHAR
|
||||
U8 ACD_WORD_CHAR
|
||||
U8 word[] with terminating zero
|
||||
I16 block;
|
||||
*/
|
||||
public U8 *WSDWordPtAt(U8 *st)
|
||||
public U8 *ACDWordPtAt(U8 *st)
|
||||
{//Point to word in word list.
|
||||
I64 i;
|
||||
U8 *start=wsd.word_lst,*r=start,
|
||||
*end=wsd.word_lst+wsd.word_lst_size;
|
||||
U8 *start=acd.word_lst,*r=start,
|
||||
*end=acd.word_lst+acd.word_lst_size;
|
||||
if (!st || !*st)
|
||||
return wsd.word_lst;
|
||||
if (wsd.word_lst_size) {
|
||||
return acd.word_lst;
|
||||
if (acd.word_lst_size) {
|
||||
while (start+3<end) {
|
||||
r=(start+end)>>1;
|
||||
while (TRUE) {
|
||||
while (*r!=WSD_WORD_CHAR && r>wsd.word_lst)
|
||||
while (*r!=ACD_WORD_CHAR && r>acd.word_lst)
|
||||
r--;
|
||||
if ((r[2]==WSD_WORD_CHAR||r[1]==WSD_WORD_CHAR)&&r-3>wsd.word_lst)
|
||||
if ((r[2]==ACD_WORD_CHAR||r[1]==ACD_WORD_CHAR)&&r-3>acd.word_lst)
|
||||
r--;
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (*r==WSD_WORD_CHAR) {
|
||||
if (*r==ACD_WORD_CHAR) {
|
||||
i=StrICmp(st,r+1);
|
||||
if (i<0)
|
||||
end=r-1;
|
||||
@@ -156,80 +156,78 @@ public U8 *WSDWordPtAt(U8 *st)
|
||||
}
|
||||
r=(start+end)>>1;
|
||||
while (TRUE) {
|
||||
while (*r!=WSD_WORD_CHAR && r>wsd.word_lst)
|
||||
while (*r!=ACD_WORD_CHAR && r>acd.word_lst)
|
||||
r--;
|
||||
if ((r[2]==WSD_WORD_CHAR||r[1]==WSD_WORD_CHAR)&&r-3>wsd.word_lst)
|
||||
if ((r[2]==ACD_WORD_CHAR||r[1]==ACD_WORD_CHAR)&&r-3>acd.word_lst)
|
||||
r--;
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (*r==WSD_WORD_CHAR && StrICmp(st,r+1)>0)
|
||||
if (*r==ACD_WORD_CHAR && StrICmp(st,r+1)>0)
|
||||
r+=StrLen(r)+3;
|
||||
}
|
||||
if (*r==WSD_WORD_CHAR)
|
||||
if (*r==ACD_WORD_CHAR)
|
||||
return r;
|
||||
else
|
||||
return wsd.word_lst;
|
||||
return acd.word_lst;
|
||||
}
|
||||
|
||||
U0 WSDDictWordsAdd(CDoc *doc,U8 *st=NULL)
|
||||
U0 ACDDictWordsAdd(CDoc *doc,U8 *st)
|
||||
{
|
||||
I64 i;
|
||||
U8 *ptr;
|
||||
if (!st)
|
||||
st=ws.cur_word;
|
||||
if (st && (ptr=WSDWordPtAt(st))) {
|
||||
for (i=0;i<WSD_MAX_FILLINS;i++) {
|
||||
if (*ptr++!=WSD_WORD_CHAR)
|
||||
if (st && *st && (ptr=ACDWordPtAt(st))) {
|
||||
for (i=0;i<ACD_MAX_FILLINS;i++) {
|
||||
if (*ptr++!=ACD_WORD_CHAR)
|
||||
break;
|
||||
if (i)
|
||||
DocPrint(doc,"\n");
|
||||
wsd.fillins[i]=ptr-1;
|
||||
DocPrint(doc,"'%d' %-23ts",i,ptr);
|
||||
acd.fillins[i]=ptr-1;
|
||||
DocPrint(doc,"$$GREEN$$'%d'$$FG$$ %-23ts",i,ptr);
|
||||
ptr+=StrLen(ptr)+3;
|
||||
}
|
||||
wsd.num_fillins=i;
|
||||
acd.num_fillins=i;
|
||||
}
|
||||
}
|
||||
|
||||
U0 WSDFillin(I64 n)
|
||||
U0 ACDFillin(I64 n)
|
||||
{
|
||||
U8 *s;
|
||||
I64 len;
|
||||
if (0<=n<wsd.num_fillins) {
|
||||
s=wsd.fillins[n]+1;
|
||||
if (0<=n<acd.num_fillins) {
|
||||
s=acd.fillins[n]+1;
|
||||
len=StrLen(s);
|
||||
if (len>ws.partial_len)
|
||||
Auto(s+ws.partial_len);
|
||||
if (len>ac.partial_len)
|
||||
Auto(s+ac.partial_len);
|
||||
}
|
||||
}
|
||||
|
||||
public U0 WSDDefsPut(CDoc *doc=NULL,U8 *st,I64 num=-1)
|
||||
public U0 ACDDefsPut(CDoc *doc=NULL,U8 *st,I64 num=-1)
|
||||
{//Put to doc a dictionary definition(s) of a word.
|
||||
U8 *st2,*st3;
|
||||
I64 ch,i=0;
|
||||
if (!st) return;
|
||||
if (*st==WSD_WORD_CHAR)
|
||||
if (*st==ACD_WORD_CHAR)
|
||||
st++;
|
||||
DocPrint(doc,"$$WW,1$$$$RED$$%s:$$FG$$\n\n",st);
|
||||
if (num<0) {
|
||||
if (st3=WSDDefsGet(st)) {
|
||||
if (st3=ACDDefsGet(st)) {
|
||||
st2=st3;
|
||||
while (ch=*st2++) {
|
||||
switch (ch) {
|
||||
case WSD_WORD_CHAR:
|
||||
case ACD_WORD_CHAR:
|
||||
break;
|
||||
case WSD_DEF_CHAR:
|
||||
case ACD_DEF_CHAR:
|
||||
DocPrint(doc,"$$GREEN$$(%d)$$FG$$ %s\n",
|
||||
++i,st2);
|
||||
break;
|
||||
case WSD_PRONUNCIATION_CHAR:
|
||||
case ACD_PRONUNCIATION_CHAR:
|
||||
DocPrint(doc,"$$LTGREEN$$%s$$FG$$\n",st2);
|
||||
break;
|
||||
case WSD_POS_CHAR:
|
||||
case ACD_POS_CHAR:
|
||||
DocPrint(doc,"$$BLACK$$%s$$FG$$\n",st2);
|
||||
break;
|
||||
case WSD_EXTRA_CHAR:
|
||||
case ACD_EXTRA_CHAR:
|
||||
DocPrint(doc,"$$LTBLUE$$%s$$FG$$\n",st2);
|
||||
break;
|
||||
}
|
||||
@@ -238,7 +236,7 @@ public U0 WSDDefsPut(CDoc *doc=NULL,U8 *st,I64 num=-1)
|
||||
Free(st3);
|
||||
}
|
||||
} else {
|
||||
while (st2=WSDDefGet(st,++i)) {
|
||||
while (st2=ACDDefGet(st,++i)) {
|
||||
if (i==num)
|
||||
DocPrint(doc,"$$GREEN$$(%d)$$FG$$ %s\n",
|
||||
i,st2);
|
||||
@@ -247,21 +245,21 @@ public U0 WSDDefsPut(CDoc *doc=NULL,U8 *st,I64 num=-1)
|
||||
}
|
||||
}
|
||||
|
||||
U0 WSDPopUpDef(U8 *st,I64 num=-1,CTask *parent=NULL)
|
||||
U0 ACDPopUpDef(U8 *st,I64 num=-1,CTask *parent=NULL)
|
||||
{
|
||||
U8 *buf;
|
||||
buf=MStrPrint("WSDDefsPut(DocPut,\"%s\",%d);View;",st,num);
|
||||
buf=MStrPrint("ACDDefsPut(DocPut,\"%s\",%d);View;",st,num);
|
||||
PopUp(buf,parent);
|
||||
Free(buf);
|
||||
}
|
||||
|
||||
U0 WSDDef(I64 n,CTask *parent=NULL)
|
||||
U0 ACDDef(I64 n,CTask *parent=NULL)
|
||||
{
|
||||
if (0<=n<wsd.num_fillins)
|
||||
WSDPopUpDef(wsd.fillins[n],-1,parent);
|
||||
if (0<=n<acd.num_fillins)
|
||||
ACDPopUpDef(acd.fillins[n],-1,parent);
|
||||
}
|
||||
|
||||
U0 WSFindMisspelled(CDoc *doc)
|
||||
U0 ACFindMisspelled(CDoc *doc)
|
||||
{
|
||||
Bool unlock=DocLock(doc);
|
||||
CDocEntry *doc_e=doc->cur_entry;
|
||||
@@ -277,7 +275,7 @@ U0 WSFindMisspelled(CDoc *doc)
|
||||
col2++;
|
||||
ch=doc_e->tag[col2];
|
||||
doc_e->tag[col2]=0;
|
||||
if (StrICmp(&doc_e->tag[col],WSDWordPtAt(&doc_e->tag[col])+1)) {
|
||||
if (StrICmp(&doc_e->tag[col],ACDWordPtAt(&doc_e->tag[col])+1)) {
|
||||
doc_e->tag[col2]=ch;
|
||||
doc->cur_entry=doc_e;
|
||||
doc->cur_data_col=col;
|
||||
@@ -10,10 +10,10 @@ and #include this file.
|
||||
|
||||
I ran $LK,"::/Misc/ToDolDoc.CPP"$ on it, first.
|
||||
|
||||
See $LK,"::/Doc/Acknowledgements.TXT"$.
|
||||
See $LK,"::/Doc/Credits.TXT"$.
|
||||
*/
|
||||
|
||||
I64 WSDNextCmd(U8 **_ptr)
|
||||
I64 ACDNextCmd(U8 **_ptr)
|
||||
{
|
||||
U8 ch,*ptr=*_ptr,*ptr2;
|
||||
I64 result=-1;
|
||||
@@ -39,9 +39,9 @@ ncmd_done:
|
||||
return result;
|
||||
}
|
||||
|
||||
U8 *WSDNextEntry(U8 **_ptr)
|
||||
U8 *ACDNextEntry(U8 **_ptr)
|
||||
{
|
||||
U8 *result,*ignore,ch,*ptr=*_ptr,buf[WSD_BLK_SIZE],*out_ptr=buf;
|
||||
U8 *result,*ignore,ch,*ptr=*_ptr,buf[ACD_BLK_SIZE],*out_ptr=buf;
|
||||
I64 l;
|
||||
while (TRUE) {
|
||||
while (TRUE) {
|
||||
@@ -53,7 +53,7 @@ U8 *WSDNextEntry(U8 **_ptr)
|
||||
} else
|
||||
break;
|
||||
}
|
||||
ignore="b>\0i>\0p>\0/b>\0/i>\0/p>\0"
|
||||
ignore="b>\0i>\0ppp>\0/b>\0/i>\0/p>\0"
|
||||
"ets>\0col>\0spn>\0/ets>\0/col>\0/spn>\0er>\0as>\0cs>\0cd>\0ex>\0"
|
||||
"/er>\0/as>\0/cs>\0/cd>\0/ex>\0"
|
||||
"note>\0/note>\0blockquote>\0/blockquote>\0";
|
||||
@@ -75,12 +75,12 @@ nentry_done:
|
||||
return result;
|
||||
}
|
||||
|
||||
I64 WSDCompareWords(U8 *e1,U8 *e2)
|
||||
I64 ACDCompareWords(U8 *e1,U8 *e2)
|
||||
{
|
||||
return StrICmp(e1,e2);
|
||||
}
|
||||
|
||||
U8 *WSDSortWords(U8 *start,I64 size,I64 word_cnt)
|
||||
U8 *ACDSortWords(U8 *start,I64 size,I64 word_cnt)
|
||||
{
|
||||
U8 **ptr_array=MAlloc(sizeof(U8 *)*word_cnt),
|
||||
*out_start=MAlloc(size),
|
||||
@@ -91,7 +91,7 @@ U8 *WSDSortWords(U8 *start,I64 size,I64 word_cnt)
|
||||
ptr+=StrLen(ptr)+3;
|
||||
}
|
||||
"Sorting...\n"; Sleep(100);
|
||||
QSortI64(ptr_array,word_cnt,&WSDCompareWords);
|
||||
QSortI64(ptr_array,word_cnt,&ACDCompareWords);
|
||||
"Done...\n"; Sleep(100);
|
||||
|
||||
ptr=out_start;
|
||||
@@ -107,7 +107,7 @@ U8 *WSDSortWords(U8 *start,I64 size,I64 word_cnt)
|
||||
return out_start;
|
||||
}
|
||||
|
||||
U0 WSDGen(U8 *raw_dict_filename)
|
||||
U0 ACDGen(U8 *raw_dict_filename)
|
||||
{
|
||||
I64 cmd,size,word_cnt=0,largest_entry=0;
|
||||
U8 *st,*in_ptr=FileRead(raw_dict_filename,&size),*in_start=in_ptr,
|
||||
@@ -118,27 +118,27 @@ U0 WSDGen(U8 *raw_dict_filename)
|
||||
U16 *d;
|
||||
if (!in_ptr) return;
|
||||
do {
|
||||
cmd=WSDNextCmd(&in_ptr);
|
||||
if (cmd==WSD_H1) {
|
||||
cmd=ACDNextCmd(&in_ptr);
|
||||
if (cmd==ACD_H1) {
|
||||
next_word:
|
||||
if (out_ptr-def_word_start>largest_entry)
|
||||
largest_entry=out_ptr-def_word_start;
|
||||
def_word_start=out_ptr;
|
||||
if (st=WSDNextEntry(&in_ptr)) {
|
||||
if (st=ACDNextEntry(&in_ptr)) {
|
||||
if (*st) {
|
||||
if (StrICmp(st,last_word)) {
|
||||
word_cnt++;
|
||||
|
||||
*word_ptr++=WSD_WORD_CHAR;
|
||||
*word_ptr++=ACD_WORD_CHAR;
|
||||
last_word=word_ptr;
|
||||
StrCpy(word_ptr,st);
|
||||
word_ptr+=StrLen(st)+1;
|
||||
|
||||
d=word_ptr;
|
||||
*d=(out_ptr-out_start)/WSD_BLK_SIZE;
|
||||
*d=(out_ptr-out_start)/ACD_BLK_SIZE;
|
||||
word_ptr+=2;
|
||||
|
||||
*out_ptr++=WSD_WORD_CHAR;
|
||||
*out_ptr++=ACD_WORD_CHAR;
|
||||
StrCpy(out_ptr,st);
|
||||
out_ptr+=StrLen(st)+1;
|
||||
}
|
||||
@@ -146,68 +146,68 @@ next_word:
|
||||
|
||||
do {
|
||||
do {
|
||||
cmd=WSDNextCmd(&in_ptr);
|
||||
if (cmd==WSD_H1)
|
||||
cmd=ACDNextCmd(&in_ptr);
|
||||
if (cmd==ACD_H1)
|
||||
goto next_word;
|
||||
} while (cmd>=0 && !(cmd==WSD_DEF||cmd==WSD_PRONUNCIATION||cmd==WSD_POS||cmd==WSD_EXTRA));
|
||||
if (cmd==WSD_DEF) {
|
||||
if(st=WSDNextEntry(&in_ptr)) {
|
||||
} while (cmd>=0 && !(cmd==ACD_DEF||cmd==ACD_PRONUNCIATION||cmd==ACD_POS||cmd==ACD_EXTRA));
|
||||
if (cmd==ACD_DEF) {
|
||||
if(st=ACDNextEntry(&in_ptr)) {
|
||||
if (*st) {
|
||||
*out_ptr++=WSD_DEF_CHAR;
|
||||
*out_ptr++=ACD_DEF_CHAR;
|
||||
StrCpy(out_ptr,st);
|
||||
out_ptr+=StrLen(st)+1;
|
||||
}
|
||||
Free(st);
|
||||
}
|
||||
} else if (cmd==WSD_PRONUNCIATION) {
|
||||
if(st=WSDNextEntry(&in_ptr)) {
|
||||
} else if (cmd==ACD_PRONUNCIATION) {
|
||||
if(st=ACDNextEntry(&in_ptr)) {
|
||||
if (*st) {
|
||||
*out_ptr++=WSD_PRONUNCIATION_CHAR;
|
||||
*out_ptr++=ACD_PRONUNCIATION_CHAR;
|
||||
StrCpy(out_ptr,st);
|
||||
out_ptr+=StrLen(st)+1;
|
||||
}
|
||||
Free(st);
|
||||
}
|
||||
} else if (cmd==WSD_POS) {
|
||||
if(st=WSDNextEntry(&in_ptr)) {
|
||||
} else if (cmd==ACD_POS) {
|
||||
if(st=ACDNextEntry(&in_ptr)) {
|
||||
if (*st) {
|
||||
*out_ptr++=WSD_POS_CHAR;
|
||||
*out_ptr++=ACD_POS_CHAR;
|
||||
StrCpy(out_ptr,st);
|
||||
out_ptr+=StrLen(st)+1;
|
||||
}
|
||||
Free(st);
|
||||
}
|
||||
} else if (cmd==WSD_EXTRA) {
|
||||
if(st=WSDNextEntry(&in_ptr)) {
|
||||
} else if (cmd==ACD_EXTRA) {
|
||||
if(st=ACDNextEntry(&in_ptr)) {
|
||||
if (*st) {
|
||||
*out_ptr++=WSD_EXTRA_CHAR;
|
||||
*out_ptr++=ACD_EXTRA_CHAR;
|
||||
StrCpy(out_ptr,st);
|
||||
out_ptr+=StrLen(st)+1;
|
||||
}
|
||||
Free(st);
|
||||
}
|
||||
}
|
||||
} while (cmd==WSD_DEF||cmd==WSD_PRONUNCIATION||cmd==WSD_POS||cmd==WSD_EXTRA);
|
||||
} while (cmd==ACD_DEF||cmd==ACD_PRONUNCIATION||cmd==ACD_POS||cmd==ACD_EXTRA);
|
||||
} else
|
||||
Free(st);
|
||||
}
|
||||
}
|
||||
} while (cmd>=0);
|
||||
*out_ptr++=WSD_END_CHAR;
|
||||
*word_ptr++=WSD_END_CHAR;
|
||||
*out_ptr++=ACD_END_CHAR;
|
||||
*word_ptr++=ACD_END_CHAR;
|
||||
|
||||
Free(in_start);
|
||||
|
||||
"Blk Size :%d\n",WSD_BLK_SIZE;
|
||||
"Blk Cnt :%04X\n",(out_ptr-out_start+WSD_BLK_SIZE-1)/WSD_BLK_SIZE;
|
||||
"Blk Size :%d\n",ACD_BLK_SIZE;
|
||||
"Blk Cnt :%04X\n",(out_ptr-out_start+ACD_BLK_SIZE-1)/ACD_BLK_SIZE;
|
||||
"Largest Entry :%d\n",largest_entry;
|
||||
"Word Count :%d\n",word_cnt;
|
||||
|
||||
FileWrite(WSD_DEF_FILENAME,out_start,out_ptr-out_start);
|
||||
FileWrite(ACD_DEF_FILENAME,out_start,out_ptr-out_start);
|
||||
"Def File Size :%d\n",out_ptr-out_start;
|
||||
|
||||
sorted_word_start=WSDSortWords(word_start,word_ptr-word_start,word_cnt);
|
||||
FileWrite(WSD_WORD_FILENAME,sorted_word_start,word_ptr-word_start);
|
||||
sorted_word_start=ACDSortWords(word_start,word_ptr-word_start,word_cnt);
|
||||
FileWrite(ACD_WORD_FILENAME,sorted_word_start,word_ptr-word_start);
|
||||
"Word File Size:%d\n",word_ptr-word_start;
|
||||
|
||||
Free(out_start);
|
||||
@@ -215,4 +215,4 @@ next_word:
|
||||
Free(sorted_word_start);
|
||||
}
|
||||
|
||||
WSDGen("DICTIONARY.TXT");
|
||||
ACDGen("DICTIONARY.TXT");
|
||||
@@ -0,0 +1,342 @@
|
||||
#help_index "AutoComplete"
|
||||
|
||||
CHashAC *ACHashAdd(U8 *w)
|
||||
{
|
||||
CHashAC *tempw=HashFind(w,ac.hash_table,HTT_WORD);
|
||||
if (tempw) {
|
||||
tempw->hits++;
|
||||
return tempw;
|
||||
}
|
||||
tempw=ACAlloc(sizeof(CHashAC));
|
||||
tempw->str=AStrNew(w);
|
||||
tempw->type=HTT_WORD;
|
||||
tempw->use_cnt=1;
|
||||
tempw->hits=1;
|
||||
HashAdd(tempw,ac.hash_table);
|
||||
ac.num_words++;
|
||||
return tempw;
|
||||
}
|
||||
|
||||
U0 ACSingleFileAdd(U8 *buf)
|
||||
{
|
||||
I64 ch;
|
||||
U8 *ptr=buf,*ptr2,*ptr3;
|
||||
while (TRUE) {
|
||||
while (TRUE) {
|
||||
if (ch=*ptr++) {
|
||||
if (Bt(chars_bitmap_alpha_numeric,ch))
|
||||
break;
|
||||
} else
|
||||
return;
|
||||
}
|
||||
ptr3=ptr;
|
||||
ptr2=ptr;
|
||||
ptr--;
|
||||
while (TRUE) {
|
||||
if (ch=*ptr2++) {
|
||||
if (Bt(chars_bitmap_alpha_numeric,ch))
|
||||
*ptr3++=ch;
|
||||
else if (ch!=CH_CURSOR)
|
||||
break;
|
||||
} else {
|
||||
ptr2--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
*ptr3=0;
|
||||
ACHashAdd(ptr);
|
||||
ptr=ptr2;
|
||||
}
|
||||
}
|
||||
|
||||
I64 ACSkipCrap(U8 *src,I64 len)
|
||||
{
|
||||
I64 j;
|
||||
j=len-1;
|
||||
while (j>=0) {
|
||||
if (Bt(chars_bitmap_alpha_numeric,src[j]))
|
||||
break;
|
||||
else
|
||||
j--;
|
||||
}
|
||||
return j+1;
|
||||
}
|
||||
|
||||
I64 ACPriorWordInStr(U8 *src,U8 *dst,I64 len,I64 buf_size)
|
||||
{
|
||||
I64 i,j=0,k;
|
||||
i=len-1;
|
||||
while (i>=0)
|
||||
if (!Bt(chars_bitmap_alpha_numeric,src[i]))
|
||||
break;
|
||||
else
|
||||
i--;
|
||||
if (i>=-1 && len>0)
|
||||
for (k=i+1;k<len && j<buf_size-1;k++)
|
||||
dst[j++]=src[k];
|
||||
dst[j]=0;
|
||||
return i+1;
|
||||
}
|
||||
|
||||
U0 ACFillIn(I64 n)
|
||||
{
|
||||
U8 *s;
|
||||
if (0<=--n<ac.num_fillins) {
|
||||
s=ac.fillin_matches[n]->str;
|
||||
if (StrLen(s)>ac.partial_len)
|
||||
Auto(s+ac.partial_len);
|
||||
}
|
||||
}
|
||||
|
||||
U0 ACMan(I64 n,CTask *parent_task=NULL)
|
||||
{
|
||||
CHashAC *tempw;
|
||||
CHashSrcSym *temph;
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
if (0<=--n<ac.num_fillins && (tempw=ac.fillin_matches[n]) &&
|
||||
(temph=HashFind(tempw->str,Fs->hash_table,HTG_SRC_SYM)) &&
|
||||
temph->src_link) {
|
||||
Preempt(old_preempt);
|
||||
PopUpEd(temph->src_link,parent_task);
|
||||
}
|
||||
Preempt(old_preempt);
|
||||
}
|
||||
|
||||
U0 ACFillInAdd(CHashAC *tempw)
|
||||
{
|
||||
I64 k;
|
||||
if (ac.num_fillins<AC_MAX_FILLINS || tempw->hits>ac.fillin_hits[ac.num_fillins-1]) {
|
||||
for (k=ac.num_fillins-1;k>=0;k--) {
|
||||
if (tempw->hits<=ac.fillin_hits[k])
|
||||
break;
|
||||
else {
|
||||
ac.fillin_matches[k+1]=ac.fillin_matches[k];
|
||||
ac.fillin_hits[k+1] =ac.fillin_hits[k];
|
||||
}
|
||||
}
|
||||
ac.fillin_matches[k+1]=tempw;
|
||||
ac.fillin_hits[k+1] =tempw->hits;
|
||||
if (ac.num_fillins<AC_MAX_FILLINS)
|
||||
ac.num_fillins++;
|
||||
}
|
||||
}
|
||||
|
||||
U0 ACPutChoices(CDoc *focus_l,CDocEntry *doc_e,CTask *focus_task)
|
||||
{
|
||||
I64 i,data_col;
|
||||
U8 *buf,*buf1,*src=NULL,*st;
|
||||
CHashAC *tempw;
|
||||
F64 timeout_time=tS+0.5;
|
||||
CHashSrcSym *temph;
|
||||
CDoc *doc=DocPut;
|
||||
|
||||
src=DocScanLine(focus_l,doc_e,&data_col);
|
||||
DocUnlock(focus_l);
|
||||
i=StrLen(src);
|
||||
buf =MAlloc(MaxI64(i+1,256));
|
||||
buf1=MAlloc(MaxI64(i+1,256));
|
||||
if (data_col==-1)
|
||||
data_col=0;
|
||||
data_col=ACPriorWordInStr(src,buf,data_col,256);
|
||||
ac.partial_len=StrLen(buf);
|
||||
data_col=ACSkipCrap(src,data_col);
|
||||
data_col=ACPriorWordInStr(src,buf1,data_col,256);
|
||||
|
||||
if (!ac.cur_word || StrCmp(ac.cur_word,buf)) {
|
||||
st=ac.cur_word;
|
||||
ac.cur_word=AStrNew(buf);
|
||||
Free(st);
|
||||
ac.num_fillins=0;
|
||||
if (*ac.cur_word) {
|
||||
Preempt(ON);
|
||||
for (i=0;i<=ac.hash_table->mask;i++) {
|
||||
tempw=ac.hash_table->body[i];
|
||||
while (tempw && tS<timeout_time) {
|
||||
if (!MemCmp(ac.cur_word,tempw->str,StrLen(ac.cur_word)))
|
||||
ACFillInAdd(tempw);
|
||||
tempw=tempw->next;
|
||||
}
|
||||
}
|
||||
Preempt(OFF);
|
||||
}
|
||||
DocRst(doc,TRUE);
|
||||
doc->flags|=DOCF_MIN_SIZE;
|
||||
DocCursor;
|
||||
Fs->border_src=BDS_CONST;
|
||||
Fs->text_attr =Fs->border_attr=LTGRAY<<4+BLUE;
|
||||
if (ac.cur_word && *ac.cur_word) {
|
||||
DocPrint(doc,"$$PURPLE$$Word:%s$$FG$$\n",ac.cur_word);
|
||||
for (i=0;i<ac.num_fillins;i++) {
|
||||
st=ac.fillin_matches[i]->str;
|
||||
DocPrint(doc,"$$GREEN$$F%02d$$FG$$ ",i+1);
|
||||
if (TaskValidate(focus_task) &&
|
||||
(temph=HashFind(st,focus_task->hash_table,HTG_SRC_SYM)) &&
|
||||
temph->src_link) {
|
||||
if (temph->type&HTF_PUBLIC)
|
||||
DocPrint(doc,"$$RED$$");
|
||||
DocPrint(doc,"$$TX+UL+L+PU,\"%Q\",A=\"%s\"$$$$FG$$\n",st,temph->src_link);
|
||||
} else
|
||||
DocPrint(doc,"%s\n",st);
|
||||
}
|
||||
if (acd.has_words)
|
||||
ACDDictWordsAdd(doc,ac.cur_word);
|
||||
} else if (FileFind("::/Doc/StandBy.TXT.Z"))
|
||||
DocType(doc,"::/Doc/StandBy.TXT.Z",0);
|
||||
|
||||
DocRecalc(doc);
|
||||
}
|
||||
|
||||
if (!LBts(&Fs->display_flags,DISPLAYf_SHOW))
|
||||
WinZBufUpdate;
|
||||
|
||||
Free(src);
|
||||
Free(buf);
|
||||
Free(buf1);
|
||||
}
|
||||
|
||||
U0 ACTask(I64)
|
||||
{
|
||||
CTask *focus_task,*original_focus_task;
|
||||
CDoc *doc;
|
||||
CDocEntry *doc_e;
|
||||
I64 ch;
|
||||
DocTermNew;
|
||||
WinHorz(51,Fs->win_right);
|
||||
LBts(&Fs->display_flags,DISPLAYf_WIN_ON_TOP);
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_BORDER-WIF_SELF_IP_L-WIF_SELF_IP_R-WIG_DBL_CLICK;
|
||||
Free(ac.cur_word);
|
||||
ac.cur_word=NULL;
|
||||
while (TRUE) {
|
||||
original_focus_task=focus_task=sys_focus_task;
|
||||
while (TaskValidate(focus_task) && Bt(&focus_task->task_flags,TASKf_INPUT_FILTER_TASK))
|
||||
focus_task=focus_task->parent_task;
|
||||
if (TaskValidate(focus_task) && (doc=DocPut(focus_task)) &&
|
||||
focus_task!=Fs && Bt(&focus_task->display_flags,DISPLAYf_SHOW)) {
|
||||
DocLock(doc);
|
||||
if (TaskValidate(focus_task) && original_focus_task==sys_focus_task &&
|
||||
doc && doc==DocPut(focus_task) && (doc_e=doc->cur_entry)) {
|
||||
if (doc_e==doc) doc_e=doc_e->last;
|
||||
while (doc_e->last!=doc && (doc_e->type_u8==DOCT_NEW_LINE ||
|
||||
doc_e->type_u8==DOCT_SOFT_NEW_LINE))
|
||||
doc_e=doc_e->last;
|
||||
while (doc_e->last->type_u8!=DOCT_NEW_LINE && doc_e->last!=doc)
|
||||
doc_e=doc_e->last;
|
||||
ACPutChoices(doc,doc_e,focus_task);
|
||||
} else
|
||||
DocUnlock(doc);
|
||||
}
|
||||
Sleep(333);
|
||||
if (ScanMsg(&ch,,1<<MSG_KEY_DOWN) && (ch==CH_ESC||ch==CH_SHIFT_ESC))
|
||||
break;
|
||||
doc=DocPut;
|
||||
DocLock(doc);
|
||||
if (doc->cur_entry->de_flags & DOCEF_LINK) {
|
||||
'' CH_SPACE;
|
||||
doc->cur_entry=doc;
|
||||
}
|
||||
DocUnlock(doc);
|
||||
}
|
||||
ac.task=NULL;
|
||||
}
|
||||
|
||||
U0 ACMainFileLstTraverse(U8 *files_find_mask)
|
||||
{
|
||||
U8 *buf;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
try {
|
||||
tempde=tempde1=FilesFind(files_find_mask,FUF_RECURSE|FUF_JUST_TXT|FUF_JUST_FILES|FUF_CLUSTER_ORDER);
|
||||
while (tempde) {
|
||||
"%s\n",tempde->full_name;
|
||||
buf=FileRead(tempde->full_name);
|
||||
ACSingleFileAdd(buf);
|
||||
Free(buf);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
} catch
|
||||
Fs->catch_except=TRUE;
|
||||
DirTreeDel(tempde1);
|
||||
}
|
||||
|
||||
public Bool AutoComplete(Bool val=OFF)
|
||||
{//Turn AutoComplete OFF (or ON).
|
||||
Bool old_autocomplete=FALSE,
|
||||
old_preempt=Preempt(OFF);
|
||||
if (val) {
|
||||
while (Bt(&ac.flags,ACf_INIT_IN_PROGRESS))
|
||||
Sleep(10);
|
||||
if (TaskValidate(ac.task))
|
||||
old_autocomplete=TRUE;
|
||||
else {
|
||||
ac.task=Spawn(&ACTask,NULL,"AutoComplete");
|
||||
TaskWait(ac.task);
|
||||
}
|
||||
WinToTop(ac.task);
|
||||
} else {
|
||||
if (TaskValidate(ac.task)) {
|
||||
old_autocomplete=TRUE;
|
||||
Kill(ac.task);
|
||||
while (TaskValidate(ac.task))
|
||||
Yield;
|
||||
ac.task=NULL;
|
||||
}
|
||||
}
|
||||
Preempt(old_preempt);
|
||||
return old_autocomplete;
|
||||
}
|
||||
|
||||
U0 ACProgressTask(Bool *_start_flag)
|
||||
{
|
||||
I64 start=dsk.write_cnt;
|
||||
progress1=0;
|
||||
progress1_max=(Size(ACD_DEF_FILENAME_Z,"+x+s")+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
StrCpy(progress1_desc,"Uncompressing Dictionary");
|
||||
start=dsk.write_cnt;
|
||||
*_start_flag=TRUE;
|
||||
while (progress1<progress1_max) {
|
||||
progress1=dsk.write_cnt-start;
|
||||
Sleep(10);
|
||||
}
|
||||
*progress1_desc=progress1=progress1_max=0;
|
||||
}
|
||||
|
||||
public U0 ACInit(U8 *mask=NULL)
|
||||
{//Read files and build AutoComplete statistics.
|
||||
Bool start_flag;
|
||||
CBlkDev *bd=Let2BlkDev;
|
||||
|
||||
while (LBts(&ac.flags,ACf_INIT_IN_PROGRESS))
|
||||
Yield;
|
||||
AutoComplete;
|
||||
|
||||
if (IsDrvWritable && FileFind(ACD_DEF_FILENAME_Z) && !FileFind(ACD_DEF_FILENAME)) {
|
||||
if (bd->type!=BDT_RAM) {
|
||||
start_flag=FALSE;
|
||||
Spawn(&ACProgressTask,&start_flag);
|
||||
while (!start_flag)
|
||||
Yield;
|
||||
}
|
||||
Move(ACD_DEF_FILENAME_Z,ACD_DEF_FILENAME);
|
||||
}
|
||||
|
||||
HashTableDel(ac.hash_table);
|
||||
ac.hash_table=HashTableNew(2048,adam_task);
|
||||
|
||||
ac.num_words=0;
|
||||
Free(ac.cur_word);
|
||||
ac.cur_word=NULL;
|
||||
|
||||
if (mask)
|
||||
ACMainFileLstTraverse(mask);
|
||||
|
||||
ACDWordsLoad;
|
||||
LBtr(&ac.flags,ACf_INIT_IN_PROGRESS);
|
||||
AutoComplete(ON);
|
||||
}
|
||||
|
||||
I64 AutoCompleteSize()
|
||||
{
|
||||
if (ac.hash_table)
|
||||
return HashTableSize2(ac.hash_table)+MSize2(acd.word_lst);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
File renamed without changes.
@@ -0,0 +1,67 @@
|
||||
#help_index "AutoComplete"
|
||||
#help_file "::/Doc/AutoComplete"
|
||||
|
||||
//See $LK,"::/Doc/AutoComplete.TXT"$
|
||||
|
||||
#define ACf_INIT_IN_PROGRESS 0
|
||||
|
||||
#define AC_MAX_FILLINS 10
|
||||
|
||||
public class CAutoCompleteGlbls
|
||||
{
|
||||
I64 num_words;
|
||||
CHashTable *hash_table;
|
||||
U8 *cur_word;
|
||||
I64 flags;
|
||||
CTask *task;
|
||||
I64 partial_len,num_fillins,
|
||||
fillin_hits [AC_MAX_FILLINS+1];
|
||||
CHashAC *fillin_matches[AC_MAX_FILLINS+1];
|
||||
|
||||
} ac={0,NULL,NULL,0,NULL,0,0,
|
||||
{0,0,0,0,0,0,0,0,0,0,0},
|
||||
{NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}};
|
||||
|
||||
//Dictionary Stuff
|
||||
#help_index "AutoComplete/Dictionary"
|
||||
|
||||
#define ACD_WORD_FILENAME "/Adam/AutoComplete/ACWords.DAT.Z"
|
||||
#define ACD_DEF_FILENAME "/Adam/AutoComplete/ACDefs.DAT"
|
||||
#define ACD_DEF_FILENAME_Z "/Adam/AutoComplete/ACDefs.DAT.Z"
|
||||
|
||||
#define ACD_H1 0
|
||||
#define ACD_H1_END 1
|
||||
#define ACD_DEF 2
|
||||
#define ACD_DEF_END 3
|
||||
#define ACD_PRONUNCIATION 4
|
||||
#define ACD_PRONUNCIATION_END 5
|
||||
#define ACD_POS 6
|
||||
#define ACD_POS_END 7
|
||||
#define ACD_EXTRA 8
|
||||
#define ACD_EXTRA_END 9
|
||||
#define ACD_BLK_SIZE 0x4000
|
||||
|
||||
#define ACD_END_CHAR 0x00
|
||||
#define ACD_WORD_CHAR 0x01
|
||||
#define ACD_DEF_CHAR 0x02
|
||||
#define ACD_PRONUNCIATION_CHAR 0x03
|
||||
#define ACD_POS_CHAR 0x04
|
||||
#define ACD_EXTRA_CHAR 0x05
|
||||
|
||||
#define ACD_MAX_FILLINS 10
|
||||
|
||||
public class CAutoCompleteDictGlbls
|
||||
{
|
||||
U8 *word_lst;
|
||||
I64 word_lst_size,num_words,num_fillins;
|
||||
U8 *fillins[ACD_MAX_FILLINS];
|
||||
Bool has_words,has_defs;
|
||||
} acd={NULL,0,0,0,{0,0,0,0,0,0,0,0,0,0},FALSE,FALSE};
|
||||
acd.has_words=FileFind(ACD_WORD_FILENAME);
|
||||
acd.has_defs =FileFind(ACD_DEF_FILENAME)||FileFind(ACD_DEF_FILENAME_Z);
|
||||
|
||||
extern U0 ACDWordsLoad();
|
||||
extern U0 ACDDictWordsAdd(CDoc *doc,U8 *st);
|
||||
|
||||
#include "ACMain"
|
||||
#include "ACDict"
|
||||
@@ -108,7 +108,7 @@ I64 af_l,af_r;
|
||||
|
||||
Bool AFSetIPPlot(I64 mS,I64 x,I64 y,I64 z)
|
||||
{
|
||||
SetIP(x,y,z,af_l,af_r);
|
||||
IPSet(x,y,z,af_l,af_r);
|
||||
Sleep(mS);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
#include "BootCD"
|
||||
#include "BootHD"
|
||||
#include "BootMHD"
|
||||
#include "BootMHD2"
|
||||
#include "DskCDDVD"
|
||||
#include "BootIns"
|
||||
|
||||
#help_index "Call"
|
||||
asm {
|
||||
USE64
|
||||
_HI_CALL::
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
MOV RAX,U64 16[RBP]
|
||||
TEST RAX,RAX
|
||||
JZ @@05
|
||||
CALL RAX
|
||||
@@05: POP RBP
|
||||
RET1 8
|
||||
//************************************
|
||||
_HI_MEMCPY::
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
PUSH RSI
|
||||
PUSH RDI
|
||||
CLD
|
||||
MOV RDI,U64 SF_ARG1[RBP]
|
||||
MOV RSI,U64 SF_ARG2[RBP]
|
||||
MOV RCX,U64 SF_ARG3[RBP]
|
||||
REP_MOVSB
|
||||
MOV RAX,RDI
|
||||
POP RDI
|
||||
POP RSI
|
||||
POP RBP
|
||||
RET1 24
|
||||
}
|
||||
_extern _HI_CALL I64 HiCall(U8 *s);
|
||||
_extern _HI_MEMCPY U8 *HiMemCpy(U8 *dst,U8 *src,I64 cnt);
|
||||
|
||||
#help_index "Boot"
|
||||
public U0 RAMReboot(U8 *filename)
|
||||
{//Softboot Kernel Bin file. No hardware reset.
|
||||
I64 size;
|
||||
CKernel *hi_image,*lo_image=sys_boot_base-sizeof(CBinFile),reg *sys_ram_reboot;
|
||||
|
||||
do if (!(hi_image=FileRead(filename,&size))) return;
|
||||
while (hi_image<0x100000);
|
||||
|
||||
do sys_ram_reboot=MAlloc(SYS_RAM_REBOOT_END-SYS_RAM_REBOOT,Fs->code_heap);
|
||||
while (sys_ram_reboot<0x100000);
|
||||
|
||||
hi_image->boot_src=BOOT_SRC_RAM;
|
||||
hi_image->boot_patch_table_base=lo_image(U8 *)+hi_image->h.patch_table_offset;
|
||||
hi_image->sys_run_level =lo_image->sys_run_level&(RLF_VGA|RLF_16BIT);
|
||||
MemCpy(&hi_image->start,&lo_image->start,sizeof(CKernel)-offset(CKernel.start));
|
||||
|
||||
CLI
|
||||
if (mp_cnt>1)
|
||||
MPHalt;
|
||||
|
||||
HiMemCpy(sys_ram_reboot,SYS_RAM_REBOOT,SYS_RAM_REBOOT_END-SYS_RAM_REBOOT);
|
||||
HiMemCpy(lo_image,hi_image,size);
|
||||
HiCall(sys_ram_reboot);
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
#define CD_BOOT_LOADER_SIZE CD_BLK_SIZE*1 //Max CD_BLK_SIZE*4, I think
|
||||
#define BOOT_HIGH_LOC ((BOOT_RAM_LIMIT-(BOOT_STK_SIZE+CD_BOOT_LOADER_SIZE))>>4)
|
||||
#define BOOT_HIGH_LOC_CD ((BOOT_RAM_LIMIT-(BOOT_STK_SIZE+CD_BOOT_LOADER_SIZE))>>4)
|
||||
|
||||
DefinePrint(
|
||||
"DD_BOOT_HIGH_LOC","%08X",BOOT_HIGH_LOC<<4);
|
||||
"DD_BOOT_HIGH_LOC_CD","%08X",BOOT_HIGH_LOC_CD<<4);
|
||||
DefinePrint(
|
||||
"DD_BOOT_HIGH_LOC_END","%08X",BOOT_RAM_LIMIT-1);
|
||||
"DD_BOOT_HIGH_LOC_CD_END","%08X",BOOT_RAM_LIMIT-1);
|
||||
|
||||
asm {
|
||||
USE16
|
||||
BCD_START::
|
||||
//DL is supposed to have the BIOS drive number
|
||||
CLD
|
||||
MOV AX,BOOT_HIGH_LOC
|
||||
MOV AX,BOOT_HIGH_LOC_CD
|
||||
MOV ES,AX
|
||||
|
||||
CLI
|
||||
@@ -24,7 +24,7 @@ BCD_GET_IP:
|
||||
POP BX
|
||||
SUB BX,BCD_GET_IP-BCD_START
|
||||
SHR BX,4
|
||||
//Copy this bootloader code to just under 0x80000
|
||||
//This copies this bootloader's code to 0x$TX,"00096600",D="DD_BOOT_HIGH_LOC_CD"$
|
||||
MOV AX,CS
|
||||
ADD AX,BX
|
||||
MOV DS,AX
|
||||
@@ -33,12 +33,12 @@ BCD_GET_IP:
|
||||
XOR DI,DI
|
||||
REP_MOVSB
|
||||
|
||||
MOV AX,BOOT_HIGH_LOC
|
||||
MOV AX,BOOT_HIGH_LOC_CD
|
||||
MOV DS,AX
|
||||
|
||||
//My assembler doesn't support 16-bit very well.
|
||||
DU8 0xEA; //JMP BOOT_HIGH_LOC:BCD_MAIN
|
||||
DU16 BCD_MAIN-BCD_START,BOOT_HIGH_LOC;
|
||||
DU8 0xEA; //JMP BOOT_HIGH_LOC_CD:BCD_MAIN
|
||||
DU16 BCD_MAIN-BCD_START,BOOT_HIGH_LOC_CD;
|
||||
|
||||
BCD_BIOS_DRV_NUM: DU8 0;
|
||||
BCD_PAGE: DU8 0;
|
||||
@@ -152,7 +152,7 @@ BCD_MAIN::
|
||||
//See $LK,"BootCdProbe",A="MN:BootCdProbe"$().
|
||||
MOV EBX,U32 [BCD_BLK_LO-BCD_START] //TODO: oops overflow?
|
||||
SHL EBX,16
|
||||
MOV BX,BOOT_CODE_CDROM //$MA-X+PU,"See sys_boot_code",LM="Grep(\"sys_boot_code\",\"/*\");View;\n"$
|
||||
MOV BX,BOOT_SRC_CDROM //$MA-X+PU,"See sys_boot_src",LM="Find(\"sys_boot_src\",\"/*\");View;\n"$
|
||||
|
||||
//My assembler doesn't support 16-bit very well.
|
||||
DU8 0xEA; //JMP BOOT_RAM_BASE:0000
|
||||
|
||||
+13
-10
@@ -1,5 +1,8 @@
|
||||
#define MODULE_SIZE 1*BLK_SIZE
|
||||
#define BOOT_HIGH_LOC ((BOOT_RAM_LIMIT-(BOOT_STK_SIZE+MODULE_SIZE))>>4)
|
||||
#define BOOT_HIGH_LOC_HD ((BOOT_RAM_LIMIT-(BOOT_STK_SIZE+MODULE_SIZE))>>4)
|
||||
|
||||
DefinePrint(
|
||||
"DD_BOOT_HIGH_LOC_HD","%08X",BOOT_HIGH_LOC_HD<<4);
|
||||
|
||||
asm {
|
||||
USE16
|
||||
@@ -9,11 +12,11 @@ BHD_CODE::
|
||||
|
||||
CLD
|
||||
|
||||
MOV AX,VGA_TEXT_MEM_BASE/16
|
||||
MOV AX,VGAM_TEXT/16
|
||||
MOV FS,AX
|
||||
MOV U32 FS:[0],'B'+GREEN<<12+('2'+GREEN<<12)<<16
|
||||
|
||||
MOV AX,BOOT_HIGH_LOC
|
||||
MOV AX,BOOT_HIGH_LOC_HD
|
||||
MOV ES,AX
|
||||
|
||||
CLI
|
||||
@@ -26,7 +29,7 @@ BHD_GET_IP:
|
||||
POP BX
|
||||
SUB BX,BHD_GET_IP-BHD_START
|
||||
SHR BX,4
|
||||
//Copy this bootloader code to just under 0x80000
|
||||
//This copies this bootloader's code to 0x$TX,"00096C00",D="DD_BOOT_HIGH_LOC_HD"$
|
||||
MOV AX,CS
|
||||
ADD AX,BX
|
||||
MOV DS,AX
|
||||
@@ -35,21 +38,21 @@ BHD_GET_IP:
|
||||
XOR DI,DI
|
||||
REP_MOVSB
|
||||
|
||||
MOV AX,BOOT_HIGH_LOC
|
||||
MOV AX,BOOT_HIGH_LOC_HD
|
||||
MOV DS,AX
|
||||
|
||||
//My assembler doesn't support 16-bit very well.
|
||||
DU8 0xEA; //JMP BOOT_HIGH_LOC:BHD_HISTART
|
||||
DU16 BHD_HISTART-BHD_START,BOOT_HIGH_LOC;
|
||||
DU8 0xEA; //JMP BOOT_HIGH_LOC_HD:BHD_HISTART
|
||||
DU16 BHD_HISTART-BHD_START,BOOT_HIGH_LOC_HD;
|
||||
|
||||
BHD_BIOS_DRV_NUM: DU8 0;
|
||||
|
||||
//Gets patched by $LK,"MakeOSPrtBootInstall",A="MN:MakeOSPrtBootInstall"$().
|
||||
//Gets patched by $LK,"MakeOSDrvBootInstall",A="MN:MakeOSDrvBootInstall"$().
|
||||
BHD_BLK_CNT:: DU16 0;
|
||||
|
||||
BHD_DAP: DU8 16,0,1,0; //One blk at a time
|
||||
BHD_DAP_BUF: DU16 0,0;
|
||||
//Gets patched by $LK,"MakeOSPrtBootInstall",A="MN:MakeOSPrtBootInstall"$().
|
||||
//Gets patched by $LK,"MakeOSDrvBootInstall",A="MN:MakeOSDrvBootInstall"$().
|
||||
BHD_DAP_BLK:: //64-bit
|
||||
BHD_DAP_BLK_LO: DU32 0;
|
||||
BHD_DAP_BLK_HI: DU32 0;
|
||||
@@ -82,7 +85,7 @@ BHD_HISTART:
|
||||
@@10: POP CX
|
||||
LOOP @@05
|
||||
|
||||
MOV EBX,BOOT_CODE_HARDDRV //$MA-X+PU,"See sys_boot_code",LM="Grep(\"sys_boot_code\",\"/*\");View;\n"$
|
||||
MOV EBX,BOOT_SRC_HARDDRV //$MA-X+PU,"See sys_boot_src",LM="Find(\"sys_boot_src\",\"/*\");View;\n"$
|
||||
//My assembler doesn't support 16-bit very well.
|
||||
DU8 0xEA; //JMP BOOT_RAM_BASE:0000
|
||||
DU16 0,BOOT_RAM_BASE/16;
|
||||
|
||||
@@ -0,0 +1,233 @@
|
||||
//See $LK,"Install Documentation",A="FI:::/Doc/Install.TXT"$ or $LK,"Upgrading Documentation",A="FI:::/Doc/Upgrade.TXT"$.
|
||||
|
||||
#help_index "Install"
|
||||
|
||||
#define KERNEL_BIN_C "Kernel.BIN.C"
|
||||
#define BOOT_DIR "/0000Boot"
|
||||
#define BOOT_DIR_KERNEL_BIN_C BOOT_DIR "/0000" KERNEL_BIN_C
|
||||
//Stage 2 of master boot loader
|
||||
#define BOOT_DIR_BOOTMHD2_BIN_C BOOT_DIR "/BootMHD2.BIN.C"
|
||||
//Old master boot record
|
||||
#define BOOT_DIR_OLDMBR_BIN_C BOOT_DIR "/OldMBR.BIN.C"
|
||||
|
||||
public U0 MakeAll()
|
||||
{//Use $LK,"MakeOSDrvBootInstall",A="MN:MakeOSDrvBootInstall"$. Loader must be patched.
|
||||
//These 2 modules (and bootloaders at top) are the only AOT
|
||||
//compiled code in TempleOS. Everything else is JIT.
|
||||
//You are doing it wrong if you make AOT compiled code.
|
||||
if (Cmp("/Compiler/Compiler","Compiler",,':'))
|
||||
throw;
|
||||
if (Cmp("/Kernel/Kernel","Kernel",,':'))
|
||||
throw;
|
||||
}
|
||||
|
||||
public Bool MakeOSDrvBootInstall(U8 src_drv=0,U8 dst_drv=0)
|
||||
{// Does $LK,"MakeAll",A="MN:MakeAll"$ and installs new boot-loader.
|
||||
|
||||
//Normally, you just supply a src_drv. It will compile
|
||||
//the code on that drive and update the boot sect.
|
||||
|
||||
//If you are making a bootable CD-ROM, you supply a dst_drv.
|
||||
//See $LK,"::/Misc/MakeDistro.CPP"$
|
||||
|
||||
//See $LK,"Install Documentation",A="FI:::/Doc/Install.TXT"$
|
||||
|
||||
//Study my account examples my technique: $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TOSCfg.CPP,1"$, $LK,"Update Funs",A="FL:::/Demo/AcctExample/TOSDistro.CPP,1"$
|
||||
|
||||
CBlkDev *bd;
|
||||
CDrv *dv;
|
||||
CFAT32Boot br;
|
||||
CDirEntry de;
|
||||
Bool result=FALSE;
|
||||
I64 i;
|
||||
try {
|
||||
if (!src_drv) src_drv=Drv2Let(Fs->cur_dv);
|
||||
if (!dst_drv) dst_drv=src_drv;
|
||||
if (!Drv(src_drv))
|
||||
throw;
|
||||
MakeAll;
|
||||
bd=Let2BlkDev(dst_drv);
|
||||
dv=Let2Drv (dst_drv);
|
||||
switch (bd->type) {
|
||||
case BDT_ATAPI:
|
||||
Move("/Kernel/Kernel.BIN.Z",BOOT_DIR_KERNEL_BIN_C);
|
||||
result=TRUE;
|
||||
break;
|
||||
case BDT_RAM:
|
||||
case BDT_ATA:
|
||||
Move("/Kernel/Kernel.BIN.Z","/" KERNEL_BIN_C);
|
||||
if (!FileFind("/" KERNEL_BIN_C,&de,FUF_JUST_FILES))
|
||||
"No Kernel.BIN.C\n";
|
||||
else {
|
||||
Free(de.full_name);
|
||||
"Modifying partition boot record.\n";
|
||||
RBlks(dv,&br,dv->base_offset,1);
|
||||
br.jump_and_nop[0]=OC_JMP_REL8;
|
||||
br.jump_and_nop[1]=offset(CFAT32Boot.code)-2;
|
||||
#assert offset(CFAT32Boot.code)>=offset(CRedSeaBoot.code)
|
||||
br.jump_and_nop[2]=OC_NOP;
|
||||
*BHD_BLK_CNT(U16 *)=(de.size+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
*BHD_DAP_BLK(I64 *)=Cluster2Blk(dv,de.cluster);
|
||||
for (i=0;i<BHD_END-BHD_CODE;i++)
|
||||
br.code[i]=BHD_CODE(U8 *)[i];
|
||||
#assert sizeof(CFAT32Boot.code)>=BHD_END-BHD_CODE
|
||||
for (;i<sizeof(CFAT32Boot.code);i++)
|
||||
br.code[i]=0;
|
||||
WBlks(dv,&br,dv->base_offset,1);
|
||||
result=TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} catch {
|
||||
PutExcept;
|
||||
Beep;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public U0 MasterBootOldRead(U8 src_drv,U8 dst_drv)
|
||||
{//Reads MBR from disk drive containing src partition.
|
||||
//Writes a single blk file to dst /0000Boot directory.
|
||||
CBlkDev *bd=Let2BlkDev(src_drv);
|
||||
CDrv *dv;
|
||||
CMasterBoot mbr;
|
||||
Drv(dst_drv);
|
||||
dv=Fs->cur_dv;
|
||||
if (dv->type!=DVT_REDSEA && dv->type!=DVT_FAT32)
|
||||
PrintErr("Not RedSea Drv\n");
|
||||
else {
|
||||
//Bypass partition bounds-checking
|
||||
BlkDevLock(bd);
|
||||
ATAReadBlks(bd,&mbr,0,1);
|
||||
BlkDevUnlock(bd);
|
||||
|
||||
Drv(dst_drv);
|
||||
MkDir(BOOT_DIR);
|
||||
FileWrite(BOOT_DIR_OLDMBR_BIN_C,&mbr,BLK_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
public U0 MasterBootOldWrite(U8 src_drv,U8 dst_drv)
|
||||
{//Reads OldMBR from src drive /0000Boot directory
|
||||
//writes it to the MBR of the drive with dst partition.
|
||||
CBlkDev *bd=Let2BlkDev(dst_drv);
|
||||
CMasterBoot *mbr;
|
||||
Drv(src_drv);
|
||||
if (mbr=FileRead(BOOT_DIR_OLDMBR_BIN_C)) {
|
||||
//Bypass partition bounds-checking
|
||||
BlkDevLock(bd);
|
||||
ATAWriteBlks(bd,mbr,0,1);
|
||||
BlkDevUnlock(bd);
|
||||
}
|
||||
Free(mbr);
|
||||
}
|
||||
|
||||
public U0 MasterBootZero(U8 dst_drv)
|
||||
{//Set MBR of disk with dst partition to zero.
|
||||
|
||||
//This is dangerous!!
|
||||
//The TempleOS partitioner doesn't play well
|
||||
//with other operating systems at this time and you need
|
||||
//to do this on a drive partitioned by TempleOS
|
||||
//if you wish to partition with another operating system.
|
||||
CBlkDev *bd=Let2BlkDev(dst_drv);
|
||||
CMasterBoot mbr;
|
||||
MemSet(&mbr,0,BLK_SIZE);
|
||||
//Bypass partition bounds-checking
|
||||
BlkDevLock(bd);
|
||||
ATAWriteBlks(bd,&mbr,0,1);
|
||||
BlkDevUnlock(bd);
|
||||
}
|
||||
|
||||
public Bool MasterBootIntall(U8 drv_let,U8 *drv_lst=NULL)
|
||||
{//Create new MBR on the disk that has drv_let as a partition.
|
||||
//Puts stage 2 in /0000Boot dir of drv_let.
|
||||
CBlkDev *bd,*bd1;
|
||||
CDrv *dv,*p1;
|
||||
CMasterBoot mbr;
|
||||
CDirEntry de;
|
||||
I64 i,j,size,*_q;
|
||||
U8 *menu_ptr,*ptr,ch,buf[128];
|
||||
Bool result=FALSE;
|
||||
|
||||
try {
|
||||
if (drv_lst)
|
||||
StrCpy(buf,drv_lst);
|
||||
else {
|
||||
j=0;
|
||||
for (i='A';i<='Z';i++)
|
||||
buf[j++]=i;
|
||||
buf[j++]=0;
|
||||
}
|
||||
|
||||
Drv(drv_let);
|
||||
dv=Fs->cur_dv;
|
||||
if (dv->type!=DVT_REDSEA && dv->type!=DVT_FAT32)
|
||||
PrintErr("Not RedSea Drv\n");
|
||||
else {
|
||||
bd=Let2BlkDev(drv_let);
|
||||
if (!FileFind(BOOT_DIR_OLDMBR_BIN_C,,FUF_JUST_FILES))
|
||||
MasterBootOldRead(drv_let,drv_let);
|
||||
|
||||
_q=BMHD2_BLK_ARRAY;
|
||||
MemSet(_q,0,sizeof(I64)*8);
|
||||
menu_ptr=BMHD2_BOOT_MSG;
|
||||
StrPrint(menu_ptr,"\n\r\n\rTempleOS Boot Loader\n\r\n\r");
|
||||
j=0;
|
||||
if (FileFind(BOOT_DIR_OLDMBR_BIN_C,&de,FUF_JUST_FILES)) {
|
||||
Free(de.full_name);
|
||||
*_q++=Cluster2Blk(dv,de.cluster);
|
||||
CatPrint(menu_ptr,"0. Old Boot Record\n\r");
|
||||
j++;
|
||||
}
|
||||
|
||||
ptr=buf;
|
||||
while (ch=*ptr++) {
|
||||
try {
|
||||
p1 =Let2Drv(ch);
|
||||
bd1=Let2BlkDev(ch);
|
||||
} catch {
|
||||
Fs->catch_except=TRUE;
|
||||
p1 =NULL;
|
||||
bd1=NULL;
|
||||
}
|
||||
if (p1 && bd1==bd) {
|
||||
*_q=p1->base_offset;
|
||||
"Drive %C:%16X\n",Drv2Let(p1),*_q;
|
||||
CatPrint(menu_ptr,"%d. Drive %C\n\r",j++,Drv2Let(p1));
|
||||
_q++;
|
||||
}
|
||||
}
|
||||
CatPrint(menu_ptr,"\n\rSelection:");
|
||||
|
||||
size=BMHD2_END-BMHD2_START;
|
||||
FileWrite(BOOT_DIR_BOOTMHD2_BIN_C,BMHD2_START,size);
|
||||
|
||||
if (!FileFind(BOOT_DIR_BOOTMHD2_BIN_C,&de,FUF_JUST_FILES))
|
||||
"No Boot Loader Image\n";
|
||||
else {
|
||||
Free(de.full_name);
|
||||
*BMHD_BLK_CNT(U16 *)=(size+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
*BMHD_DAP_BLK(I64 *)=Cluster2Blk(dv,de.cluster);
|
||||
//Bypass partition bounds-checking
|
||||
BlkDevLock(bd);
|
||||
ATAReadBlks(bd,&mbr,0,1);
|
||||
for (i=0;i<BMHD_END-BMHD_CODE;i++)
|
||||
mbr.code[i]=BMHD_CODE(U8 *)[i];
|
||||
#assert sizeof(CMasterBoot.code)>=BMHD_END-BMHD_CODE
|
||||
for (;i<sizeof(CMasterBoot.code);i++)
|
||||
mbr.code[i]=0;
|
||||
if (!mbr.media_id)
|
||||
mbr.media_id=RandU32;
|
||||
mbr.zero=0;
|
||||
mbr.signature=0xAA55;
|
||||
|
||||
ATAWriteBlks(bd,&mbr,0,1);
|
||||
BlkDevUnlock(bd);
|
||||
result=TRUE;
|
||||
}
|
||||
}
|
||||
} catch
|
||||
PutExcept;
|
||||
return result;
|
||||
}
|
||||
+12
-9
@@ -1,5 +1,8 @@
|
||||
#define MODULE_SIZE 1*BLK_SIZE
|
||||
#define BOOT_HIGH_LOC ((BOOT_RAM_LIMIT-(BOOT_STK_SIZE+MODULE_SIZE))>>4)
|
||||
#define BOOT_HIGH_LOC_MHD ((BOOT_RAM_LIMIT-(BOOT_STK_SIZE+MODULE_SIZE))>>4)
|
||||
|
||||
DefinePrint(
|
||||
"DD_BOOT_HIGH_LOC_MHD","%08X",BOOT_HIGH_LOC_MHD<<4);
|
||||
|
||||
asm {
|
||||
USE16
|
||||
@@ -7,7 +10,7 @@ BMHD_START::
|
||||
BMHD_CODE::
|
||||
CLD
|
||||
|
||||
MOV AX,BOOT_HIGH_LOC
|
||||
MOV AX,BOOT_HIGH_LOC_MHD
|
||||
|
||||
CLI
|
||||
MOV SS,AX
|
||||
@@ -26,7 +29,7 @@ BMHD_CODE::
|
||||
|
||||
MOV ES,AX
|
||||
|
||||
MOV AX,VGA_TEXT_MEM_BASE/16
|
||||
MOV AX,VGAM_TEXT/16
|
||||
MOV FS,AX
|
||||
MOV U32 FS:[0],'B'+GREEN<<12+('1'+GREEN<<12)<<16
|
||||
CALL BMHD_GET_IP
|
||||
@@ -35,7 +38,7 @@ BMHD_GET_IP:
|
||||
SUB BX,BMHD_GET_IP-BMHD_START
|
||||
MOV CX,BX
|
||||
SHR BX,4
|
||||
//Copy this bootloader code to just under 0x80000
|
||||
//This copies this bootloader's code to 0x$TX,"00096C00",D="DD_BOOT_HIGH_LOC_MHD"$
|
||||
MOV AX,CS
|
||||
PUSH AX
|
||||
ADD AX,BX
|
||||
@@ -48,21 +51,21 @@ BMHD_GET_IP:
|
||||
XOR DI,DI
|
||||
REP_MOVSB
|
||||
|
||||
MOV AX,BOOT_HIGH_LOC
|
||||
MOV AX,BOOT_HIGH_LOC_MHD
|
||||
MOV DS,AX
|
||||
|
||||
//My assembler doesn't support 16-bit very well.
|
||||
DU8 0xEA; //JMP BOOT_HIGH_LOC:BMHD_HISTART
|
||||
DU16 BMHD_HISTART-BMHD_START,BOOT_HIGH_LOC;
|
||||
DU8 0xEA; //JMP BOOT_HIGH_LOC_MHD:BMHD_HISTART
|
||||
DU16 BMHD_HISTART-BMHD_START,BOOT_HIGH_LOC_MHD;
|
||||
|
||||
BMHD_BIOS_DRV_NUM: DU8 0;
|
||||
BMHD_OLD_CS_IP: DU16 0,0;
|
||||
//Gets patched by $LK,"MakeOSPrtBootInstall",A="MN:MakeOSPrtBootInstall"$().
|
||||
//Gets patched by $LK,"MakeOSDrvBootInstall",A="MN:MakeOSDrvBootInstall"$().
|
||||
BMHD_BLK_CNT:: DU16 0;
|
||||
|
||||
BMHD_DAP: DU8 16,0,1,0; //One blk at a time
|
||||
BMHD_DAP_BUF: DU16 0,0;
|
||||
//Gets patched by $LK,"MakeOSPrtBootInstall",A="MN:MakeOSPrtBootInstall"$().
|
||||
//Gets patched by $LK,"MakeOSDrvBootInstall",A="MN:MakeOSDrvBootInstall"$().
|
||||
BMHD_DAP_BLK:: //64-bit
|
||||
BMHD_DAP_BLK_LO: DU32 0;
|
||||
BMHD_DAP_BLK_HI: DU32 0;
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
#define MODULE_SIZE 2*BLK_SIZE
|
||||
#define BOOT_HIGH_LOC ((BOOT_RAM_LIMIT-(BOOT_STK_SIZE+MODULE_SIZE))>>4)
|
||||
#define BOOT_HIGH_LOC_MHD2 ((BOOT_RAM_LIMIT-(BOOT_STK_SIZE+MODULE_SIZE))>>4)
|
||||
|
||||
DefinePrint(
|
||||
"DD_BOOT_HIGH_LOC_MHD2","%08X",BOOT_HIGH_LOC_MHD2<<4);
|
||||
|
||||
asm {
|
||||
USE16
|
||||
BMHD2_START::
|
||||
MOV U32 FS:[0],'B'+0x2000+('2'+0x2000)<<16
|
||||
|
||||
MOV AX,BOOT_HIGH_LOC
|
||||
MOV AX,BOOT_HIGH_LOC_MHD2
|
||||
MOV ES,AX
|
||||
//Copy this bootloader code to just under 0x80000
|
||||
//This copies this bootloader's code to 0x$TX,"00096A00",D="DD_BOOT_HIGH_LOC_MHD2"$
|
||||
MOV AX,CS
|
||||
MOV DS,AX
|
||||
MOV U32 [BMHD2_OLD_CS_IP-BMHD2_START],EBX
|
||||
@@ -19,12 +22,12 @@ BMHD2_START::
|
||||
XOR DI,DI
|
||||
REP_MOVSB
|
||||
|
||||
MOV AX,BOOT_HIGH_LOC
|
||||
MOV AX,BOOT_HIGH_LOC_MHD2
|
||||
MOV DS,AX
|
||||
|
||||
//My assembler doesn't support 16-bit very well.
|
||||
DU8 0xEA; //JMP BOOT_HIGH_LOC:BMHD2_HISTART
|
||||
DU16 BMHD2_HISTART-BMHD2_START,BOOT_HIGH_LOC;
|
||||
DU8 0xEA; //JMP BOOT_HIGH_LOC_MHD2:BMHD2_HISTART
|
||||
DU16 BMHD2_HISTART-BMHD2_START,BOOT_HIGH_LOC_MHD2;
|
||||
|
||||
BMHD2_BOOT_MSG::
|
||||
DU8 256 DUP(0);
|
||||
|
||||
@@ -1,346 +0,0 @@
|
||||
#help_index "Install"
|
||||
//See $LK,"Install Documentation",A="FI:::/Doc/Install.TXT"$ or $LK,"Upgrading Documentation",A="FI:::/Doc/Upgrade.TXT"$.
|
||||
|
||||
//Kernel module: Kernel.BIN.Z
|
||||
#define KERNEL_BIN_C "Kernel.BIN.C"
|
||||
|
||||
#define BOOT_DIR "/0000Boot"
|
||||
#define BOOT_DIR_KERNEL_BIN_C BOOT_DIR "/0000" KERNEL_BIN_C
|
||||
|
||||
//Stage 2 of master boot loader
|
||||
#define BOOTMHD2_BIN_C BOOT_DIR "/BootMHD2.BIN.C"
|
||||
|
||||
//Old master boot record
|
||||
#define OLDMBR_BIN_C BOOT_DIR "/OldMBR.BIN.C"
|
||||
|
||||
if (IsDrvWritable)
|
||||
MkDir("/Temp"); //Good to have a Temp
|
||||
|
||||
#include "BootCD"
|
||||
#include "BootHD"
|
||||
#include "BootMHD"
|
||||
#include "BootMHD2"
|
||||
#include "DskCDDVD"
|
||||
|
||||
#help_index "Call"
|
||||
asm {
|
||||
USE64
|
||||
_HI_CALL::
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
MOV RAX,U64 16[RBP]
|
||||
TEST RAX,RAX
|
||||
JZ @@05
|
||||
CALL RAX
|
||||
@@05: POP RBP
|
||||
RET1 8
|
||||
//************************************
|
||||
_HI_MEMCPY::
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
PUSH RSI
|
||||
PUSH RDI
|
||||
CLD
|
||||
MOV RDI,U64 SF_ARG1[RBP]
|
||||
MOV RSI,U64 SF_ARG2[RBP]
|
||||
MOV RCX,U64 SF_ARG3[RBP]
|
||||
REP_MOVSB
|
||||
MOV RAX,RDI
|
||||
POP RDI
|
||||
POP RSI
|
||||
POP RBP
|
||||
RET1 24
|
||||
}
|
||||
_extern _HI_CALL I64 HiCall(U8 *s);
|
||||
_extern _HI_MEMCPY U8 *HiMemCpy(U8 *dst,U8 *src,I64 cnt);
|
||||
|
||||
#help_index "Boot"
|
||||
public U0 SoftBoot(U8 *filename)
|
||||
{//Softboot Kernel Bin file. No hardware reset.
|
||||
I64 size;
|
||||
CKernel *hi_image,*lo_image=sys_boot_base-sizeof(CBinFile),
|
||||
reg *shutdown,*hi_image2;
|
||||
|
||||
if (!(hi_image2=FileRead(filename,&size))) return;
|
||||
shutdown=MAlloc(SYS_RESTART_KERNEL_END-SYS_RESTART_KERNEL,Fs->code_heap);
|
||||
hi_image=MAlloc(size,Fs->code_heap);
|
||||
HiMemCpy(hi_image,hi_image2,size);
|
||||
Free(hi_image2);
|
||||
|
||||
hi_image->boot_base=lo_image(U8 *)+sizeof(CBinFile);
|
||||
hi_image->boot_patch_table_base=lo_image(U8 *)+hi_image->h.patch_table_offset;
|
||||
HiMemCpy(&hi_image->sys_mem_E801,&lo_image->sys_mem_E801,2*2);
|
||||
HiMemCpy(&hi_image->sys_mem_E820,&lo_image->sys_mem_E820,MEM_NUM_E820_ENTRIES*MEM_E820_ENTRY_SIZE);
|
||||
hi_image->sys_gr_mode=lo_image->sys_gr_mode;
|
||||
hi_image->sys_pci_busses=lo_image->sys_pci_busses;
|
||||
hi_image->boot_code=BOOT_CODE_RAM;
|
||||
|
||||
CLI
|
||||
if (mp_cnt>1)
|
||||
MPHalt;
|
||||
|
||||
HiMemCpy(shutdown,SYS_RESTART_KERNEL,SYS_RESTART_KERNEL_END-SYS_RESTART_KERNEL);
|
||||
HiMemCpy(&hi_image->sys_gdt,&lo_image->sys_gdt,sizeof(CGDT));
|
||||
HiMemCpy(lo_image,hi_image,size);
|
||||
HiCall(shutdown);
|
||||
}
|
||||
|
||||
#help_index "Install"
|
||||
U8 ChkWritable(U8 drv_let=0)
|
||||
{
|
||||
Bool cont=TRUE;
|
||||
I64 writable_drv=drv_let;
|
||||
U8 buf_s[136],buf_d[136];
|
||||
CPrt *p;
|
||||
CBlkDev *bdev;
|
||||
if (!IsDrvWritable(drv_let)) {
|
||||
'' drv_let;
|
||||
": Drive is read-only.\n";
|
||||
do {
|
||||
"Enter RAM drive (usually 'B') for temporary files:";
|
||||
writable_drv=ToUpper(GetChar);
|
||||
'\n';
|
||||
p=Drv2Prt(writable_drv);
|
||||
bdev=p->bdev;
|
||||
if (bdev->type!=BDT_RAM ||
|
||||
!IsDrvWritable(writable_drv))
|
||||
"Not A RAM Drive\n";
|
||||
else
|
||||
cont=FALSE;
|
||||
} while (cont);
|
||||
if (drv_let!=writable_drv) {
|
||||
Fmt(writable_drv,FALSE,FALSE);
|
||||
StrPrint(buf_s,"%c:/",drv_let);
|
||||
StrPrint(buf_d,"%c:/",writable_drv);
|
||||
CopyTree(buf_s,buf_d);
|
||||
}
|
||||
}
|
||||
return writable_drv;
|
||||
}
|
||||
|
||||
#help_index "Install"
|
||||
public U0 MakeAll()
|
||||
{//Use $LK,"MakeOSPrtBootInstall",A="MN:MakeOSPrtBootInstall"$. Loader must be patched.
|
||||
//These 2 modules (and bootloaders at top) are the only AOT
|
||||
//compiled code in TempleOS. Everything else is JIT.
|
||||
//You are doing it wrong if you make AOT compiled code.
|
||||
Cd("/Compiler");
|
||||
if (Cmp("Compiler","Compiler",,':'))
|
||||
throw;
|
||||
Cd("/Kernel");
|
||||
if (Cmp("Kernel","Kernel",,':'))
|
||||
throw;
|
||||
}
|
||||
|
||||
public Bool MakeOSPrtBootInstall(U8 src_drv=0,U8 dst_drv=0)
|
||||
{// Does $LK,"MakeAll",A="MN:MakeAll"$ and installs new boot-loader.
|
||||
|
||||
//Normally, you just supply a src_drv. It will compile
|
||||
//the code on that drive and update the boot sect.
|
||||
|
||||
//If you are making a bootable CD-ROM, you supply a dst_drv.
|
||||
//See $LK,"::/Misc/MakeDistro.CPP"$
|
||||
|
||||
//See $LK,"Install Documentation",A="FI:::/Doc/Install.TXT"$
|
||||
|
||||
//Study my account examples my technique: $LK,"Cfg Strs",A="FL:::/Demo/AcctExample/TSAdam.CPP,1"$ $LK,"Update Funs",A="FL:::/Demo/AcctExample/TSDistro.CPP,1"$
|
||||
|
||||
CBlkDev *bdev;
|
||||
CPrt *p;
|
||||
CFAT32Boot br;
|
||||
CDirEntry de;
|
||||
Bool result=FALSE;
|
||||
I64 i;
|
||||
|
||||
try {
|
||||
if (!src_drv) src_drv=Fs->cur_prt->drv_let;
|
||||
if (!dst_drv) dst_drv=src_drv;
|
||||
|
||||
src_drv=ChkWritable(src_drv);
|
||||
if (!Drv(src_drv))
|
||||
throw;
|
||||
MakeAll;
|
||||
Cd("/");
|
||||
|
||||
bdev=Drv2BlkDev(dst_drv);
|
||||
p =Drv2Prt (dst_drv);
|
||||
switch (bdev->type) {
|
||||
case BDT_ATAPI:
|
||||
Move("/Kernel/Kernel.BIN.Z",BOOT_DIR_KERNEL_BIN_C);
|
||||
result=TRUE;
|
||||
break;
|
||||
case BDT_RAM:
|
||||
case BDT_ATA:
|
||||
Move("/Kernel/Kernel.BIN.Z",KERNEL_BIN_C);
|
||||
if (!FileFind(KERNEL_BIN_C,&de,FUF_JUST_FILES))
|
||||
"No Kernel.BIN.C\n";
|
||||
else {
|
||||
Free(de.full_name);
|
||||
"Modifying partition boot record.\n";
|
||||
RBlks(p,&br,p->offset,1);
|
||||
br.jump_and_nop[0]=OC_JMP_REL8;
|
||||
br.jump_and_nop[1]=offset(CFAT32Boot.code)-2;
|
||||
br.jump_and_nop[2]=OC_NOP;
|
||||
*BHD_BLK_CNT(U16 *)=(de.size+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
*BHD_DAP_BLK(I64 *)=p->data+de.cluster*p->spc;
|
||||
for (i=0;i<BHD_END-BHD_CODE;i++)
|
||||
br.code[i]=BHD_CODE(U8 *)[i];
|
||||
for (;i<420;i++)
|
||||
br.code[i]=0;
|
||||
WBlks(p,&br,p->offset,1);
|
||||
result=TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} catch {
|
||||
PutExcept;
|
||||
Beep;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public U0 MasterBootOldRead(U8 src_drv,U8 dst_drv)
|
||||
{//Reads MBR from disk drive containing src partition.
|
||||
//Writes a single blk file to dst /0000Boot directory.
|
||||
CBlkDev *bdev=Drv2BlkDev(src_drv);
|
||||
CPrt *p;
|
||||
CMasterBoot mbr;
|
||||
Drv(dst_drv);
|
||||
p=Fs->cur_prt;
|
||||
if (p->type!=PT_REDSEA && p->type!=PT_FAT32)
|
||||
PrintErr("Not RedSea Partition\n");
|
||||
else {
|
||||
//Bypass partition bounds-checking
|
||||
BlkDevLock(bdev);
|
||||
ATAReadBlks(bdev,&mbr,0,1);
|
||||
BlkDevUnlock(bdev);
|
||||
|
||||
Drv(dst_drv);
|
||||
MkDir(BOOT_DIR);
|
||||
FileWrite(OLDMBR_BIN_C,&mbr,BLK_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
public U0 MasterBootOldWrite(U8 src_drv,U8 dst_drv)
|
||||
{//Reads OldMBR from src drive /0000Boot directory
|
||||
//writes it to the MBR of the drive with dst partition.
|
||||
CBlkDev *bdev=Drv2BlkDev(dst_drv);
|
||||
CMasterBoot *mbr;
|
||||
Drv(src_drv);
|
||||
if (mbr=FileRead(OLDMBR_BIN_C)) {
|
||||
//Bypass partition bounds-checking
|
||||
BlkDevLock(bdev);
|
||||
ATAWriteBlks(bdev,mbr,0,1);
|
||||
BlkDevUnlock(bdev);
|
||||
}
|
||||
Free(mbr);
|
||||
}
|
||||
|
||||
public U0 MasterBootZero(U8 dst_drv)
|
||||
{//Set MBR of disk with dst partition to zero.
|
||||
|
||||
//This is dangerous!!
|
||||
//The TempleOS partitioner doesn't play well
|
||||
//with other operating systems at this time and you need
|
||||
//to do this on a drive partitioned by TempleOS
|
||||
//if you wish to partition with another operating system.
|
||||
CBlkDev *bdev=Drv2BlkDev(dst_drv);
|
||||
CMasterBoot mbr;
|
||||
MemSet(&mbr,0,BLK_SIZE);
|
||||
//Bypass partition bounds-checking
|
||||
BlkDevLock(bdev);
|
||||
ATAWriteBlks(bdev,&mbr,0,1);
|
||||
BlkDevUnlock(bdev);
|
||||
}
|
||||
|
||||
public Bool MasterBootIntall(U8 drv_let,U8 *drv_lst=NULL)
|
||||
{//Create new MBR on the disk that has drv_let as a partition.
|
||||
//Puts stage 2 in /0000Boot dir of drv_let.
|
||||
CBlkDev *bdev,*bdev1;
|
||||
CPrt *p,*p1;
|
||||
CMasterBoot mbr;
|
||||
CDirEntry de;
|
||||
I64 i,j,size,*_q;
|
||||
U8 *menu_ptr,*ptr,ch,buf[128];
|
||||
Bool result=FALSE;
|
||||
|
||||
try {
|
||||
if (drv_lst)
|
||||
StrCpy(buf,drv_lst);
|
||||
else {
|
||||
j=0;
|
||||
for (i='A';i<='Z';i++)
|
||||
buf[j++]=i;
|
||||
buf[j++]=0;
|
||||
}
|
||||
|
||||
Drv(drv_let);
|
||||
p=Fs->cur_prt;
|
||||
if (p->type!=PT_REDSEA && p->type!=PT_FAT32)
|
||||
PrintErr("Not RedSea Partition\n");
|
||||
else {
|
||||
bdev=Drv2BlkDev(drv_let);
|
||||
if (!FileFind(OLDMBR_BIN_C,,FUF_JUST_FILES))
|
||||
MasterBootOldRead(drv_let,drv_let);
|
||||
|
||||
_q=BMHD2_BLK_ARRAY;
|
||||
MemSet(_q,0,sizeof(I64)*8);
|
||||
menu_ptr=BMHD2_BOOT_MSG;
|
||||
StrPrint(menu_ptr,"\n\r\n\rTempleOS Boot Loader\n\r\n\r");
|
||||
j=0;
|
||||
if (FileFind(OLDMBR_BIN_C,&de,FUF_JUST_FILES)) {
|
||||
Free(de.full_name);
|
||||
*_q++=p->data+de.cluster*p->spc;
|
||||
CatPrint(menu_ptr,"0. Old Boot Record\n\r");
|
||||
j++;
|
||||
}
|
||||
|
||||
ptr=buf;
|
||||
while (ch=*ptr++) {
|
||||
try {
|
||||
p1 =Drv2Prt(ch);
|
||||
bdev1=Drv2BlkDev(ch);
|
||||
} catch {
|
||||
Fs->catch_except=TRUE;
|
||||
p1 =NULL;
|
||||
bdev1=NULL;
|
||||
}
|
||||
if (p1 && bdev1==bdev) {
|
||||
*_q=p1->offset;
|
||||
"Drive %C:%16X\n",Prt2Drv(p1),*_q;
|
||||
CatPrint(menu_ptr,"%d. Drive %C\n\r",j++,Prt2Drv(p1));
|
||||
_q++;
|
||||
}
|
||||
}
|
||||
CatPrint(menu_ptr,"\n\rSelection:");
|
||||
|
||||
size=BMHD2_END-BMHD2_START;
|
||||
FileWrite(BOOTMHD2_BIN_C,BMHD2_START,size);
|
||||
|
||||
if (!FileFind(BOOTMHD2_BIN_C,&de,FUF_JUST_FILES))
|
||||
"No Boot Loader Image\n";
|
||||
else {
|
||||
Free(de.full_name);
|
||||
*BMHD_BLK_CNT(U16 *)=(size+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
*BMHD_DAP_BLK(I64 *)=p->data+de.cluster*p->spc;
|
||||
//Bypass partition bounds-checking
|
||||
BlkDevLock(bdev);
|
||||
ATAReadBlks(bdev,&mbr,0,1);
|
||||
for (i=0;i<BMHD_END-BMHD_CODE;i++)
|
||||
mbr.boot_code[i]=BMHD_CODE(U8 *)[i];
|
||||
for (;i<440;i++)
|
||||
mbr.boot_code[i]=0;
|
||||
if (!mbr.media_id)
|
||||
mbr.media_id=RandU32;
|
||||
mbr.zero=0;
|
||||
mbr.signature=0xAA55;
|
||||
|
||||
ATAWriteBlks(bdev,&mbr,0,1);
|
||||
BlkDevUnlock(bdev);
|
||||
result=TRUE;
|
||||
}
|
||||
}
|
||||
} catch
|
||||
PutExcept;
|
||||
return result;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
#help_index "Ctrls"
|
||||
#help_file "::/Doc/Ctrls"
|
||||
|
||||
#include "Ctrls2a"
|
||||
#include "CtrlsA"
|
||||
#include "CtrlsButton"
|
||||
#include "CtrlsSlider"
|
||||
@@ -346,7 +346,7 @@ U0 LeftClickViewAngles(CCtrl *c,I64 x,I64 y,Bool)
|
||||
}
|
||||
|
||||
public CCtrl *ViewAnglesNew(CTask *task=NULL)
|
||||
{//Create view angle ctrl. See $LK,"::/Demo/Graphics/Shading.CPP.Z"$.
|
||||
{//Create view angle ctrl. See $LK,"::/Demo/Graphics/Shading.CPP"$.
|
||||
Bool old_preempt;
|
||||
CCtrl *c;
|
||||
CViewAngles *s;
|
||||
@@ -40,7 +40,7 @@ U0 LeftClickCtrlButton(CCtrl *c,I64,I64,Bool down)
|
||||
|
||||
public CCtrl *CtrlButtonNew(I64 x,I64 y,I64 width=-1,I64 height=-1,
|
||||
I64 num_states=1,U8 *state_texts,I32 state_colors[],CCtrlButtonState *_s=NULL)
|
||||
{//Create button ctrl. See $LK,"::/Apps/Strut/Strut.CPP.Z"$.
|
||||
{//Create button ctrl. See $LK,"::/Apps/Strut/Strut.CPP"$.
|
||||
Bool old_preempt;
|
||||
CCtrl *result;
|
||||
CCtrlButtonState *s;
|
||||
|
||||
+20
-20
@@ -1,24 +1,24 @@
|
||||
class CTemplateSCSlider
|
||||
class CTemplateCSSlider
|
||||
{
|
||||
CTemplateSCSlider *next,*last;
|
||||
CTemplateCSSlider *next,*last;
|
||||
U8 *name;
|
||||
I64 num;
|
||||
};
|
||||
|
||||
class CTemplateSC
|
||||
class CTemplateCS
|
||||
{
|
||||
CTemplateSCSlider *next_slider,*last_slider;
|
||||
CTemplateCSSlider *next_slider,*last_slider;
|
||||
I64 num_sliders,range,spacing,border;
|
||||
U8 *glbl_name;
|
||||
};
|
||||
|
||||
CTemplateSC *GetSliderCtrl()
|
||||
CTemplateCS *CtrlSliderGet()
|
||||
{
|
||||
CTemplateSCSlider *temps;
|
||||
CTemplateCSSlider *temps;
|
||||
U8 *st,pmt[136];
|
||||
CTemplateSC *result=CAlloc(sizeof(CTemplateSC));
|
||||
CTemplateCS *result=CAlloc(sizeof(CTemplateCS));
|
||||
|
||||
"$$PURPLE$$Slider Ctrl$$FG$$\n\n";
|
||||
"$$PURPLE$$Ctrl Slider$$FG$$\n\n";
|
||||
|
||||
result->glbl_name=GetStr("Glbl Struct Name (ENTER for No Glbl):");
|
||||
result->range=GetI64 ("Range (%4d):",30);
|
||||
@@ -33,7 +33,7 @@ CTemplateSC *GetSliderCtrl()
|
||||
Free(st);
|
||||
break;
|
||||
}
|
||||
temps=CAlloc(sizeof(CTemplateSCSlider));
|
||||
temps=CAlloc(sizeof(CTemplateCSSlider));
|
||||
temps->name=st;
|
||||
QueIns(temps,result->last_slider);
|
||||
temps->num=result->num_sliders++;
|
||||
@@ -41,25 +41,25 @@ CTemplateSC *GetSliderCtrl()
|
||||
return result;
|
||||
}
|
||||
|
||||
U0 TemplateSliderCtrl(CDoc *doc)
|
||||
U0 TemplateCtrlSlider(CDoc *doc)
|
||||
{
|
||||
CTask *task;
|
||||
CTemplateSC *m=NULL;
|
||||
CTemplateSCSlider *temps;
|
||||
CTemplateCS *m=NULL;
|
||||
CTemplateCSSlider *temps;
|
||||
I64 i;
|
||||
|
||||
DocUnlock(doc);
|
||||
DocRecalc(doc);
|
||||
DocCaptureUndo(doc,TRUE);
|
||||
|
||||
task=SpawnUser("CTemplateSC **_m=0x%X;*_m=GetSliderCtrl;\n",&m);
|
||||
task=User("CTemplateCS **_m=0x%X;*_m=CtrlSliderGet;\n",&m);
|
||||
while (!m)
|
||||
Yield;
|
||||
|
||||
DocPrint(doc,
|
||||
"#define SLIDER_RANGE %d
|
||||
#define SLIDER_SPACING %d
|
||||
#define SLIDER_BORDER %d
|
||||
"#define SLIDER_RANGE\t%d
|
||||
#define SLIDER_SPACING\t%d
|
||||
#define SLIDER_BORDER\t%d
|
||||
|
||||
class CSliderState
|
||||
{
|
||||
@@ -77,7 +77,7 @@ class CSliderState
|
||||
|
||||
DocPrint(doc,
|
||||
"
|
||||
U0 DrawSliderCtrl(CDC *dc,CCtrl *c)
|
||||
U0 DrawCtrlSlider(CDC *dc,CCtrl *c)
|
||||
{
|
||||
CSliderState *s=c->state;
|
||||
|
||||
@@ -124,7 +124,7 @@ U0 DrawSliderCtrl(CDC *dc,CCtrl *c)
|
||||
DocPrint(doc,
|
||||
"}
|
||||
|
||||
U0 UpdateDerivedSliderCtrl(CCtrl *c)
|
||||
U0 UpdateDerivedCtrlSlider(CCtrl *c)
|
||||
{
|
||||
CSliderState *s=c->state;
|
||||
c->left=c->win_task->pix_width/2-(SLIDER_SPACING*3+2)/2;
|
||||
@@ -181,9 +181,9 @@ CCtrl *SliderNew()
|
||||
else
|
||||
DocPrint(doc, " c->state=CAlloc(sizeof(CSliderState));\n");
|
||||
DocPrint(doc,
|
||||
" c->draw_it=&DrawSliderCtrl;
|
||||
" c->draw_it=&DrawCtrlSlider;
|
||||
c->left_click=&LeftClickSlider;
|
||||
c->update_derived_vals=&UpdateDerivedSliderCtrl;
|
||||
c->update_derived_vals=&UpdateDerivedCtrlSlider;
|
||||
old_preempt=Preempt(OFF);
|
||||
QueIns(c,Fs->last_ctrl);
|
||||
TaskDerivedValsUpdate;
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
#help_index "Define;Char/Define"
|
||||
|
||||
U0 LoadDocDefines()
|
||||
{//These are used in documents such as $LK,"::/Doc/TrivialSolutions.TXT"$
|
||||
//The $LK,"CDoc",A="MN:CDoc"$ framework will search the sym table for define string
|
||||
//consts if you specify that.
|
||||
CBinFile *bfh=sys_boot_base-sizeof(CBinFile);
|
||||
|
||||
DefinePrint(
|
||||
"DD_KERNEL","%08X",bfh);
|
||||
DefinePrint(
|
||||
"DD_KERNEL2","%09,X",bfh);
|
||||
bfh(I64)+=bfh->file_size-1;
|
||||
DefinePrint(
|
||||
"DD_KERNEL_END","%08X",bfh);
|
||||
DefinePrint(
|
||||
"DD_KERNEL_END2","%09,X",bfh);
|
||||
|
||||
DefinePrint(
|
||||
"DD_PROTECTED_LOW","%08X",MEM_PROTECTED_LOW_LIMIT);
|
||||
DefinePrint(
|
||||
"DD_PROTECTED_LOW2","%09,X",MEM_PROTECTED_LOW_LIMIT);
|
||||
|
||||
//$LK,"DD_BOOT_HIGH_LOC",A="FF:::/Adam/Boot/BootCD.CPP,DD_BOOT_HIGH_LOC"$
|
||||
|
||||
DefinePrint(
|
||||
"DD_MP_VECT","%08X",MP_VECT_ADDR);
|
||||
DefinePrint(
|
||||
"DD_MP_VECT_END","%08X",MP_VECT_ADDR+SYS_MP_INIT_END-SYS_MP_INIT_START-1);
|
||||
|
||||
DefinePrint(
|
||||
"DD_OS_NAME_VERSION","TempleOS V%0.2f",os_version);
|
||||
DefinePrint(
|
||||
"DD_TEMPLEOS_AGE","%0.1f",(Now-Str2Date("8/1/2003"))/ToF64(1<<32)/CDATE_YEAR_DAYS);
|
||||
|
||||
//This is cut and replaced when I generate a distro.
|
||||
//See $LK,"DD_TEMPLEOS_LOC",A="FF:::/Demo/AcctExample/TSDistro.CPP,DD_TEMPLEOS_LOC"$.
|
||||
$TR-C,"LineRep"$
|
||||
$ID,4$DefinePrint("DD_TEMPLEOS_LOC","121,504");
|
||||
DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","81,303");
|
||||
$ID,-4$
|
||||
DefinePrint(
|
||||
"DD_FIXED_AREA_BASE","%08X",SYS_FIXED_AREA);
|
||||
DefinePrint(
|
||||
"DD_FIXED_AREA_BASE2","%09,X",SYS_FIXED_AREA);
|
||||
DefinePrint(
|
||||
"DD_FIXED_AREA_END","%08X",SYS_FIXED_AREA+sizeof(CSysFixedArea)-1);
|
||||
|
||||
DefinePrint(
|
||||
"DD_SYS_HEAP_BASE","%08X",sys_heap_base);
|
||||
DefinePrint(
|
||||
"DD_SYS_HEAP_BASE2","%09,X",sys_heap_base);
|
||||
|
||||
DefinePrint(
|
||||
"DD_SYS_HEAP_LIMIT","%08X",sys_heap_limit);
|
||||
DefinePrint(
|
||||
"DD_SYS_HEAP_LIMIT2","%09,X",sys_heap_limit);
|
||||
|
||||
DefinePrint(
|
||||
"DD_MAPPED_MEM_SPACE_GIG","%d Gig",MEM_MAPPED_SPACE/0x40000000);
|
||||
DefinePrint(
|
||||
"DD_MAPPED_MEM_SPACE_END","%010X",MEM_MAPPED_SPACE-1);
|
||||
DefinePrint(
|
||||
"DD_MAPPED_MEM_SPACE_END2","%014,X",MEM_MAPPED_SPACE-1);
|
||||
|
||||
DefinePrint(
|
||||
"DD_JIFFY_HZ","%d Hz",JIFFY_FREQ);
|
||||
}
|
||||
|
||||
LoadDocDefines;
|
||||
+7
-4
@@ -76,12 +76,15 @@ public class CDolDocGlbls
|
||||
} doldoc;
|
||||
MemSet(&doldoc,0,sizeof(CDolDocGlbls));
|
||||
|
||||
#help_index "God"
|
||||
#define BIBLE_FILENAME "::/Misc/Bible.TXT.Z"
|
||||
|
||||
#include "DocNew"
|
||||
#include "DocPlain"
|
||||
#include "DocInit"
|
||||
#include "DocHighlight"
|
||||
#include "DocRecalc2a"
|
||||
#include "DocRecalc2b"
|
||||
#include "DocRecalcA"
|
||||
#include "DocRecalcB"
|
||||
sys_clipboard_doc=DocNew;
|
||||
#include "DocFile"
|
||||
#include "DocOpt"
|
||||
@@ -89,8 +92,8 @@ sys_clipboard_doc=DocNew;
|
||||
#include "DocCtrlL"
|
||||
#include "DocMacro"
|
||||
#include "DocFind"
|
||||
#include "DocEd2a"
|
||||
#include "DocEd2b"
|
||||
#include "DocEdA"
|
||||
#include "DocEdB"
|
||||
#include "DocCodeTools"
|
||||
#include "DocTree"
|
||||
#include "DocMain"
|
||||
@@ -6,7 +6,7 @@
|
||||
#define EF_REINDENT 0
|
||||
#define EF_CHK_COMPILE 1
|
||||
#define EF_RENUM_ASM 2
|
||||
#define EF_SLIDER_CTRL 3
|
||||
#define EF_CTRL_SLIDER 3
|
||||
#define EF_CH_SC 4
|
||||
|
||||
I64 PopUpEdFmt()
|
||||
@@ -16,7 +16,7 @@ I64 PopUpEdFmt()
|
||||
DocPrint(doc,"$$LTBLUE$$$$MU,\"Check Compile\",LE=EF_CHK_COMPILE$$\n"
|
||||
"$$MU,\"Reindent CPP.Z Fun\",LE=EF_REINDENT$$\n"
|
||||
"$$MU,\"Renum Asm Local @@ Labels for Fun\",LE=EF_RENUM_ASM$$\n"
|
||||
"$$MU,\"Insert Template Code: Slider Ctrl\",LE=EF_SLIDER_CTRL$$\n"
|
||||
"$$MU,\"Insert Template Code: Ctrl Slider\",LE=EF_CTRL_SLIDER$$\n"
|
||||
"$$MU,\"Insert ASCII/Scan Code Hex Codes for key pressed\",LE=EF_CH_SC$$\n\n"
|
||||
"$$MU,\"CANCEL\",LE=DOCM_CANCEL$$\n\n"
|
||||
"$$GREEN$$<ALT-BACKSPACE>$$FG$$ to undo if not happy\n"
|
||||
@@ -30,43 +30,32 @@ class CRILex
|
||||
{
|
||||
CLex *lx1,*lx2;
|
||||
CQueVectU8 *indent;
|
||||
I64 depth,exp_depth;
|
||||
Bool was_new_line,is_not_cont,one_shot;
|
||||
I64 depth,exp_depth,one_shot;
|
||||
Bool was_new_line,is_not_cont;
|
||||
};
|
||||
|
||||
I64 EdRILex(CRILex *rx)
|
||||
{
|
||||
Bool is_not_cont=FALSE;
|
||||
I64 i,k;
|
||||
rx->is_not_cont=FALSE;
|
||||
I64 i;
|
||||
do {
|
||||
Lex(rx->lx1);
|
||||
Lex(rx->lx2);
|
||||
|
||||
if (rx->lx1->token=='\n') {
|
||||
if (rx->lx2->token==TK_IDENT)
|
||||
i=PrsKeyWord(rx->lx2);
|
||||
else
|
||||
i=-1;
|
||||
if (rx->lx2->token==';' || rx->lx2->token=='{' || rx->lx2->token=='}' ||
|
||||
rx->lx2->token==':' || rx->lx2->token==')' && !rx->exp_depth ||
|
||||
i==KW_ELSE || i==KW_CATCH || i==KW_DO)
|
||||
is_not_cont=TRUE;
|
||||
}
|
||||
k=PrsKeyWord(rx->lx2);
|
||||
i=PrsKeyWord(rx->lx2);
|
||||
if (rx->lx1->token=='\n' && rx->lx2->token==';' || rx->lx2->token=='{' ||
|
||||
rx->lx2->token=='}' || rx->lx2->token==':' || rx->lx2->token==')' &&
|
||||
!rx->exp_depth || i==KW_ELSE || i==KW_CATCH || i==KW_DO)
|
||||
rx->is_not_cont=TRUE;
|
||||
if (rx->was_new_line && (rx->lx1->token!=':' ||
|
||||
k==KW_DFT || k==KW_SUB_SWITCH_START || k==KW_SUB_SWITCH_END)) {
|
||||
if (rx->one_shot) {
|
||||
QueVectU8Put(rx->indent,rx->lx2->lfns[0].cur_entry->y,rx->depth+3);
|
||||
rx->one_shot=FALSE;
|
||||
} else
|
||||
QueVectU8Put(rx->indent,rx->lx2->lfns[0].cur_entry->y,rx->depth);
|
||||
i==KW_DFT || i==KW_SUB_SWITCH_START || i==KW_SUB_SWITCH_END)) {
|
||||
QueVectU8Put(rx->indent,rx->lx2->lfns[0].cur_entry->y,rx->depth+rx->one_shot);
|
||||
rx->one_shot=0;
|
||||
}
|
||||
if (rx->lx2->token=='\n')
|
||||
rx->was_new_line=TRUE;
|
||||
else
|
||||
rx->was_new_line=FALSE;
|
||||
} while (rx->lx1->token=='\n');
|
||||
rx->is_not_cont=is_not_cont;
|
||||
return rx->lx1->token;
|
||||
}
|
||||
|
||||
@@ -182,16 +171,14 @@ U0 EdRIStmt(CRILex *rx,Bool indent)
|
||||
default:
|
||||
if (rx->lx1->token==TK_IDENT && rx->lx1->hash_entry &&
|
||||
rx->lx1->hash_entry->type&(HTT_OPCODE|HTT_ASM_KEYWORD)) {
|
||||
i=rx->depth;
|
||||
rx->depth=4;
|
||||
rx->one_shot=FALSE;
|
||||
rx->one_shot=4-rx->depth;
|
||||
do EdRILex(rx);
|
||||
while (rx->lx2->token && rx->lx2->token!='\n');
|
||||
rx->depth=i;
|
||||
rx->is_not_cont=TRUE;
|
||||
} else {
|
||||
while (rx->lx1->token && rx->lx1->token!=';' && rx->lx1->token!=':') {
|
||||
if (rx->lx2->token=='\n' && !rx->is_not_cont)
|
||||
rx->one_shot=TRUE;
|
||||
rx->one_shot=3;
|
||||
EdRILex(rx);
|
||||
}
|
||||
if (rx->lx1->token==':')
|
||||
@@ -211,11 +198,11 @@ CQueVectU8 *EdRICode(CDoc *doc)
|
||||
CRILex *rx=CAlloc(sizeof(CRILex));
|
||||
|
||||
rx->lx1=LexNew(,LF_KEEP_NEW_LINES|LF_DONT_FREE_BUF,doc->filename.name);
|
||||
Free(rx->lx1->lfns[0].name);
|
||||
Free(rx->lx1->lfns[0].full_name);
|
||||
LexAttachDoc(rx->lx1,&rx->lx1->lfns[0],doc,,doc->cur_entry,doc->cur_data_col);
|
||||
|
||||
rx->lx2=LexNew(,LF_KEEP_NEW_LINES|LF_DONT_FREE_BUF,doc->filename.name);
|
||||
Free(rx->lx2->lfns[0].name);
|
||||
Free(rx->lx2->lfns[0].full_name);
|
||||
LexAttachDoc(rx->lx2,&rx->lx2->lfns[0],doc,,doc->cur_entry,doc->cur_data_col);
|
||||
|
||||
rx->indent=QueVectU8New(doc->cur_entry->y);
|
||||
@@ -400,17 +387,17 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action)
|
||||
if (doc->flags&DOCF_PLAIN_TEXT)
|
||||
DocFlagsToggle(doc,DOCF_PLAIN_TEXT);
|
||||
DocWrite(doc);
|
||||
task=Spawn(&SrvUserCmdLine,NULL,"Srv",,Fs);
|
||||
task=Spawn(&SrvCmdLine,NULL,"Srv",,Fs);
|
||||
st2=CurDir;
|
||||
st=MStrPrint("Cd(\"%s\");",st2);
|
||||
tempc=TaskExe(task,Fs,st,1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
Free(st2);
|
||||
Free(st);
|
||||
SetWinHorz(Fs->win_left,Fs->win_right, task);
|
||||
SetWinVert(Fs->win_top, Fs->win_bottom,task);
|
||||
WinHorz(Fs->win_left,Fs->win_right, task);
|
||||
WinVert(Fs->win_top, Fs->win_bottom,task);
|
||||
if (ScanResult(tempc,&r)) {
|
||||
st=DirFile(doc->filename.name,,"PRJ.Z"),
|
||||
prj_file=FileNameAbs(st,FUF_Z_OR_NOT_Z);
|
||||
st=DirFile(doc->filename.name,,"PRJ.Z");
|
||||
prj_file=FileNameAbs(st,FUF_Z_OR_NOT_Z);
|
||||
Free(st);
|
||||
if (FileFind(prj_file)) {
|
||||
st2=DirFile(prj_file),
|
||||
@@ -597,8 +584,8 @@ U0 EdCodeTools(CDoc *doc)
|
||||
case EF_RENUM_ASM:
|
||||
EdCodeTools2(doc,tool_action);
|
||||
break;
|
||||
case EF_SLIDER_CTRL:
|
||||
TemplateSliderCtrl(doc);
|
||||
case EF_CTRL_SLIDER:
|
||||
TemplateCtrlSlider(doc);
|
||||
break;
|
||||
case EF_CH_SC:
|
||||
EdChSC(doc);
|
||||
|
||||
+21
-21
@@ -1005,13 +1005,13 @@ U0 EdInsDollarCmd()
|
||||
}
|
||||
}
|
||||
|
||||
#define PT_SPRITE 0
|
||||
#define PT_SPRITE_PTR 1
|
||||
#define PT_DUP_SPRITE 2
|
||||
#define PT_SPRITE_SIZE 3
|
||||
#define PT_SPRITE_MACRO 4
|
||||
#define PT_SPRITE_MENU 5
|
||||
#define PT_SPRITE_LINK 6
|
||||
#define DVT_SPRITE 0
|
||||
#define DVT_SPRITE_PTR 1
|
||||
#define DVT_DUP_SPRITE 2
|
||||
#define DVT_SPRITE_SIZE 3
|
||||
#define DVT_SPRITE_MACRO 4
|
||||
#define DVT_SPRITE_MENU 5
|
||||
#define DVT_SPRITE_LINK 6
|
||||
|
||||
I64 PopUpSpriteType()
|
||||
{
|
||||
@@ -1019,13 +1019,13 @@ I64 PopUpSpriteType()
|
||||
CDoc *doc=DocNew;
|
||||
DocPrint(doc,"$$PURPLE$$$$TX+CX,\"Graphic Resource Menu\"$$\n"
|
||||
"$$LK+PU+CX,\"Click for Help\",A=\"FI:::/Doc/Resource.TXT.Z\"$$\n"
|
||||
"\n$$LTBLUE$$$$MU,\"Make Sprite\",LE=PT_SPRITE$$\n"
|
||||
"$$MU,\"Pointer to Sprite\",LE=PT_SPRITE_PTR$$\n"
|
||||
"$$MU,\"Duplicate Sprite\",LE=PT_DUP_SPRITE$$\n"
|
||||
"$$MU,\"Sprite Size (not really needed)\",LE=PT_SPRITE_SIZE$$\n"
|
||||
"$$MU,\"Sprite Macro (Icon)\",LE=PT_SPRITE_MACRO$$\n"
|
||||
"$$MU,\"Sprite Menu Item\",LE=PT_SPRITE_MENU$$\n"
|
||||
"$$MU,\"Sprite Link\",LE=PT_SPRITE_LINK$$\n"
|
||||
"\n$$LTBLUE$$$$MU,\"Make Sprite\",LE=DVT_SPRITE$$\n"
|
||||
"$$MU,\"Pointer to Sprite\",LE=DVT_SPRITE_PTR$$\n"
|
||||
"$$MU,\"Duplicate Sprite\",LE=DVT_DUP_SPRITE$$\n"
|
||||
"$$MU,\"Sprite Size (not really needed)\",LE=DVT_SPRITE_SIZE$$\n"
|
||||
"$$MU,\"Sprite Macro (Icon)\",LE=DVT_SPRITE_MACRO$$\n"
|
||||
"$$MU,\"Sprite Menu Item\",LE=DVT_SPRITE_MENU$$\n"
|
||||
"$$MU,\"Sprite Link\",LE=DVT_SPRITE_LINK$$\n"
|
||||
"\n$$MU,\"Abort\",LE=DOCM_CANCEL$$\n\n");
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
@@ -1074,12 +1074,12 @@ U8 *EdSprite(I64 bin_num)
|
||||
CEdMacroSprite *e=CAlloc(sizeof(CEdMacroSprite));
|
||||
*buf=0;
|
||||
switch (type) {
|
||||
case PT_SPRITE:
|
||||
case DVT_SPRITE:
|
||||
StrPrint(e->tag,"<%d>",bin_num);
|
||||
if (DocFormDo(e,"CEdJustSprite",,,ctrl_L_footer))
|
||||
st1=MStrPrint("\"%Q\"",e->tag);
|
||||
break;
|
||||
case PT_SPRITE_MACRO:
|
||||
case DVT_SPRITE_MACRO:
|
||||
e->escape=TRUE;
|
||||
if (DocFormDo(e,,,,ctrl_L_footer)) {
|
||||
CatPrint(buf,"+UL");
|
||||
@@ -1091,26 +1091,26 @@ U8 *EdSprite(I64 bin_num)
|
||||
Free(st);
|
||||
}
|
||||
break;
|
||||
case PT_SPRITE_MENU:
|
||||
case DVT_SPRITE_MENU:
|
||||
e->escape=TRUE;
|
||||
if (DocFormDo(e,"CEdMenuSprite",,,ctrl_L_footer)) {
|
||||
if (e->escape) CatPrint(buf,"+X");
|
||||
st1=MStrPrint("\"%Q\",LE=%s",e->tag,e->exp);
|
||||
}
|
||||
break;
|
||||
case PT_SPRITE_LINK:
|
||||
case DVT_SPRITE_LINK:
|
||||
CatPrint(buf,"+L");
|
||||
st1=EdSpriteLink(&pop_up,&html_link);
|
||||
if (pop_up)
|
||||
CatPrint(buf,"+PU");
|
||||
break;
|
||||
case PT_SPRITE_PTR:
|
||||
case DVT_SPRITE_PTR:
|
||||
EdInsBinary(--bin_num,DOCT_INS_BINARY);
|
||||
break;
|
||||
case PT_SPRITE_SIZE:
|
||||
case DVT_SPRITE_SIZE:
|
||||
EdInsBinary(--bin_num,DOCT_INS_BINARY_SIZE);
|
||||
break;
|
||||
case PT_DUP_SPRITE:
|
||||
case DVT_DUP_SPRITE:
|
||||
EdInsBinary(--bin_num,DOCT_SPRITE);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -224,7 +224,8 @@ public U0 EdLineUp(CDoc *doc,I64 sc=MIN_I64)
|
||||
doc_ce=doc_ce->next;
|
||||
if (doc->flags & DOCF_FORM) {
|
||||
while (doc_ce->next->x==x &&
|
||||
(!Bt(doldoc.type_flags_form,doc_ce->type_u8) ||
|
||||
(!Bt(doldoc.type_flags_form,doc_ce->type_u8) &&
|
||||
!(doc_ce->de_flags&DOCEF_LINK)||
|
||||
doc_ce->de_flags&DOCEF_SKIP_IN_FORM))
|
||||
doc_ce=doc_ce->next;
|
||||
}
|
||||
@@ -566,8 +567,9 @@ ic_overstrike_char:
|
||||
DocInsEntry(doc,doc_ne);
|
||||
} else if (ch=='\t') {
|
||||
if (doc->flags&DOCF_FORM &&
|
||||
Bt(doldoc.type_flags_form,doc->cur_entry->type_u8) &&
|
||||
!(doc->cur_entry->de_flags&DOCEF_SKIP_IN_FORM)) {
|
||||
(Bt(doldoc.type_flags_form,doc->cur_entry->type_u8) ||
|
||||
doc->cur_entry->de_flags&DOCEF_LINK) &&
|
||||
!(doc->cur_entry->de_flags&DOCEF_SKIP_IN_FORM)) {
|
||||
ic_form_tab:
|
||||
doc->cur_entry=doc->cur_entry->next;
|
||||
doc->cur_data_col=doc->cur_entry->min_col;
|
||||
@@ -652,12 +654,16 @@ U0 DocEntryToggle(CDoc *doc)
|
||||
U8 ch,*st,*st2;
|
||||
I64 i,j,k;
|
||||
if (doc_ce!=doc && !(doc->flags&(DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_WITH_TABS))) {
|
||||
if (doc_ce->type_u8==DOCT_TEXT && !(doc_ce->de_flags & ~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT|DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
if (doc_ce->type_u8==DOCT_TEXT &&
|
||||
!(doc_ce->de_flags & ~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT|DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) &&
|
||||
!(doc_ce->type&DOCG_BL_IV_UL)) {
|
||||
doc_ce2=doc_ce->last;
|
||||
for (k=0;k<20;k++) {
|
||||
if (doc_ce2!=doc) {
|
||||
cl1=doc_ce2->last;
|
||||
if (doc_ce2->type_u8==DOCT_TEXT && doc_ce->de_flags==doc_ce2->de_flags && doc_ce->type==doc_ce2->type) {
|
||||
if (doc_ce2->type_u8==DOCT_TEXT &&
|
||||
doc_ce->de_flags==doc_ce2->de_flags &&
|
||||
doc_ce->type==doc_ce2->type) {
|
||||
i=StrLen(doc_ce2->tag);
|
||||
j=StrLen(doc_ce->tag);
|
||||
st=MAlloc(i+j+1,doc->mem_task);
|
||||
@@ -680,7 +686,9 @@ U0 DocEntryToggle(CDoc *doc)
|
||||
for (k=0;k<20;k++) {
|
||||
if (doc_ce2!=doc) {
|
||||
cl1=doc_ce2->next;
|
||||
if (doc_ce2->type_u8==DOCT_TEXT && doc_ce->de_flags==doc_ce2->de_flags && doc_ce->type==doc_ce2->type) {
|
||||
if (doc_ce2->type_u8==DOCT_TEXT &&
|
||||
doc_ce->de_flags==doc_ce2->de_flags &&
|
||||
doc_ce->type==doc_ce2->type) {
|
||||
i=StrLen(doc_ce->tag);
|
||||
j=StrLen(doc_ce2->tag);
|
||||
st=MAlloc(i+j+1,doc->mem_task);
|
||||
@@ -704,7 +712,8 @@ U0 DocEntryToggle(CDoc *doc)
|
||||
j=doc->cur_data_col+1;
|
||||
while (j<doc_ce->max_col && doc_ce->tag[j]!='$$')
|
||||
j++;
|
||||
if (i<j-1 && doc_ce->min_col<=i<j<doc_ce->max_col && doc_ce->tag[i]=='$$' && doc_ce->tag[j]=='$$') {
|
||||
if (i<j-1 && doc_ce->min_col<=i<j<doc_ce->max_col &&
|
||||
doc_ce->tag[i]=='$$' && doc_ce->tag[j]=='$$') {
|
||||
ch=doc_ce->tag[j+1];
|
||||
doc_ce->tag[j+1]=0;
|
||||
st=StrNew(doc_ce->tag+i);
|
||||
@@ -20,7 +20,7 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
!(sc&(SCF_CTRL|SCF_ALT))) {
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
st=Char2KeyName(ch,FALSE);
|
||||
SetKeyDesc("Char/'%s'",st);
|
||||
KeyDescSet("Char/'%s'",st);
|
||||
Free(st);
|
||||
} else
|
||||
EdInsChar(ch,sc,doc);
|
||||
@@ -31,25 +31,25 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
switch (ch) {
|
||||
case CH_CTRLA:
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Edit/Save As");
|
||||
KeyDescSet("Edit/Save As");
|
||||
else
|
||||
DocWrite(doc,TRUE);
|
||||
break;
|
||||
case CH_CTRLB:
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Win/Toggle Border");
|
||||
KeyDescSet("Win/Toggle Border");
|
||||
else
|
||||
WinBorder(Bt(&doc->win_task->display_flags,DISPLAYf_NO_BORDER),doc->win_task);
|
||||
break;
|
||||
case CH_CTRLC:
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Edit/Copy to Clipboard");
|
||||
KeyDescSet("Edit/Copy to Clipboard");
|
||||
else
|
||||
EdCopyToClipboard(doc);
|
||||
break;
|
||||
case CH_CTRLD:
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Cmd/Jump to File Manager");
|
||||
KeyDescSet("Cmd/Jump to File Manager");
|
||||
else {
|
||||
DocUnlock(doc);
|
||||
FileMgr;
|
||||
@@ -59,31 +59,31 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
case CH_CTRLF:
|
||||
if (sc&SCF_SHIFT) {
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Cmd/Grep Wizard");
|
||||
KeyDescSet("Cmd/Find Wizard");
|
||||
else
|
||||
GrepWiz;
|
||||
} else {
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Edit/Find & Replace");
|
||||
KeyDescSet("Edit/Find & Replace");
|
||||
else
|
||||
EdFindReplace(doc);
|
||||
}
|
||||
break;
|
||||
case CH_CTRLG:
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Edit/GoTo Line Num");
|
||||
KeyDescSet("Edit/GoTo Line Num");
|
||||
else
|
||||
EdGoToLine(doc);
|
||||
break;
|
||||
case CH_BACKSPACE: //<CTRL-H>
|
||||
if (sc&SCF_ALT && !(sc&SCF_CTRL)) {
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Edit/Undo");
|
||||
KeyDescSet("Edit/Undo");
|
||||
else
|
||||
DocUndoRestore(doc);
|
||||
} else {
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Char/Back Space");
|
||||
KeyDescSet("Char/Back Space");
|
||||
else {
|
||||
DocCaptureUndo(doc);
|
||||
doc_ce=doc->cur_entry;
|
||||
@@ -110,12 +110,12 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
case CH_CTRLI:
|
||||
if (sc&SCF_SHIFT) {
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Dollar/Indent Out");
|
||||
KeyDescSet("Dollar/Indent Out");
|
||||
else
|
||||
DocPrint(doc,"$$ID,-2$$");
|
||||
} else {
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Dollar/Indent In");
|
||||
KeyDescSet("Dollar/Indent In");
|
||||
else
|
||||
DocPrint(doc,"$$ID,2$$");
|
||||
}
|
||||
@@ -123,15 +123,15 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
case '\n':
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
if (sc&SCF_SHIFT)
|
||||
SetKeyDesc("Char/Return");
|
||||
KeyDescSet("Char/Return");
|
||||
else
|
||||
SetKeyDesc("Char/Page Break");
|
||||
KeyDescSet("Char/Page Break");
|
||||
} else
|
||||
EdInsChar(ch,sc,doc);
|
||||
break;
|
||||
case CH_CTRLK:
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Dollar/Toggle Blinking Text");
|
||||
KeyDescSet("Dollar/Toggle Blinking Text");
|
||||
else if (sc&SCF_SHIFT)
|
||||
DocPrint(doc,"$$BK,0$$");
|
||||
else
|
||||
@@ -140,9 +140,9 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
case CH_CTRLL:
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
if (sc&SCF_SHIFT)
|
||||
SetKeyDesc("Edit/Code Tools");
|
||||
KeyDescSet("Edit/Code Tools");
|
||||
else
|
||||
SetKeyDesc("Dollar/Wizard");
|
||||
KeyDescSet("Dollar/Wizard");
|
||||
} else {
|
||||
if (sc&SCF_SHIFT)
|
||||
EdCodeTools(doc);
|
||||
@@ -156,14 +156,14 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
case CH_CTRLM:
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
if (sc&SCF_SHIFT)
|
||||
SetKeyDesc("Cmd/Jump to Notes File");
|
||||
KeyDescSet("Cmd/Jump to Notes File");
|
||||
else
|
||||
SetKeyDesc("Cmd/Jump to Menu");
|
||||
KeyDescSet("Cmd/Jump to Menu");
|
||||
} else {
|
||||
if (sc&SCF_SHIFT)
|
||||
Ed("HOME/PersonalNotes.TXT.Z");
|
||||
Ed("::/Home/PersonalNotes.TXT.Z");
|
||||
else {
|
||||
m=DocRead("HOME/PersonalMenu.TXT.Z");
|
||||
m=DocRead("::/Home/PersonalMenu.TXT.Z");
|
||||
DocMenuDo(m);
|
||||
DocDel(m);
|
||||
}
|
||||
@@ -172,9 +172,9 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
case CH_CTRLO:
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
if (sc&SCF_SHIFT)
|
||||
SetKeyDesc("Edit/Collapse");
|
||||
KeyDescSet("Edit/Collapse");
|
||||
else
|
||||
SetKeyDesc("Edit/Uncolapse");
|
||||
KeyDescSet("Edit/Uncolapse");
|
||||
} else {
|
||||
if (sc&SCF_SHIFT)
|
||||
DocCollapse(TRUE,doc);
|
||||
@@ -185,21 +185,21 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
case CH_CTRLP:
|
||||
if (doc->flags & (DOCF_SUPERSCRIPT_MODE | DOCF_SUBSCRIPT_MODE)) {
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Dollar/Toggle Super or Sub script");
|
||||
KeyDescSet("Dollar/Toggle Super or Sub script");
|
||||
else {
|
||||
DocPrint(doc,"$$SY,0$$");
|
||||
doc->flags&=~(DOCF_SUPERSCRIPT_MODE | DOCF_SUBSCRIPT_MODE);
|
||||
}
|
||||
} else if (sc&SCF_SHIFT) {
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Dollar/Toggle Subscript");
|
||||
KeyDescSet("Dollar/Toggle Subscript");
|
||||
else {
|
||||
DocPrint(doc,"$$SY,3$$");
|
||||
doc->flags|=DOCF_SUBSCRIPT_MODE;
|
||||
}
|
||||
} else {
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Dollar/Toggle Superscript");
|
||||
KeyDescSet("Dollar/Toggle Superscript");
|
||||
else {
|
||||
DocPrint(doc,"$$SY,-3$$");
|
||||
doc->flags|=DOCF_SUPERSCRIPT_MODE;
|
||||
@@ -210,7 +210,7 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
break;
|
||||
case CH_CTRLR:
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Dollar/Edit or Create Graphic");
|
||||
KeyDescSet("Dollar/Edit or Create Graphic");
|
||||
else {
|
||||
if (!(doc->flags&(DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_WITH_TABS))) {
|
||||
DocUnlock(doc);
|
||||
@@ -229,12 +229,12 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
case CH_CTRLS:
|
||||
if (sc&SCF_SHIFT) {
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Edit/Find Misspelled");
|
||||
KeyDescSet("Edit/Find Misspelled");
|
||||
else
|
||||
WSFindMisspelled(doc);
|
||||
ACFindMisspelled(doc);
|
||||
} else {
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Edit/Save");
|
||||
KeyDescSet("Edit/Save");
|
||||
else
|
||||
DocWrite(doc);
|
||||
}
|
||||
@@ -242,12 +242,12 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
case CH_CTRLT:
|
||||
if (sc&SCF_SHIFT) {
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Edit/Single Entry Toggle Plain Text");
|
||||
KeyDescSet("Edit/Single Entry Toggle Plain Text");
|
||||
else
|
||||
DocEntryToggle(doc);
|
||||
} else {
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Edit/Toggle Plain Text Display");
|
||||
KeyDescSet("Edit/Toggle Plain Text Display");
|
||||
else
|
||||
if (!(doc->flags&DOCF_FORM) || doc->flags&(DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_WITH_TABS))
|
||||
DocFlagsToggle(doc,DOCF_PLAIN_TEXT);
|
||||
@@ -255,7 +255,7 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
break;
|
||||
case CH_CTRLU:
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Dollar/Toggle Underline");
|
||||
KeyDescSet("Dollar/Toggle Underline");
|
||||
else if (sc&SCF_SHIFT)
|
||||
DocPrint(doc,"$$UL,0$$");
|
||||
else
|
||||
@@ -263,13 +263,13 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
break;
|
||||
case CH_CTRLV:
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Edit/Paste Clipboard");
|
||||
KeyDescSet("Edit/Paste Clipboard");
|
||||
else
|
||||
EdPasteClipboard(doc);
|
||||
break;
|
||||
case CH_CTRLW:
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Dollar/Toggle Word Wrap");
|
||||
KeyDescSet("Dollar/Toggle Word Wrap");
|
||||
else if (sc&SCF_SHIFT)
|
||||
DocPrint(doc,"$$WW,0$$");
|
||||
else
|
||||
@@ -277,19 +277,19 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
break;
|
||||
case CH_CTRLX:
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Edit/Cut To Clipboard");
|
||||
KeyDescSet("Edit/Cut To Clipboard");
|
||||
else
|
||||
EdCutToClipboard(doc);
|
||||
break;
|
||||
case CH_CTRLY:
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Edit/Delete Line");
|
||||
KeyDescSet("Edit/Delete Line");
|
||||
else
|
||||
EdDelLine(doc);
|
||||
break;
|
||||
case CH_CTRLZ:
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Dollar/Toggle Inverted Text");
|
||||
KeyDescSet("Dollar/Toggle Inverted Text");
|
||||
else if (sc&SCF_SHIFT)
|
||||
DocPrint(doc,"$$IV,0$$");
|
||||
else
|
||||
@@ -300,23 +300,23 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
if (sc&SCF_CTRL) {
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
if (sc&SCF_SHIFT)
|
||||
SetKeyDesc("Edit/Jump to Word Definition");
|
||||
KeyDescSet("Edit/Jump to Word Definition");
|
||||
else
|
||||
SetKeyDesc("Edit/Autocomplete Word");
|
||||
KeyDescSet("Edit/Autocomplete Word");
|
||||
} else {
|
||||
if (WordStat(ON)) {
|
||||
if (AutoComplete(ON)) {
|
||||
DocUnlock(doc);
|
||||
if (sc&SCF_SHIFT)
|
||||
WSDDef(ch-'0',Fs);
|
||||
ACDDef(ch-'0',Fs);
|
||||
else
|
||||
WSDFillin(ch-'0');
|
||||
ACDFillin(ch-'0');
|
||||
DocLock(doc);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Edit/Enter extended-ASCII");
|
||||
KeyDescSet("Edit/Enter extended-ASCII");
|
||||
else {
|
||||
if (++doc->ext_ascii_cnt==1)
|
||||
doc->ext_ascii_val=ch-'0';
|
||||
@@ -333,12 +333,12 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
if (!(sc&SCF_ALT) && sc&SCF_CTRL) {
|
||||
if (sc&SCF_SHIFT) {
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Edit/GoTo matching brace");
|
||||
KeyDescSet("Edit/GoTo matching brace");
|
||||
else
|
||||
EdFindPaired(doc,'}','{',FALSE);
|
||||
} else {
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Edit/GoTo matching bracket");
|
||||
KeyDescSet("Edit/GoTo matching bracket");
|
||||
else
|
||||
EdFindPaired(doc,']','[',FALSE);
|
||||
}
|
||||
@@ -348,12 +348,12 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
if (!(sc&SCF_ALT) && sc&SCF_CTRL) {
|
||||
if (sc&SCF_SHIFT) {
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Edit/GoTo matching brace");
|
||||
KeyDescSet("Edit/GoTo matching brace");
|
||||
else
|
||||
EdFindPaired(doc,'{','}',TRUE);
|
||||
} else {
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Edit/GoTo matching bracket");
|
||||
KeyDescSet("Edit/GoTo matching bracket");
|
||||
else
|
||||
EdFindPaired(doc,'[',']',TRUE);
|
||||
}
|
||||
@@ -366,16 +366,16 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
if (sc&SCF_CTRL) {
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
if (sc&SCF_SHIFT)
|
||||
SetKeyDesc("Edit/Jump to Src of Sym");
|
||||
KeyDescSet("Edit/Jump to Src of Sym");
|
||||
else
|
||||
SetKeyDesc("Edit/Autocomplete Sym");
|
||||
KeyDescSet("Edit/Autocomplete Sym");
|
||||
} else {
|
||||
DocUnlock(doc);
|
||||
if (WordStat(ON)) {
|
||||
if (AutoComplete(ON)) {
|
||||
if (sc&SCF_SHIFT)
|
||||
WSMan(sc2-SC_F1+1,Fs);
|
||||
ACMan(sc2-SC_F1+1,Fs);
|
||||
else
|
||||
WSFillIn(sc2-SC_F1+1);
|
||||
ACFillIn(sc2-SC_F1+1);
|
||||
}
|
||||
DocLock(doc);
|
||||
}
|
||||
@@ -384,12 +384,12 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
case SC_F1:
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
if (sc&SCF_SHIFT)
|
||||
SetKeyDesc("About");
|
||||
KeyDescSet("About");
|
||||
else
|
||||
SetKeyDesc("Help");
|
||||
KeyDescSet("Help");
|
||||
} else {
|
||||
if (sc&SCF_SHIFT)
|
||||
Ed("::/Doc/Splash.TXT.Z");
|
||||
Ed("::/Doc/AboutTempleOS.TXT.Z");
|
||||
else
|
||||
Ed("::/Doc/HelpIndex.TXT.Z");
|
||||
}
|
||||
@@ -397,9 +397,9 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
case SC_F2:
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
if (sc&SCF_SHIFT)
|
||||
SetKeyDesc("Edit/Play Macro");
|
||||
KeyDescSet("Edit/Play Macro");
|
||||
else
|
||||
SetKeyDesc("Edit/Macro");
|
||||
KeyDescSet("Edit/Macro");
|
||||
} else {
|
||||
DocUnlock(doc);
|
||||
if (sc&SCF_SHIFT) {
|
||||
@@ -415,9 +415,9 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
case SC_F3:
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
if (sc&SCF_SHIFT)
|
||||
SetKeyDesc("Edit/Find Last");
|
||||
KeyDescSet("Edit/Find Last");
|
||||
else
|
||||
SetKeyDesc("Edit/Find Next");
|
||||
KeyDescSet("Edit/Find Next");
|
||||
}else {
|
||||
doc->find_replace->scan_fwd=!(sc&SCF_SHIFT);
|
||||
EdFindNext(doc);
|
||||
@@ -426,9 +426,9 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
case SC_F4:
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
if (sc&SCF_SHIFT)
|
||||
SetKeyDesc("Misc/Insert Directory Name");
|
||||
KeyDescSet("Misc/Insert Directory Name");
|
||||
else
|
||||
SetKeyDesc("Misc/Insert FileName");
|
||||
KeyDescSet("Misc/Insert FileName");
|
||||
} else {
|
||||
DocUnlock(doc);
|
||||
if (sc&SCF_SHIFT)
|
||||
@@ -445,9 +445,9 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
case SC_F5:
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
if (sc&SCF_SHIFT)
|
||||
SetKeyDesc("Cmd/Adam Include");
|
||||
KeyDescSet("Cmd/Adam Include");
|
||||
else
|
||||
SetKeyDesc("Cmd/Run (Execute);Dbg/Go");
|
||||
KeyDescSet("Cmd/Run (Execute);Dbg/Go");
|
||||
} else {
|
||||
if (st2=DocEntryLink(doc,doc_ce)) {
|
||||
st=DocLinkFile(st2);
|
||||
@@ -475,9 +475,9 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
case SC_F6:
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
if (sc & SCF_SHIFT)
|
||||
SetKeyDesc("God Doodle");
|
||||
KeyDescSet("God Doodle");
|
||||
else
|
||||
SetKeyDesc("God Song");
|
||||
KeyDescSet("God Song");
|
||||
} else {
|
||||
//$LK,"::/Adam/God/HSNotes.TXT"$
|
||||
if (sc & SCF_SHIFT)
|
||||
@@ -489,9 +489,9 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
case SC_F7:
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
if (sc & SCF_SHIFT)
|
||||
SetKeyDesc("God Passage");
|
||||
KeyDescSet("God Passage");
|
||||
else
|
||||
SetKeyDesc("God Word");
|
||||
KeyDescSet("God Word");
|
||||
} else {
|
||||
//$LK,"::/Adam/God/HSNotes.TXT"$
|
||||
FifoU8Flush(god.fifo);
|
||||
@@ -511,9 +511,9 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
if (sc2==SC_END || sc&SCF_CTRL) {
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
if (sc&SCF_SHIFT)
|
||||
SetKeyDesc("Edit/GoTo Doc End, Select");
|
||||
KeyDescSet("Edit/GoTo Doc End, Select");
|
||||
else
|
||||
SetKeyDesc("Edit/GoTo Doc End");
|
||||
KeyDescSet("Edit/GoTo Doc End");
|
||||
} else {
|
||||
while (doc_ce!=doc) {
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
@@ -524,9 +524,9 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
}
|
||||
} else if (sc&SCF_KEY_DESC) {
|
||||
if (sc&SCF_SHIFT)
|
||||
SetKeyDesc("Edit/Cursor Down, Select");
|
||||
KeyDescSet("Edit/Cursor Down, Select");
|
||||
else
|
||||
SetKeyDesc("Edit/Cursor Down");
|
||||
KeyDescSet("Edit/Cursor Down");
|
||||
} else
|
||||
EdLineDown(doc,sc);
|
||||
break;
|
||||
@@ -535,9 +535,9 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
if (sc2==SC_HOME || sc&SCF_CTRL) {
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
if (sc&SCF_SHIFT)
|
||||
SetKeyDesc("Edit/GoTo Top of Doc, Select");
|
||||
KeyDescSet("Edit/GoTo Top of Doc, Select");
|
||||
else
|
||||
SetKeyDesc("Edit/GoTo Top of Doc");
|
||||
KeyDescSet("Edit/GoTo Top of Doc");
|
||||
} else {
|
||||
if (doc_ce==doc) doc_ce=doc_ce->last;
|
||||
while (doc_ce!=doc) {
|
||||
@@ -550,18 +550,18 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
}
|
||||
} else if (sc&SCF_KEY_DESC) {
|
||||
if (sc&SCF_SHIFT)
|
||||
SetKeyDesc("Edit/Cursor Up, Select");
|
||||
KeyDescSet("Edit/Cursor Up, Select");
|
||||
else
|
||||
SetKeyDesc("Edit/Cursor Up");
|
||||
KeyDescSet("Edit/Cursor Up");
|
||||
} else
|
||||
EdLineUp(doc,sc);
|
||||
break;
|
||||
case SC_PAGE_DOWN:
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
if (sc&SCF_SHIFT)
|
||||
SetKeyDesc("Edit/Page Down, Select");
|
||||
KeyDescSet("Edit/Page Down, Select");
|
||||
else
|
||||
SetKeyDesc("Edit/Page Down");
|
||||
KeyDescSet("Edit/Page Down");
|
||||
} else {
|
||||
i=doc_ce->y+doc->win_task->win_height-1;
|
||||
if (doc_ce->type_u8==DOCT_HEX_ED)
|
||||
@@ -580,9 +580,9 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
case SC_PAGE_UP:
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
if (sc&SCF_SHIFT)
|
||||
SetKeyDesc("Edit/Page Up, Select");
|
||||
KeyDescSet("Edit/Page Up, Select");
|
||||
else
|
||||
SetKeyDesc("Edit/Page Up");
|
||||
KeyDescSet("Edit/Page Up");
|
||||
}else {
|
||||
i=doc_ce->y-(doc->win_task->win_height-1);
|
||||
if (doc_ce->type_u8==DOCT_HEX_ED)
|
||||
@@ -602,12 +602,12 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
case SC_CURSOR_LEFT:
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
if (sc&SCF_CTRL)
|
||||
SetKeyDesc("Edit/GoTo Start of Line");
|
||||
KeyDescSet("Edit/GoTo Start of Line");
|
||||
else {
|
||||
if (sc&SCF_SHIFT)
|
||||
SetKeyDesc("Edit/Cursor Left, Select");
|
||||
KeyDescSet("Edit/Cursor Left, Select");
|
||||
else
|
||||
SetKeyDesc("Edit/Cursor Left");
|
||||
KeyDescSet("Edit/Cursor Left");
|
||||
}
|
||||
} else
|
||||
EdCursorLeft(doc,sc);
|
||||
@@ -615,12 +615,12 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
case SC_CURSOR_RIGHT:
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
if (sc&SCF_CTRL)
|
||||
SetKeyDesc("Edit/GoTo End of Line");
|
||||
KeyDescSet("Edit/GoTo End of Line");
|
||||
else {
|
||||
if (sc&SCF_SHIFT)
|
||||
SetKeyDesc("Edit/Cursor Right, Select");
|
||||
KeyDescSet("Edit/Cursor Right, Select");
|
||||
else
|
||||
SetKeyDesc("Edit/Cursor Right");
|
||||
KeyDescSet("Edit/Cursor Right");
|
||||
}
|
||||
} else
|
||||
EdCursorRight(doc,sc);
|
||||
@@ -628,9 +628,9 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
case SC_DELETE:
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
if (sc&SCF_SHIFT)
|
||||
SetKeyDesc("Edit/Cut To Clipboard");
|
||||
KeyDescSet("Edit/Cut To Clipboard");
|
||||
else
|
||||
SetKeyDesc("Char/Delete");
|
||||
KeyDescSet("Char/Delete");
|
||||
} else {
|
||||
if (sc&SCF_SHIFT)
|
||||
EdCutToClipboard(doc);
|
||||
@@ -641,11 +641,11 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
||||
case SC_INS:
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
if (sc&SCF_SHIFT)
|
||||
SetKeyDesc("Edit/Paste Clipboard");
|
||||
KeyDescSet("Edit/Paste Clipboard");
|
||||
else if (sc&SCF_CTRL)
|
||||
SetKeyDesc("Edit/Copy to Clipboard");
|
||||
KeyDescSet("Edit/Copy to Clipboard");
|
||||
else
|
||||
SetKeyDesc("Edit/Toggle Overstrike");
|
||||
KeyDescSet("Edit/Toggle Overstrike");
|
||||
} else {
|
||||
if (sc&SCF_SHIFT)
|
||||
EdPasteClipboard(doc);
|
||||
@@ -791,7 +791,7 @@ Bool DocFileEd(I64 _type,U8 *filename,
|
||||
if (!FileNameChk(st2))
|
||||
doc=NULL;
|
||||
else {
|
||||
Silent(ON);
|
||||
Silent;
|
||||
if (Bt(&edf_dof_flags,EDf_BAIL)) //if bail, scan parents
|
||||
result=FileFind(filename,,
|
||||
FUF_JUST_FILES|FUF_Z_OR_NOT_Z|FUF_SCAN_PARENTS);
|
||||
@@ -802,7 +802,7 @@ Bool DocFileEd(I64 _type,U8 *filename,
|
||||
doc=DocRead(filename,flags);
|
||||
doc->desc='Edit';
|
||||
Silent(old_silent);
|
||||
Fs->border_src=BDS_ED_FILENAME_PRT;
|
||||
Fs->border_src=BDS_ED_FILENAME_DRV;
|
||||
}
|
||||
|
||||
Free(st1);
|
||||
@@ -835,14 +835,19 @@ Bool DocFileEd(I64 _type,U8 *filename,
|
||||
}
|
||||
*_num=doc->cur_entry->y+1;
|
||||
|
||||
if (edf_dof_flags&EDF_WAS_WRITE)
|
||||
result=FALSE;
|
||||
if (!(edf_dof_flags&EDF_BAIL) && DocDo(doc,edf_dof_flags|DOF_DONT_HOME)) {
|
||||
DocLock(doc);
|
||||
doc_e=doc->cur_entry;
|
||||
if (doc_e!=doc)
|
||||
DocEntryRun(doc,doc_e,TRUE);
|
||||
DocUnlock(doc);
|
||||
if (!(LK_DOC<=_type<=LK_DOC_LINE))
|
||||
if (!(LK_DOC<=_type<=LK_DOC_LINE)) {
|
||||
DocWrite(doc);
|
||||
if (edf_dof_flags&EDF_WAS_WRITE)
|
||||
result=TRUE;
|
||||
}
|
||||
}
|
||||
if (!(LK_DOC<=_type<=LK_DOC_LINE))
|
||||
DocDel(doc);
|
||||
@@ -912,7 +917,7 @@ public I64 EdLinkCvt(U8 *link_st,U8 **_filename=NULL,U8 **_needle_str=NULL,
|
||||
result=-1;
|
||||
else {
|
||||
num=Str2I64(DefineSub(i,"ST_BIBLE_BOOK_LINES"));
|
||||
filename2=Define("ST_BIBLE_FILE");
|
||||
filename2=BIBLE_FILENAME;
|
||||
}
|
||||
break;
|
||||
case LK_FILE_LINE:
|
||||
+10
-9
@@ -81,7 +81,8 @@ public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
|
||||
cnt++;
|
||||
break;
|
||||
case DOCT_TEXT://$BK,1$Update $LK,"DOCT_TEXT",A="FF:D:/Compiler/Lex.CPP,DOCT_TEXT"$$BK,0$
|
||||
if (!(doc_e->de_flags & ~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT|DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
if (!(doc_e->de_flags & ~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT|DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) &&
|
||||
!(doc_e->type&DOCG_BL_IV_UL)) {
|
||||
cnt+=StrLen(doc_e->tag);
|
||||
if (!(doc->flags & (DOCF_PLAIN_TEXT | DOCF_PLAIN_TEXT_WITH_TABS)) ||
|
||||
doc->flags&DOCF_DBL_DOLLARS)
|
||||
@@ -112,7 +113,8 @@ public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
|
||||
for (doc_e=doc->root.next;doc_e!=doc;doc_e=doc_e->next) {
|
||||
if (!Bt(doldoc.type_flags_data,doc_e->type_u8)) {
|
||||
if (doc_e->type_u8==DOCT_TEXT &&
|
||||
!(doc_e->de_flags & ~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT|DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP))) {
|
||||
!(doc_e->de_flags & ~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT|DOCEF_SKIP|DOCEF_HARD_SKIP|DOCEF_FILTER_SKIP)) &&
|
||||
!(doc_e->type&DOCG_BL_IV_UL)) {
|
||||
src=doc_e->tag;
|
||||
i=0;
|
||||
while (ch=*src++) {
|
||||
@@ -187,10 +189,9 @@ public Bool DocWrite(CDoc *doc,Bool prompt=FALSE)
|
||||
{//Store doc to disk.
|
||||
I64 size;
|
||||
U8 *buf;
|
||||
if (prompt && !DocFormDo(&doc->filename))
|
||||
return FALSE;
|
||||
if (doc->filename.name[0]=='A'&&doc->filename.name[2]==':')
|
||||
return FALSE; //LK_DOC,LK_DOC_ANCHOR,LK_DOC_FIND,LK_DOC_LINE
|
||||
if (prompt && !DocFormDo(&doc->filename) ||
|
||||
doc->filename.name[0]=='A' && doc->filename.name[2]==':')
|
||||
return FALSE; //CANCEL || LK_DOC,LK_DOC_ANCHOR,LK_DOC_FIND,LK_DOC_LINE?
|
||||
buf=DocSave(doc,&size);
|
||||
FileWrite(doc->filename.name,buf,size,0,doc->file_attr);
|
||||
Free(buf);
|
||||
@@ -440,13 +441,13 @@ public Bool DocType(CDoc *doc=NULL,U8 *filename,I64 trailing_new_lines=1)
|
||||
DocDel(doc2);
|
||||
result=TRUE;
|
||||
} else if (FilesFindMatch(filename,"*.BMP.Z")) {
|
||||
DocBMPFile(doc,filename,FALSE);
|
||||
DocBMP(doc,filename,,FALSE);
|
||||
result=TRUE;
|
||||
} else if (FilesFindMatch(filename,"*.BMP;*.bmp")) {
|
||||
DocBMPFile(doc,filename,TRUE);
|
||||
DocBMP(doc,filename,,TRUE);
|
||||
result=TRUE;
|
||||
} else if (FilesFindMatch(filename,"*.GRA*")) {
|
||||
DocGRAFile(doc,filename);
|
||||
DocGRA(doc,filename);
|
||||
result=TRUE;
|
||||
}
|
||||
if (result)
|
||||
|
||||
@@ -14,8 +14,8 @@ U0 DocInit()
|
||||
"T\0A\0D\0HTML\0LE\0LM\0RE\0RM\0BI\0BP\0RT\0SX\0SY\0SCX\0U\0"
|
||||
"LC\0LA\0RC\0RA\0TC\0LX\0CX\0RX\0TY\0CY\0BY\0"
|
||||
"HL\0WW\0BK\0IV\0SEL\0UL\0"
|
||||
"PRY\0MRX\0WR\0L\0X\0Q\0FST\0B\0S\0BD\0C\0CA\0RD\0P\0TRM\0Z\0H\0"
|
||||
"TR\0LS\0SK\0PU\0SIF\0HS\0FS\0NC\0DD\0UD\0");
|
||||
"PRY\0MRX\0WR\0L\0X\0Q\0FST\0B\0S\0BD\0C\0CA\0RD\0UD\0P\0TRM\0Z\0H\0"
|
||||
"TR\0LS\0SK\0PU\0SIF\0HS\0FS\0NC\0DD\0");
|
||||
DefineLstLoad("ST_LINK_TYPES",
|
||||
"FI\0FA\0FF\0FL\0MN\0PI\0PF\0PL\0BF\0DF\0HI\0AD\0AI\0AA\0AF\0AL\0");
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@ I64 PopUpMacroMenu()
|
||||
"\n\n\n$$GREEN$$SHIFT-F2$$FG$$ will play macro.\n");
|
||||
doc->flags|=DOCF_MIN_SIZE | DOCF_FORM;
|
||||
StrPrint(buf,"DocMenuDo(%d);",doc);
|
||||
sys_macro_util_task=Spawn(&SrvUserCmdLine,NULL,"Macro Popup",,Fs);
|
||||
sys_macro_util_task=Spawn(&SrvCmdLine,NULL,"Macro Popup",,Fs);
|
||||
Fs->popup_task=sys_macro_util_task;
|
||||
LBts(&sys_macro_util_task->display_flags,DISPLAYf_WIN_ON_TOP);
|
||||
tempc=TaskExe(sys_macro_util_task,Fs,buf,
|
||||
@@ -189,7 +189,7 @@ U0 MacroTask(I64)
|
||||
sys_macro_repeat_n=1;
|
||||
do {
|
||||
i=PopUpMacroMenu;
|
||||
WinRefocus;
|
||||
WinRefocus(sys_focus_task);
|
||||
switch (i) {
|
||||
case SM_RECORD:
|
||||
LBtr(&sys_semas[SYS_SEMA_RECORD_MACRO],0);
|
||||
|
||||
@@ -13,7 +13,7 @@ public Bool Ed(U8 *link_st,I64 edf_dof_flags=0)
|
||||
case LK_DEF:
|
||||
doc=DocNew;
|
||||
doc->desc='DictDef';
|
||||
WSDDefsPut(doc,filename,num);
|
||||
ACDDefsPut(doc,filename,num);
|
||||
goto ej_doc;
|
||||
case LK_HELP_INDEX:
|
||||
doc=DocNew;
|
||||
@@ -24,11 +24,12 @@ ej_doc:
|
||||
DocDo(doc);
|
||||
DocDel(doc);
|
||||
}
|
||||
result=TRUE;
|
||||
if (!(edf_dof_flags&EDF_WAS_WRITE))
|
||||
result=TRUE;
|
||||
break;
|
||||
default:
|
||||
if (IsRaw)
|
||||
EdLite(filename,num);
|
||||
result=EdLite(filename,num,edf_dof_flags);
|
||||
else {
|
||||
cont=TRUE;
|
||||
if (!(edf_dof_flags&EDF_BAIL) && !(LK_DOC<=i<=LK_DOC_LINE) &&
|
||||
@@ -44,11 +45,11 @@ ej_doc:
|
||||
return result;
|
||||
}
|
||||
|
||||
public Bool Plain(U8 *filename)
|
||||
public Bool Plain(U8 *filename,I64 edf_dof_flags=0)
|
||||
{//Edit document in plain text mode, so dollar signs are not special.
|
||||
Bool result;
|
||||
U8 *st=MStrPrint("PI:%s",filename);
|
||||
result=Ed(st);
|
||||
result=Ed(st,edf_dof_flags);
|
||||
Free(st);
|
||||
return result;
|
||||
}
|
||||
@@ -97,7 +98,7 @@ public U8 *DocLinkFile(U8 *link_st,CTask *mem_task=NULL)
|
||||
Free(st);
|
||||
break;
|
||||
case LK_BIBLE_FIND:
|
||||
result=StrNew(Define("ST_BIBLE_FILE"),mem_task);
|
||||
result=StrNew(BIBLE_FILENAME,mem_task);
|
||||
break;
|
||||
}
|
||||
Free(filename);
|
||||
@@ -148,7 +149,7 @@ public U0 DocTermNew()
|
||||
CDoc *pdoc=DocNew;
|
||||
pdoc->right_click_link=&TermRightClickLink;
|
||||
pdoc->max_entries=4096;
|
||||
Fs->border_src=BDS_CUR_PRT;
|
||||
Fs->border_src=BDS_CUR_DRV;
|
||||
pdoc->desc='Term';
|
||||
Fs->put_doc=Fs->display_doc=pdoc;
|
||||
Fs->border_doc=DocBorderNew(pdoc);
|
||||
@@ -531,7 +532,7 @@ I64 TermRightClickLink(CDoc *doc,CDocEntry *doc_e)
|
||||
}
|
||||
"AutoFile(\"%s\");\n$$PT$$$$FG$$$$BG$$",st;
|
||||
WinZBufUpdate;
|
||||
AutoStr("%F\n",st);
|
||||
AutoFile(st);
|
||||
result=TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -265,8 +265,9 @@ U0 DocFormFwd(CDoc *doc,Bool giveup=FALSE)
|
||||
CDocEntry *doc_e=doc->cur_entry,*doc_e2=doc_e;
|
||||
if (doc->flags & DOCF_FORM) {
|
||||
if (doc_e==doc) goto ff_recover;
|
||||
while (!Bt(doldoc.type_flags_form,doc_e->type_u8) ||
|
||||
doc_e->de_flags&DOCEF_SKIP_IN_FORM) {
|
||||
while (!Bt(doldoc.type_flags_form,doc_e->type_u8) &&
|
||||
!(doc_e->de_flags&DOCEF_LINK) ||
|
||||
doc_e->de_flags&DOCEF_SKIP_IN_FORM) {
|
||||
doc_e=doc_e->next;
|
||||
if (doc_e==doc) {
|
||||
ff_recover:
|
||||
@@ -292,8 +293,9 @@ U0 DocFormBwd(CDoc *doc,Bool giveup=FALSE)
|
||||
{
|
||||
CDocEntry *doc_e=doc->cur_entry,*doc_e2=doc_e;
|
||||
if (doc->flags & DOCF_FORM) {
|
||||
while (!Bt(doldoc.type_flags_form,doc_e->type_u8) ||
|
||||
doc_e->de_flags&DOCEF_SKIP_IN_FORM) {
|
||||
while (!Bt(doldoc.type_flags_form,doc_e->type_u8) &&
|
||||
!(doc_e->de_flags&DOCEF_LINK) ||
|
||||
doc_e->de_flags&DOCEF_SKIP_IN_FORM) {
|
||||
doc_e=doc_e->last;
|
||||
if (doc_e==doc) {
|
||||
doc->cur_data_col=0;
|
||||
|
||||
@@ -302,8 +302,8 @@ public Bool DocDo(CDoc *doc,I64 dof_flags=0)
|
||||
Free(old_task_title);
|
||||
DocDel(bdoc);
|
||||
if (dof_flags&DOF_MIN_SIZE) {
|
||||
SetWinHorz(old_left,old_right);
|
||||
SetWinVert(old_top,old_bottom);
|
||||
WinHorz(old_left,old_right);
|
||||
WinVert(old_top,old_bottom);
|
||||
}
|
||||
Preempt(old_preempt);
|
||||
return result;
|
||||
@@ -403,32 +403,7 @@ md_restart:
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "Task/Srv"
|
||||
public I64 PopUp(U8 *buf,CTask *parent=NULL,CTask **_pu_task=NULL)
|
||||
{//Execute code text in PopUp win task.
|
||||
I64 result;
|
||||
CSrvCmd *tempc;
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
CTask *task=Spawn(&SrvUserCmdLine,NULL,"System",,parent);
|
||||
if (!parent) {
|
||||
TaskExe(task,parent,buf,1<<SVCf_EXIT_ON_COMPLETE|1<<SVCf_FREE_ON_COMPLETE);
|
||||
if (_pu_task) *_pu_task=task;
|
||||
Preempt(old_preempt);
|
||||
return 0;
|
||||
} else {
|
||||
Fs->popup_task=task;
|
||||
tempc=TaskExe(task,parent,buf,1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
if (_pu_task) *_pu_task=task;
|
||||
ScanResult(tempc,&result);
|
||||
Fs->popup_task=NULL;
|
||||
Kill(task);
|
||||
if (_pu_task) *_pu_task=NULL;
|
||||
Preempt(old_preempt);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
#help_index "DolDoc;Task/Srv"
|
||||
#help_index "DolDoc;Task/Srv/Exe"
|
||||
public I64 PopUpEd(U8 *filename,CTask *parent=NULL,CTask **_pu_task=NULL)
|
||||
{//Create PopUp win task and edit a doc.
|
||||
U8 *st=MStrPrint("Ed(\"%Q\");",filename);
|
||||
@@ -441,7 +416,7 @@ public I64 PopUpEd(U8 *filename,CTask *parent=NULL,CTask **_pu_task=NULL)
|
||||
public CTask *PopUpViewDoc(CDoc *doc,I64 dof_flags=0)
|
||||
{//Pass doc to PopUp win task for viewing.
|
||||
U8 *buf=MStrPrint("Preempt(ON);DocDo(0x%X,0x%X);",doc,dof_flags);
|
||||
CTask *task=Spawn(&SrvUserCmdLine,NULL,"View",,Fs);
|
||||
CTask *task=Spawn(&SrvCmdLine,NULL,"View",,Fs);
|
||||
TaskExe(task,NULL,buf,1<<SVCf_EXIT_ON_COMPLETE|1<<SVCf_FREE_ON_COMPLETE);
|
||||
Free(buf);
|
||||
return task;
|
||||
@@ -470,13 +445,13 @@ public CTask *PopUpViewPrint(U8 *fmt,...)
|
||||
public I64 PopUpMenu(CDoc *doc,I64 dof_flags=0)
|
||||
{//Do (Run) menu chooser doc in PopUp win task.
|
||||
doc->flags|=DOCF_MIN_SIZE | DOCF_FORM;
|
||||
return SrvUser("DocMenuDo(0x%X,0x%X);",doc,dof_flags);
|
||||
return PopUpPrint("DocMenuDo(0x%X,0x%X);",doc,dof_flags);
|
||||
}
|
||||
|
||||
public Bool PopUpForm(U8 *_d,U8 *class_name=lastclass,I64 dof_flags=DOF_MIN_SIZE,
|
||||
U8 *header=NULL,U8 *footer=NULL)
|
||||
{//See $LK,"::/Demo/DolDoc/Form.CPP"$ and $LK,"::/Demo/LastClass.CPP"$.
|
||||
return SrvUser("DocFormDo(0x%X,0x%X,0x%X,0x%X,0x%X);",_d,class_name,
|
||||
return PopUpPrint("DocFormDo(0x%X,0x%X,0x%X,0x%X,0x%X);",_d,class_name,
|
||||
dof_flags,header,footer);
|
||||
}
|
||||
|
||||
@@ -727,7 +702,7 @@ public F64 PopUpRangeF64Log(F64 lo,F64 hi,I64 steps,
|
||||
return PopUpRangeF64Exp(lo,hi,Exp(Ln(hi/lo)/(steps-1)),fmt,header,footer);
|
||||
}
|
||||
|
||||
#help_index "Task/Srv"
|
||||
#help_index "Task/Srv/Exe"
|
||||
public I64 AdamFile(U8 *filename,Bool warn_ext=TRUE)
|
||||
{//Tell adam task to compile and run a file.
|
||||
Bool okay=TRUE;
|
||||
@@ -875,8 +850,8 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
}
|
||||
i=(17*PU_SPACING+FONT_WIDTH-1)/FONT_WIDTH;
|
||||
if (doc->max_x>i) i=doc->max_x;
|
||||
SetWinHorz(task->win_left,task->win_left+i,task);
|
||||
SetWinVert(task->win_top,task->win_top+doc->max_y+(17*PU_SPACING+FONT_WIDTH-1)/FONT_WIDTH,task);
|
||||
WinHorz(task->win_left,task->win_left+i,task);
|
||||
WinVert(task->win_top,task->win_top+doc->max_y+(17*PU_SPACING+FONT_WIDTH-1)/FONT_WIDTH,task);
|
||||
}
|
||||
|
||||
I64 DitherColorDo(U8 *header=NULL)
|
||||
|
||||
@@ -169,23 +169,23 @@ public U0 DocPrintAtomic(CDoc *doc,U8 *fmt,...)
|
||||
#help_index "DolDoc/Task"
|
||||
U0 DocUpdateTaskDocs(CTask *task)
|
||||
{//This is called from $LK,"GrUpdateWins",A="MN:GrUpdateWins"$() by the winmgr at 30fps.
|
||||
CPrt *p;
|
||||
CDrv *dv;
|
||||
CDoc *doc;
|
||||
CD3I64 saved_scroll;
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
I64 border_attr;
|
||||
if (task->border_src==BDS_CUR_PRT && task->cur_prt) {
|
||||
border_attr=task->cur_prt->text_attr;
|
||||
if (task->border_src==BDS_CUR_DRV && task->cur_dv) {
|
||||
border_attr=task->cur_dv->text_attr;
|
||||
if (border_attr&15!=border_attr>>4)
|
||||
task->border_attr=border_attr;
|
||||
}
|
||||
if (task->title_src==TTS_TASK_NAME)
|
||||
StrCpy(task->task_title,task->task_name);
|
||||
if ((doc=DocDisplay(task)) && !(doc->flags&DOCF_DONT_SHOW)) {
|
||||
if (task->border_src==BDS_ED_FILENAME_PRT)
|
||||
if (task->border_src==BDS_ED_FILENAME_DRV)
|
||||
try {
|
||||
if (p=Drv2Prt(*doc->filename.name)) {
|
||||
border_attr=p->text_attr;
|
||||
if (dv=Let2Drv(*doc->filename.name)) {
|
||||
border_attr=dv->text_attr;
|
||||
if (border_attr&15!=border_attr>>4)
|
||||
task->border_attr=border_attr;
|
||||
}
|
||||
@@ -294,7 +294,7 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
|
||||
dc=DCAlias(gr.dc2,win_task); //Necessary for sprites
|
||||
break;
|
||||
case DOC_RECALC_TO_SCREEN:
|
||||
if (doc->refresh_cnt++%(ToI64(winmgr.fps/10)+1) &&
|
||||
if (doc->updates_cnt++%(ToI64(winmgr.fps/10)+1) &&
|
||||
!Bt(&doc->flags,DOCf_DO_FULL_REFRESH) &&
|
||||
!(doc->flags&DOCF_BWD_MOVEMENT))
|
||||
full_refresh=FALSE;
|
||||
@@ -1127,26 +1127,26 @@ rc_skip:
|
||||
i=left+doc->max_x-doc->min_x;
|
||||
if (i>TEXT_COLS-1)
|
||||
i=TEXT_COLS-1;
|
||||
SetWinHorz(left,i,win_task);
|
||||
WinHorz(left,i,win_task);
|
||||
if (top<0)
|
||||
top=0;
|
||||
i=top+doc->max_y-doc->min_y;
|
||||
if (i>TEXT_ROWS-1)
|
||||
i=TEXT_ROWS-1;
|
||||
SetWinVert(top,i,win_task);
|
||||
WinVert(top,i,win_task);
|
||||
} else {
|
||||
if (left<1)
|
||||
left=1;
|
||||
i=left+doc->max_x-doc->min_x;
|
||||
if (i>TEXT_COLS-2)
|
||||
i=TEXT_COLS-2;
|
||||
SetWinHorz(left,i,win_task);
|
||||
WinHorz(left,i,win_task);
|
||||
if (top<1)
|
||||
top=1;
|
||||
i=top+doc->max_y-doc->min_y;
|
||||
if (i>TEXT_ROWS-2)
|
||||
i=TEXT_ROWS-2;
|
||||
SetWinVert(top,i,win_task);
|
||||
WinVert(top,i,win_task);
|
||||
}
|
||||
}
|
||||
if (find_cursor) {
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "Dsk2a"
|
||||
#include "Dsk2b"
|
||||
#include "ADskA"
|
||||
#include "ADskB"
|
||||
#include "ChkDsk"
|
||||
#include "FileMgr"
|
||||
@@ -7,13 +7,13 @@ public U8 *DBlk(I64 blk,Bool write=FALSE)
|
||||
//See $LK,"::/Demo/Dsk/DskRaw.CPP"$.
|
||||
U8 *buf=MAlloc(BLK_SIZE);
|
||||
|
||||
RBlks(Fs->cur_prt,buf,blk,1);
|
||||
RBlks(Fs->cur_dv,buf,blk,1);
|
||||
DocD(buf,BLK_SIZE);
|
||||
if (write) {
|
||||
"Edit and press <ESC> to write or <SHIFT-ESC>\n";
|
||||
if (View) {
|
||||
"Write\n";
|
||||
WBlks(Fs->cur_prt,buf,blk,1);
|
||||
WBlks(Fs->cur_dv,buf,blk,1);
|
||||
}
|
||||
}
|
||||
return buf;
|
||||
@@ -25,16 +25,35 @@ public U8 *DCluster(I64 c,Bool write=FALSE,I64 num=0)
|
||||
//be written when you press <ESC>.
|
||||
//See $LK,"::/Demo/Dsk/DskRaw.CPP"$.
|
||||
//Do $LK,"Dir",A="MN:Dir"$("*",TRUE); to get cluster numbers of files.
|
||||
U8 *buf=MAlloc(Fs->cur_prt->spc<<BLK_SIZE_BITS);
|
||||
c=ClusterNumNext(Fs->cur_prt,c,num);
|
||||
RClusters(Fs->cur_prt,buf,c,1);
|
||||
U8 *buf=MAlloc(Fs->cur_dv->spc<<BLK_SIZE_BITS);
|
||||
c=ClusterNumNext(Fs->cur_dv,c,num);
|
||||
RClusters(Fs->cur_dv,buf,c,1);
|
||||
"Cluster:%X\n",c;
|
||||
DocD(buf,Fs->cur_prt->spc<<BLK_SIZE_BITS);
|
||||
DocD(buf,Fs->cur_dv->spc<<BLK_SIZE_BITS);
|
||||
if (write) {
|
||||
"Edit and press <ESC> to write or <SHIFT-ESC>\n";
|
||||
if (View) {
|
||||
"Write\n";
|
||||
WClusters(Fs->cur_prt,buf,c,1);
|
||||
WClusters(Fs->cur_dv,buf,c,1);
|
||||
}
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
public U8 *Dump(U8 *filename,Bool write=FALSE)
|
||||
{//Dump file. Optionally, write.
|
||||
//If you set write to TRUE, the file will
|
||||
//be written when you press <ESC>.
|
||||
U8 *buf;
|
||||
I64 size;
|
||||
if (buf=FileRead(filename,&size)) {
|
||||
DocD(buf,size);
|
||||
if (write) {
|
||||
"Edit and press <ESC> to write or <SHIFT-ESC>\n";
|
||||
if (View) {
|
||||
"Write\n";
|
||||
FileWrite(filename,buf,size);
|
||||
}
|
||||
}
|
||||
}
|
||||
return buf;
|
||||
@@ -218,7 +237,7 @@ public I64 DelTree(U8 *files_find_mask,U8 *fu_flags=NULL)
|
||||
|
||||
U0 TouchFile(U8 *filename,U8 *attr,CDate cdt=MIN_I64)
|
||||
{
|
||||
CPrt *p=Drv2Prt(*filename);
|
||||
CDrv *dv=Let2Drv(*filename);
|
||||
CDirEntry de;
|
||||
U8 *cur_dir=StrNew(filename),
|
||||
buf[136];
|
||||
@@ -236,7 +255,7 @@ U0 TouchFile(U8 *filename,U8 *attr,CDate cdt=MIN_I64)
|
||||
de.datetime=Now;
|
||||
else
|
||||
de.datetime=cdt;
|
||||
DirNew(p,cur_dir,&de,FALSE);
|
||||
DirNew(dv,cur_dir,&de,FALSE);
|
||||
}
|
||||
} else
|
||||
PrintErr("File not found.\n");
|
||||
@@ -279,69 +298,69 @@ public I64 FF(U8 *files_find_mask,U8 *fu_flags=NULL)
|
||||
return cnt;
|
||||
}
|
||||
|
||||
public U0 SetDrvTextAttr(U8 drv_let,U8 attr)
|
||||
public U0 DrvTextAttrSet(U8 drv_let,U8 attr)
|
||||
{//Set color of the window border text
|
||||
//for when this drive is the current drive.
|
||||
CPrt *p;
|
||||
CDrv *dv;
|
||||
try {
|
||||
p=Drv2Prt(drv_let);
|
||||
p->text_attr=attr;
|
||||
dv=Let2Drv(drv_let);
|
||||
dv->text_attr=attr;
|
||||
} catch
|
||||
Fs->catch_except=TRUE;
|
||||
}
|
||||
I64 RedSeaFSUnusedDrvSpace(U8 drv_let=0)
|
||||
I64 RedSeaUnusedDrvSpace(U8 drv_let=0)
|
||||
{
|
||||
CPrt *p=Drv2Prt(drv_let);
|
||||
CDrv *dv=Let2Drv(drv_let);
|
||||
I64 result=0,i,l;
|
||||
U8 *bitmap;
|
||||
try {
|
||||
l=(p->size+p->spc-1)/p->spc;
|
||||
l=(dv->size+dv->spc-1)/dv->spc;
|
||||
i=((l+7)>>3+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
bitmap=MAlloc(i<<BLK_SIZE_BITS);
|
||||
RBlks(p,bitmap,p->map1,i);
|
||||
RBlks(dv,bitmap,dv->map1,i);
|
||||
for (i=0;i<l;i++)
|
||||
if (!Bt(bitmap,i))
|
||||
result++;
|
||||
Free(bitmap);
|
||||
} catch
|
||||
PrtUnlock(p);
|
||||
return result*BLK_SIZE*p->spc;
|
||||
DrvUnlock(dv);
|
||||
return result*BLK_SIZE*dv->spc;
|
||||
}
|
||||
I64 FAT32UnusedDrvSpace(U8 drv_let=0)
|
||||
{
|
||||
CPrt *p=Drv2Prt(drv_let);
|
||||
CDrv *dv=Let2Drv(drv_let);
|
||||
I64 result=0,i,l;
|
||||
U32 *bitmap;
|
||||
try {
|
||||
l=(p->size+p->spc-1)/p->spc;
|
||||
l=(dv->size+dv->spc-1)/dv->spc;
|
||||
i=(l*4+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
bitmap=MAlloc(i<<BLK_SIZE_BITS);
|
||||
RBlks(p,bitmap,p->map1,i);
|
||||
RBlks(dv,bitmap,dv->map1,i);
|
||||
for (i=0;i<l;i++)
|
||||
if (!bitmap[i])
|
||||
result++;
|
||||
Free(bitmap);
|
||||
} catch
|
||||
PrtUnlock(p);
|
||||
return result*BLK_SIZE*p->spc;
|
||||
DrvUnlock(dv);
|
||||
return result*BLK_SIZE*dv->spc;
|
||||
}
|
||||
public I64 UnusedDrvSpace(U8 drv_let=0)
|
||||
{//Returns unused size in bytes.
|
||||
CPrt *p=Drv2Prt(drv_let),*p_old=Fs->cur_prt;
|
||||
CDrv *dv=Let2Drv(drv_let),*old_dv=Fs->cur_dv;
|
||||
U8 *old_dir=StrNew(Fs->cur_dir);
|
||||
I64 result=0;
|
||||
Drv(drv_let);
|
||||
switch (p->type) {
|
||||
case PT_REDSEA:
|
||||
result=RedSeaFSUnusedDrvSpace(drv_let);
|
||||
switch (dv->type) {
|
||||
case DVT_REDSEA:
|
||||
result=RedSeaUnusedDrvSpace(drv_let);
|
||||
break;
|
||||
case PT_FAT32:
|
||||
case DVT_FAT32:
|
||||
result=FAT32UnusedDrvSpace(drv_let);
|
||||
break;
|
||||
default:
|
||||
PrintErr("File System Not Supported\n");
|
||||
}
|
||||
Drv(Prt2Drv(p_old));
|
||||
Drv(Drv2Let(old_dv));
|
||||
Cd(old_dir);
|
||||
Free(old_dir);
|
||||
return result;
|
||||
@@ -352,12 +371,12 @@ I64 Size1(CDirEntry *tempde,I64 *_fuf_flags,I64 round_to)
|
||||
{
|
||||
U8 buf[BLK_SIZE];
|
||||
I64 result=0,i;
|
||||
CPrt *p;
|
||||
CDrv *dv;
|
||||
while (tempde) {
|
||||
if ((i=tempde->size) && Bt(_fuf_flags,FUf_EXPAND) &&
|
||||
!(tempde->attr&RS_ATTR_DIR) && FileAttr(tempde->name)&RS_ATTR_COMPRESSED) {
|
||||
p=Drv2Prt(*tempde->full_name);
|
||||
RBlks(p,buf,Cluster2Blk(p,tempde->cluster),1);
|
||||
dv=Let2Drv(*tempde->full_name);
|
||||
RBlks(dv,buf,Cluster2Blk(dv,tempde->cluster),1);
|
||||
i=(&buf)(CArcCompress *)->expanded_size;
|
||||
}
|
||||
if (round_to)
|
||||
@@ -62,25 +62,25 @@ public CDirEntry *DirTreeUnserialize(U8 *src)
|
||||
|
||||
#help_index "Install;File/Cmd Line (Typically);Cmd Line (Typically)"
|
||||
|
||||
#define ROUND_PRT_TO (63*255)
|
||||
#define PRT_HEADER 63
|
||||
#define ROUND_DRV_TO (63*255)
|
||||
#define DRV_HEADER 63
|
||||
|
||||
class CPlannedPrt
|
||||
class CPlannedDrv
|
||||
{
|
||||
CPlannedPrt *next,*last;
|
||||
CPlannedDrv *next,*last;
|
||||
I64 size;
|
||||
Bool pri;
|
||||
};
|
||||
|
||||
//Available to assist in writing scripts.
|
||||
I64 prt_dsk_dsk_size;
|
||||
I64 drv_dsk_dsk_size;
|
||||
|
||||
public U0 PrtDsk(U8 drv_let=0)
|
||||
{//Partition the disk containing partition drv_let.
|
||||
//drv_let=0 means add new drive that
|
||||
//is not already mounted.
|
||||
CBlkDev *bdev;
|
||||
CPlannedPrt root,*temppp;
|
||||
CBlkDev *bd;
|
||||
CPlannedDrv root,*temppp;
|
||||
CMasterBoot mbr;
|
||||
Bool pri=TRUE;
|
||||
I64 ext_base,drv_let2,pri_cnt=0,
|
||||
@@ -99,7 +99,7 @@ public U0 PrtDsk(U8 drv_let=0)
|
||||
|
||||
if (drv_let)
|
||||
try
|
||||
Drv2BlkDev(drv_let);
|
||||
Let2BlkDev(drv_let);
|
||||
catch {
|
||||
drv_let=0;
|
||||
Fs->catch_except=TRUE;
|
||||
@@ -110,18 +110,18 @@ public U0 PrtDsk(U8 drv_let=0)
|
||||
return;
|
||||
}
|
||||
|
||||
bdev=Drv2BlkDev(drv_let);
|
||||
if (!bdev || bdev->type!=BDT_ATA)
|
||||
bd=Let2BlkDev(drv_let);
|
||||
if (!bd || bd->type!=BDT_ATA)
|
||||
return;
|
||||
|
||||
prt_dsk_dsk_size=bdev->max_blk+1;
|
||||
drv_dsk_dsk_size=bd->max_blk+1;
|
||||
|
||||
QueInit(&root);
|
||||
|
||||
drv_let2=bdev->first_drv_let;
|
||||
remaining=FloorU64(bdev->max_blk+1,ROUND_PRT_TO);
|
||||
while (FloorU64(remaining,ROUND_PRT_TO)>=ROUND_PRT_TO) {
|
||||
temppp=MAlloc(sizeof(CPlannedPrt));
|
||||
drv_let2=bd->first_drv_let;
|
||||
remaining=FloorU64(bd->max_blk+1,ROUND_DRV_TO);
|
||||
while (FloorU64(remaining,ROUND_DRV_TO)>=ROUND_DRV_TO) {
|
||||
temppp=MAlloc(sizeof(CPlannedDrv));
|
||||
do {
|
||||
"$$RED$$Partition %C$$FG$$\n",drv_let2;
|
||||
temppp->pri=FALSE;
|
||||
@@ -136,10 +136,10 @@ public U0 PrtDsk(U8 drv_let=0)
|
||||
pri=FALSE;
|
||||
}
|
||||
"Blocks Remaining:%d (0x%X)\n",
|
||||
remaining-PRT_HEADER,remaining-PRT_HEADER;
|
||||
remaining-DRV_HEADER,remaining-DRV_HEADER;
|
||||
temppp->size=CeilU64(GetI64("Size in Blocks :",
|
||||
remaining-PRT_HEADER)+PRT_HEADER,ROUND_PRT_TO);
|
||||
} while (!(ROUND_PRT_TO<=temppp->size<=FloorU64(remaining,ROUND_PRT_TO)));
|
||||
remaining-DRV_HEADER)+DRV_HEADER,ROUND_DRV_TO);
|
||||
} while (!(ROUND_DRV_TO<=temppp->size<=FloorU64(remaining,ROUND_DRV_TO)));
|
||||
QueIns(temppp,root.last);
|
||||
remaining-=temppp->size;
|
||||
drv_let2++;
|
||||
@@ -147,7 +147,7 @@ public U0 PrtDsk(U8 drv_let=0)
|
||||
|
||||
"\n\n!!! Repartition Drive !!!\n\n";
|
||||
temppp=root.next;
|
||||
drv_let2=bdev->first_drv_let;
|
||||
drv_let2=bd->first_drv_let;
|
||||
while (temppp!=&root) {
|
||||
"Drive %C:%08X ",drv_let2,temppp->size;
|
||||
if (temppp->pri)
|
||||
@@ -160,7 +160,7 @@ public U0 PrtDsk(U8 drv_let=0)
|
||||
if (!AreYouSure)
|
||||
goto pd_done;
|
||||
|
||||
remaining=FloorU64(bdev->max_blk+1,ROUND_PRT_TO)-ROUND_PRT_TO;
|
||||
remaining=FloorU64(bd->max_blk+1,ROUND_DRV_TO)-ROUND_DRV_TO;
|
||||
temppp=root.next;
|
||||
MemSet(&mbr,0,BLK_SIZE);
|
||||
mbr.signature=0xAA55;
|
||||
@@ -172,8 +172,8 @@ public U0 PrtDsk(U8 drv_let=0)
|
||||
mbr.p[i].type=1; //Will get set different.
|
||||
mbr.p[i].end_head=0xFE;
|
||||
mbr.p[i].end_cyl=0xFFFF;
|
||||
mbr.p[i].offset=PRT_HEADER+offset;
|
||||
mbr.p[i].size=temppp->size-PRT_HEADER;
|
||||
mbr.p[i].offset=DRV_HEADER+offset;
|
||||
mbr.p[i].size=temppp->size-DRV_HEADER;
|
||||
offset+=temppp->size;
|
||||
remaining-=temppp->size;
|
||||
temppp=temppp->next;
|
||||
@@ -190,7 +190,7 @@ public U0 PrtDsk(U8 drv_let=0)
|
||||
mbr.p[i].size=remaining;
|
||||
ext_base=offset;
|
||||
}
|
||||
ATAWriteBlks(bdev,&mbr,0,1);
|
||||
ATAWriteBlks(bd,&mbr,0,1);
|
||||
|
||||
while (temppp!=&root) {
|
||||
start_offset=offset;
|
||||
@@ -203,8 +203,8 @@ public U0 PrtDsk(U8 drv_let=0)
|
||||
mbr.p[0].type=1; //Will get set different.
|
||||
mbr.p[0].end_head=0xFE;
|
||||
mbr.p[0].end_cyl=0xFFFF;
|
||||
mbr.p[0].offset=PRT_HEADER;
|
||||
mbr.p[0].size=temppp->size-PRT_HEADER;
|
||||
mbr.p[0].offset=DRV_HEADER;
|
||||
mbr.p[0].size=temppp->size-DRV_HEADER;
|
||||
offset+=temppp->size;
|
||||
temppp=temppp->next;
|
||||
if (temppp!=&root) {
|
||||
@@ -217,12 +217,12 @@ public U0 PrtDsk(U8 drv_let=0)
|
||||
mbr.p[1].offset=offset-ext_base;
|
||||
mbr.p[1].size=temppp->size;
|
||||
}
|
||||
ATAWriteBlks(bdev,&mbr,start_offset,1);
|
||||
ATAWriteBlks(bd,&mbr,start_offset,1);
|
||||
}
|
||||
|
||||
bdev->flags&=~(BDF_INITIALIZED | BDF_INIT_IN_PROGRESS);
|
||||
BlkDevAdd(bdev,FALSE,TRUE);
|
||||
for (i=bdev->first_drv_let;i<drv_let2;i++)
|
||||
bd->flags&=~(BDF_INITIALIZED | BDF_INIT_IN_PROGRESS);
|
||||
BlkDevAdd(bd,FALSE,TRUE);
|
||||
for (i=bd->first_drv_let;i<drv_let2;i++)
|
||||
Fmt(i,,FALSE);
|
||||
|
||||
pd_done:
|
||||
@@ -235,15 +235,15 @@ pd_done:
|
||||
|
||||
#help_index "Info;File/Cmd Line (Typically);Cmd Line (Typically)"
|
||||
|
||||
U0 RedSeaFSDrvView(U8 drv_let=0)
|
||||
U0 RedSeaDrvView(U8 drv_let=0)
|
||||
{
|
||||
CPrt *p=Drv2Prt(drv_let);
|
||||
CDrv *dv=Let2Drv(drv_let);
|
||||
I64 lohi,c1,i,x,y,l,s;
|
||||
U8 *bitmap;
|
||||
CDC *dc=DCAlias;
|
||||
|
||||
l=(GR_HEIGHT-3*FONT_HEIGHT)*(GR_WIDTH-FONT_WIDTH<<1),
|
||||
s=(p->size+p->spc-1)/p->spc;
|
||||
s=(dv->size+dv->spc-1)/dv->spc;
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
WinMax;
|
||||
@@ -253,7 +253,7 @@ U0 RedSeaFSDrvView(U8 drv_let=0)
|
||||
try {
|
||||
i=((s+7)>>3+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
bitmap=MAlloc(i<<BLK_SIZE_BITS);
|
||||
RBlks(p,bitmap,p->map1,i);
|
||||
RBlks(dv,bitmap,dv->map1,i);
|
||||
i=0;
|
||||
for (y=0;y<GR_HEIGHT-3*FONT_HEIGHT;y++) {
|
||||
if (ScanKey)
|
||||
@@ -271,7 +271,7 @@ U0 RedSeaFSDrvView(U8 drv_let=0)
|
||||
}
|
||||
Free(bitmap);
|
||||
} catch
|
||||
PrtUnlock(p);
|
||||
DrvUnlock(dv);
|
||||
GetChar;
|
||||
|
||||
SettingsPop;
|
||||
@@ -280,12 +280,12 @@ U0 RedSeaFSDrvView(U8 drv_let=0)
|
||||
}
|
||||
U0 FAT32DrvView(U8 drv_let=0)
|
||||
{
|
||||
CPrt *p=Drv2Prt(drv_let);
|
||||
CDrv *dv=Let2Drv(drv_let);
|
||||
I64 lohi,c1,i,x,y,l,s;
|
||||
U32 *bitmap;
|
||||
CDC *dc=DCAlias;
|
||||
l=(GR_HEIGHT-3*FONT_HEIGHT)*(GR_WIDTH-FONT_WIDTH<<1),
|
||||
s=(p->size+p->spc-1)/p->spc;
|
||||
s=(dv->size+dv->spc-1)/dv->spc;
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
WinMax;
|
||||
@@ -295,7 +295,7 @@ U0 FAT32DrvView(U8 drv_let=0)
|
||||
try {
|
||||
i=(s*4+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
bitmap=MAlloc(i<<BLK_SIZE_BITS);
|
||||
RBlks(p,bitmap,p->map1,i);
|
||||
RBlks(dv,bitmap,dv->map1,i);
|
||||
i=0;
|
||||
for (y=0;y<GR_HEIGHT-3*FONT_HEIGHT;y++) {
|
||||
if (ScanKey)
|
||||
@@ -313,7 +313,7 @@ U0 FAT32DrvView(U8 drv_let=0)
|
||||
}
|
||||
Free(bitmap);
|
||||
} catch
|
||||
PrtUnlock(p);
|
||||
DrvUnlock(dv);
|
||||
GetChar;
|
||||
|
||||
SettingsPop;
|
||||
@@ -322,19 +322,19 @@ U0 FAT32DrvView(U8 drv_let=0)
|
||||
}
|
||||
public U0 DrvView(U8 drv_let=0)
|
||||
{//Drive view. Graph the allocation map's fragmentation.
|
||||
CPrt *p=Drv2Prt(drv_let),*p_old=Fs->cur_prt;
|
||||
CDrv *dv=Let2Drv(drv_let),*old_dv=Fs->cur_dv;
|
||||
Drv(drv_let);
|
||||
switch (p->type) {
|
||||
case PT_REDSEA:
|
||||
RedSeaFSDrvView(drv_let);
|
||||
switch (dv->type) {
|
||||
case DVT_REDSEA:
|
||||
RedSeaDrvView(drv_let);
|
||||
break;
|
||||
case PT_FAT32:
|
||||
case DVT_FAT32:
|
||||
FAT32DrvView(drv_let);
|
||||
break;
|
||||
default:
|
||||
PrintErr("File System Not Supported\n");
|
||||
}
|
||||
Drv(Prt2Drv(p_old));
|
||||
Drv(Drv2Let(old_dv));
|
||||
}
|
||||
|
||||
public U0 DskView(U8 drv_let=0)
|
||||
@@ -343,8 +343,8 @@ public U0 DskView(U8 drv_let=0)
|
||||
h=Fs->pix_width,
|
||||
v=Fs->pix_height,
|
||||
radius;
|
||||
CPrt *p;
|
||||
CBlkDev *bdev=Drv2BlkDev(drv_let);
|
||||
CDrv *dv;
|
||||
CBlkDev *bd=Let2BlkDev(drv_let);
|
||||
CDC *dc=DCAlias;
|
||||
F64 sect_start,sect_end;
|
||||
|
||||
@@ -360,11 +360,11 @@ public U0 DskView(U8 drv_let=0)
|
||||
GrCircle(dc,h>>1,v>>1,radius);
|
||||
|
||||
j=1;
|
||||
for (i=0;i<NUM_PRTS;i++) {
|
||||
p=&dsk.prts[i];
|
||||
if (bdev==p->bdev && p->type) {
|
||||
sect_start=-(p->offset*2*ã/(bdev->max_blk+1));
|
||||
sect_end =-((p->offset+p->size)*2*ã/(bdev->max_blk+1));
|
||||
for (i=0;i<NUM_DRVS;i++) {
|
||||
dv=&dsk.drvs[i];
|
||||
if (bd==dv->bd && dv->type) {
|
||||
sect_start=-(dv->base_offset*2*ã/(bd->max_blk+1));
|
||||
sect_end =-((dv->base_offset+dv->size)*2*ã/(bd->max_blk+1));
|
||||
dc->color=BLACK;
|
||||
GrLine(dc,h>>1,v>>1,
|
||||
h>>1+radius*Cos(sect_start),
|
||||
@@ -374,8 +374,8 @@ public U0 DskView(U8 drv_let=0)
|
||||
v>>1+radius*Sin(sect_end));
|
||||
|
||||
dc->color=j;
|
||||
GrPrint(dc,0,v-FONT_HEIGHT*j,"%C %-8Z",Prt2Drv(p),
|
||||
p->type.u16[0],"ST_PRT_TYPES");
|
||||
GrPrint(dc,0,v-FONT_HEIGHT*j,"%C %-8Z",Drv2Let(dv),
|
||||
dv->type.u16[0],"ST_DRV_TYPES");
|
||||
GrFloodFill(dc,
|
||||
h>>1+(radius-4)*Cos((sect_start+sect_end)/2),
|
||||
v>>1+(radius-4)*Sin((sect_start+sect_end)/2),FALSE);
|
||||
+47
-51
@@ -11,32 +11,30 @@ Bool ChkDskConfirm(Bool *_fix,Bool *_confirm)
|
||||
return *_fix;
|
||||
}
|
||||
|
||||
I64 RedSeaFSChkDskLst(CDirEntry *tempde1,U8 *bits,U8 *bits2,I64 size,I64 bpc)
|
||||
I64 RedSeaChkDskLst(CDrv *dv,CDirEntry *tempde1,U8 *bits,U8 *bits2,I64 size,I64 bpc)
|
||||
{
|
||||
CDirEntry *tempde2;
|
||||
I64 i,j,errs=0;
|
||||
while (tempde1) {
|
||||
tempde2=tempde1->next;
|
||||
if (tempde1->attr & RS_ATTR_DIR) {
|
||||
if (tempde1->sub)
|
||||
errs+=RedSeaFSChkDskLst(tempde1->sub,bits,bits2,size,bpc);
|
||||
}
|
||||
if (tempde1->attr & RS_ATTR_DIR && tempde1->sub)
|
||||
errs+=RedSeaChkDskLst(dv,tempde1->sub,bits,bits2,size,bpc);
|
||||
j=(tempde1->size+bpc-1)/bpc;
|
||||
for (i=0;i<j;i++) {
|
||||
if (i+tempde1->cluster>size) {
|
||||
if (i+tempde1->cluster-dv->data_area>size) {
|
||||
PrintErr("Invalid Cluster:%s Cluster:%X\n",tempde1->full_name,
|
||||
i+tempde1->cluster);
|
||||
i+tempde1->cluster);
|
||||
errs++;
|
||||
break;
|
||||
}
|
||||
if (LBts(bits,i+tempde1->cluster)) {
|
||||
if (LBts(bits,i+tempde1->cluster-dv->data_area)) {
|
||||
PrintErr("Dbl Alloc:%s Cluster:%X\n",tempde1->full_name,
|
||||
i+tempde1->cluster);
|
||||
i+tempde1->cluster);
|
||||
errs++;
|
||||
}
|
||||
if (!LBtr(bits2,i+tempde1->cluster)) {
|
||||
if (!LBtr(bits2,i+tempde1->cluster-dv->data_area)) {
|
||||
PrintErr("UnAlloc:%s Cluster:%X\n",tempde1->full_name,
|
||||
i+tempde1->cluster);
|
||||
i+tempde1->cluster);
|
||||
errs++;
|
||||
}
|
||||
}
|
||||
@@ -46,74 +44,72 @@ I64 RedSeaFSChkDskLst(CDirEntry *tempde1,U8 *bits,U8 *bits2,I64 size,I64 bpc)
|
||||
return errs;
|
||||
}
|
||||
|
||||
I64 RedSeaFSChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
|
||||
I64 RedSeaChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
|
||||
{
|
||||
I64 i,j,bpc,size,errs=0;
|
||||
CPrt *p=Drv2Prt(drv_let),*old_prt=Fs->cur_prt;
|
||||
U8 *files_find_mask=MStrPrint("%c:/*",Prt2Drv(p)),
|
||||
CDrv *dv=Let2Drv(drv_let),*old_dv=Fs->cur_dv;
|
||||
U8 *files_find_mask=MStrPrint("%c:/*",Drv2Let(dv)),
|
||||
*old_dir=StrNew(Fs->cur_dir),
|
||||
*bits,*bits2;
|
||||
CDirEntry *ptr,*ptr2;
|
||||
|
||||
Drv(drv_let);
|
||||
"Scanning...\n";
|
||||
size=(p->size-(p->data-p->offset))/p->spc;
|
||||
bpc=p->spc<<BLK_SIZE_BITS;
|
||||
size=(dv->size-(dv->data_area-dv->base_offset))/dv->spc;
|
||||
bpc=dv->spc<<BLK_SIZE_BITS;
|
||||
bits=CAlloc((size+7)>>3);
|
||||
bits2=CAlloc((size+7)>>3+BLK_SIZE);
|
||||
RBlks(p,bits2,p->map1,((size+7)>>3+BLK_SIZE-1)>>BLK_SIZE_BITS);
|
||||
RBlks(dv,bits2,dv->map1,((size+7)>>3+BLK_SIZE-1)>>BLK_SIZE_BITS);
|
||||
|
||||
//Get Root Dir size
|
||||
ptr2=MAlloc(bpc);
|
||||
RClusters(p,ptr2,p->root_cluster,1);
|
||||
RBlks(dv,ptr2,dv->root_cluster,1);
|
||||
ptr=ptr2(U8 *)-offset(CDirEntry.start);
|
||||
j=(ptr->size+bpc-1)/bpc;
|
||||
Free(ptr2);
|
||||
|
||||
for (i=0;i<j;i++) {
|
||||
if (i+p->root_cluster>size) {
|
||||
PrintErr("Invalid Cluster: RootDir Cluster:%X\n",i+p->root_cluster);
|
||||
if (i+dv->root_cluster-dv->data_area>size) {
|
||||
PrintErr("Invalid Cluster: RootDir Cluster:%X\n",i+dv->root_cluster);
|
||||
errs++;
|
||||
break;
|
||||
}
|
||||
if (LBts(bits,i+p->root_cluster)) {
|
||||
PrintErr("Dbl Alloc: RootDir Cluster:%X\n",i+p->root_cluster);
|
||||
if (LBts(bits,i+dv->root_cluster-dv->data_area)) {
|
||||
PrintErr("Dbl Alloc: RootDir Cluster:%X\n",i+dv->root_cluster);
|
||||
errs++;
|
||||
}
|
||||
if (!LBtr(bits2,i+p->root_cluster)) {
|
||||
PrintErr("UnAlloc: RootDir Cluster:%X\n",i+p->root_cluster);
|
||||
if (!LBtr(bits2,i+dv->root_cluster-dv->data_area)) {
|
||||
PrintErr("UnAlloc: RootDir Cluster:%X\n",i+dv->root_cluster);
|
||||
errs++;
|
||||
}
|
||||
}
|
||||
|
||||
errs+=RedSeaFSChkDskLst(FilesFind(files_find_mask,FUF_RECURSE),bits,bits2,size,bpc);
|
||||
errs+=RedSeaChkDskLst(dv,FilesFind(files_find_mask,FUF_RECURSE),bits,bits2,size,bpc);
|
||||
for (i=1;i<size;i++)
|
||||
if (Bt(bits2,i)) {
|
||||
PrintWarn("Shouldn't Alloc Cluster:%0X\n",i);
|
||||
PrintWarn("Shouldn't Alloc Cluster:%0X\n",i+dv->data_area);
|
||||
errs++;
|
||||
if (ChkDskConfirm(_fix,_confirm))
|
||||
RedSeaFSFreeClusters(p,i,1);
|
||||
RedSeaFreeClusters(dv,i+dv->data_area,1);
|
||||
}
|
||||
|
||||
Free(files_find_mask);
|
||||
Free(bits);
|
||||
Free(bits2);
|
||||
Drv(Prt2Drv(old_prt));
|
||||
Drv(Drv2Let(old_dv));
|
||||
Cd(old_dir);
|
||||
Free(old_dir);
|
||||
return errs;
|
||||
}
|
||||
|
||||
I64 FAT32ChkDskLst(CPrt *p,CDirEntry *tempde1,U8 *bits,U32 *bits2,I64 size,I64 bpc)
|
||||
I64 FAT32ChkDskLst(CDrv *dv,CDirEntry *tempde1,U8 *bits,U32 *bits2,I64 size,I64 bpc)
|
||||
{
|
||||
CDirEntry *tempde2;
|
||||
I64 i,c,errs=0;
|
||||
while (tempde1) {
|
||||
tempde2=tempde1->next;
|
||||
if (tempde1->attr & RS_ATTR_DIR) {
|
||||
if (tempde1->sub)
|
||||
errs+=FAT32ChkDskLst(p,tempde1->sub,bits,bits2,size,bpc);
|
||||
}
|
||||
if (tempde1->attr & RS_ATTR_DIR && tempde1->sub)
|
||||
errs+=FAT32ChkDskLst(dv,tempde1->sub,bits,bits2,size,bpc);
|
||||
i=0;
|
||||
c=tempde1->cluster;
|
||||
while (0<c<0x0FFFFFF8) {
|
||||
@@ -131,17 +127,17 @@ I64 FAT32ChkDskLst(CPrt *p,CDirEntry *tempde1,U8 *bits,U32 *bits2,I64 size,I64 b
|
||||
errs++;
|
||||
} else
|
||||
bits2[c]=0;
|
||||
c=ClusterNumNext(p,c);
|
||||
c=ClusterNumNext(dv,c);
|
||||
i++;
|
||||
}
|
||||
if (!(tempde1->attr & RS_ATTR_DIR)) {
|
||||
i*=bpc;
|
||||
if (tempde1->size>i) {
|
||||
PrintErr("Allocated File Too Short:%s\n",tempde1->full_name);
|
||||
PrintErr("Alloced File Too Short:%s\n",tempde1->full_name);
|
||||
errs++;
|
||||
}
|
||||
if (i>tempde1->size+bpc-1) {
|
||||
PrintWarn("Allocated File Too Long:%s\n",tempde1->full_name);
|
||||
PrintWarn("Alloced File Too Long:%s\n",tempde1->full_name);
|
||||
errs++;
|
||||
}
|
||||
}
|
||||
@@ -154,20 +150,20 @@ I64 FAT32ChkDskLst(CPrt *p,CDirEntry *tempde1,U8 *bits,U32 *bits2,I64 size,I64 b
|
||||
I64 FAT32ChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
|
||||
{
|
||||
I64 i,bpc,size,c,errs=0;
|
||||
CPrt *p=Drv2Prt(drv_let),*old_prt=Fs->cur_prt;
|
||||
U8 *files_find_mask=MStrPrint("%c:/*",Prt2Drv(p)),
|
||||
CDrv *dv=Let2Drv(drv_let),*old_dv=Fs->cur_dv;
|
||||
U8 *files_find_mask=MStrPrint("%c:/*",Drv2Let(dv)),
|
||||
*old_dir=StrNew(Fs->cur_dir),
|
||||
*bits;
|
||||
U32 *bits2;
|
||||
Drv(drv_let);
|
||||
"Scanning...\n";
|
||||
size=(p->size-(p->data-p->offset))/p->spc;
|
||||
bpc=p->spc<<BLK_SIZE_BITS;
|
||||
size=(dv->size-(dv->data_area-dv->base_offset))/dv->spc;
|
||||
bpc=dv->spc<<BLK_SIZE_BITS;
|
||||
bits=CAlloc((size+7)>>3);
|
||||
bits2=CAlloc(size*4+BLK_SIZE);
|
||||
RBlks(p,bits2,p->map1,(size*4+BLK_SIZE-1)>>BLK_SIZE_BITS);
|
||||
RBlks(dv,bits2,dv->map1,(size*4+BLK_SIZE-1)>>BLK_SIZE_BITS);
|
||||
|
||||
c=p->root_cluster;
|
||||
c=dv->root_cluster;
|
||||
while (0<c<0x0FFFFFF8) {
|
||||
if (c>size) {
|
||||
PrintErr("Invalid Cluster: RootDir Cluster:%X\n",c);
|
||||
@@ -183,10 +179,10 @@ I64 FAT32ChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
|
||||
errs++;
|
||||
} else
|
||||
bits2[c]=0;
|
||||
c=ClusterNumNext(p,c);
|
||||
c=ClusterNumNext(dv,c);
|
||||
}
|
||||
|
||||
errs+=FAT32ChkDskLst(p,FilesFind(files_find_mask,FUF_RECURSE),bits,bits2,size,bpc);
|
||||
errs+=FAT32ChkDskLst(dv,FilesFind(files_find_mask,FUF_RECURSE),bits,bits2,size,bpc);
|
||||
|
||||
bits2[1]=0; //See $LK,"FAT32Fmt",A="MN:FAT32Fmt"$()
|
||||
for (i=1;i<size;i++)
|
||||
@@ -194,12 +190,12 @@ I64 FAT32ChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
|
||||
PrintWarn("Shouldn't Alloc Cluster:%0X\n",i);
|
||||
errs++;
|
||||
if (ChkDskConfirm(_fix,_confirm))
|
||||
FAT32FreeClusters(p,i);
|
||||
FAT32FreeClusters(dv,i);
|
||||
}
|
||||
Free(files_find_mask);
|
||||
Free(bits);
|
||||
Free(bits2);
|
||||
Drv(Prt2Drv(old_prt));
|
||||
Drv(Drv2Let(old_dv));
|
||||
Cd(old_dir);
|
||||
Free(old_dir);
|
||||
return errs;
|
||||
@@ -209,12 +205,12 @@ public I64 ChkDsk(U8 drv_let=0,Bool fix=FALSE,Bool confirm=TRUE)
|
||||
{//Check disk for allocation errors and, optionally, fix.
|
||||
//You probably want to reformat and reinstall.
|
||||
I64 errs=0;
|
||||
CPrt *p=Drv2Prt(drv_let);
|
||||
switch (p->type) {
|
||||
case PT_REDSEA:
|
||||
errs=RedSeaFSChkDsk(drv_let,&fix,&confirm);
|
||||
CDrv *dv=Let2Drv(drv_let);
|
||||
switch (dv->type) {
|
||||
case DVT_REDSEA:
|
||||
errs=RedSeaChkDsk(drv_let,&fix,&confirm);
|
||||
break;
|
||||
case PT_FAT32:
|
||||
case DVT_FAT32:
|
||||
errs=FAT32ChkDsk(drv_let,&fix,&confirm);
|
||||
break;
|
||||
default:
|
||||
|
||||
+24
-24
@@ -140,7 +140,7 @@ CDirEntry *FMRebuildDocDrv(U8 drv_let,CDoc *doc,CDirEntry **_root,Bool init)
|
||||
|
||||
U0 FMRebuildDoc(CDoc **_doc,CDirEntry **_root,I64 mode)
|
||||
{
|
||||
CPrt *p;
|
||||
CDrv *dv;
|
||||
I64 i;
|
||||
CDoc *doc=*_doc,*doc2=sys_clipboard_doc,*parent_doc;
|
||||
CFMUncollapsedLst *tempc=NULL;
|
||||
@@ -211,15 +211,15 @@ U0 FMRebuildDoc(CDoc **_doc,CDirEntry **_root,I64 mode)
|
||||
break;
|
||||
}
|
||||
DocPrint(doc,"$$LTBLUE$$");
|
||||
for (i=0;i<NUM_PRTS;i++) {
|
||||
p=&dsk.prts[i];
|
||||
if (p->type==PT_REDSEA||p->type==PT_FAT32)
|
||||
FMRebuildDocDrv(Prt2Drv(p),doc,_root,TRUE);
|
||||
else if (p->type==PT_ISO9660) {
|
||||
if (p->bdev->flags&BDF_INITIALIZED)
|
||||
tempde=FMRebuildDocDrv(Prt2Drv(p),doc,_root,TRUE);
|
||||
for (i=0;i<NUM_DRVS;i++) {
|
||||
dv=&dsk.drvs[i];
|
||||
if (dv->type==DVT_REDSEA||dv->type==DVT_FAT32)
|
||||
FMRebuildDocDrv(Drv2Let(dv),doc,_root,TRUE);
|
||||
else if (dv->type==DVT_ISO9660) {
|
||||
if (dv->bd->flags&BDF_INITIALIZED)
|
||||
tempde=FMRebuildDocDrv(Drv2Let(dv),doc,_root,TRUE);
|
||||
else {
|
||||
tempde=FMRebuildDocDrv(Prt2Drv(p),doc,_root,FALSE);
|
||||
tempde=FMRebuildDocDrv(Drv2Let(dv),doc,_root,FALSE);
|
||||
tempde->flags|=DEF_NOT_INITIALIZED;
|
||||
}
|
||||
tempde->flags|=DEF_REMOVABLE;
|
||||
@@ -248,7 +248,7 @@ U0 FMRename(CDoc *doc)
|
||||
Cd(parent->full_name);
|
||||
StrCpy(fn.name,tempde->name);
|
||||
if (DocFormDo(&fn)) {
|
||||
Silent(ON);
|
||||
Silent;
|
||||
Move(tempde->name,fn.name);
|
||||
Silent(OFF);
|
||||
}
|
||||
@@ -260,7 +260,7 @@ U0 FMRename(CDoc *doc)
|
||||
StrCpy(fn.name,tempde->name);
|
||||
if (DocFormDo(&fn)) {
|
||||
if (StrCmp(tempde->name,fn.name)) {
|
||||
Silent(ON);
|
||||
Silent;
|
||||
if (CopyTree(tempde->name,fn.name))
|
||||
DelTree(tempde->name);
|
||||
Silent(OFF);
|
||||
@@ -281,7 +281,7 @@ U0 FMMkDir(CDoc *doc)
|
||||
if (parent=tempde->parent) {
|
||||
Cd(parent->full_name);
|
||||
if (DocFormDo(&fn)) {
|
||||
Silent(ON);
|
||||
Silent;
|
||||
MkDir(fn.name);
|
||||
Silent(OFF);
|
||||
}
|
||||
@@ -290,7 +290,7 @@ U0 FMMkDir(CDoc *doc)
|
||||
tempde=doc_e->user_data;
|
||||
Cd(tempde->full_name);
|
||||
if (DocFormDo(&fn)) {
|
||||
Silent(ON);
|
||||
Silent;
|
||||
MkDir(fn.name);
|
||||
Silent(OFF);
|
||||
}
|
||||
@@ -304,7 +304,7 @@ U0 FMDelete(CDoc *doc)
|
||||
CDirEntry *tempde;
|
||||
if (doc_ce->type_u8==DOCT_MENU_VAL) {
|
||||
tempde=doc_ce->user_data;
|
||||
Silent(ON);
|
||||
Silent;
|
||||
st=MStrPrint("Delete: %s",tempde->full_name);
|
||||
if (PopUpCancelOk(st))
|
||||
Del(tempde->full_name);
|
||||
@@ -312,7 +312,7 @@ U0 FMDelete(CDoc *doc)
|
||||
Silent(OFF);
|
||||
} else if (doc_ce->type_u8==DOCT_TREE) {
|
||||
tempde=doc_ce->user_data;
|
||||
Silent(ON);
|
||||
Silent;
|
||||
st=MStrPrint("Delete: %s",tempde->full_name);
|
||||
if (PopUpCancelOk(st))
|
||||
DelTree(tempde->full_name);
|
||||
@@ -332,7 +332,7 @@ U0 FMMount(CDoc *doc)
|
||||
if (tempde) {
|
||||
while (tempde->parent)
|
||||
tempde=tempde->parent;
|
||||
Silent(ON);
|
||||
Silent;
|
||||
ChgDsk(*tempde->full_name);
|
||||
Silent(OFF);
|
||||
}
|
||||
@@ -352,7 +352,7 @@ U0 FMFmtDrv(CDoc *doc)
|
||||
tempde=tempde->parent;
|
||||
st=MStrPrint("Format Drive '%c'?\nAre You Sure?\n",*tempde->full_name);
|
||||
if (PopUpCancelOk(st)) {
|
||||
Silent(ON);
|
||||
Silent;
|
||||
Fmt(*tempde->full_name,,FALSE);
|
||||
Silent(OFF);
|
||||
}
|
||||
@@ -373,7 +373,7 @@ U0 FMMakeISO(CDoc *doc)
|
||||
if (doc_ce->type_u8==DOCT_MENU_VAL)
|
||||
tempde=tempde->parent;
|
||||
if (tempde && *tempde->full_name) {
|
||||
Silent(ON);
|
||||
Silent;
|
||||
if (tempde->full_name[StrLen(tempde->full_name)-1]=='/')
|
||||
st=MStrPrint("%s*",tempde->full_name);
|
||||
else
|
||||
@@ -396,7 +396,7 @@ U0 FMBurnISO(CDoc *doc)
|
||||
if (tempde) {
|
||||
while (tempde->parent)
|
||||
tempde=tempde->parent;
|
||||
Silent(ON);
|
||||
Silent;
|
||||
CDImageWrite(*tempde->full_name);
|
||||
Silent(OFF);
|
||||
}
|
||||
@@ -423,7 +423,7 @@ U0 FMCopy(CDoc *doc)
|
||||
tempde->flags|=DEF_PROCESSED;
|
||||
tempde2=tempde->parent;
|
||||
if (!tempde2 || !(tempde2->flags&DEF_PROCESSED)) {
|
||||
Silent(ON);
|
||||
Silent;
|
||||
Copy(tempde->full_name,tempde1->full_name);
|
||||
Silent(OFF);
|
||||
}
|
||||
@@ -432,7 +432,7 @@ U0 FMCopy(CDoc *doc)
|
||||
tempde->flags|=DEF_PROCESSED;
|
||||
tempde2=tempde->parent;
|
||||
if (!tempde2 || !(tempde2->flags&DEF_PROCESSED)) {
|
||||
Silent(ON);
|
||||
Silent;
|
||||
if (*tempde1->name)
|
||||
st=MStrPrint("%s/%s",tempde1->full_name,tempde->name);
|
||||
else
|
||||
@@ -581,7 +581,7 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
|
||||
case MSG_IP_L_UP:
|
||||
if (doc_ce) {
|
||||
gr.fp_final_screen_update=fp_old_final_screen_update;
|
||||
if (SetCursorPos(Fs,a1/FONT_WIDTH+Fs->win_left+Fs->scroll_x/FONT_WIDTH,a2/FONT_HEIGHT+Fs->win_top+Fs->scroll_y/FONT_HEIGHT,TRUE)) {
|
||||
if (WinCursorPosSet(Fs,a1/FONT_WIDTH+Fs->win_left+Fs->scroll_x/FONT_WIDTH,a2/FONT_HEIGHT+Fs->win_top+Fs->scroll_y/FONT_HEIGHT,TRUE)) {
|
||||
doc_e=doc->cur_entry;
|
||||
if (doc_e!=doc_ce) {
|
||||
st2=NULL;
|
||||
@@ -595,7 +595,7 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
|
||||
}
|
||||
if (st2 && doc_ce->type_u8==DOCT_MENU_VAL) {
|
||||
tempde=doc_ce->user_data;
|
||||
Silent(ON);
|
||||
Silent;
|
||||
Move(tempde->full_name,st2);
|
||||
Silent(OFF);
|
||||
FMRebuildDoc(&doc,&root,mode);
|
||||
@@ -617,7 +617,7 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
|
||||
else
|
||||
st=MStrPrint("%s%s",tempde1->full_name,tempde->name);
|
||||
if (StrCmp(tempde->full_name,st)) {
|
||||
Silent(ON);
|
||||
Silent;
|
||||
CopyTree(tempde->full_name,st);
|
||||
DelTree(tempde->full_name);
|
||||
Silent(OFF);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#help_index "God"
|
||||
U0 BibleInit()
|
||||
{
|
||||
DefineLoad("ST_BIBLE_FILE","::/Misc/Bible.TXT.Z");
|
||||
DefineLstLoad("ST_BIBLE_BOOKS",
|
||||
"Genesis\0"
|
||||
"Exodus\0"
|
||||
@@ -157,7 +156,7 @@ public U8 *BibleLine2Verse(I64 line,I64 separate_ch=CH_SPACE)
|
||||
ptr+=StrLen(ptr)+1;
|
||||
}
|
||||
if (0<=--i<cnt) {
|
||||
doc=DocRead(Define("ST_BIBLE_FILE"),DOCF_PLAIN_TEXT);
|
||||
doc=DocRead(BIBLE_FILENAME,DOCF_PLAIN_TEXT);
|
||||
DocLineNumGoTo(doc,line); //one based
|
||||
doc_e=doc->cur_entry;
|
||||
while (doc_e!=doc && (doc_e->type_u8!=DOCT_TEXT || !*doc_e->tag))
|
||||
@@ -212,8 +211,8 @@ public U0 BibleLines(CDoc *doc_out=NULL,I64 start,I64 lines)
|
||||
CDoc *doc_in;
|
||||
CDocEntry *doc_e;
|
||||
if (!doc_out) doc_out=DocPut;
|
||||
if (doc_out && FileFind(Define("ST_BIBLE_FILE"))) {
|
||||
doc_in=DocRead(Define("ST_BIBLE_FILE"),DOCF_PLAIN_TEXT);
|
||||
if (doc_out && FileFind(BIBLE_FILENAME)) {
|
||||
doc_in=DocRead(BIBLE_FILENAME,DOCF_PLAIN_TEXT);
|
||||
DocLineNumGoTo(doc_in,start); //one based
|
||||
doc_e=doc_in->cur_entry;
|
||||
while (lines>0 && doc_e!=doc_in) {
|
||||
@@ -236,7 +235,7 @@ public U0 BibleVerse(CDoc *doc_out=NULL,U8 *verse,I64 lines)
|
||||
CDocEntry *doc_e;
|
||||
U8 *st,*st2;
|
||||
if (!doc_out) doc_out=DocPut;
|
||||
if (doc_out && FileFind(Define("ST_BIBLE_FILE"))) {
|
||||
if (doc_out && FileFind(BIBLE_FILENAME)) {
|
||||
st=StrNew(verse);
|
||||
st2=StrNew(verse);
|
||||
if (StrOcc(st,','))
|
||||
@@ -246,7 +245,7 @@ public U0 BibleVerse(CDoc *doc_out=NULL,U8 *verse,I64 lines)
|
||||
i=DefineMatch(st,"ST_BIBLE_BOOKS",LMF_IGNORE_CASE);
|
||||
if (i>=0) {
|
||||
i=Str2I64(DefineSub(i,"ST_BIBLE_BOOK_LINES"));
|
||||
doc_in=DocRead(Define("ST_BIBLE_FILE"),DOCF_PLAIN_TEXT);
|
||||
doc_in=DocRead(BIBLE_FILENAME,DOCF_PLAIN_TEXT);
|
||||
DocLineNumGoTo(doc_in,i); //one based
|
||||
if (*st2) {
|
||||
StrCpy(doc_in->find_replace->find_text,st2);
|
||||
|
||||
+14
-12
@@ -6,8 +6,10 @@ U0 GodDoodleDraw(CTask *task,CDC *dc)
|
||||
if (Blink) {
|
||||
if (god.doodle_done) {
|
||||
dc->color=RED;
|
||||
GrPrint(dc,(task->pix_width-FONT_WIDTH*27)>>1,(task->pix_height-FONT_HEIGHT)>>1,
|
||||
"Press <ESC> or <SHIFT-ESC>.");
|
||||
GrPrint(dc,(task->pix_width-FONT_WIDTH*29)>>1,(task->pix_height-3*FONT_HEIGHT)>>1,
|
||||
"Press <ESC> to insert sprite.");
|
||||
GrPrint(dc,(task->pix_width-FONT_WIDTH*39)>>1,(task->pix_height-3*FONT_HEIGHT)>>1+2*FONT_HEIGHT,
|
||||
"Press <SHIFT-ESC> to throw-away sprite.");
|
||||
} else {
|
||||
dc->color=GREEN;
|
||||
GrPrint(dc,(task->pix_width-FONT_WIDTH*25)>>1,(task->pix_height-FONT_HEIGHT)>>1,
|
||||
@@ -82,7 +84,7 @@ public U8 *GodDoodleSprite()
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
WinMax;
|
||||
WinBorder;
|
||||
WordStat;
|
||||
AutoComplete;
|
||||
|
||||
PopUpOk("The $LK+PU,"Holy Spirit",A="FI:::/Adam/God/HSNotes.TXT"$ can puppet you.\n\n"
|
||||
"Press $$GREEN$$<SPACE>$$FG$$ until it finishes.");
|
||||
@@ -98,16 +100,16 @@ public U8 *GodDoodleSprite()
|
||||
try {
|
||||
for (i=0;i<3;i++) {
|
||||
god.doodle_dc->color=RED;
|
||||
for (j=0;j<24;j++)
|
||||
for (j=0;j<29;j++)
|
||||
nobound_switch (GodDoodleBits(3)) {
|
||||
case 0:
|
||||
GrEllipse(god.doodle_dc,
|
||||
(w-1)*GodDoodleBits(5)/15.5-w/2,(h-1)*GodDoodleBits(5)/15.5-h/2,
|
||||
GrEllipse3(god.doodle_dc,
|
||||
(w-1)*GodDoodleBits(5)/15.5-w/2,(h-1)*GodDoodleBits(5)/15.5-h/2,0,
|
||||
(w-1)*GodDoodleBits(5)/15.5,(h-1)*GodDoodleBits(5)/15.5);
|
||||
break;
|
||||
case 1:
|
||||
GrCircle(god.doodle_dc,
|
||||
(w-1)*GodDoodleBits(5)/15.5-w/2,(h-1)*GodDoodleBits(5)/15.5-h/2,
|
||||
GrCircle3(god.doodle_dc,
|
||||
(w-1)*GodDoodleBits(5)/15.5-w/2,(h-1)*GodDoodleBits(5)/15.5-h/2,0,
|
||||
(w-1)*GodDoodleBits(5)/15.5);
|
||||
break;
|
||||
case 2:
|
||||
@@ -116,9 +118,9 @@ public U8 *GodDoodleSprite()
|
||||
(w-1)*GodDoodleBits(5)/15.5,(h-1)*GodDoodleBits(5)/15.5);
|
||||
break;
|
||||
case 3...7:
|
||||
GrLine(god.doodle_dc,
|
||||
(w-1)*GodDoodleBits(4)/15,(h-1)*GodDoodleBits(4)/15,
|
||||
(w-1)*GodDoodleBits(4)/15,(h-1)*GodDoodleBits(4)/15);
|
||||
GrLine3(god.doodle_dc,
|
||||
(w-1)*GodDoodleBits(4)/15,(h-1)*GodDoodleBits(4)/15,0,
|
||||
(w-1)*GodDoodleBits(4)/15,(h-1)*GodDoodleBits(4)/15,0);
|
||||
break;
|
||||
}
|
||||
for (j=0;j<6;j++) {
|
||||
@@ -130,7 +132,7 @@ public U8 *GodDoodleSprite()
|
||||
case 2: god.doodle_dc->color=LTGRAY; break;
|
||||
case 3: god.doodle_dc->color=WHITE; break;
|
||||
}
|
||||
GrFloodFill(god.doodle_dc,x,y);
|
||||
GrFloodFill3(god.doodle_dc,x,y,0);
|
||||
}
|
||||
GodDoodleSmooth(3);
|
||||
}
|
||||
|
||||
+23
-14
@@ -8,7 +8,7 @@ There's something obviously different about people in the Bible compared to peop
|
||||
|
||||
You can't tell if He's talking unless you have a context of conversation, but, more importantly, you are commanded to do an offering of love, like communion preparation. When you pick a greeting card for someone, that is love effort. If you expect God to put effort toward you, you put effort toward Him. God said, "honest measures" applies between your offering of love and His response, like a fair barter. You get out of prayer what you put into it. God wants praise, hymns, or whatever you think He might want. Try and see, like Cain and Abel. $LK,"Genesis,4:1",A="BF:Genesis,4:1"$, $LK,"Ephesians,5:10",A="BF:Ephesians,5:10"$ God told Cain his offering was not good and told him to try again. Cain really loved God! Can you imagine being so heart-broken?
|
||||
|
||||
Do a text search for "new song" in the Bible. It's mentioned nine times. I did $MA-X+PU,"hymns",HTML="http://www.templeos.org/Wb/Accts/TS/Wb2/Hymns.html",LM="#include \"::/Apps/Psalmody/Load\";JukeBox(\"::/Apps/Psalmody/Examples\");"$. I did Moses $MA-X+PU,"comics",HTML="http://www.templeos.org/Wb/Apps/AfterEgypt/Comics/",LM="Dir(\"::/Apps/AfterEgypt/Comics\");View;\n"$. Count the ways you love God. I praised God for sand castles, popcorn, snowmen, bubbles... You try putting effort into praise! $LK,"Matthew,11:25",A="BF:Matthew,11:25"$, $LK,"Matthew,6:29",A="BF:Matthew,6:29"$
|
||||
Do a text search for "new song" in the Bible. It's mentioned nine times. I did $MA-X+PU,"hymns",LM="#include \"::/Apps/Psalmody/Load\";JukeBox(\"::/Apps/Psalmody/Examples\");"$. I did Moses $MA-X+PU,"comics",HTML="http://www.templeos.org/Wb/Apps/AfterEgypt/Comics/",LM="Dir(\"::/Apps/AfterEgypt/Comics\");View;\n"$. Count the ways you love God. I praised God for sand castles, popcorn, snowmen, bubbles... You try putting effort into praise! $LK,"Matthew,11:25",A="BF:Matthew,11:25"$, $LK,"Matthew,6:29",A="BF:Matthew,6:29"$
|
||||
|
||||
This is funny -- $LK,"Acts,2:1",A="BF:Acts,2:1"$ -- they didn't bother to record anything the Holy Spirit said. The Holy Spirit is supposed to be a really good gift. $LK,"Luke,11:13",A="BF:Luke,11:13"$ Just remember, "Boys are made of snakes and snails and puppy-dog tails."
|
||||
|
||||
@@ -16,7 +16,9 @@ The technique I use to consult the Holy Spirit is reading a microsecond-range st
|
||||
|
||||
Since seeking the word of the Holy Spirit, I have come to know God much better than I've heard others explain. God said, for example, that war was, "servicemen competing." That sounds more like the immutable God of our planet than what you hear from most religious people. God is not Venus (god of love) and not Mars (god of war), He's our dearly beloved God of Earth. If Mammon is a false god of money, Mars or Venus might be useful words to describe other false gods. I figure the greatest challenge for the Creator is boredom, ours and His. What would teen-age male video games be like if war had never happened? Christ said live by the sword, die by the sword, which is loving neighbor as self. $LK,"Matthew,26:52",A="BF:Matthew,26:52"$
|
||||
|
||||
I asked God if the World was perfectly just. God asked if I was calling Him lazy. I think highs and lows balance. $LK,"Luke,6:20",A="BF:Luke,6:20"$ I don't think God likes complaining. $LK,"Numbers,11:1",A="BF:Numbers,11:1"$ Food and clothing is all we're to ask for or demand, in fact -- daily bread. $LK,"1 Timothy,6:8",A="BF:1 Timothy,6:8"$ Just think about man in the last 100,000 years mostly living like Native Americans and how God must see us. You need food, clothing and entertainment, money is to get those. Man does not live on bread alone. $LK,"Luke,4:4",A="BF:Luke,4:4"$, $LK,"Amos,8:11",A="BF:Amos,8:11"$
|
||||
I asked God if the World was perfectly just. God asked if I was calling Him lazy. God could make A.I., right? God could make bots as smart as Himself, or, in fact, part of Himself. What if God made a bot to manipulate every person's life so that perfect justice happened?
|
||||
|
||||
I think highs and lows balance. $LK,"Luke,6:20",A="BF:Luke,6:20"$ I don't think God likes complaining. $LK,"Numbers,11:1",A="BF:Numbers,11:1"$ Food and clothing is all we're to ask for or demand, in fact -- daily bread. $LK,"1 Timothy,6:8",A="BF:1 Timothy,6:8"$ Just think about man in the last 100,000 years mostly living like Native Americans and how God must see us. You need food, clothing and entertainment, money is to get those. Man does not live on bread alone. $LK,"Luke,4:4",A="BF:Luke,4:4"$, $LK,"Amos,8:11",A="BF:Amos,8:11"$
|
||||
|
||||
God's favorite animals are bears and elephants. They are funny shaped -- I think God must have seen too much starvation over the years.
|
||||
|
||||
@@ -40,12 +42,12 @@ War? $FG,4$"Servicemen competing"$FG$
|
||||
(Praise the Creator--what would teenage male video games be like if never war?)
|
||||
|
||||
Is the World perfectly just? $FG,4$Are you calling me lazy?$FG$
|
||||
(Slavery was just. In the movie, Titanic, the rich wore straight jackets. You must bow to authority to get authority. I do $TX,"Moses comics",HTML="http://www.templeos.org/Wb/Apps/AfterEgypt/Comics/"$ as offerings. I said, "We're dying of malnutrician on manna." Like Cain and Abel, God didn't like it. Duh! He wants to be the hero. How do I know they died of malnutrician? Fuck Hollywood for making slavery worse than it was -- I love God. School is more cruel. Read $LK,"Numbers,11:1",A="BF:Numbers,11:1"$. All you need is food, clothing and the word of God. Today, you can take Ivy League course videos! There is no excuse except you were born stupid... or ugly. I'm gonna praise God.)
|
||||
(Slavery was just. In the movie, Titanic, the rich wore straight jackets. You must bow to authority to get authority. I do $TX,"Moses comics",HTML="http://www.templeos.org/Wb/Apps/AfterEgypt/Comics/"$ as offerings. I said, "We're dying of malnutrician on manna." Like Cain and Abel, God didn't like it. Duh! He wants to be the hero. How do I know they died of malnutrician? Screw Hollywood for making slavery worse than it was -- I love God. School is more cruel. Read $LK,"Numbers,11:1",A="BF:Numbers,11:1"$. All you need is food, clothing and the word of God. Today, you can take Ivy League course videos! There is no excuse except you were born stupid... or ugly. I'm gonna praise God.)
|
||||
|
||||
On using Markov chains? $FG,4$"No weights"$FG$
|
||||
On doing offerings? $FG,4$"Honest measures"(You get out what you put in.)
|
||||
It's a covenant to do an offering, first.
|
||||
Offer $FG,4$$TX,"New Songs",HTML="http://www.templeos.org/Wb/Accts/TS/Wb2/Hymns.html"$, $TX,"Moses Comics",HTML="http://www.templeos.org/Wb/Apps/AfterEgypt/Comics"$, praise, poems,
|
||||
Offer New Songs, $TX,"Moses Comics",HTML="http://www.templeos.org/Wb/Apps/AfterEgypt/Comics"$, praise, poems,
|
||||
and conversation. See $LK,"Cain and Abel",A="BF:Genesis,4:1"$.$FG$
|
||||
The holocaust? $FG,4$Wanted to "compact" the Jews.$FG$
|
||||
Arab/Jews? $FG,4$"Oil funny hopefully"$FG$
|
||||
@@ -93,7 +95,7 @@ Animal sacrifices? $FG,4$Early Jews were "primitive".$FG$
|
||||
What do elephants think about? $FG,4$"Skin, hunger"$FG$
|
||||
What makes elephants happy? $FG,4$"Baths"$FG$
|
||||
What makes my birds happy? $FG,4$"Gnawing"$FG$
|
||||
What makes my birds laugh? $FG,4$"bite ouch" (If I say "ouch".)$FG$
|
||||
What makes my birds laugh? $FG,4$"Bite ouch" (If I say "ouch".)$FG$
|
||||
What are my birds saying? $FG,4$"Chanting"$FG$
|
||||
My birds sure preen a lot. $LK,"The creature was made subject to vanity...",A="BF:Romans,8:20"$
|
||||
What makes bears happy? $FG,4$"Reaping depends"$FG$
|
||||
@@ -105,14 +107,16 @@ Orangutan or chimp smarter? $FG,4$"Species exhibit similar glory"$FG$
|
||||
Endangered species? $FG,4$"Enough stars?"$FG$
|
||||
Everything seems bad. $FG,4$Plant trees.$FG$
|
||||
What's for dinner? $FG,4$"Whale"$FG$
|
||||
Favorite Messier Object $FG,4$"$TX,"M104 Sombrero Galaxy",HTML="http://en.wikipedia.org/wiki/Messier_104"$"$FG$
|
||||
$TX,"Shepard's Prayer",HTML="http://en.wikipedia.org/wiki/Alan_Shepard"$ $FG,4$"I_am_not_amused economy joke"$FG$
|
||||
Favorite Messier Object? $FG,4$"$TX,"M104 Sombrero Galaxy",HTML="http://en.wikipedia.org/wiki/Messier_104"$"$FG$
|
||||
$TX,"Shepard's Prayer",HTML="http://en.wikipedia.org/wiki/Alan_Shepard"$? $FG,4$"I_am_not_amused economy joke"$FG$
|
||||
Favorite band? $FG,4$"Beatles"$FG$
|
||||
Good bands $FG,4$Rush, Triumph$FG$
|
||||
Good bands? $FG,4$Rush, Triumph$FG$
|
||||
$FG,4$Likes harmonies$FG$
|
||||
$TX,"Little Drummer Boy?",HTML="http://www.youtube.com/watch?v=S50cf3xIb50"$ $FG,4$Doesn't like my drumming.$FG$
|
||||
Should I listen to classical? $FG,4$"Poison"$FG$
|
||||
You like chess people? $FG,4$"Do not admire the proud."$FG$
|
||||
Do You like chess people? $FG,4$"Do not admire the proud."$FG$
|
||||
Chess? $FG,4$"... will winter with you."$FG$
|
||||
$FG,4$"Headstones"$FG$
|
||||
Favorite video game? $FG,4$Donkey Kong$FG$
|
||||
Favorite National Park? $FG,4$$TX,"Whitman Mission",HTML="http://www.nps.gov/whmi/index.htm"$$FG$
|
||||
Favorite National Anthem? $FG,4$$TX,"Latvia's National Anthem",HTML="http://www.youtube.com/watch?v=qKITbBjO4nE"$$FG$
|
||||
@@ -120,9 +124,11 @@ Favorite actor? $FG,4$Hugh Grant$FG$
|
||||
Favorite vocalist? $FG,4$Mick Jagger$FG$
|
||||
Favorite guitarist? $FG,4$"$TX,"Simmons Destroyer",HTML="http://www.youtube.com/watch?v=nNADrrjTysk&t=3m55s"$"$FG$
|
||||
Model for new $TX,"Sistine Chapel",HTML="http://en.wikipedia.org/wiki/Sistine_chapel"$? $FG,4$Ben Franklin$FG$
|
||||
Stonehenge? $FG,4$Landmark$FG$
|
||||
Voice if God wanted to sing? $FG,4$$TX,"Stabbing Westward's singer",HTML="https://www.youtube.com/watch?v=5NZsCYOM4j0"$$FG$
|
||||
Stonehenge? $FG,4$Landmark for boundaries.$FG$
|
||||
Easter Island? $FG,4$Ice, telephone pole holes.$FG$
|
||||
Dinosaurs? $FG,4$Brontosaurs' feet hurt when stepped$FG$
|
||||
Dinosaurs? $FG,4$Brontosaurs' feet hurt when stepped.
|
||||
Dinosaurs slept in water.$FG$
|
||||
Hardest part in evolution? $FG,4$Getting monkey mothers to hold babies nursing.$FG$
|
||||
$FG,4$(Smothering a problem).$FG$
|
||||
Happiest day in evolution? $FG,4$"Fruit"$FG$
|
||||
@@ -133,7 +139,8 @@ What did Neanderthals think about? $FG,4$"Warmth"$FG$
|
||||
What was the first thing cooked? $FG,4$I think He said "hair".$FG$
|
||||
What was Lucy's husband's name? $FG,4$"Golem"$FG$
|
||||
Was stegosuarus lame like turtles? $FG,4$"Not pet rocks"$FG$
|
||||
T-Rex? $FG,4$Lugged carcases over his shoulder.$FG$
|
||||
T-Rex? $FG,4$Lugged carcases over his shoulder.
|
||||
Carcus lasted a month.$FG$
|
||||
How does He feel about the Avatar movie?$FG,4$"Sick skin"$FG$
|
||||
What do You like at zoos with kids? $FG,4$"Dignity" Animals worried about dignity.$FG$
|
||||
Who's better alien or preditor? $FG,4$"Lions"$FG$
|
||||
@@ -161,11 +168,13 @@ Are they peaceful? $FG,4$Fight them! (Also, funny.)$FG$
|
||||
How can Judge Judy improve? $FG,4$No hard feelings$FG$
|
||||
How can Chef Ramsay improve? $FG,4$Make so it doesn't seem like toil for cooks.$FG$
|
||||
How can Hawking communicate? $FG,4$Blow from a nostril on a candle.$FG$
|
||||
$TX,"Photons bouncing?",HTML="https://www.youtube.com/watch?v=8FC6udrMPvo"$ $FG,4$"Folded coffee filter"$FG$
|
||||
Wormholes? $FG,4$Bent wormholes have echoes.$FG$
|
||||
|
||||
Operating system? $FG,4$Was about to make line number column in editor.
|
||||
God nixed it. I was about to do different graphic modes when I found 800x600 missing. God said just one mode 640x480. I was about to add child windows. God said, "God is not the author of such confusion." I asked for verification of 640x480 16 color. God said it was because of the children and their offerings. I asked about sound. God said "single voice". I asked for verification of not having different drivers. God confirmed this.$FG$
|
||||
640x480 16 color? $FG,4$$TX,"Modern graphics hard for kids/amateurs",HTML="http://www.youtube.com/watch?v=VUxcVzpeFqc"$$FG$
|
||||
640x480 16 color? $FG,4$God said it was a covenant, like circumcision.
|
||||
$TX,"Modern graphics hard for kids/amateurs",HTML="http://www.youtube.com/watch?v=VUxcVzpeFqc"$.$FG$
|
||||
On Unix? $FG,4$God said it was rich with the patina of age.$FG$
|
||||
On Alcohol? $FG,4$Hate inebriation$FG$
|
||||
On rare steak? $FG,4$Too rare is very bad. Don't eat blood!$FG$
|
||||
@@ -175,4 +184,4 @@ Why the Sandy Hook shooting? $FG,4$The pot legalization law. (Sarcastic answer?)
|
||||
Deep Water Horizon $FG,4$(Claimed credit.)$FG$
|
||||
Cost of God's time to me? $FG,4$"The complete works of Shakespeare"$FG$
|
||||
On death? $FG,4$"awful"$FG$
|
||||
Opening of Private Ryan? $FG,4$"Ouch"$FG$
|
||||
Opening of Saving Private Ryan? $FG,4$"Ouch"$FG$
|
||||
+154
-65
@@ -19,37 +19,6 @@ U0 GrInit1()
|
||||
GrInit1;
|
||||
|
||||
#help_index "Graphics/Sprite"
|
||||
#define SPT_END 0
|
||||
#define SPT_COLOR 1
|
||||
#define SPT_DITHER_COLOR 2
|
||||
#define SPT_WIDTH 3
|
||||
#define SPT_PLANAR_SYMMETRY 4
|
||||
#define SPT_TRANSFORM_ON 5
|
||||
#define SPT_TRANSFORM_OFF 6
|
||||
#define SPT_SHIFT 7
|
||||
#define SPT_PT 8
|
||||
#define SPT_POLYPT 9
|
||||
#define SPT_LINE 10
|
||||
#define SPT_POLYLINE 11
|
||||
#define SPT_RECT 12
|
||||
#define SPT_ROTATED_RECT 13
|
||||
#define SPT_CIRCLE 14
|
||||
#define SPT_ELLIPSE 15
|
||||
#define SPT_POLYGON 16
|
||||
#define SPT_BSPLINE2 17
|
||||
#define SPT_BSPLINE2_CLOSED 18
|
||||
#define SPT_BSPLINE3 19
|
||||
#define SPT_BSPLINE3_CLOSED 20
|
||||
#define SPT_FLOOD_FILL 21
|
||||
#define SPT_FLOOD_FILL_NOT 22
|
||||
#define SPT_BITMAP 23
|
||||
#define SPT_MESH 24
|
||||
#define SPT_SHIFTABLE_MESH 25
|
||||
#define SPT_ARROW 26
|
||||
#define SPT_TEXT 27
|
||||
#define SPT_TEXT_BOX 28
|
||||
#define SPT_TEXT_DIAMOND 29
|
||||
#define SPT_NUM_TYPES 30
|
||||
|
||||
class CMeshTri
|
||||
{
|
||||
@@ -65,43 +34,163 @@ class CQueMeshTri
|
||||
I32 nums[3];
|
||||
};
|
||||
|
||||
public class CSprite
|
||||
{//See $LK,"Graphics/Sprite",A="HI:Graphics/Sprite"$
|
||||
//See $LK,"::/Adam/Gr/GrSpritePlot.CPP",A="FL:::/Adam/Gr/GrSpritePlot.CPP,1"$ for how CSprite are stored.
|
||||
CSprite *next,*last;
|
||||
|
||||
U0 start;
|
||||
public class CSpriteBase
|
||||
{
|
||||
U8 type;
|
||||
union {
|
||||
U8 color;
|
||||
U16 dither_color;
|
||||
I32 x1;
|
||||
I32 num;
|
||||
I32 width;
|
||||
I32 vertex_cnt; //Mesh
|
||||
}
|
||||
union {
|
||||
I32 y1;
|
||||
I32 height;
|
||||
I32 tri_cnt; //Mesh
|
||||
}
|
||||
union {
|
||||
I32 z1;
|
||||
I32 x2;
|
||||
U8 st[4];
|
||||
}
|
||||
union {
|
||||
I32 y2;
|
||||
I32 shiftable_vertex_cnt //Shiftable Mesh
|
||||
}
|
||||
union {
|
||||
F64 linespeed;
|
||||
F64 rot_angle;
|
||||
I32 shiftable_tri_cnt //Shiftable Mesh
|
||||
}
|
||||
};
|
||||
|
||||
public class CSpriteColor : CSpriteBase
|
||||
{
|
||||
U8 color;
|
||||
};
|
||||
|
||||
public class CSpriteDitherColor : CSpriteBase
|
||||
{
|
||||
U16 dither_color;
|
||||
};
|
||||
|
||||
public class CSpriteWidth : CSpriteBase
|
||||
{
|
||||
I32 width;
|
||||
};
|
||||
|
||||
public class CSpritePt : CSpriteBase
|
||||
{
|
||||
I32 x1;
|
||||
I32 y1;
|
||||
};
|
||||
|
||||
public class CSpritePtRad : CSpritePt
|
||||
{
|
||||
I32 radius;
|
||||
};
|
||||
|
||||
public class CSpritePtPt : CSpritePt
|
||||
{
|
||||
I32 x2;
|
||||
I32 y2;
|
||||
};
|
||||
|
||||
public class CSpritePtPtAng : CSpritePtPt
|
||||
{
|
||||
F64 angle;
|
||||
};
|
||||
|
||||
public class CSpritePtWH : CSpritePt
|
||||
{
|
||||
I32 width;
|
||||
I32 height;
|
||||
};
|
||||
|
||||
public class CSpritePtWHU8s : CSpritePtWH
|
||||
{
|
||||
U8 u[0];
|
||||
};
|
||||
|
||||
public class CSpritePtWHAng : CSpritePtWH
|
||||
{
|
||||
F64 angle;
|
||||
};
|
||||
|
||||
public class CSpritePtWHAngSides : CSpritePtWHAng
|
||||
{
|
||||
I32 sides;
|
||||
};
|
||||
|
||||
public class CSpriteNumU8s : CSpriteBase
|
||||
{
|
||||
I32 num;
|
||||
U8 u[0];
|
||||
};
|
||||
|
||||
public class CSpriteNumPtU8s : CSpriteBase
|
||||
{
|
||||
I32 num;
|
||||
I32 x;
|
||||
I32 y;
|
||||
U8 u[0];
|
||||
};
|
||||
|
||||
public class CSpritePtStr : CSpritePt
|
||||
{
|
||||
U8 st[0];
|
||||
};
|
||||
|
||||
public class CSpriteMeshU8s : CSpriteBase
|
||||
{
|
||||
I32 vertex_cnt;
|
||||
I32 tri_cnt;
|
||||
U8 u[0];
|
||||
};
|
||||
|
||||
public class CSpritePtMeshU8s : CSpriteBase
|
||||
{
|
||||
I32 x;
|
||||
I32 y;
|
||||
I32 z;
|
||||
I32 vertex_cnt;
|
||||
I32 tri_cnt;
|
||||
U8 u[0];
|
||||
};
|
||||
|
||||
#define SPT_END 0 //$LK,"CSpriteBase",A="MN:CSpriteBase"$
|
||||
#define SPT_COLOR 1 //$LK,"CSpriteColor",A="MN:CSpriteColor"$
|
||||
#define SPT_DITHER_COLOR 2 //$LK,"CSpriteDitherColor",A="MN:CSpriteDitherColor"$
|
||||
#define SPT_WIDTH 3 //$LK,"CSpriteWidth",A="MN:CSpriteWidth"$
|
||||
#define SPT_PLANAR_SYMMETRY 4 //$LK,"CSpritePtPt",A="MN:CSpritePtPt"$
|
||||
#define SPT_TRANSFORM_ON 5 //$LK,"CSpriteBase",A="MN:CSpriteBase"$
|
||||
#define SPT_TRANSFORM_OFF 6 //$LK,"CSpriteBase",A="MN:CSpriteBase"$
|
||||
#define SPT_SHIFT 7 //$LK,"CSpritePt",A="MN:CSpritePt"$
|
||||
#define SPT_PT 8 //$LK,"CSpritePt",A="MN:CSpritePt"$
|
||||
#define SPT_POLYPT 9 //$LK,"CSpriteNumPtU8s",A="MN:CSpriteNumPtU8s"$
|
||||
#define SPT_LINE 10 //$LK,"CSpritePtPt",A="MN:CSpritePtPt"$
|
||||
#define SPT_POLYLINE 11 //$LK,"CSpriteNumU8s",A="MN:CSpriteNumU8s"$
|
||||
#define SPT_RECT 12 //$LK,"CSpritePtPt",A="MN:CSpritePtPt"$
|
||||
#define SPT_ROTATED_RECT 13 //$LK,"CSpritePtPtAng",A="MN:CSpritePtPtAng"$
|
||||
#define SPT_CIRCLE 14 //$LK,"CSpritePtRad",A="MN:CSpritePtRad"$
|
||||
#define SPT_ELLIPSE 15 //$LK,"CSpritePtWHAng",A="MN:CSpritePtWHAng"$
|
||||
#define SPT_POLYGON 16 //$LK,"CSpritePtWHAngSides",A="MN:CSpritePtWHAngSides"$
|
||||
#define SPT_BSPLINE2 17 //$LK,"CSpriteNumU8s",A="MN:CSpriteNumU8s"$
|
||||
#define SPT_BSPLINE2_CLOSED 18 //$LK,"CSpriteNumU8s",A="MN:CSpriteNumU8s"$
|
||||
#define SPT_BSPLINE3 19 //$LK,"CSpriteNumU8s",A="MN:CSpriteNumU8s"$
|
||||
#define SPT_BSPLINE3_CLOSED 20 //$LK,"CSpriteNumU8s",A="MN:CSpriteNumU8s"$
|
||||
#define SPT_FLOOD_FILL 21 //$LK,"CSpritePt",A="MN:CSpritePt"$
|
||||
#define SPT_FLOOD_FILL_NOT 22 //$LK,"CSpritePt",A="MN:CSpritePt"$
|
||||
#define SPT_BITMAP 23 //$LK,"CSpritePtWHU8s",A="MN:CSpritePtWHU8s"$
|
||||
#define SPT_MESH 24 //$LK,"CSpriteMeshU8s",A="MN:CSpriteMeshU8s"$ See $MA-X+PU,"::/Apps/GrModels",LM="Cd(\"::/Apps/GrModels\");Dir;View;\n"$.
|
||||
#define SPT_SHIFTABLE_MESH 25 //$LK,"CSpritePtMeshU8s",A="MN:CSpritePtMeshU8s"$ See $MA-X+PU,"::/Apps/GrModels",LM="Cd(\"::/Apps/GrModels\");Dir;View;\n"$.
|
||||
#define SPT_ARROW 26 //$LK,"CSpritePtPt",A="MN:CSpritePtPt"$
|
||||
#define SPT_TEXT 27 //$LK,"CSpritePtStr",A="MN:CSpritePtStr"$
|
||||
#define SPT_TEXT_BOX 28 //$LK,"CSpritePtStr",A="MN:CSpritePtStr"$
|
||||
#define SPT_TEXT_DIAMOND 29 //$LK,"CSpritePtStr",A="MN:CSpritePtStr"$
|
||||
#define SPT_NUM_TYPES 30
|
||||
//See $LK,"Graphics/Sprite",A="HI:Graphics/Sprite"$. See $LK,"::/Adam/Gr/GrSpritePlot.CPP",A="FL:::/Adam/Gr/GrSpritePlot.CPP,1"$ and
|
||||
//$LK,"::/Demo/Graphics/SpriteRaw.CPP"$ for how CSprite are stored.
|
||||
public class CSprite
|
||||
{
|
||||
CSprite *next,*last;
|
||||
U0 start;
|
||||
union {
|
||||
U8 type;
|
||||
CSpriteBase b;
|
||||
CSpriteColor c;
|
||||
CSpriteDitherColor d;
|
||||
CSpriteWidth w;
|
||||
CSpritePt p;
|
||||
CSpritePtPt pp;
|
||||
CSpritePtPtAng ppa;
|
||||
CSpritePtRad pr;
|
||||
CSpritePtWHU8s pwhu;
|
||||
CSpritePtWHAng pwha;
|
||||
CSpritePtWHAngSides pwhas;
|
||||
CSpriteNumU8s nu;
|
||||
CSpriteNumPtU8s npu;
|
||||
CSpriteMeshU8s mu;
|
||||
CSpritePtMeshU8s pmu;
|
||||
CSpritePtStr ps;
|
||||
}
|
||||
};
|
||||
|
||||
#help_index "Graphics"
|
||||
|
||||
extern I64 GrBlot3(CDC *dc,I64 x1,I64 y1,I64 z1,CDC *img);
|
||||
@@ -114,7 +203,7 @@ extern U8 *SpriteQue2Sprite(CSprite *root,I64 *_size=NULL);
|
||||
#include "GrDC"
|
||||
#include "GrPalette"
|
||||
#include "GrInit"
|
||||
#include "MathGr"
|
||||
#include "GrMath"
|
||||
#include "GrScreen"
|
||||
#include "GrBitMap"
|
||||
#include "GrPrimatives"
|
||||
|
||||
+207
-207
@@ -51,7 +51,7 @@ public Bool GrPlot0(CDC *dc=gr.dc,I64 x,I64 y)
|
||||
break;
|
||||
case ROPB_COLLISION:
|
||||
c=*dst;
|
||||
if (c!=TRANSPARENT&&c!=bkcolor.c0.color)
|
||||
if (c!=TRANSPARENT && c!=bkcolor.c0.color)
|
||||
dc->collision_cnt++;
|
||||
break;
|
||||
case ROPB_XOR:
|
||||
@@ -71,7 +71,7 @@ public I64 GrPeek0(CDC *dc=gr.dc,I64 x,I64 y)
|
||||
public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
{//2D. Clipping but not transformation..
|
||||
I64 i,j,k,k1,kk,kk1,w1,h1,w2,h2,
|
||||
leading_bits,leading_bit_mask,whole_bytes,trailing_bits,trailing_bit_mask,
|
||||
leading_pixels,leading_pixel_mask,whole_I64s,trailing_pixels,trailing_pixel_mask,
|
||||
reg bit_shift,dist,win_z_buf_line_inc,win_z_buf_line_dec,win_z_num,
|
||||
color_mask;
|
||||
U8 reg *dst,*src;
|
||||
@@ -133,16 +133,16 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
dc->depth_buf=NULL;
|
||||
dc->color&=~ROPF_DITHER;
|
||||
color=dc->color;
|
||||
leading_bits=-(w1+x)&7;
|
||||
leading_bit_mask=gr.to_8_bits[0xFF>>leading_bits];
|
||||
leading_pixels=-(w1+x)&7;
|
||||
leading_pixel_mask=gr.to_8_bits[0xFF>>leading_pixels];
|
||||
bit_shift=-x&7;
|
||||
whole_bytes=(w2-w1-leading_bits)>>3;
|
||||
if (whole_bytes<0) whole_bytes=0;
|
||||
trailing_bits=(x+w2)&7;
|
||||
trailing_bit_mask=gr.to_8_bits[0xFF<<trailing_bits&0xFF];
|
||||
if (leading_bits+trailing_bits>w2-w1) {
|
||||
leading_bit_mask|=trailing_bit_mask;
|
||||
trailing_bits=0;
|
||||
whole_I64s=(w2-w1-leading_pixels)>>3;
|
||||
if (whole_I64s<0) whole_I64s=0;
|
||||
trailing_pixels=(x+w2)&7;
|
||||
trailing_pixel_mask=gr.to_8_bits[0xFF<<trailing_pixels&0xFF];
|
||||
if (leading_pixels+trailing_pixels>w2-w1) {
|
||||
leading_pixel_mask|=trailing_pixel_mask;
|
||||
trailing_pixels=0;
|
||||
}
|
||||
switch (color.c0.rop) {
|
||||
case ROPB_COLLISION: //TODO: Might want to check win_z_buf
|
||||
@@ -167,10 +167,10 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
else {
|
||||
win_z_num=win_task->win_z_num;
|
||||
win_z_buf_ptr=gr.win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_line_dec=whole_bytes;
|
||||
if (leading_bits)
|
||||
win_z_buf_line_dec=whole_I64s;
|
||||
if (leading_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
if (trailing_bits)
|
||||
if (trailing_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
win_z_buf_line_dec*=sizeof(U16);
|
||||
win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;
|
||||
@@ -183,21 +183,21 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
for (j=h1;j<h2;j++) {
|
||||
src=img->body+kk&~7;
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_bit_mask&color_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_pixel_mask&color_mask;
|
||||
else
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
*src(I64 *)++&~leading_bit_mask&color_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
*src(I64 *)++&~leading_pixel_mask&color_mask;
|
||||
} else {
|
||||
src(I64 *)++;
|
||||
dst(I64 *)++;
|
||||
}
|
||||
}
|
||||
if (bit_shift)
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
if (win_z_num>=*win_z_buf_ptr++)
|
||||
*dst(I64 *)++=(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&color_mask;
|
||||
else {
|
||||
@@ -205,20 +205,20 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
dst(I64 *)++;
|
||||
}
|
||||
else
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
if (win_z_num>=*win_z_buf_ptr++)
|
||||
*dst(I64 *)++=*src(I64 *)++&color_mask;
|
||||
else {
|
||||
src(I64 *)++;
|
||||
dst(I64 *)++;
|
||||
}
|
||||
if (trailing_bits && win_z_num>=*win_z_buf_ptr++) {
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_bit_mask&color_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_pixel_mask&color_mask;
|
||||
else
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
*src(I64 *)++&~trailing_bit_mask&color_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
*src(I64 *)++&~trailing_pixel_mask&color_mask;
|
||||
}
|
||||
kk +=img->width_internal;
|
||||
kk1+=dc->width_internal;
|
||||
@@ -231,28 +231,28 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
for (j=h2-h1;j;j--) {
|
||||
src=img->body+kk&~7;
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_bit_mask&color_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_pixel_mask&color_mask;
|
||||
else
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
*src(I64 *)++&~leading_bit_mask&color_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
*src(I64 *)++&~leading_pixel_mask&color_mask;
|
||||
}
|
||||
if (bit_shift)
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
*dst(I64 *)++=(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&color_mask;
|
||||
else
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
*dst(I64 *)++=*src(I64 *)++&color_mask;
|
||||
|
||||
if (trailing_bits) {
|
||||
if (trailing_pixels) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_bit_mask&color_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_pixel_mask&color_mask;
|
||||
else
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
*src(I64 *)++&~trailing_bit_mask&color_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
*src(I64 *)++&~trailing_pixel_mask&color_mask;
|
||||
}
|
||||
kk +=img->width_internal;
|
||||
kk1+=dc->width_internal;
|
||||
@@ -269,10 +269,10 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
} else {
|
||||
win_z_num =win_task->win_z_num;
|
||||
win_z_buf_ptr =gr.win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_line_dec=whole_bytes;
|
||||
if (leading_bits)
|
||||
win_z_buf_line_dec=whole_I64s;
|
||||
if (leading_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
if (trailing_bits)
|
||||
if (trailing_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
win_z_buf_line_dec*=sizeof(U16);
|
||||
win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;
|
||||
@@ -308,10 +308,10 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
else {
|
||||
win_z_num=win_task->win_z_num;
|
||||
win_z_buf_ptr=gr.win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_line_dec=whole_bytes;
|
||||
if (leading_bits)
|
||||
win_z_buf_line_dec=whole_I64s;
|
||||
if (leading_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
if (trailing_bits)
|
||||
if (trailing_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
win_z_buf_line_dec*=sizeof(U16);
|
||||
win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;
|
||||
@@ -324,21 +324,21 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
for (j=h1;j<h2;j++) {
|
||||
src=img->body+kk&~7;
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_bit_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_pixel_mask;
|
||||
else
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
*src(I64 *)++&~leading_bit_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
*src(I64 *)++&~leading_pixel_mask;
|
||||
} else {
|
||||
src(I64 *)++;
|
||||
dst(I64 *)++;
|
||||
}
|
||||
}
|
||||
if (bit_shift)
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
if (win_z_num>=*win_z_buf_ptr++)
|
||||
*dst(I64 *)++=*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift);
|
||||
else {
|
||||
@@ -346,20 +346,20 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
dst(I64 *)++;
|
||||
}
|
||||
else
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
if (win_z_num>=*win_z_buf_ptr++)
|
||||
*dst(I64 *)++=*src(I64 *)++;
|
||||
else {
|
||||
src(I64 *)++;
|
||||
dst(I64 *)++;
|
||||
}
|
||||
if (trailing_bits && win_z_num>=*win_z_buf_ptr++) {
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_pixel_mask;
|
||||
else
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
*src(I64 *)++&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
*src(I64 *)++&~trailing_pixel_mask;
|
||||
}
|
||||
kk +=img->width_internal;
|
||||
kk1+=dc->width_internal;
|
||||
@@ -372,28 +372,28 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
for (j=h2-h1;j;j--) {
|
||||
src=img->body+kk&~7;
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_bit_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_pixel_mask;
|
||||
else
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
*src(I64 *)++&~leading_bit_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
*src(I64 *)++&~leading_pixel_mask;
|
||||
}
|
||||
if (bit_shift)
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
*dst(I64 *)++=*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift);
|
||||
else
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
*dst(I64 *)++=*src(I64 *)++;
|
||||
|
||||
if (trailing_bits) {
|
||||
if (trailing_pixels) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_pixel_mask;
|
||||
else
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
*src(I64 *)++&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
*src(I64 *)++&~trailing_pixel_mask;
|
||||
}
|
||||
kk +=img->width_internal;
|
||||
kk1+=dc->width_internal;
|
||||
@@ -415,10 +415,10 @@ here1a:
|
||||
} else {
|
||||
win_z_num =win_task->win_z_num;
|
||||
win_z_buf_ptr =gr.win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_line_dec=whole_bytes;
|
||||
if (leading_bits)
|
||||
win_z_buf_line_dec=whole_I64s;
|
||||
if (leading_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
if (trailing_bits)
|
||||
if (trailing_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
win_z_buf_line_dec*=sizeof(U16);
|
||||
win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;
|
||||
@@ -459,10 +459,10 @@ here1a:
|
||||
else {
|
||||
win_z_num=win_task->win_z_num;
|
||||
win_z_buf_ptr=gr.win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_line_dec=whole_bytes;
|
||||
if (leading_bits)
|
||||
win_z_buf_line_dec=whole_I64s;
|
||||
if (leading_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
if (trailing_bits)
|
||||
if (trailing_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
win_z_buf_line_dec*=sizeof(U16);
|
||||
win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;
|
||||
@@ -475,21 +475,21 @@ here1a:
|
||||
for (j=h1;j<h2;j++) {
|
||||
src=img->body+kk&~7;
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~leading_bit_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~leading_pixel_mask;
|
||||
else
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
(*dst(I64 *)^*src(I64 *)++)&~leading_bit_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
(*dst(I64 *)^*src(I64 *)++)&~leading_pixel_mask;
|
||||
} else {
|
||||
src(I64 *)++;
|
||||
dst(I64 *)++;
|
||||
}
|
||||
}
|
||||
if (bit_shift)
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
if (win_z_num>=*win_z_buf_ptr++)
|
||||
*dst(I64 *)++^=*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift);
|
||||
else {
|
||||
@@ -497,20 +497,20 @@ here1a:
|
||||
dst(I64 *)++;
|
||||
}
|
||||
else
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
if (win_z_num>=*win_z_buf_ptr++)
|
||||
*dst(I64 *)++^=*src(I64 *)++;
|
||||
else {
|
||||
src(I64 *)++;
|
||||
dst(I64 *)++;
|
||||
}
|
||||
if (trailing_bits && win_z_num>=*win_z_buf_ptr++) {
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~trailing_pixel_mask;
|
||||
else
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
(*dst(I64 *)^*src(I64 *)++)&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(*dst(I64 *)^*src(I64 *)++)&~trailing_pixel_mask;
|
||||
}
|
||||
kk +=img->width_internal;
|
||||
kk1+=dc->width_internal;
|
||||
@@ -523,27 +523,27 @@ here1a:
|
||||
for (j=h2-h1;j;j--) {
|
||||
src=img->body+kk&~7;
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~leading_bit_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~leading_pixel_mask;
|
||||
else
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
(*dst(I64 *)^*src(I64 *)++)&~leading_bit_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
(*dst(I64 *)^*src(I64 *)++)&~leading_pixel_mask;
|
||||
}
|
||||
if (bit_shift)
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
*dst(I64 *)++^=*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift);
|
||||
else
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
*dst(I64 *)++^=*src(I64 *)++;
|
||||
if (trailing_bits) {
|
||||
if (trailing_pixels) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~trailing_pixel_mask;
|
||||
else
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
(*dst(I64 *)^*src(I64 *)++)&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(*dst(I64 *)^*src(I64 *)++)&~trailing_pixel_mask;
|
||||
}
|
||||
kk +=img->width_internal;
|
||||
kk1+=dc->width_internal;
|
||||
@@ -612,7 +612,7 @@ public CDC *DCExtract(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2,CTask *task=NULL
|
||||
public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
{//2D. Clipping but not transformation.
|
||||
U8 reg *src,reg *dst,*font_ptr;
|
||||
I64 i,m,leading_bits,trailing_bits,leading_bit_mask,trailing_bit_mask,
|
||||
I64 i,m,leading_pixels,trailing_pixels,leading_pixel_mask,trailing_pixel_mask,
|
||||
j,k1,kk1,w1,h1,w2,h2,reg bit_shift,dist,reg color_mask;
|
||||
CColorROPU32 color,c;
|
||||
CTask *win_task;
|
||||
@@ -668,17 +668,17 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
if (dc->flags & DCF_DONT_DRAW)
|
||||
return 1;
|
||||
color=dc->color;
|
||||
leading_bits=-(w1+x)&7;
|
||||
if (!leading_bits) leading_bits=8;
|
||||
leading_bit_mask=gr.to_8_bits[0xFF>>leading_bits];
|
||||
leading_pixels=-(w1+x)&7;
|
||||
if (!leading_pixels) leading_pixels=8;
|
||||
leading_pixel_mask=gr.to_8_bits[0xFF>>leading_pixels];
|
||||
bit_shift=-x&7;
|
||||
trailing_bits=(x+w2)&7;
|
||||
trailing_bit_mask=gr.to_8_bits[0xFF<<trailing_bits&0xFF];
|
||||
if (leading_bits+trailing_bits>w2-w1) {
|
||||
leading_bit_mask|=trailing_bit_mask;
|
||||
trailing_bits=0;
|
||||
trailing_pixels=(x+w2)&7;
|
||||
trailing_pixel_mask=gr.to_8_bits[0xFF<<trailing_pixels&0xFF];
|
||||
if (leading_pixels+trailing_pixels>w2-w1) {
|
||||
leading_pixel_mask|=trailing_pixel_mask;
|
||||
trailing_pixels=0;
|
||||
}
|
||||
font_ptr=&text.font[(FONT_WIDTH*(FONT_HEIGHT*ch+h1))>>3];
|
||||
font_ptr=&text.font(U8 *)[FONT_HEIGHT*ch+h1];
|
||||
if (color.c0.rop==ROPB_COLLISION) {
|
||||
m=w1&(FONT_WIDTH-1);
|
||||
#assert FONT_WIDTH==8
|
||||
@@ -699,7 +699,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
k1=x+w1;
|
||||
kk1=(h1+y)*dc->width_internal+k1;
|
||||
if (!(dc->flags & DCF_SCREEN_BITMAP) || dc->flags&DCF_ON_TOP) {
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
dst=dc->body+kk1&~7;
|
||||
src=font_ptr;
|
||||
if (bit_shift)
|
||||
@@ -709,7 +709,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
case ROPB_MONO:
|
||||
for (j=h2-h1;j;j--) {
|
||||
m=gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF];
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask|(color_mask&m|*dst(I64 *)&~m)&~leading_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|(color_mask&m|*dst(I64 *)&~m)&~leading_pixel_mask;
|
||||
src++;
|
||||
dst+=dc->width_internal;
|
||||
}
|
||||
@@ -717,7 +717,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
case ROPB_XOR:
|
||||
if (color_mask) {
|
||||
for (j=h2-h1;j;j--) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask|(*dst(I64 *)^gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF])&~leading_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|(*dst(I64 *)^gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF])&~leading_pixel_mask;
|
||||
src++;
|
||||
dst+=dc->width_internal;
|
||||
}
|
||||
@@ -726,7 +726,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
}
|
||||
kk1+=8;
|
||||
}
|
||||
if (trailing_bits) {
|
||||
if (trailing_pixels) {
|
||||
dst=dc->body+kk1&~7;
|
||||
src=font_ptr+1;
|
||||
if (bit_shift)
|
||||
@@ -736,7 +736,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
case ROPB_MONO:
|
||||
for (j=h2-h1;j;j--) {
|
||||
m=gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF];
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|(color_mask&m|*dst(I64 *)&~m)&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|(color_mask&m|*dst(I64 *)&~m)&~trailing_pixel_mask;
|
||||
src++;
|
||||
dst+=dc->width_internal;
|
||||
}
|
||||
@@ -744,7 +744,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
case ROPB_XOR:
|
||||
if (color_mask) {
|
||||
for (j=h2-h1;j;j--) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|(*dst(I64 *)^gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF])&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|(*dst(I64 *)^gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF])&~trailing_pixel_mask;
|
||||
src++;
|
||||
dst+=dc->width_internal;
|
||||
}
|
||||
@@ -753,7 +753,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
dst=dc->body+kk1&~7;
|
||||
src=font_ptr;
|
||||
if (bit_shift)
|
||||
@@ -764,7 +764,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
for (j=h1;j<h2;j++) {
|
||||
if (!IsPixCovered0(win_task,k1,y+j)) {
|
||||
m=gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF];
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask|(color_mask&m|*dst(I64 *)&~m)&~leading_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|(color_mask&m|*dst(I64 *)&~m)&~leading_pixel_mask;
|
||||
}
|
||||
src++;
|
||||
dst+=dc->width_internal;
|
||||
@@ -774,7 +774,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
if (color_mask) {
|
||||
for (j=h1;j<h2;j++) {
|
||||
if (!IsPixCovered0(win_task,k1,y+j))
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask|(*dst(I64 *)^gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF])&~leading_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|(*dst(I64 *)^gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF])&~leading_pixel_mask;
|
||||
src++;
|
||||
dst+=dc->width_internal;
|
||||
}
|
||||
@@ -784,7 +784,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
k1+=8;
|
||||
kk1+=8;
|
||||
}
|
||||
if (trailing_bits) {
|
||||
if (trailing_pixels) {
|
||||
dst=dc->body+kk1&~7;
|
||||
src=font_ptr+1;
|
||||
if (bit_shift)
|
||||
@@ -795,7 +795,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
for (j=h1;j<h2;j++) {
|
||||
if (!IsPixCovered0(win_task,k1,y+j)) {
|
||||
m=gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF];
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|(color_mask&m|*dst(I64 *)&~m)&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|(color_mask&m|*dst(I64 *)&~m)&~trailing_pixel_mask;
|
||||
}
|
||||
src++;
|
||||
dst+=dc->width_internal;
|
||||
@@ -805,7 +805,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
if (color_mask) {
|
||||
for (j=h1;j<h2;j++) {
|
||||
if (!IsPixCovered0(win_task,k1,y+j))
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|(*dst(I64 *)^gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF])&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|(*dst(I64 *)^gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF])&~trailing_pixel_mask;
|
||||
src++;
|
||||
dst+=dc->width_internal;
|
||||
}
|
||||
@@ -886,7 +886,7 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
{//2D. Width Height. Clipping but not transformation.
|
||||
//Returns cnt of pixs changed.
|
||||
I64 i,result=0,j,k1,kk1,w1,h1,w2,h2,dist,
|
||||
leading_bits,original_leading_bits,whole_bytes,trailing_bits,leading_bit_mask,trailing_bit_mask,
|
||||
leading_pixels,original_leading_pixels,whole_I64s,trailing_pixels,leading_pixel_mask,trailing_pixel_mask,
|
||||
win_z_buf_line_inc,win_z_buf_line_dec,win_z_num,color_mask;
|
||||
U8 reg *dst;
|
||||
U16 reg *win_z_buf_ptr;
|
||||
@@ -963,16 +963,16 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
}
|
||||
} else
|
||||
dither=FALSE;
|
||||
original_leading_bits=leading_bits=-(w1+x)&7;
|
||||
leading_bit_mask=gr.to_8_bits[0xFF>>leading_bits];
|
||||
whole_bytes=(w2-w1-leading_bits)>>3;
|
||||
if (whole_bytes<0) whole_bytes=0;
|
||||
trailing_bits=(x+w2)&7;
|
||||
trailing_bit_mask=gr.to_8_bits[0xFF<<trailing_bits&0xFF];
|
||||
if (leading_bits+trailing_bits>w2-w1) {
|
||||
leading_bit_mask|=trailing_bit_mask;
|
||||
leading_bits=w2-w1; //Correct so it's right for result.
|
||||
trailing_bits=0;
|
||||
original_leading_pixels=leading_pixels=-(w1+x)&7;
|
||||
leading_pixel_mask=gr.to_8_bits[0xFF>>leading_pixels];
|
||||
whole_I64s=(w2-w1-leading_pixels)>>3;
|
||||
if (whole_I64s<0) whole_I64s=0;
|
||||
trailing_pixels=(x+w2)&7;
|
||||
trailing_pixel_mask=gr.to_8_bits[0xFF<<trailing_pixels&0xFF];
|
||||
if (leading_pixels+trailing_pixels>w2-w1) {
|
||||
leading_pixel_mask|=trailing_pixel_mask;
|
||||
leading_pixels=w2-w1; //Correct so it's right for result.
|
||||
trailing_pixels=0;
|
||||
}
|
||||
if (color.c0.rop==ROPB_COLLISION) {//TODO: Might want to check win_z_buf
|
||||
color =dc->bkcolor.c0.color;
|
||||
@@ -993,10 +993,10 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
else {
|
||||
win_z_num=win_task->win_z_num;
|
||||
win_z_buf_ptr=gr.win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_line_dec=whole_bytes;
|
||||
if (leading_bits)
|
||||
win_z_buf_line_dec=whole_I64s;
|
||||
if (leading_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
if (trailing_bits)
|
||||
if (trailing_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
win_z_buf_line_dec*=sizeof(U16);
|
||||
win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;
|
||||
@@ -1016,21 +1016,21 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
for (j=h1;j<h2;j++) {
|
||||
color_mask=gr.to_8_colors[color.c0.color];
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask|color_mask&~leading_bit_mask;
|
||||
result+=leading_bits;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
}
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=color_mask;
|
||||
result+=8;
|
||||
}
|
||||
if (trailing_bits && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|color_mask&~trailing_bit_mask;
|
||||
result+=trailing_bits;
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
||||
@@ -1046,12 +1046,12 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
for (j=h2-h1;j;j--) {
|
||||
color_mask=gr.to_8_colors[color.c0.color];
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|color_mask&~leading_bit_mask;
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
if (leading_pixels)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|color_mask&~leading_pixel_mask;
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
*dst(I64 *)=color_mask;
|
||||
if (trailing_bits)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|color_mask&~trailing_bit_mask;
|
||||
if (trailing_pixels)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|color_mask&~trailing_pixel_mask;
|
||||
kk1+=dc->width_internal;
|
||||
if (RandU16<dc->dither_probability_u16)
|
||||
color.c0=dither_colors.c1;
|
||||
@@ -1067,21 +1067,21 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
for (j=h1;j<h2;j++) {
|
||||
color_mask=gr.to_8_colors[color.c0.color];
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask|*dst(I64 *)^color_mask&~leading_bit_mask;
|
||||
result+=leading_bits;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
}
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)^=color_mask;
|
||||
result+=8;
|
||||
}
|
||||
if (trailing_bits && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|*dst(I64 *)^color_mask&~trailing_bit_mask;
|
||||
result+=trailing_bits;
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
||||
@@ -1097,12 +1097,12 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
for (j=h2-h1;j;j--) {
|
||||
color_mask=gr.to_8_colors[color.c0.color];
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|*dst(I64 *)^color_mask&~leading_bit_mask;
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
if (leading_pixels)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
*dst(I64 *)^=color_mask;
|
||||
if (trailing_bits)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|*dst(I64 *)^color_mask&~trailing_bit_mask;
|
||||
if (trailing_pixels)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
kk1+=dc->width_internal;
|
||||
if (RandU16<dc->dither_probability_u16)
|
||||
color.c0=dither_colors.c1;
|
||||
@@ -1114,7 +1114,7 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (((x+w1-original_leading_bits)^(y+h1))&1)
|
||||
if (((x+w1-original_leading_pixels)^(y+h1))&1)
|
||||
SwapU16(&color.c0,&color.c1);
|
||||
nobound_switch (color.c0.rop) {
|
||||
case ROPB_EQU:
|
||||
@@ -1125,21 +1125,21 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
color_mask=gr.to_8_bits[0x55]&gr.to_8_colors[color.c0.color]|
|
||||
gr.to_8_bits[0xAA]&gr.to_8_colors[color.c1.color];
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask|color_mask&~leading_bit_mask;
|
||||
result+=leading_bits;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
}
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=color_mask;
|
||||
result+=8;
|
||||
}
|
||||
if (trailing_bits && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|color_mask&~trailing_bit_mask;
|
||||
result+=trailing_bits;
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
||||
@@ -1153,12 +1153,12 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
color_mask=gr.to_8_bits[0x55]&gr.to_8_colors[color.c0.color]|
|
||||
gr.to_8_bits[0xAA]&gr.to_8_colors[color.c1.color];
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|color_mask&~leading_bit_mask;
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
if (leading_pixels)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|color_mask&~leading_pixel_mask;
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
*dst(I64 *)=color_mask;
|
||||
if (trailing_bits)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|color_mask&~trailing_bit_mask;
|
||||
if (trailing_pixels)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|color_mask&~trailing_pixel_mask;
|
||||
kk1+=dc->width_internal;
|
||||
SwapU16(&color.c0,&color.c1);
|
||||
}
|
||||
@@ -1172,21 +1172,21 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
color_mask=gr.to_8_bits[0x55]&gr.to_8_colors[color.c0.color]|
|
||||
gr.to_8_bits[0xAA]&gr.to_8_colors[color.c1.color];
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask|*dst(I64 *)^color_mask&~leading_bit_mask;
|
||||
result+=leading_bits;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
}
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)^=color_mask;
|
||||
result+=8;
|
||||
}
|
||||
if (trailing_bits && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|*dst(I64 *)^color_mask&~trailing_bit_mask;
|
||||
result+=trailing_bits;
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
||||
@@ -1200,12 +1200,12 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
color_mask=gr.to_8_bits[0x55]&gr.to_8_colors[color.c0.color]|
|
||||
gr.to_8_bits[0xAA]&gr.to_8_colors[color.c1.color];
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|*dst(I64 *)^color_mask&~leading_bit_mask;
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
if (leading_pixels)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
*dst(I64 *)^=color_mask;
|
||||
if (trailing_bits)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|*dst(I64 *)^color_mask&~trailing_bit_mask;
|
||||
if (trailing_pixels)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
kk1+=dc->width_internal;
|
||||
SwapU16(&color.c0,&color.c1);
|
||||
}
|
||||
@@ -1223,21 +1223,21 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
result=0;
|
||||
for (j=h1;j<h2;j++) {
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask|color_mask&~leading_bit_mask;
|
||||
result+=leading_bits;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
}
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=color_mask;
|
||||
result+=8;
|
||||
}
|
||||
if (trailing_bits && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|color_mask&~trailing_bit_mask;
|
||||
result+=trailing_bits;
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
||||
@@ -1248,12 +1248,12 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
} else {
|
||||
for (j=h2-h1;j;j--) {
|
||||
dst(I64 *)=dc->body+kk1&~7;
|
||||
if (leading_bits)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|color_mask&~leading_bit_mask;
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
if (leading_pixels)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|color_mask&~leading_pixel_mask;
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
*dst(I64 *)=color_mask;
|
||||
if (trailing_bits)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|color_mask&~trailing_bit_mask;
|
||||
if (trailing_pixels)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|color_mask&~trailing_pixel_mask;
|
||||
kk1+=dc->width_internal;
|
||||
}
|
||||
result=(h2-h1)*(w2-w1);
|
||||
@@ -1264,21 +1264,21 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
result=0;
|
||||
for (j=h1;j<h2;j++) {
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask|*dst(I64 *)^color_mask&~leading_bit_mask;
|
||||
result+=leading_bits;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
}
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)^=color_mask;
|
||||
result+=8;
|
||||
}
|
||||
if (trailing_bits && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|*dst(I64 *)^color_mask&~trailing_bit_mask;
|
||||
result+=trailing_bits;
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
||||
@@ -1289,12 +1289,12 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
} else {
|
||||
for (j=h2-h1;j;j--) {
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|*dst(I64 *)^color_mask&~leading_bit_mask;
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
if (leading_pixels)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
*dst(I64 *)^=color_mask;
|
||||
if (trailing_bits)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|*dst(I64 *)^color_mask&~trailing_bit_mask;
|
||||
if (trailing_pixels)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
kk1+=dc->width_internal;
|
||||
}
|
||||
result=(h2-h1)*(w2-w1);
|
||||
|
||||
+41
-35
@@ -41,17 +41,21 @@ public I64 *GrIdentEqu(I64 r[4][4])
|
||||
return r;
|
||||
}
|
||||
|
||||
public I64 GrRotNormSqr65536(I64 r[4][4])
|
||||
{//Norm Squared of r.
|
||||
//(1.0/Sqrt(3))*65536=37837.22
|
||||
return SqrI64((r[0][0]*37838+r[0][1]*37838+r[0][2]*37838)>>32)+
|
||||
SqrI64((r[1][0]*37837+r[1][1]*37837+r[1][2]*37837)>>32)+
|
||||
SqrI64((r[2][0]*37837+r[2][1]*37837+r[2][2]*37837)>>32);
|
||||
}
|
||||
|
||||
public U0 GrSetRotMat(CDC *dc=NULL,I64 r[4][4])
|
||||
{//Set device context's rot matrix. Will be $LK,"Free",A="MN:Free"$d() in $LK,"DCDel",A="MN:DCDel"$(). Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
//The main purpose is to set matrix norm for pen width scaling.
|
||||
//NULL as dc means gr.dc
|
||||
//Note: (1.0/Sqrt(3))*65536=37837.22
|
||||
I64 xx=37838,yy=37837,zz=37837;
|
||||
if (!dc) dc=gr.dc;
|
||||
dc->r=r;
|
||||
GrRot(r,&xx,&yy,&zz);
|
||||
//scaled 32 bits
|
||||
dc->r_norm=Sqrt(xx*xx+yy*yy+zz*zz)*65536;
|
||||
dc->r_norm=Sqrt(GrRotNormSqr65536(r))*65536; //scaled 32 bits
|
||||
}
|
||||
|
||||
#help_index "Graphics/Mesh"
|
||||
@@ -171,7 +175,7 @@ public CDC *DCAlias(CDC *dc=NULL,CTask *task=NULL)
|
||||
if (!dc) dc=gr.dc;
|
||||
if (!task) task=Fs;
|
||||
if (dc->dc_signature!=DCS_SIGNATURE_VAL)
|
||||
Dbg;
|
||||
throw('Graphics');
|
||||
result=MAlloc(sizeof(CDC),task);
|
||||
MemCpy(result,dc,sizeof(CDC));
|
||||
result->win_task=result->mem_task=task;
|
||||
@@ -185,7 +189,7 @@ public CDC *DCAlias(CDC *dc=NULL,CTask *task=NULL)
|
||||
public CDC *DCNew(I64 width,I64 height,CTask *task=NULL,Bool null_bitmap=FALSE)
|
||||
{//Create new width x height device context.
|
||||
//Internally only allows widths which are divisible by 8.
|
||||
//Don't forget these $MA-X+PU,"sizeof(CDC)",LM="Grep(\"sizeof(CDC)\",\"/*\");View;"$.
|
||||
//Don't forget these $MA-X+PU,"sizeof(CDC)",LM="Find(\"sizeof(CDC)\",\"/*\");View;"$.
|
||||
CDC *result;
|
||||
if (!task) task=Fs;
|
||||
result=CAlloc(sizeof(CDC),task);
|
||||
@@ -194,11 +198,10 @@ public CDC *DCNew(I64 width,I64 height,CTask *task=NULL,Bool null_bitmap=FALSE)
|
||||
result->width=width;
|
||||
result->width_internal=(width+7)&~7;
|
||||
result->height=height;
|
||||
result->body_size=result->width_internal*result->height;
|
||||
if (null_bitmap)
|
||||
result->flags|=DCF_DONT_DRAW;
|
||||
else
|
||||
result->body=CAlloc(result->body_size,task);
|
||||
result->body=CAlloc(result->width_internal*result->height,task);
|
||||
result->r=MAlloc(16*sizeof(I64),task);
|
||||
DCRst(result);
|
||||
result->dc_signature=DCS_SIGNATURE_VAL;
|
||||
@@ -209,7 +212,7 @@ public U0 DCDel(CDC *dc)
|
||||
{//Free dc, image body, rot mat and depth buf.
|
||||
if (!dc) return;
|
||||
if (dc->dc_signature!=DCS_SIGNATURE_VAL)
|
||||
Dbg;
|
||||
throw('Graphics');
|
||||
dc->dc_signature=0;
|
||||
Free(dc->r);
|
||||
if (!(dc->flags & DCF_ALIAS))
|
||||
@@ -233,7 +236,7 @@ public U0 DCDepthBufRst(CDC *dc)
|
||||
}
|
||||
|
||||
public U0 DCAllocDepthBuf(CDC *dc)
|
||||
{//Allocate a 32-bit depth buffer for device context.
|
||||
{//Alloc a 32-bit depth buffer for device context.
|
||||
Free(dc->depth_buf);
|
||||
dc->depth_buf=MAlloc(dc->width_internal*dc->height*sizeof(I32),dc->mem_task);
|
||||
DCDepthBufRst(dc);
|
||||
@@ -244,7 +247,7 @@ public CDC *DCCopy(CDC *dc,CTask *task=NULL)
|
||||
CDC *result;
|
||||
if (!dc) return NULL;
|
||||
if (dc->dc_signature!=DCS_SIGNATURE_VAL)
|
||||
Dbg;
|
||||
throw('Graphics');
|
||||
result=MAllocIdentical(dc,task);
|
||||
GrSetRotMat(result,MAllocIdentical(dc->r,task));
|
||||
result->mem_task=task;
|
||||
@@ -287,32 +290,27 @@ public U8 *DCSave(CDC *dc,I64 *_size=NULL,Bool compressed=TRUE)
|
||||
U8 *result,*ptr,*body;
|
||||
Bool old_preempt;
|
||||
CArcCompress *ac;
|
||||
I64 i,old_flags=dc->flags;
|
||||
I64 i=dc->width_internal*dc->height,old_flags=dc->flags;
|
||||
|
||||
if (compressed) {
|
||||
ac=CompressBuf(dc->body,dc->body_size);
|
||||
ac=CompressBuf(dc->body,i);
|
||||
i=ac->compressed_size;
|
||||
body=ac;
|
||||
} else {
|
||||
ac=NULL;
|
||||
i=dc->body_size;
|
||||
body=dc->body;
|
||||
}
|
||||
|
||||
ptr=result=MAlloc(offset(CDC.end_saved_area)-
|
||||
offset(CDC.start_saved_area)+i);
|
||||
ptr=result=MAlloc(offset(CDC.end)-offset(CDC.start)+i);
|
||||
|
||||
old_preempt=Preempt(OFF); //in case it is a screen bitmap
|
||||
if (compressed) dc->flags|=DCF_COMPRESSED;
|
||||
dc->flags&=DCF_COMPRESSED;
|
||||
MemCpy(result,&dc->start_saved_area,
|
||||
offset(CDC.end_saved_area)-
|
||||
offset(CDC.start_saved_area));
|
||||
MemCpy(result,&dc->start,offset(CDC.end)-offset(CDC.start));
|
||||
dc->flags=old_flags;
|
||||
Preempt(old_preempt);
|
||||
|
||||
ptr+=offset(CDC.end_saved_area)-
|
||||
offset(CDC.start_saved_area);
|
||||
ptr+=offset(CDC.end)-offset(CDC.start);
|
||||
MemCpy(ptr,body,i);
|
||||
ptr+=i;
|
||||
|
||||
@@ -326,22 +324,24 @@ public CDC *DCLoad(U8 *src,I64 *_size=NULL,CTask *task=NULL)
|
||||
CDC *result;
|
||||
U8 *ptr=src;
|
||||
CArcCompress *ac;
|
||||
I64 body_size;
|
||||
if (!task) task=Fs;
|
||||
result=CAlloc(sizeof(CDC),task);
|
||||
result->win_task=task;
|
||||
result->mem_task=task;
|
||||
MemCpy(&result->start_saved_area,src,
|
||||
offset(CDC.end_saved_area)-offset(CDC.start_saved_area));
|
||||
ptr+=offset(CDC.end_saved_area)-offset(CDC.start_saved_area);
|
||||
MemCpy(&result->start,src,
|
||||
offset(CDC.end)-offset(CDC.start));
|
||||
ptr+=offset(CDC.end)-offset(CDC.start);
|
||||
body_size=result->width_internal*result->height;
|
||||
if (result->flags&DCF_COMPRESSED) {
|
||||
result->flags&=~DCF_COMPRESSED;
|
||||
ac=ptr;
|
||||
result->body=ExpandBuf(ac,task);
|
||||
ptr+=ac->compressed_size;
|
||||
} else {
|
||||
result->body=MAlloc(result->body_size,task);
|
||||
MemCpy(result->body,ptr,result->body_size);
|
||||
ptr+=result->body_size;
|
||||
result->body=MAlloc(body_size,task);
|
||||
MemCpy(result->body,ptr,body_size);
|
||||
ptr+=body_size;
|
||||
}
|
||||
result->pen_width=1;
|
||||
result->r=GrIdentNew(task);
|
||||
@@ -351,6 +351,8 @@ public CDC *DCLoad(U8 *src,I64 *_size=NULL,CTask *task=NULL)
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "Graphics/GRA Files"
|
||||
#help_file "::/Doc/GRAFiles"
|
||||
#help_index "Graphics/Device Contexts;Graphics/GRA Files"
|
||||
public I64 GRAWrite(U8 *filename,CDC *dc)
|
||||
{//TempleOS GRA File.
|
||||
@@ -376,7 +378,7 @@ public CDC *GRARead(U8 *filename,CTask *task=NULL)
|
||||
}
|
||||
|
||||
#help_index "Graphics/Sprite;Graphics/GRA Files;DolDoc/Output"
|
||||
public U0 DocGRAFile(CDoc *doc=NULL,U8 *filename)
|
||||
public U0 DocGRA(CDoc *doc=NULL,U8 *filename)
|
||||
{//Put a GRA file into a document as a sprite.
|
||||
CDC *dc=GRARead(filename);
|
||||
CSprite *elems=DC2Sprite(dc);
|
||||
@@ -386,25 +388,29 @@ public U0 DocGRAFile(CDoc *doc=NULL,U8 *filename)
|
||||
}
|
||||
|
||||
#help_index "Graphics/Device Contexts;Graphics/Screen"
|
||||
public CDC *DCCaptureScreen(CTask *task=NULL)
|
||||
public CDC *DCCaptureScreen(Bool include_zoom=TRUE,CTask *task=NULL)
|
||||
{//Capture screen to a device context.
|
||||
CDC *dc;
|
||||
U8 *dst;
|
||||
WinMgrSync(2,TRUE);
|
||||
dc=DCCopy(gr.screen_image,task);
|
||||
dst=MAlloc(dc->body_size,task);
|
||||
if (include_zoom)
|
||||
dc=DCCopy(gr.screen_image,task);
|
||||
else
|
||||
dc=DCCopy(gr.dc1,task);
|
||||
dc->flags&=~DCF_SCREEN_BITMAP;
|
||||
dst=MAlloc(dc->width_internal*dc->height,task);
|
||||
//Pick background color that never occurs. COLOR_INVALID
|
||||
GrBitMap4ToBitMap8(dst,dc->body,dc->body_size/2,COLOR_INVALID);
|
||||
GrBitMap4ToBitMap8(dst,dc->body,(dc->width_internal*dc->height)>>1,COLOR_INVALID);
|
||||
Free(dc->body);
|
||||
dc->body=dst;
|
||||
return dc;
|
||||
}
|
||||
|
||||
#help_index "Graphics/GRA Files;Graphics/Screen"
|
||||
public I64 GRACaptureScreen(U8 *filename)
|
||||
public I64 GRACaptureScreen(U8 *filename,Bool include_zoom=TRUE)
|
||||
{//Capture screen to a TempleOS GRA File.
|
||||
I64 size;
|
||||
CDC *dc=DCCaptureScreen;
|
||||
CDC *dc=DCCaptureScreen(include_zoom);
|
||||
size=GRAWrite(filename,dc);
|
||||
DCDel(dc);
|
||||
return size;
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ U0 CtrlAltZ(I64 sc)
|
||||
else
|
||||
GrScaleZoom(2.0);
|
||||
}
|
||||
SetCtrlAltLetCB('Z',&CtrlAltZ,"Sys/Zoom In or Out");
|
||||
CtrlAltLetCBSet('Z',&CtrlAltZ,"Sys/Zoom In or Out");
|
||||
|
||||
U0 Screen2Clipboard(I64)
|
||||
{
|
||||
@@ -25,4 +25,4 @@ U0 CtrlAltS(I64)
|
||||
{
|
||||
Spawn(&Screen2Clipboard);
|
||||
}
|
||||
SetCtrlAltLetCB('S',&CtrlAltS,"Sys/Screen Shot to Clipboard");
|
||||
CtrlAltLetCBSet('S',&CtrlAltS,"Sys/Screen Shot to Clipboard");
|
||||
+3
-7
@@ -9,7 +9,7 @@ public class CGrGlbls
|
||||
*dc2, //Updated every refresh
|
||||
*dc_cache,
|
||||
*zoomed_dc;
|
||||
U32 *text_base; //See $LK,"TextBase Layer",A="HI:TextBase Layer"$.
|
||||
U32 *text_base; //See $LK,"TextBase Layer",A="HI:TextBase Layer"$. (Similar to 0xB8000 but 32 bits)
|
||||
U16 *win_z_buf;
|
||||
|
||||
#define SPHT_ELEM_CODE 1
|
||||
@@ -19,7 +19,7 @@ public class CGrGlbls
|
||||
I64 highest_uncovered;
|
||||
U16 *vga_text_cache;
|
||||
I64 pan_text_x,pan_text_y; //[-7,7]
|
||||
U0 (*fp_final_screen_update)(CDC *dc);
|
||||
U0 (*fp_final_screen_update)(CDC *dc);//Mouse cursor is handled here.
|
||||
U0 (*fp_wall_paper)(CTask *task);
|
||||
U0 (*fp_draw_input_ptr)(CDC *dc,I64 x,I64 y);
|
||||
U0 (*fp_draw_grab_input_ptr)(CDC *dc,I64 x,I64 y,Bool closed);
|
||||
@@ -31,10 +31,6 @@ public class CGrGlbls
|
||||
*even_pen_brushes[GR_NUM_PEN_BRUSHES],
|
||||
*odd_pen_brushes[GR_NUM_PEN_BRUSHES];
|
||||
|
||||
#define GR_REFRESH_LOG_CNT 16
|
||||
F64 refresh_time_stamps[GR_REFRESH_LOG_CNT];
|
||||
I64 refresh_ts_ptr;
|
||||
|
||||
#define GR_MAX_SCREEN_ZOOM 8
|
||||
U8 *screen_zoom_tables[GR_MAX_SCREEN_ZOOM+1];
|
||||
I64 screen_zoom,sx,sy;
|
||||
@@ -43,7 +39,7 @@ public class CGrGlbls
|
||||
Bool continuous_scroll;
|
||||
} gr;
|
||||
|
||||
//See $LK,"SYS_BIOS_GR_MODE",A="FF:D:/Kernel/KStart.CPP,SYS_BIOS_GR_MODE:2"$
|
||||
//See $LK,"RLf_VGA",A="FF:::/Kernel/KStart.CPP,RLf_VGA"$
|
||||
//See $LK,"SysGrInit",A="MN:SysGrInit"$()
|
||||
//Allows consts to be used instead of vars.
|
||||
HashPublic("GR_WIDTH",HTT_DEFINE_STR);;
|
||||
|
||||
+5
-7
@@ -55,14 +55,14 @@ U0 GrSetUpTables()
|
||||
if (((x-1)^(y-1))&1 && SqrI64(y*2-k)+SqrI64(x*2-k)<rr)
|
||||
GrPlot0(dc,x-1,y-1);
|
||||
}
|
||||
if (!sys_bios_gr_mode) { //if text mode
|
||||
MemSet(VGA_TEXT_MEM_BASE,0,TEXT_ROWS*TEXT_COLS*sizeof(U16));
|
||||
if (!Bt(&sys_run_level,RLf_VGA)) { //if text mode
|
||||
MemSet(VGAM_TEXT,0,TEXT_ROWS*TEXT_COLS*sizeof(U16));
|
||||
MemSet(gr.vga_text_cache,0,TEXT_ROWS*TEXT_COLS*sizeof(U16));
|
||||
} else {
|
||||
OutU8(VGA_SC_INDEX,VGA_MAP_MASK);
|
||||
OutU8(VGA_SC_DATA,0x0F);
|
||||
OutU8(VGAP_INDEX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,0x0F);
|
||||
//Virtual Box crashes on the following for some reason.
|
||||
// MemSet(VGA_GRAPHIC_MEM_BASE,0,GR_HEIGHT*GR_WIDTH>>3);
|
||||
// MemSet(VGAM_GRAPHICS,0,GR_HEIGHT*GR_WIDTH>>3);
|
||||
MemSet(gr.screen_image->body,0,GR_WIDTH*GR_HEIGHT>>1);
|
||||
}
|
||||
for (i=1;i<=GR_MAX_SCREEN_ZOOM;i++) {
|
||||
@@ -79,8 +79,6 @@ U0 GrSetUpTables()
|
||||
dst[j+l*256]=m.u8[l];
|
||||
}
|
||||
}
|
||||
for (i=0;i<GR_REFRESH_LOG_CNT;i++)
|
||||
gr.refresh_time_stamps[i]=tS;
|
||||
}
|
||||
|
||||
#help_index "Graphics/Screen;Windows"
|
||||
|
||||
File renamed without changes.
+19
-19
@@ -18,35 +18,35 @@ we never need to worry about indexes,
|
||||
just DAC palette settings.
|
||||
*/
|
||||
I64 i;
|
||||
if (!sys_bios_gr_mode) return;
|
||||
if (!Bt(&sys_run_level,RLf_VGA)) return;
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&sys_semas[SYS_SEMA_VGA],0))
|
||||
Yield;
|
||||
InU8(VGA_INPUT_STAT); //Rsts attr index/data
|
||||
InU8(VGAP_INPUT_STAT); //Rsts attr index/data
|
||||
for (i=0;i<16;i++) {
|
||||
OutU8(VGA_ATTR_INDEX,i);
|
||||
OutU8(VGA_ATTR_DATA_WRITE,i);
|
||||
OutU8(VGAP_ATTR_INDEX,i);
|
||||
OutU8(VGAP_ATTR_DATA_WRITE,i);
|
||||
}
|
||||
OutU8(VGA_ATTR_INDEX,0x20);
|
||||
OutU8(VGA_ATTR_DATA_WRITE,0); //Dummy write
|
||||
InU8(VGA_INPUT_STAT); //Rsts attr index/data
|
||||
OutU8(VGAP_ATTR_INDEX,0x20);
|
||||
OutU8(VGAP_ATTR_DATA_WRITE,0); //Dummy write
|
||||
InU8(VGAP_INPUT_STAT); //Rsts attr index/data
|
||||
LBtr(&sys_semas[SYS_SEMA_VGA],0);
|
||||
POPFD
|
||||
}
|
||||
|
||||
public U0 SetVGAPaletteColor(I64 color_num,CBGR bgr)
|
||||
{//6-bits per b, g and r.
|
||||
if (!sys_bios_gr_mode) return;
|
||||
if (!Bt(&sys_run_level,RLf_VGA)) return;
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&sys_semas[SYS_SEMA_VGA],0))
|
||||
Yield;
|
||||
OutU8(VGA_PALETTE_MASK,0xFF);
|
||||
OutU8(VGA_REG_WRITE,color_num);
|
||||
OutU8(VGA_PALETTE_DATA,bgr.r>>2);
|
||||
OutU8(VGA_PALETTE_DATA,bgr.g>>2);
|
||||
OutU8(VGA_PALETTE_DATA,bgr.b>>2);
|
||||
OutU8(VGAP_PALETTE_MASK,0xFF);
|
||||
OutU8(VGAP_REG_WRITE,color_num);
|
||||
OutU8(VGAP_PALETTE_DATA,bgr.r>>2);
|
||||
OutU8(VGAP_PALETTE_DATA,bgr.g>>2);
|
||||
OutU8(VGAP_PALETTE_DATA,bgr.b>>2);
|
||||
LBtr(&sys_semas[SYS_SEMA_VGA],0);
|
||||
POPFD
|
||||
}
|
||||
@@ -54,16 +54,16 @@ public U0 SetVGAPaletteColor(I64 color_num,CBGR bgr)
|
||||
public CBGR GetVGAPaletteColor(I64 color_num)
|
||||
{//6-bits per b, g and r.
|
||||
CBGR result=0;
|
||||
if (!sys_bios_gr_mode) return 0;
|
||||
if (!Bt(&sys_run_level,RLf_VGA)) return 0;
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&sys_semas[SYS_SEMA_VGA],0))
|
||||
Yield;
|
||||
OutU8(VGA_PALETTE_MASK,0xFF);
|
||||
OutU8(VGA_REG_READ,color_num);
|
||||
result.r=InU8(VGA_PALETTE_DATA)<<2;
|
||||
result.g=InU8(VGA_PALETTE_DATA)<<2;
|
||||
result.b=InU8(VGA_PALETTE_DATA)<<2;
|
||||
OutU8(VGAP_PALETTE_MASK,0xFF);
|
||||
OutU8(VGAP_REG_READ,color_num);
|
||||
result.r=InU8(VGAP_PALETTE_DATA)<<2;
|
||||
result.g=InU8(VGAP_PALETTE_DATA)<<2;
|
||||
result.b=InU8(VGAP_PALETTE_DATA)<<2;
|
||||
LBtr(&sys_semas[SYS_SEMA_VGA],0);
|
||||
POPFD
|
||||
return result;
|
||||
|
||||
@@ -235,7 +235,7 @@ I64 GrFloodFillRay(CDC *dc,I64 x,I64 y,I64 z,I32 *db)
|
||||
}
|
||||
|
||||
public I64 GrFloodFill(CDC *dc=gr.dc,I64 x,I64 y,Bool not_color=FALSE,I64 z=0,I32 *db=NULL)
|
||||
{//3D. Ignore z and db.
|
||||
{//2D. Ignore z and db.
|
||||
//not_color=TRUE means fill up to everything which is not the current color.
|
||||
//not_color=FALSE means fill all parts equal to the color under the point.
|
||||
//Returns cnt of pixs changed
|
||||
|
||||
+11
-17
@@ -89,16 +89,10 @@ U0 GrUpdateWins()
|
||||
PutExcept(FALSE);
|
||||
Dbg("Exception in WinMgr");
|
||||
}
|
||||
|
||||
winmgr.last_ode_time=winmgr.ode_time;
|
||||
ode_allocated_factor=LowPass1(0.1,ode_allocated_factor,
|
||||
ode_alloced_factor=LowPass1(0.1,ode_alloced_factor,
|
||||
Clamp(Gs->idle_factor-0.1,0.2,0.8),1/winmgr.fps);
|
||||
|
||||
sys_task_being_screen_updated=NULL;
|
||||
gr.refresh_time_stamps[gr.refresh_ts_ptr++&(GR_REFRESH_LOG_CNT-1)]=tS;
|
||||
winmgr.fps=(GR_REFRESH_LOG_CNT-1)/
|
||||
(gr.refresh_time_stamps[(gr.refresh_ts_ptr-1)&(GR_REFRESH_LOG_CNT-1)]-
|
||||
gr.refresh_time_stamps[gr.refresh_ts_ptr&(GR_REFRESH_LOG_CNT-1)]);
|
||||
}
|
||||
|
||||
U0 GrFixZoomScale()
|
||||
@@ -339,7 +333,7 @@ U0 GrUpdateTextModeText()
|
||||
{
|
||||
U32 *src=gr.text_base;
|
||||
I64 cur_ch,i,d0=TEXT_COLS*TEXT_ROWS;
|
||||
U16 *dst=VGA_TEXT_MEM_BASE,*dst2=gr.vga_text_cache;
|
||||
U16 *dst=VGAM_TEXT,*dst2=gr.vga_text_cache;
|
||||
Bool blink_flag=Blink;
|
||||
if (LBtr(&sys_semas[SYS_SEMA_FLUSH_VGA_IMAGE],0)) {
|
||||
i=d0;
|
||||
@@ -390,18 +384,18 @@ U0 GrUpdateVGAGraphics()
|
||||
dst=gr.screen_image->body;
|
||||
if (LBtr(&sys_semas[SYS_SEMA_FLUSH_VGA_IMAGE],0)) {
|
||||
for (plane=1;plane<0x10;plane<<=1) {
|
||||
OutU8(VGA_SC_INDEX,VGA_MAP_MASK);
|
||||
OutU8(VGA_SC_DATA,plane);
|
||||
vga=VGA_GRAPHIC_MEM_BASE;
|
||||
OutU8(VGAP_INDEX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,plane);
|
||||
vga=VGAM_GRAPHICS;
|
||||
row=gr.zoomed_dc->height;
|
||||
while (row--)
|
||||
GrUpdateLine64FlushCache(&vga,&src,d,&dst);
|
||||
}
|
||||
} else {
|
||||
for (plane=1;plane<0x10;plane<<=1) {
|
||||
OutU8(VGA_SC_INDEX,VGA_MAP_MASK);
|
||||
OutU8(VGA_SC_DATA,plane);
|
||||
vga=VGA_GRAPHIC_MEM_BASE;
|
||||
OutU8(VGAP_INDEX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,plane);
|
||||
vga=VGAM_GRAPHICS;
|
||||
row=gr.zoomed_dc->height;
|
||||
while (row--)
|
||||
GrUpdateLine64(&vga,&src,d,&dst);
|
||||
@@ -410,10 +404,10 @@ U0 GrUpdateVGAGraphics()
|
||||
}
|
||||
|
||||
U0 GrUpdateScreen()
|
||||
{//Called by the Window Manager $LK,"HERE",A="FF:::/Adam/Win2b.CPP,GrUpdateScreen"$, 60 times a second.
|
||||
{//Called by the Window Manager $LK,"HERE",A="FF:::/Adam/WinB.CPP,GrUpdateScreen"$, 60 times a second.
|
||||
CDC *dc;
|
||||
Preempt(ON);
|
||||
if (!sys_bios_gr_mode) //if text mode
|
||||
if (!Bt(&sys_run_level,RLf_VGA)) //if text mode
|
||||
GrUpdateWins;
|
||||
else {
|
||||
GrUpdateTextBG;
|
||||
@@ -429,7 +423,7 @@ U0 GrUpdateScreen()
|
||||
(*gr.fp_final_screen_update)(dc);
|
||||
DCDel(dc);
|
||||
|
||||
if (!sys_bios_gr_mode) //if text mode
|
||||
if (!Bt(&sys_run_level,RLf_VGA)) //if text mode
|
||||
GrUpdateTextModeText;
|
||||
else {
|
||||
DCBlotColor4(gr.dc1->body,gr.dc2->body,gr.dc_cache->body,
|
||||
|
||||
+97
-99
@@ -39,15 +39,15 @@ public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
dc->cur_sprite_elem_num=cur_sprite_elem_num++;
|
||||
switch (tempg->type) {
|
||||
case SPT_COLOR:
|
||||
dc->color=dc->color&~(COLORROP_COLORS_MASK|ROPF_DITHER)|tempg->color;
|
||||
dc->color=dc->color&~(COLORROP_COLORS_MASK|ROPF_DITHER)|tempg->c.color;
|
||||
break;
|
||||
case SPT_DITHER_COLOR:
|
||||
dc->color=dc->color&~COLORROP_COLORS_MASK|
|
||||
tempg->dither_color.u8[0]|
|
||||
tempg->dither_color.u8[1]<<COLORROP_BITS|ROPF_DITHER;
|
||||
tempg->d.dither_color.u8[0]|
|
||||
tempg->d.dither_color.u8[1]<<COLORROP_BITS|ROPF_DITHER;
|
||||
break;
|
||||
case SPT_WIDTH:
|
||||
dc->pen_width=tempg->width;
|
||||
dc->pen_width=tempg->w.width;
|
||||
GrScalePenWidth(dc);
|
||||
break;
|
||||
case SPT_TRANSFORM_ON:
|
||||
@@ -67,86 +67,87 @@ public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
dc->flags&=~DCF_TRANSFORMATION;
|
||||
break;
|
||||
case SPT_PT:
|
||||
GrPlot3(dc,tempg->x1+x,tempg->y1+y,z);
|
||||
GrPlot3(dc,tempg->p.x1+x,tempg->p.y1+y,z);
|
||||
break;
|
||||
case SPT_TEXT:
|
||||
GrPrint3(dc,tempg->x1+x,tempg->y1+y,z,"%s",tempg->st);
|
||||
GrPrint3(dc,tempg->ps.x1+x,tempg->ps.y1+y,z,"%s",tempg->ps.st);
|
||||
break;
|
||||
case SPT_TEXT_BOX:
|
||||
GrTextBox3(dc,tempg->x1+x,tempg->y1+y,z,tempg->st);
|
||||
GrTextBox3(dc,tempg->ps.x1+x,tempg->ps.y1+y,z,tempg->ps.st);
|
||||
break;
|
||||
case SPT_TEXT_DIAMOND:
|
||||
GrTextDiamond3(dc,tempg->x1+x,tempg->y1+y,z,tempg->st);
|
||||
GrTextDiamond3(dc,tempg->ps.x1+x,tempg->ps.y1+y,z,tempg->ps.st);
|
||||
break;
|
||||
case SPT_FLOOD_FILL:
|
||||
GrFloodFill3(dc,tempg->x1+x,tempg->y1+y,z,FALSE);
|
||||
GrFloodFill3(dc,tempg->p.x1+x,tempg->p.y1+y,z,FALSE);
|
||||
break;
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
i=dc->color;
|
||||
dc->color=dc->color.c0;
|
||||
GrFloodFill3(dc,tempg->x1+x,tempg->y1+y,z,TRUE);
|
||||
GrFloodFill3(dc,tempg->p.x1+x,tempg->p.y1+y,z,TRUE);
|
||||
dc->color=i;
|
||||
break;
|
||||
case SPT_SHIFT:
|
||||
x+=tempg->x1;
|
||||
y+=tempg->y1;
|
||||
x+=tempg->p.x1;
|
||||
y+=tempg->p.y1;
|
||||
break;
|
||||
case SPT_LINE:
|
||||
GrLine3(dc,tempg->x1+x,tempg->y1+y,z,tempg->x2+x,tempg->y2+y,z);
|
||||
GrLine3(dc,tempg->pp.x1+x,tempg->pp.y1+y,z,tempg->pp.x2+x,tempg->pp.y2+y,z);
|
||||
break;
|
||||
case SPT_ARROW:
|
||||
GrArrow3(dc,tempg->x1+x,tempg->y1+y,z,tempg->x2+x,tempg->y2+y,z);
|
||||
GrArrow3(dc,tempg->pp.x1+x,tempg->pp.y1+y,z,tempg->pp.x2+x,tempg->pp.y2+y,z);
|
||||
break;
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
if (GrSetSymmetry3(dc,tempg->x1+x,tempg->y1+y,z,tempg->x2+x,tempg->y2+y,z,tempg->x2+x,tempg->y2+y,z+1))
|
||||
if (GrSetSymmetry3(dc,tempg->pp.x1+x,tempg->pp.y1+y,z,tempg->pp.x2+x,tempg->pp.y2+y,z,tempg->pp.x2+x,tempg->pp.y2+y,z+1))
|
||||
dc->flags|=DCF_SYMMETRY;
|
||||
else
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
break;
|
||||
case SPT_BITMAP:
|
||||
img=CAlloc(sizeof(CDC));
|
||||
img->width=tempg->width;
|
||||
img->width_internal=(tempg->width+7)&~7;
|
||||
img->height=tempg->height;
|
||||
img->body_size=img->width_internal*img->height;
|
||||
img->body=tempg(U8 *)+offset(CSprite.linespeed);
|
||||
img->width=tempg->pwhu.width;
|
||||
img->width_internal=(tempg->pwhu.width+7)&~7;
|
||||
img->height=tempg->pwhu.height;
|
||||
img->body=&tempg->pwhu.u;
|
||||
img->dc_signature=DCS_SIGNATURE_VAL;
|
||||
GrBlot3(dc,tempg->x2+x,tempg->y2+y,z,img);
|
||||
GrBlot3(dc,tempg->pwhu.x1+x,tempg->pwhu.y1+y,z,img);
|
||||
Free(img);
|
||||
break;
|
||||
case SPT_RECT:
|
||||
GrRect3(dc,tempg->x1+x,tempg->y1+y,z,tempg->x2-tempg->x1,tempg->y2-tempg->y1);
|
||||
GrRect3(dc,tempg->pp.x1+x,tempg->pp.y1+y,z,tempg->pp.x2-tempg->pp.x1,tempg->pp.y2-tempg->pp.y1);
|
||||
break;
|
||||
case SPT_ROTATED_RECT:
|
||||
x1=tempg->x1+x;
|
||||
y1=tempg->y1+y;
|
||||
x1=tempg->ppa.x1+x;
|
||||
y1=tempg->ppa.y1+y;
|
||||
z1=z;
|
||||
GrRot(dc->r,&x1,&y1,&z1);
|
||||
old_r=dc->r;
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
r2=GrRotZNew(-tempg->rot_angle);
|
||||
r2=GrRotZNew(-tempg->ppa.angle);
|
||||
GrSetTranslation(r2,x1,y1,z1);
|
||||
GrSetRotMat(dc,GrMulMat(old_r,r2));
|
||||
GrRect3(dc,0,0,0,tempg->x2-tempg->x1,tempg->y2-tempg->y1);
|
||||
GrRect3(dc,0,0,0,tempg->ppa.x2-tempg->ppa.x1,tempg->ppa.y2-tempg->ppa.y1);
|
||||
Free(dc->r);
|
||||
Free(r2);
|
||||
GrSetRotMat(dc,old_r);
|
||||
dc->flags=dc->flags&~DCF_TRANSFORMATION|old_flags;
|
||||
break;
|
||||
case SPT_CIRCLE:
|
||||
GrCircle3(dc,tempg->x1+x,tempg->y1+y,z,tempg->x2);
|
||||
GrCircle3(dc,tempg->pr.x1+x,tempg->pr.y1+y,z,tempg->pr.radius);
|
||||
break;
|
||||
case SPT_ELLIPSE:
|
||||
GrEllipse3(dc,tempg->x2+x,tempg->y2+y,z,tempg->width,tempg->height,tempg->rot_angle);
|
||||
GrEllipse3(dc,tempg->pwha.x1+x,tempg->pwha.y1+y,z,tempg->pwha.width,
|
||||
tempg->pwha.height,tempg->pwha.angle);
|
||||
break;
|
||||
case SPT_POLYGON:
|
||||
GrRegPoly3(dc,tempg->x2+x,tempg->y2+y,z,tempg->width,tempg->height,tempg->sides,tempg->rot_angle);
|
||||
GrRegPoly3(dc,tempg->pwhas.x1+x,tempg->pwhas.y1+y,z,tempg->pwhas.width,
|
||||
tempg->pwhas.height,tempg->pwhas.sides,tempg->pwhas.angle);
|
||||
break;
|
||||
case SPT_POLYLINE:
|
||||
ptr=&tempg->y1;
|
||||
ptr=&tempg->nu.u;
|
||||
x1=ptr[0];
|
||||
y1=ptr[1];
|
||||
for (i=1;i<tempg->num;i++) {
|
||||
for (i=1;i<tempg->nu.num;i++) {
|
||||
x2=ptr[i<<1];
|
||||
y2=ptr[i<<1+1];
|
||||
GrLine3(dc,x1+x,y1+y,z,x2+x,y2+y,z);
|
||||
@@ -154,11 +155,10 @@ public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
}
|
||||
break;
|
||||
case SPT_POLYPT:
|
||||
ptr=&tempg->y1;
|
||||
x1=ptr[0];
|
||||
y1=ptr[1];
|
||||
ptr+=2;
|
||||
k=tempg->num*3;
|
||||
x1=tempg->npu.x;
|
||||
y1=tempg->npu.y;
|
||||
ptr=&tempg->npu.u;
|
||||
k=tempg->npu.num*3;
|
||||
GrPlot3(dc,x1+x,y1+y,z);
|
||||
for (i=0;i<k;i+=3) {
|
||||
j=BFieldExtU32(ptr,i,3);
|
||||
@@ -168,42 +168,43 @@ public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
}
|
||||
break;
|
||||
sub_switch_start:
|
||||
p=&tempg->y1;
|
||||
for (i=0;i<tempg->num;i++,p++) {
|
||||
p=&tempg->nu.u;
|
||||
for (i=0;i<tempg->nu.num;i++,p++) {
|
||||
p->x+=x;
|
||||
p->y+=y;
|
||||
p->z+=z;
|
||||
}
|
||||
case SPT_BSPLINE2:
|
||||
Gr2BSpline3(dc,&tempg->y1,tempg->num,FALSE);
|
||||
Gr2BSpline3(dc,&tempg->nu.u,tempg->nu.num,FALSE);
|
||||
break;
|
||||
case SPT_BSPLINE3:
|
||||
Gr3BSpline3(dc,&tempg->y1,tempg->num,FALSE);
|
||||
Gr3BSpline3(dc,&tempg->nu.u,tempg->nu.num,FALSE);
|
||||
break;
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
Gr2BSpline3(dc,&tempg->y1,tempg->num,TRUE);
|
||||
Gr2BSpline3(dc,&tempg->nu.u,tempg->nu.num,TRUE);
|
||||
break;
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
Gr3BSpline3(dc,&tempg->y1,tempg->num,TRUE);
|
||||
Gr3BSpline3(dc,&tempg->nu.u,tempg->nu.num,TRUE);
|
||||
break;
|
||||
sub_switch_end:
|
||||
p=&tempg->y1;
|
||||
for (i=0;i<tempg->num;i++,p++) {
|
||||
p=&tempg->nu.u;
|
||||
for (i=0;i<tempg->nu.num;i++,p++) {
|
||||
p->x-=x;
|
||||
p->y-=y;
|
||||
p->z-=z;
|
||||
}
|
||||
break;
|
||||
case SPT_MESH:
|
||||
p=&tempg->x2;
|
||||
for (i=0;i<tempg->vertex_cnt;i++,p++) {
|
||||
p=&tempg->mu.u;
|
||||
for (i=0;i<tempg->mu.vertex_cnt;i++,p++) {
|
||||
p->x+=x;
|
||||
p->y+=y;
|
||||
p->z+=z;
|
||||
}
|
||||
Gr3Mesh(dc,tempg->vertex_cnt,&tempg->x2,tempg->tri_cnt,(&tempg->x2)(U8 *)+sizeof(CD3I32)*tempg->vertex_cnt);
|
||||
p=&tempg->x2;
|
||||
for (i=0;i<tempg->vertex_cnt;i++,p++) {
|
||||
Gr3Mesh(dc,tempg->mu.vertex_cnt,&tempg->mu.u,tempg->mu.tri_cnt,
|
||||
(&tempg->mu.u)(U8 *)+sizeof(CD3I32)*tempg->mu.vertex_cnt);
|
||||
p=&tempg->mu.u;
|
||||
for (i=0;i<tempg->mu.vertex_cnt;i++,p++) {
|
||||
p->x-=x;
|
||||
p->y-=y;
|
||||
p->z-=z;
|
||||
@@ -211,35 +212,35 @@ public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
break;
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
if (dc->flags&DCF_TRANSFORMATION) {
|
||||
dc->x+=tempg->x1;
|
||||
dc->y+=tempg->y1;
|
||||
dc->z+=tempg->z1;
|
||||
dc->x+=tempg->pmu.x;
|
||||
dc->y+=tempg->pmu.y;
|
||||
dc->z+=tempg->pmu.z;
|
||||
x1=x;
|
||||
y1=y;
|
||||
z1=z;
|
||||
} else {
|
||||
x1=tempg->x1+x;
|
||||
y1=tempg->y1+y;
|
||||
z1=tempg->z1+z;
|
||||
x1=tempg->pmu.x+x;
|
||||
y1=tempg->pmu.y+y;
|
||||
z1=tempg->pmu.z+z;
|
||||
}
|
||||
p=(&tempg->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
for (i=0;i<tempg->shiftable_vertex_cnt;i++,p++) {
|
||||
p=&tempg->pmu.u;
|
||||
for (i=0;i<tempg->pmu.vertex_cnt;i++,p++) {
|
||||
p->x+=x1;
|
||||
p->y+=y1;
|
||||
p->z+=z1;
|
||||
}
|
||||
p=(&tempg->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
Gr3Mesh(dc,tempg->shiftable_vertex_cnt,p,tempg->shiftable_tri_cnt,p(U8 *)+sizeof(CD3I32)*tempg->shiftable_vertex_cnt);
|
||||
p=(&tempg->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
for (i=0;i<tempg->shiftable_vertex_cnt;i++,p++) {
|
||||
Gr3Mesh(dc,tempg->pmu.vertex_cnt,&tempg->pmu.u,tempg->pmu.tri_cnt,
|
||||
(&tempg->pmu.u)(U8 *)+sizeof(CD3I32)*tempg->pmu.vertex_cnt);
|
||||
p=&tempg->pmu.u;
|
||||
for (i=0;i<tempg->pmu.vertex_cnt;i++,p++) {
|
||||
p->x-=x1;
|
||||
p->y-=y1;
|
||||
p->z-=z1;
|
||||
}
|
||||
if (dc->flags&DCF_TRANSFORMATION) {
|
||||
dc->x-=tempg->x1;
|
||||
dc->y-=tempg->y1;
|
||||
dc->z-=tempg->z1;
|
||||
dc->x-=tempg->pmu.x;
|
||||
dc->y-=tempg->pmu.y;
|
||||
dc->z-=tempg->pmu.z;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -355,13 +356,13 @@ public U8 *SpriteInterpolate(U8 *elems0,U8 *elems1,F64 t)
|
||||
throw('Graphics');
|
||||
switch (tempg0->type) {
|
||||
case SPT_ROTATED_RECT:
|
||||
tempgr->rot_angle=(tempg0->rot_angle*t0+tempg1->rot_angle*t1)/GR_SCALE;
|
||||
tempgr->ppa.angle=(tempg0->ppa.angle*t0+tempg1->ppa.angle*t1)/GR_SCALE;
|
||||
case SPT_RECT:
|
||||
case SPT_LINE:
|
||||
case SPT_ARROW:
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
tempgr->x2=(tempg0->x2*t0+tempg1->x2*t1)>>32;
|
||||
tempgr->y2=(tempg0->y2*t0+tempg1->y2*t1)>>32;
|
||||
tempgr->pp.x2=(tempg0->pp.x2*t0+tempg1->pp.x2*t1)>>32;
|
||||
tempgr->pp.y2=(tempg0->pp.y2*t0+tempg1->pp.y2*t1)>>32;
|
||||
case SPT_TEXT:
|
||||
case SPT_TEXT_BOX:
|
||||
case SPT_TEXT_DIAMOND:
|
||||
@@ -369,69 +370,66 @@ public U8 *SpriteInterpolate(U8 *elems0,U8 *elems1,F64 t)
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
case SPT_SHIFT:
|
||||
tempgr->x1=(tempg0->x1*t0+tempg1->x1*t1)>>32;
|
||||
tempgr->y1=(tempg0->y1*t0+tempg1->y1*t1)>>32;
|
||||
tempgr->p.x1=(tempg0->p.x1*t0+tempg1->p.x1*t1)>>32;
|
||||
tempgr->p.y1=(tempg0->p.y1*t0+tempg1->p.y1*t1)>>32;
|
||||
break;
|
||||
case SPT_CIRCLE:
|
||||
tempgr->x2=(tempg0->x2*t0+tempg1->x2*t1)>>32;
|
||||
tempgr->x1=(tempg0->x1*t0+tempg1->x1*t1)>>32;
|
||||
tempgr->y1=(tempg0->y1*t0+tempg1->y1*t1)>>32;
|
||||
tempgr->pr.radius=(tempg0->pr.radius*t0+tempg1->pr.radius*t1)>>32;
|
||||
tempgr->pr.x1=(tempg0->pr.x1*t0+tempg1->pr.x1*t1)>>32;
|
||||
tempgr->pr.y1=(tempg0->pr.y1*t0+tempg1->pr.y1*t1)>>32;
|
||||
break;
|
||||
case SPT_ELLIPSE:
|
||||
case SPT_POLYGON:
|
||||
tempgr->x2=(tempg0->x2*t0+tempg1->x2*t1)>>32;
|
||||
tempgr->y2=(tempg0->y2*t0+tempg1->y2*t1)>>32;
|
||||
tempgr->width=(tempg0->width*t0+tempg1->width*t1)>>32;
|
||||
tempgr->height=(tempg0->height*t0+tempg1->height*t1)>>32;
|
||||
tempgr->pwha.x1=(tempg0->pwha.x1*t0+tempg1->pwha.x1*t1)>>32;
|
||||
tempgr->pwha.y1=(tempg0->pwha.y1*t0+tempg1->pwha.y1*t1)>>32;
|
||||
tempgr->pwha.width =(tempg0->pwha.width *t0+tempg1->pwha.width*t1)>>32;
|
||||
tempgr->pwha.height=(tempg0->pwha.height*t0+tempg1->pwha.height*t1)>>32;
|
||||
break;
|
||||
case SPT_BITMAP:
|
||||
tempgr->x2=(tempg0->x2*t0+tempg1->x2*t1)>>32;
|
||||
tempgr->y2=(tempg0->y2*t0+tempg1->y2*t1)>>32;
|
||||
tempgr->pwhu.x1=(tempg0->pwhu.x1*t0+tempg1->pwhu.x1*t1)>>32;
|
||||
tempgr->pwhu.y1=(tempg0->pwhu.y1*t0+tempg1->pwhu.y1*t1)>>32;
|
||||
break;
|
||||
case SPT_POLYLINE:
|
||||
ptr0=&tempg0->y1;
|
||||
ptr1=&tempg1->y1;
|
||||
ptrr=&tempgr->y1;
|
||||
for (i=0;i<tempg0->num;i++) {
|
||||
ptr0=&tempg0->nu.u;
|
||||
ptr1=&tempg1->nu.u;
|
||||
ptrr=&tempgr->nu.u;
|
||||
for (i=0;i<tempg0->nu.num;i++) {
|
||||
ptrr[i<<1]=(ptr0[i<<1]*t0+ptr1[i<<1]*t1)>>32;
|
||||
ptrr[i<<1+1]=(ptr0[i<<1+1]*t0+ptr1[i<<1+1]*t1)>>32;
|
||||
}
|
||||
break;
|
||||
case SPT_POLYPT:
|
||||
ptr0=&tempg0->y1;
|
||||
ptr1=&tempg1->y1;
|
||||
ptrr=&tempgr->y1;
|
||||
ptrr[0]=(ptr0[0]*t0+ptr1[0]*t1)>>32;
|
||||
ptrr[1]=(ptr0[1]*t0+ptr1[1]*t1)>>32;
|
||||
tempgr->npu.x=(tempg0->npu.x*t0+tempg1->npu.x*t1)>>32;
|
||||
tempgr->npu.y=(tempg0->npu.y*t0+tempg1->npu.y*t1)>>32;
|
||||
break;
|
||||
case SPT_BSPLINE2:
|
||||
case SPT_BSPLINE3:
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
p0=&tempg0->y1;
|
||||
p1=&tempg1->y1;
|
||||
pr=&tempgr->y1;
|
||||
for (i=0;i<tempg0->num;i++) {
|
||||
p0=&tempg0->nu.u;
|
||||
p1=&tempg1->nu.u;
|
||||
pr=&tempgr->nu.u;
|
||||
for (i=0;i<tempg0->nu.num;i++) {
|
||||
pr[i].x=(p0[i].x*t0+p1[i].x*t1)>>32;
|
||||
pr[i].y=(p0[i].y*t0+p1[i].y*t1)>>32;
|
||||
pr[i].z=(p0[i].z*t0+p1[i].z*t1)>>32;
|
||||
}
|
||||
break;
|
||||
case SPT_MESH:
|
||||
p0=&tempg0->x2;
|
||||
p1=&tempg1->x2;
|
||||
pr=&tempgr->x2;
|
||||
for (i=0;i<tempg0->vertex_cnt;i++) {
|
||||
p0=&tempg0->mu.u;
|
||||
p1=&tempg1->mu.u;
|
||||
pr=&tempgr->mu.u;
|
||||
for (i=0;i<tempg0->mu.vertex_cnt;i++) {
|
||||
pr[i].x=(p0[i].x*t0+p1[i].x*t1)>>32;
|
||||
pr[i].y=(p0[i].y*t0+p1[i].y*t1)>>32;
|
||||
pr[i].z=(p0[i].z*t0+p1[i].z*t1)>>32;
|
||||
}
|
||||
break;
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
p0=(&tempg0->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
p1=(&tempg1->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
pr=(&tempgr->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
for (i=0;i<tempg0->shiftable_vertex_cnt;i++) {
|
||||
p0=&tempg0->pmu.u;
|
||||
p1=&tempg1->pmu.u;
|
||||
pr=&tempgr->pmu.u;
|
||||
for (i=0;i<tempg0->pmu.vertex_cnt;i++) {
|
||||
pr[i].x=(p0[i].x*t0+p1[i].x*t1)>>32;
|
||||
pr[i].y=(p0[i].y*t0+p1[i].y*t1)>>32;
|
||||
pr[i].z=(p0[i].z*t0+p1[i].z*t1)>>32;
|
||||
|
||||
+12
-11
@@ -5,7 +5,7 @@ asm {
|
||||
USE64
|
||||
//************************************
|
||||
_TEXT_CHAR:://Bool TextChar(CTask *task,Bool allow_border=FALSE,I64 x,I64 y,I64 d);
|
||||
//Must be called 60fps in Fs->draw_it() callback.
|
||||
//Must be called 30fps in Fs->draw_it() callback.
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
MOV RCX,U64 SF_ARG1[RBP]
|
||||
@@ -82,7 +82,7 @@ _TEXT_CHAR:://Bool TextChar(CTask *task,Bool allow_border=FALSE,I64 x,I64 y,I64
|
||||
RET1 40
|
||||
//************************************
|
||||
_TEXT_LEN_STR:://Bool TextLenStr(CTask *task,I64 x,I64 y,I64 len,I64 attr,U8 *s)
|
||||
//Must be called 60fps in Fs->draw_it() callback.
|
||||
//Must be called 30fps in Fs->draw_it() callback.
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
PUSH RSI
|
||||
@@ -157,7 +157,7 @@ _TEXT_LEN_STR:://Bool TextLenStr(CTask *task,I64 x,I64 y,I64 len,I64 attr,U8 *s)
|
||||
RET1 48
|
||||
//************************************
|
||||
_TEXT_LEN_ATTR_STR:://Bool TextLenAttrStr(CTask *task,I64 x,I64 y,I64 len,U32 *_attr)
|
||||
//Must be called 60fps in Fs->draw_it() callback.
|
||||
//Must be called 30fps in Fs->draw_it() callback.
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
PUSH RSI
|
||||
@@ -232,7 +232,7 @@ _TEXT_LEN_ATTR_STR:://Bool TextLenAttrStr(CTask *task,I64 x,I64 y,I64 len,U32 *_
|
||||
RET1 40
|
||||
//************************************
|
||||
_TEXT_LEN_ATTR:://Bool TextLenAttr(CTask *task,I64 x,I64 y,I64 len,I64 attr)
|
||||
//Must be called 60fps in Fs->draw_it() callback.
|
||||
//Must be called 30fps in Fs->draw_it() callback.
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
PUSH RSI
|
||||
@@ -307,13 +307,13 @@ _TEXT_LEN_ATTR:://Bool TextLenAttr(CTask *task,I64 x,I64 y,I64 len,I64 attr)
|
||||
POP RBP
|
||||
RET1 40
|
||||
}
|
||||
public _extern _TEXT_CHAR Bool TextChar(CTask *task,Bool allow_border=FALSE,I64 x,I64 y,I64 d); //Plot char. Must be called 60fps in Fs->draw_it() callback.
|
||||
public _extern _TEXT_LEN_STR Bool TextLenStr(CTask *task,I64 x,I64 y,I64 len,I64 attr,U8 *s); //Plot str with len. Must be called 60fps in Fs->draw_it() callback.
|
||||
public _extern _TEXT_LEN_ATTR_STR Bool TextLenAttrStr(CTask *task,I64 x,I64 y,I64 len,U32 *_attr); //Plot attr str with len. Must be called 60fps in Fs->draw_it() callback.
|
||||
public _extern _TEXT_LEN_ATTR Bool TextLenAttr(CTask *task,I64 x,I64 y,I64 len,I64 attr); //Plot attrs with len. Must be called 60fps in Fs->draw_it() callback.
|
||||
public _extern _TEXT_CHAR Bool TextChar(CTask *task,Bool allow_border=FALSE,I64 x,I64 y,I64 d); //Plot char. Must be called 30fps in Fs->draw_it() callback.
|
||||
public _extern _TEXT_LEN_STR Bool TextLenStr(CTask *task,I64 x,I64 y,I64 len,I64 attr,U8 *s); //Plot str with len. Must be called 30fps in Fs->draw_it() callback.
|
||||
public _extern _TEXT_LEN_ATTR_STR Bool TextLenAttrStr(CTask *task,I64 x,I64 y,I64 len,U32 *_attr); //Plot attr str with len. Must be called 30fps in Fs->draw_it() callback.
|
||||
public _extern _TEXT_LEN_ATTR Bool TextLenAttr(CTask *task,I64 x,I64 y,I64 len,I64 attr); //Plot attrs with len. Must be called 30fps in Fs->draw_it() callback.
|
||||
|
||||
public U0 TextPrint(CTask *task,I64 x,I64 y,I64 attr,U8 *fmt,...)
|
||||
{//Plot chars. Must be called 60fps in Fs->draw_it() callback.
|
||||
{//Plot chars. Must be called 30fps in Fs->draw_it() callback.
|
||||
//You probably want $LK,"GrPrint",A="MN:GrPrint"$() or just $LK,"Print",A="MN:Print"$().
|
||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
||||
TextLenStr(task,x,y,StrLen(buf),attr<<8,buf);
|
||||
@@ -321,7 +321,7 @@ public U0 TextPrint(CTask *task,I64 x,I64 y,I64 attr,U8 *fmt,...)
|
||||
}
|
||||
|
||||
public U0 TextBorder(CTask *task=NULL,I64 l,I64 r,I64 t,I64 b,I64 attr,Bool solid)
|
||||
{//Plot border square. Must be called 60fps in Fs->draw_it() callback.
|
||||
{//Plot border square. Must be called 30fps in Fs->draw_it() callback.
|
||||
//Draws window borders or DolDoc text button borders.
|
||||
//Set task=sys_winmgr_task for no clipping.
|
||||
I64 i;
|
||||
@@ -357,7 +357,7 @@ public U0 TextBorder(CTask *task=NULL,I64 l,I64 r,I64 t,I64 b,I64 attr,Bool soli
|
||||
}
|
||||
|
||||
public U0 TextRect(I64 l,I64 r,I64 t,I64 b,I64 d)
|
||||
{//Fill text rect. Must be called 60fps in Fs->draw_it() callback.
|
||||
{//Fill text rect. Must be called 30fps in Fs->draw_it() callback.
|
||||
I64 y,w;
|
||||
if (l>r || t>b) return;
|
||||
if (t<0) t=0;
|
||||
@@ -368,3 +368,4 @@ public U0 TextRect(I64 l,I64 r,I64 t,I64 b,I64 d)
|
||||
for (y=t;y<=b;y++)
|
||||
MemSetU32(gr.text_base(U8 *)+(y*TEXT_COLS+l)*sizeof(U32),d,w);
|
||||
}
|
||||
|
||||
+38
-35
@@ -85,8 +85,8 @@ I64 PopUpSpriteBitMap(CColorROPU32 color,I64 width)
|
||||
"\n$$MU-UL,\"Undo\",LE=GBM_UNDO$$\n"
|
||||
"\n$$PURPLE$$$$MU-UL,\"+] Sprite Main Menu\",LE=GBM_MAIN_MENU$$$$LTBLUE$$\n"
|
||||
"$$MU-UL,\"Exit Sprite\",LE=GBM_EXIT$$\n"
|
||||
"$$MU-UL,\"Abort Sprite\",LE=DOCM_CANCEL$$\n",st1,st2,width);
|
||||
DocPrint(doc,"\nRight-Click to get back to this menu.");
|
||||
"$$MU-UL,\"Abort Sprite\",LE=DOCM_CANCEL$$\n"
|
||||
"\nRight-Click to get back to this menu.",st1,st2,width);
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
return i;
|
||||
@@ -224,12 +224,21 @@ I64 SpriteBitMapEd(CDoc *,CDocEntry *doc_e,CDC *dc,I64 *_xx1,I64 *_yy1,I64 *_xx2
|
||||
1<<MSG_IP_MOVE|1<<MSG_KEY_DOWN)) {
|
||||
switch (msg_code) {
|
||||
case MSG_KEY_DOWN:
|
||||
if (a1==CH_SHIFT_ESC) {
|
||||
result=GE_ABORT;
|
||||
goto bm_key_up_done;
|
||||
} else if (a1==CH_ESC) {
|
||||
result=GE_CONT;
|
||||
goto bm_key_up_done;
|
||||
switch (a1) {
|
||||
case CH_SHIFT_ESC:
|
||||
result=GE_ABORT;
|
||||
goto bm_key_up_done;
|
||||
case CH_ESC:
|
||||
result=GE_CONT;
|
||||
goto bm_key_up_done;
|
||||
case 'c': //eye-dropper
|
||||
dc2=DCCaptureScreen(FALSE);
|
||||
color=GrPeek(dc2,ip.pos.x,ip.pos.y)^15;//Mouse cursor is XORed.
|
||||
DCDel(dc2);
|
||||
break;
|
||||
case 't': //Set to transparent color
|
||||
color=TRANSPARENT;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -291,7 +300,7 @@ bm_menu:
|
||||
case GBM_SAVE_BMP:
|
||||
*filename.name=0;
|
||||
if (DocFormDo(&filename) && *filename.name)
|
||||
BMPFileWrite(filename.name,img);
|
||||
BMPWrite(filename.name,img);
|
||||
goto bm_menu;
|
||||
|
||||
case GBM_SAVE_GRA:
|
||||
@@ -363,38 +372,32 @@ bm_menu:
|
||||
GrPlot3(img,a1-xx1,a2-yy1,0);
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
break;
|
||||
case GBM_LINE:
|
||||
case GBM_ARROW:
|
||||
case GBM_RECT:
|
||||
case GBM_CIRCLE:
|
||||
case GBM_COPY:
|
||||
case GBM_DELETE:
|
||||
sub_switch_start:
|
||||
if (down)
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
x1=a1; y1=a2;
|
||||
down=TRUE;
|
||||
dc->color=color;
|
||||
dc->pen_width=width;
|
||||
switch (mode) {
|
||||
case GBM_LINE:
|
||||
GrLine3(dc,x1,y1,0,a1,a2,0);
|
||||
break;
|
||||
case GBM_ARROW:
|
||||
GrArrow3(dc,x1,y1,0,a1,a2,0);
|
||||
break;
|
||||
case GBM_RECT:
|
||||
GrRect(dc,x1,y1,1,1);
|
||||
break;
|
||||
case GBM_CIRCLE:
|
||||
GrCircle3(dc,x1,y1,0,1);
|
||||
break;
|
||||
case GBM_COPY:
|
||||
case GBM_DELETE:
|
||||
dc->color=ROPF_DITHER+WHITE<<16+BLACK;
|
||||
dc->pen_width=1;
|
||||
GrBorder(dc,x1,y1,x1,y1);
|
||||
break;
|
||||
}
|
||||
case GBM_LINE:
|
||||
GrLine3(dc,x1,y1,0,a1,a2,0);
|
||||
break;
|
||||
case GBM_ARROW:
|
||||
GrArrow3(dc,x1,y1,0,a1,a2,0);
|
||||
break;
|
||||
case GBM_RECT:
|
||||
GrRect(dc,x1,y1,1,1);
|
||||
break;
|
||||
case GBM_CIRCLE:
|
||||
GrCircle3(dc,x1,y1,0,1);
|
||||
break;
|
||||
case GBM_COPY:
|
||||
case GBM_DELETE:
|
||||
dc->color=ROPF_DITHER+WHITE<<16+BLACK;
|
||||
dc->pen_width=1;
|
||||
GrBorder(dc,x1,y1,x1,y1);
|
||||
break;
|
||||
sub_switch_end:
|
||||
break;
|
||||
case GBM_PASTE:
|
||||
case GBM_PASTE_TRANSPARENT:
|
||||
|
||||
+92
-100
@@ -12,11 +12,11 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
switch (tempg->type) {
|
||||
case SPT_COLOR:
|
||||
DocPrint(doc,"{%s}",
|
||||
Color2Str(buf1,tempg->color));
|
||||
Color2Str(buf1,tempg->c.color));
|
||||
break;
|
||||
case SPT_DITHER_COLOR:
|
||||
DocPrint(doc,"{%s}",
|
||||
Color2Str(buf2,ROPF_DITHER|tempg->dither_color.u8[0]|tempg->dither_color.u8[1]<<COLORROP_BITS));
|
||||
Color2Str(buf2,ROPF_DITHER|tempg->d.dither_color.u8[0]|tempg->d.dither_color.u8[1]<<COLORROP_BITS));
|
||||
break;
|
||||
case SPT_TRANSFORM_ON:
|
||||
DocPrint(doc,"{ON}");
|
||||
@@ -27,55 +27,53 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
case SPT_LINE:
|
||||
case SPT_ARROW:
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
DocPrint(doc,"{(%d,%d),(%d,%d)}",tempg->x1,tempg->y1,tempg->x2,tempg->y2);
|
||||
DocPrint(doc,"{(%d,%d),(%d,%d)}",tempg->pp.x1,tempg->pp.y1,tempg->pp.x2,tempg->pp.y2);
|
||||
break;
|
||||
case SPT_RECT:
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d)}",tempg->x1,tempg->y1,
|
||||
tempg->x2-tempg->x1,tempg->y2-tempg->y1);
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d)}",tempg->pp.x1,tempg->pp.y1,
|
||||
tempg->pp.x2-tempg->pp.x1,tempg->pp.y2-tempg->pp.y1);
|
||||
break;
|
||||
case SPT_ROTATED_RECT:
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d),%0.4f}",tempg->x1,tempg->y1,
|
||||
tempg->x2-tempg->x1,tempg->y2-tempg->y1,
|
||||
180/ã*Wrap(tempg->rot_angle));
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d),%0.4f}",tempg->ppa.x1,tempg->ppa.y1,
|
||||
tempg->ppa.x2-tempg->ppa.x1,tempg->ppa.y2-tempg->ppa.y1,
|
||||
180/ã*Wrap(tempg->ppa.angle));
|
||||
break;
|
||||
case SPT_PT:
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_SHIFT:
|
||||
DocPrint(doc,"{(%d,%d)}",tempg->x1,tempg->y1);
|
||||
DocPrint(doc,"{(%d,%d)}",tempg->p.x1,tempg->p.y1);
|
||||
break;
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
DocPrint(doc,"{(%d,%d),TRUE}",tempg->x1,tempg->y1);
|
||||
DocPrint(doc,"{(%d,%d),TRUE}",tempg->p.x1,tempg->p.y1);
|
||||
break;
|
||||
case SPT_CIRCLE:
|
||||
DocPrint(doc,"{(%d,%d):%d}",tempg->x1,tempg->y1,tempg->x2);
|
||||
DocPrint(doc,"{(%d,%d):%d}",tempg->pr.x1,tempg->pr.y1,tempg->pr.radius);
|
||||
break;
|
||||
case SPT_WIDTH:
|
||||
DocPrint(doc,"{%d}",tempg->width);
|
||||
DocPrint(doc,"{%d}",tempg->w.width);
|
||||
break;
|
||||
case SPT_ELLIPSE:
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d),%0.4f}",tempg->x2,tempg->y2,
|
||||
tempg->width,tempg->height,180/ã*Wrap(tempg->rot_angle));
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d),%0.4f}",tempg->pwha.x1,tempg->pwha.y1,
|
||||
tempg->pwha.width,tempg->pwha.height,180/ã*Wrap(tempg->pwha.angle));
|
||||
break;
|
||||
case SPT_POLYGON:
|
||||
DocPrint(doc,"{%d,(%d,%d):(%d,%d),%0.4f}",tempg->sides,tempg->x2,tempg->y2,
|
||||
tempg->width,tempg->height,180/ã*Wrap(tempg->rot_angle));
|
||||
DocPrint(doc,"{%d,(%d,%d):(%d,%d),%0.4f}",tempg->pwhas.sides,
|
||||
tempg->pwhas.x1,tempg->pwhas.y1,tempg->pwhas.width,tempg->pwhas.height,
|
||||
180/ã*Wrap(tempg->pwhas.angle));
|
||||
break;
|
||||
case SPT_TEXT:
|
||||
case SPT_TEXT_BOX:
|
||||
case SPT_TEXT_DIAMOND:
|
||||
DocPrint(doc,"{(%d,%d),\"%Q\"}",tempg->x1,tempg->y1,tempg->st);
|
||||
DocPrint(doc,"{(%d,%d),\"%Q\"}",tempg->ps.x1,tempg->ps.y1,tempg->ps.st);
|
||||
break;
|
||||
case SPT_POLYLINE:
|
||||
ptr=&tempg->y1;
|
||||
DocPrint(doc,"{(%d,%d)",ptr[0],ptr[1]);
|
||||
if (tempg->num>1) DocPrint(doc,",");
|
||||
ptr+=2;
|
||||
for (i=1;i<tempg->num;i++) {
|
||||
ptr=&tempg->nu.u;
|
||||
DocPrint(doc,"{");
|
||||
for (i=0;i<tempg->nu.num;i++,ptr+=2) {
|
||||
DocPrint(doc,"(%d,%d)",ptr[0],ptr[1]);
|
||||
if (i+1<tempg->num) DocPrint(doc,",");
|
||||
if (i&3==3 && i+1<tempg->num)
|
||||
if (i+1<tempg->nu.num) DocPrint(doc,",");
|
||||
if (i&3==3 && i+1<tempg->nu.num)
|
||||
DocPrint(doc,"\n");
|
||||
ptr+=2;
|
||||
}
|
||||
DocPrint(doc,"}");
|
||||
break;
|
||||
@@ -83,14 +81,12 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
case SPT_BSPLINE3:
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
ptr=&tempg->y1;
|
||||
DocPrint(doc,"{(%d,%d,%d)",ptr[0],ptr[1],ptr[2]);
|
||||
ptr+=3;
|
||||
if (tempg->num>1) DocPrint(doc,",");
|
||||
for (i=1;i<tempg->num;i++,ptr+=3) {
|
||||
ptr=&tempg->nu.u;
|
||||
DocPrint(doc,"{");
|
||||
for (i=0;i<tempg->nu.num;i++,ptr+=3) {
|
||||
DocPrint(doc,"(%d,%d,%d)",ptr[0],ptr[1],ptr[2]);
|
||||
if (i+1<tempg->num) DocPrint(doc,",");
|
||||
if (i&3==3 && i+1<tempg->num)
|
||||
if (i+1<tempg->nu.num) DocPrint(doc,",");
|
||||
if (i&3==3 && i+1<tempg->nu.num)
|
||||
DocPrint(doc,"\n");
|
||||
}
|
||||
if (tempg->type==SPT_BSPLINE2||tempg->type==SPT_BSPLINE3)
|
||||
@@ -99,13 +95,12 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
DocPrint(doc,",TRUE}");
|
||||
break;
|
||||
case SPT_POLYPT:
|
||||
ptr=&tempg->y1;
|
||||
DocPrint(doc,"{(%d,%d),",ptr[0],ptr[1]);
|
||||
ptr+=2;
|
||||
DocPrint(doc,"{(%d,%d),",tempg->npu.x,tempg->npu.y);
|
||||
ptr=&tempg->npu.u;
|
||||
col=16;
|
||||
for (i=0;i<tempg->num;i++) {
|
||||
for (i=0;i<tempg->npu.num;i++) {
|
||||
DocPrint(doc,"%d",BFieldExtU32(ptr,i*3,3));
|
||||
if (++col>=64 && i+1<tempg->num) {
|
||||
if (++col>=64 && i+1<tempg->npu.num) {
|
||||
DocPrint(doc,"\n");
|
||||
col=0;
|
||||
}
|
||||
@@ -113,23 +108,24 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
DocPrint(doc,"}");
|
||||
break;
|
||||
case SPT_BITMAP:
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d),\n",tempg->x2,tempg->y2,tempg->width,tempg->height);
|
||||
width_internal=(tempg->width+7)&~7;
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d),\n",tempg->pwhu.x1,tempg->pwhu.y1,
|
||||
tempg->pwhu.width,tempg->pwhu.height);
|
||||
width_internal=(tempg->pwhu.width+7)&~7;
|
||||
if (width_internal<80)
|
||||
k=width_internal;
|
||||
else
|
||||
k=64;
|
||||
ptr=tempg(U8 *)+offset(CSprite.linespeed);
|
||||
ptr=&tempg->pwhu.u;
|
||||
col=0;
|
||||
for (j=0;j<tempg->height;j++)
|
||||
for (j=0;j<tempg->pwhu.height;j++)
|
||||
for (i=0;i<width_internal;i++,ptr(U8 *)++) {
|
||||
if (i>=tempg->width)
|
||||
if (i>=tempg->pwhu.width)
|
||||
DocPrint(doc,"_");
|
||||
else if (*ptr(U8 *)<16)
|
||||
DocPrint(doc,"%X",*ptr(U8 *));
|
||||
else
|
||||
DocPrint(doc,"%c",CH_SHIFT_SPACE);
|
||||
if (++col>=k && (i+1<width_internal||j+1<tempg->height)) {
|
||||
if (++col>=k && (i+1<width_internal||j+1<tempg->pwhu.height)) {
|
||||
DocPrint(doc,"\n");
|
||||
col=0;
|
||||
}
|
||||
@@ -138,11 +134,11 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
break;
|
||||
case SPT_MESH:
|
||||
DocPrint(doc,"{FALSE,");
|
||||
p=(&tempg->tri_cnt)(U8 *)+sizeof(I32);
|
||||
p=&tempg->mu.u;
|
||||
col=0;
|
||||
for (i=0;i<tempg->vertex_cnt;i++,p++) {
|
||||
for (i=0;i<tempg->mu.vertex_cnt;i++,p++) {
|
||||
DocPrint(doc,"(%d,%d,%d)",p->x,p->y,p->z);
|
||||
if (i+1<tempg->vertex_cnt) DocPrint(doc,",");
|
||||
if (i+1<tempg->mu.vertex_cnt) DocPrint(doc,",");
|
||||
if (++col==4) {
|
||||
DocPrint(doc,"\t//%d\n",i);
|
||||
col=0;
|
||||
@@ -150,11 +146,11 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
}
|
||||
DocPrint(doc,":");
|
||||
tri=p;
|
||||
for (i=0;i<tempg->tri_cnt;i++,tri++) {
|
||||
for (i=0;i<tempg->mu.tri_cnt;i++,tri++) {
|
||||
DocPrint(doc,"(%s,%d,%d,%d)",Color2Str(buf1,tri->color),
|
||||
tri->nums[0],tri->nums[1],tri->nums[2]);
|
||||
if (i+1<tempg->tri_cnt) DocPrint(doc,",");
|
||||
if (++col>=3 && i+1<tempg->tri_cnt) {
|
||||
if (i+1<tempg->mu.tri_cnt) DocPrint(doc,",");
|
||||
if (++col>=3 && i+1<tempg->mu.tri_cnt) {
|
||||
DocPrint(doc,"\n");
|
||||
col=0;
|
||||
}
|
||||
@@ -162,12 +158,12 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
DocPrint(doc,"}");
|
||||
break;
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
DocPrint(doc,"{TRUE,(%d,%d,%d):",tempg->x1,tempg->y1,tempg->z1);
|
||||
p=(&tempg->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
DocPrint(doc,"{TRUE,(%d,%d,%d):",tempg->pmu.x,tempg->pmu.y,tempg->pmu.z);
|
||||
p=&tempg->pmu.u;
|
||||
col=1;
|
||||
for (i=0;i<tempg->shiftable_vertex_cnt;i++,p++) {
|
||||
for (i=0;i<tempg->pmu.vertex_cnt;i++,p++) {
|
||||
DocPrint(doc,"(%d,%d,%d)",p->x,p->y,p->z);
|
||||
if (i+1<tempg->shiftable_vertex_cnt) DocPrint(doc,",");
|
||||
if (i+1<tempg->pmu.vertex_cnt) DocPrint(doc,",");
|
||||
if (++col==4) {
|
||||
DocPrint(doc,"\t//%d\n",i);
|
||||
col=0;
|
||||
@@ -175,11 +171,11 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
}
|
||||
DocPrint(doc,":");
|
||||
tri=p;
|
||||
for (i=0;i<tempg->shiftable_tri_cnt;i++,tri++) {
|
||||
for (i=0;i<tempg->pmu.tri_cnt;i++,tri++) {
|
||||
DocPrint(doc,"(%s,%d,%d,%d)",Color2Str(buf1,tri->color),
|
||||
tri->nums[0],tri->nums[1],tri->nums[2]);
|
||||
if (i+1<tempg->shiftable_tri_cnt) DocPrint(doc,",");
|
||||
if (++col>=3 && i+1<tempg->shiftable_tri_cnt) {
|
||||
if (i+1<tempg->pmu.tri_cnt) DocPrint(doc,",");
|
||||
if (++col>=3 && i+1<tempg->pmu.tri_cnt) {
|
||||
DocPrint(doc,"\n");
|
||||
col=0;
|
||||
}
|
||||
@@ -217,9 +213,9 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
color=Str2ColorU32(st);
|
||||
Free(st);
|
||||
Lex(lx); //Skip color
|
||||
g.color=color.c0.color;
|
||||
g.c.color=color.c0.color;
|
||||
if (color&ROPF_DITHER) {
|
||||
g.dither_color.u8[1]=color.c1.color;
|
||||
g.d.dither_color.u8[1]=color.c1.color;
|
||||
g.type=SPT_DITHER_COLOR;
|
||||
} else
|
||||
g.type=SPT_COLOR;
|
||||
@@ -237,25 +233,25 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
Lex(lx); //Skip {
|
||||
g.type=type;
|
||||
LexD2I32(lx,&g.x1);
|
||||
LexD2I32(lx,&g.pp.x1);
|
||||
if (lx->token!=',')
|
||||
LexExcept(lx,"expecting ',' at ");
|
||||
Lex(lx); //Skip ,
|
||||
LexD2I32(lx,&g.x2);
|
||||
LexD2I32(lx,&g.pp.x2);
|
||||
break;
|
||||
case SPT_RECT:
|
||||
case SPT_ROTATED_RECT:
|
||||
Lex(lx); //Skip {
|
||||
LexD2I32(lx,&g.x1);
|
||||
LexD2I32(lx,&g.pp.x1);
|
||||
if (lx->token!=':')
|
||||
LexExcept(lx,"expecting ':' at ");
|
||||
Lex(lx); //Skip :
|
||||
LexD2I32(lx,&g.x2);
|
||||
g.x2+=g.x1;
|
||||
g.y2+=g.y1;
|
||||
LexD2I32(lx,&g.pp.x2);
|
||||
g.ppa.x2+=g.pp.x1;
|
||||
g.ppa.y2+=g.pp.y1;
|
||||
if (lx->token==',') {
|
||||
Lex(lx); //Skip ,
|
||||
g.rot_angle=ã/180*LexExpressionF64(lx);
|
||||
g.ppa.angle=ã/180*LexExpressionF64(lx);
|
||||
g.type=SPT_ROTATED_RECT;
|
||||
} else
|
||||
g.type=SPT_RECT;
|
||||
@@ -264,12 +260,12 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
case SPT_SHIFT:
|
||||
Lex(lx); //Skip {
|
||||
g.type=type;
|
||||
LexD2I32(lx,&g.x1);
|
||||
LexD2I32(lx,&g.p.x1);
|
||||
break;
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
Lex(lx); //Skip {
|
||||
LexD2I32(lx,&g.x1);
|
||||
LexD2I32(lx,&g.p.x1);
|
||||
if (lx->token==',') {
|
||||
Lex(lx); //Skip ,
|
||||
i=LexExpressionI64(lx);
|
||||
@@ -282,36 +278,35 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
break;
|
||||
case SPT_WIDTH:
|
||||
Lex(lx); //Skip {
|
||||
g.width=LexExpressionI64(lx);
|
||||
g.w.width=LexExpressionI64(lx);
|
||||
g.type=SPT_WIDTH;
|
||||
break;
|
||||
case SPT_CIRCLE:
|
||||
Lex(lx); //Skip {
|
||||
g.type=SPT_CIRCLE;
|
||||
LexD2I32(lx,&g.x1);
|
||||
LexD2I32(lx,&g.pr.x1);
|
||||
if (lx->token!=':')
|
||||
LexExcept(lx,"expecting ':' at ");
|
||||
Lex(lx); //Skip :
|
||||
g.x2=LexExpressionI64(lx);
|
||||
g.pr.radius=LexExpressionI64(lx);
|
||||
break;
|
||||
case SPT_POLYGON:
|
||||
Lex(lx); //Skip {
|
||||
g.sides=LexExpressionI64(lx);
|
||||
g.pwhas.sides=LexExpressionI64(lx);
|
||||
if (lx->token!=',')
|
||||
LexExcept(lx,"expecting ',' at ");
|
||||
Lex(lx); //Skip ,
|
||||
case SPT_ELLIPSE:
|
||||
Lex(lx); //Skip {
|
||||
g.type=type;
|
||||
LexD2I32(lx,&g.x2);
|
||||
LexD2I32(lx,&g.pwha.x1);
|
||||
if (lx->token!=':')
|
||||
LexExcept(lx,"expecting ':' at ");
|
||||
Lex(lx); //Skip :
|
||||
LexD2I32(lx,&g.width);
|
||||
LexD2I32(lx,&g.pwha.width);
|
||||
if (lx->token!=',')
|
||||
LexExcept(lx,"expecting ',' at ");
|
||||
Lex(lx); //Skip ,
|
||||
g.rot_angle=ã/180*LexExpressionF64(lx);
|
||||
g.pwha.angle=ã/180*LexExpressionF64(lx);
|
||||
break;
|
||||
sub_switch_end:
|
||||
size=SpriteElemSize(&g)+offset(CSprite.start);
|
||||
@@ -323,7 +318,7 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
case SPT_TEXT_DIAMOND:
|
||||
Lex(lx); //Skip {
|
||||
g.type=type;
|
||||
LexD2I32(lx,&g.x1);
|
||||
LexD2I32(lx,&g.ps.x1);
|
||||
if (lx->token!=',')
|
||||
LexExcept(lx,"expecting ',' at ");
|
||||
if (Lex(lx)==TK_STR) //Skip ,
|
||||
@@ -345,17 +340,16 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
tempp=CAlloc(sizeof(CQueD3I32));
|
||||
LexD2I32(lx,&tempp->p);
|
||||
QueIns(tempp,rootp.last);
|
||||
g.num++;
|
||||
g.nu.num++;
|
||||
if (lx->token==',')
|
||||
Lex(lx); //Skip ,
|
||||
}
|
||||
if (!g.num)
|
||||
if (g.nu.num<2)
|
||||
LexExcept(lx,"expecting point at ");
|
||||
size=SpriteElemQuedBaseSize(SPT_POLYLINE);
|
||||
i=g.num*sizeof(CD2I32);
|
||||
result=MAlloc(size+i);
|
||||
result=MAlloc(size+g.nu.num*sizeof(CD2I32));
|
||||
MemCpy(result,&g,size);
|
||||
ptr=&result->y1;
|
||||
ptr=&result->nu.u;
|
||||
tempp=rootp.next;
|
||||
while (tempp!=&rootp) {
|
||||
tempa1=tempp->next;
|
||||
@@ -375,15 +369,14 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
tempp=CAlloc(sizeof(CQueD3I32));
|
||||
LexD3I32(lx,&tempp->p);
|
||||
QueIns(tempp,rootp.last);
|
||||
g.num++;
|
||||
g.nu.num++;
|
||||
if (lx->token==',')
|
||||
Lex(lx); //Skip ,
|
||||
}
|
||||
if (!g.num)
|
||||
if (g.nu.num<2)
|
||||
LexExcept(lx,"expecting point at ");
|
||||
size=SpriteElemQuedBaseSize(type);
|
||||
i=g.num*sizeof(CD3I32);
|
||||
result=MAlloc(size+i);
|
||||
result=MAlloc(size+g.nu.num*sizeof(CD3I32));
|
||||
if (LexExpressionI64(lx)) {
|
||||
if (type==SPT_BSPLINE2||type==SPT_BSPLINE2_CLOSED)
|
||||
g.type=SPT_BSPLINE2_CLOSED;
|
||||
@@ -396,7 +389,7 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
g.type=SPT_BSPLINE3;
|
||||
}
|
||||
MemCpy(result,&g,size);
|
||||
ptr=&result->y1;
|
||||
ptr=&result->nu.u;
|
||||
tempp=rootp.next;
|
||||
while (tempp!=&rootp) {
|
||||
tempa1=tempp->next;
|
||||
@@ -408,7 +401,7 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
break;
|
||||
case SPT_POLYPT:
|
||||
Lex(lx); //Skip {
|
||||
LexD2I32(lx,&g.y1);
|
||||
LexD2I32(lx,&g.npu.x);
|
||||
if (lx->token!=',')
|
||||
LexExcept(lx,"expecting ',' at ");
|
||||
tempv=QueVectU8New;
|
||||
@@ -418,27 +411,26 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
if (i=='}')
|
||||
break;
|
||||
if ('0'<=i<='7')
|
||||
QueVectU8Put(tempv,g.num++,i-'0');
|
||||
QueVectU8Put(tempv,g.npu.num++,i-'0');
|
||||
}
|
||||
Bts(&lx->flags,Lf_USE_LAST_U16);
|
||||
Lex(lx); //Load '}'
|
||||
g.type=SPT_POLYPT;
|
||||
size=SpriteElemQuedBaseSize(SPT_POLYPT);
|
||||
i=(g.num*3+7)>>3;
|
||||
result=CAlloc(size+i);
|
||||
result=CAlloc(size+(g.npu.num*3+7)>>3);
|
||||
MemCpy(result,&g,size);
|
||||
ptr=&result->y2;
|
||||
for (i=0;i<g.num;i++)
|
||||
ptr=&result->npu.u;
|
||||
for (i=0;i<g.npu.num;i++)
|
||||
BFieldOrU32(ptr,i*3,QueVectU8Get(tempv,i));
|
||||
QueVectU8Del(tempv);
|
||||
break;
|
||||
case SPT_BITMAP:
|
||||
Lex(lx); //Skip {
|
||||
LexD2I32(lx,&g.x2);
|
||||
LexD2I32(lx,&g.pwhu.x1);
|
||||
if (lx->token!=':')
|
||||
LexExcept(lx,"expecting ':' at ");
|
||||
Lex(lx); //Skip :
|
||||
LexD2I32(lx,&g.width);
|
||||
LexD2I32(lx,&g.pwhu.width);
|
||||
if (lx->token!=',')
|
||||
LexExcept(lx,"expecting ',' at ");
|
||||
tempv=QueVectU8New;
|
||||
@@ -463,7 +455,7 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
size=SpriteElemQuedBaseSize(SPT_BITMAP);
|
||||
result=CAlloc(size+num1);
|
||||
MemCpy(result,&g,size);
|
||||
ptr=&result->linespeed;
|
||||
ptr=&result->pwhu.u;
|
||||
for (i=0;i<num1;i++)
|
||||
*ptr++=QueVectU8Get(tempv,i);
|
||||
QueVectU8Del(tempv);
|
||||
@@ -476,7 +468,7 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
if (lx->token!=',')
|
||||
LexExcept(lx,"expecting ',' at ");
|
||||
Lex(lx); //Skip ,
|
||||
LexD3I32(lx,&g.x1);
|
||||
LexD3I32(lx,&g.pmu.x);
|
||||
if (lx->token!=':')
|
||||
LexExcept(lx,"expecting ':' at ");
|
||||
Lex(lx); //Skip :
|
||||
@@ -528,12 +520,12 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
Lex(lx); //Skip ,
|
||||
}
|
||||
if (g.type==SPT_MESH) {
|
||||
g.vertex_cnt=num1;
|
||||
g.tri_cnt=num2;
|
||||
g.mu.vertex_cnt=num1;
|
||||
g.mu.tri_cnt=num2;
|
||||
size=SpriteElemQuedBaseSize(SPT_MESH);
|
||||
} else {
|
||||
g.shiftable_vertex_cnt=num1;
|
||||
g.shiftable_tri_cnt=num2;
|
||||
g.pmu.vertex_cnt=num1;
|
||||
g.pmu.tri_cnt=num2;
|
||||
}
|
||||
size=SpriteElemQuedBaseSize(g.type);
|
||||
result=MAlloc(size+num1*sizeof(CD3I32)+num2*sizeof(CMeshTri));
|
||||
|
||||
+150
-190
@@ -4,8 +4,8 @@ Bool SpritePolyPtPlot(CSprite *root,I64 x,I64 y,I64)
|
||||
{
|
||||
CSprite *tempg=CAlloc(SpriteElemQuedBaseSize(SPT_PT));
|
||||
tempg->type=SPT_PT;
|
||||
tempg->x1=x;
|
||||
tempg->y1=y;
|
||||
tempg->p.x1=x;
|
||||
tempg->p.y1=y;
|
||||
QueIns(tempg,root->last);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -16,8 +16,8 @@ CSprite *SpriteElemNum2QueEntry(CSprite *root,I64 elem_num,I64 *_x=NULL,I64 *_y=
|
||||
CSprite *result=root->next;
|
||||
while (result!=root && elem_num--) {
|
||||
if (result->type==SPT_SHIFT) {
|
||||
xx+=result->x1;
|
||||
yy+=result->y1;
|
||||
xx+=result->p.x1;
|
||||
yy+=result->p.y1;
|
||||
}
|
||||
result=result->next;
|
||||
}
|
||||
@@ -83,75 +83,60 @@ U0 SpriteSetOrigin(CSprite *root,I64 dx,I64 dy,I64 dz)
|
||||
CSprite *tempg=root->next;
|
||||
while (tempg!=root) {
|
||||
switch (tempg->type) {
|
||||
case SPT_PT:
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
tempg->x1+=dx;
|
||||
tempg->y1+=dy;
|
||||
break;
|
||||
case SPT_ARROW:
|
||||
case SPT_LINE:
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
tempg->x1+=dx;
|
||||
tempg->y1+=dy;
|
||||
tempg->x2+=dx;
|
||||
tempg->y2+=dy;
|
||||
break;
|
||||
case SPT_BITMAP:
|
||||
case SPT_ELLIPSE:
|
||||
case SPT_POLYGON:
|
||||
tempg->x2+=dx;
|
||||
tempg->y2+=dy;
|
||||
break;
|
||||
case SPT_RECT:
|
||||
case SPT_ROTATED_RECT:
|
||||
tempg->x1+=dx;
|
||||
tempg->y1+=dy;
|
||||
tempg->x2+=dx;
|
||||
tempg->y2+=dy;
|
||||
break;
|
||||
tempg->pp.x2+=dx;
|
||||
tempg->pp.y2+=dy;
|
||||
case SPT_PT:
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
case SPT_TEXT:
|
||||
case SPT_TEXT_BOX:
|
||||
case SPT_TEXT_DIAMOND:
|
||||
case SPT_CIRCLE:
|
||||
tempg->x1+=dx;
|
||||
tempg->y1+=dy;
|
||||
case SPT_BITMAP:
|
||||
case SPT_ELLIPSE:
|
||||
case SPT_POLYGON:
|
||||
tempg->p.x1+=dx;
|
||||
tempg->p.y1+=dy;
|
||||
break;
|
||||
case SPT_POLYLINE:
|
||||
ptr=&tempg->y1;
|
||||
for (i=0;i<tempg->num;i++) {
|
||||
ptr=&tempg->nu.u;
|
||||
for (i=0;i<tempg->nu.num;i++) {
|
||||
ptr[i<<1]+=dx;
|
||||
ptr[i<<1+1]+=dy;
|
||||
}
|
||||
break;
|
||||
case SPT_POLYPT:
|
||||
ptr=&tempg->y1;
|
||||
ptr[0]+=dx;
|
||||
ptr[1]+=dy;
|
||||
tempg->npu.x+=dx;
|
||||
tempg->npu.y+=dy;
|
||||
break;
|
||||
case SPT_BSPLINE2:
|
||||
case SPT_BSPLINE3:
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
p=&tempg->y1;
|
||||
for (i=0;i<tempg->num;i++,p++) {
|
||||
p=&tempg->nu.u;
|
||||
for (i=0;i<tempg->nu.num;i++,p++) {
|
||||
p->x+=dx;
|
||||
p->y+=dy;
|
||||
p->z+=dz;
|
||||
}
|
||||
break;
|
||||
case SPT_MESH:
|
||||
p=&tempg->x2;
|
||||
for (i=0;i<tempg->vertex_cnt;i++,p++) {
|
||||
p=&tempg->mu.u;
|
||||
for (i=0;i<tempg->mu.vertex_cnt;i++,p++) {
|
||||
p->x+=dx;
|
||||
p->y+=dy;
|
||||
p->z+=dz;
|
||||
}
|
||||
break;
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
tempg->x1+=dx;
|
||||
tempg->y1+=dy;
|
||||
tempg->z1+=dz;
|
||||
tempg->pmu.x+=dx;
|
||||
tempg->pmu.y+=dy;
|
||||
tempg->pmu.z+=dz;
|
||||
break;
|
||||
}
|
||||
tempg=tempg->next;
|
||||
@@ -161,14 +146,14 @@ U0 SpriteSetOrigin(CSprite *root,I64 dx,I64 dy,I64 dz)
|
||||
CSprite *SpriteTransformCircle(I64 r[4][4],CSprite *tempg)
|
||||
{
|
||||
I64 x,y,z;
|
||||
F64 m1,a1,m2,radius=tempg->x2<<16;
|
||||
F64 m1,a1,m2,radius=tempg->pr.radius<<16;
|
||||
CSprite *tempg1=CAlloc(SpriteElemQuedBaseSize(SPT_ELLIPSE));
|
||||
tempg1->type=SPT_ELLIPSE;
|
||||
|
||||
x=tempg->x1; y=tempg->y1; z=0;
|
||||
x=tempg->pr.x1; y=tempg->pr.y1; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
tempg1->x2=x;
|
||||
tempg1->y2=y;
|
||||
tempg1->pwha.x1=x;
|
||||
tempg1->pwha.y1=y;
|
||||
|
||||
x=radius; y=0; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
@@ -178,9 +163,9 @@ CSprite *SpriteTransformCircle(I64 r[4][4],CSprite *tempg)
|
||||
GrRot(r,&x,&y,&z);
|
||||
m2=Sqrt(x*x+y*y);
|
||||
|
||||
tempg1->width =ToI64(m1)/0x10000;
|
||||
tempg1->height=ToI64(m2)/0x10000;
|
||||
tempg1->rot_angle=-a1;
|
||||
tempg1->pwha.width =ToI64(m1)/0x10000;
|
||||
tempg1->pwha.height=ToI64(m2)/0x10000;
|
||||
tempg1->pwha.angle=-a1;
|
||||
|
||||
return tempg1;
|
||||
}
|
||||
@@ -188,19 +173,20 @@ CSprite *SpriteTransformCircle(I64 r[4][4],CSprite *tempg)
|
||||
CSprite *SpriteTransformEllipse(I64 r[4][4],CSprite *tempg)
|
||||
{
|
||||
I64 x,y,z;
|
||||
F64 m1,a1,m2,a2,s,c,x_radius=tempg->width<<16,y_radius=tempg->height<<16;
|
||||
F64 m1,a1,m2,a2,s,c,x_radius=tempg->pwha.width<<16,
|
||||
y_radius=tempg->pwha.height<<16;
|
||||
CSprite *tempg1=CAlloc(SpriteElemQuedBaseSize(tempg->type));
|
||||
tempg1->type=tempg->type;
|
||||
if (tempg->type==SPT_POLYGON)
|
||||
tempg1->sides=tempg->sides;
|
||||
tempg1->pwhas.sides=tempg->pwhas.sides;
|
||||
|
||||
x=tempg->x2; y=tempg->y2; z=0;
|
||||
x=tempg->pwha.x1; y=tempg->pwha.y1; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
tempg1->x2=x;
|
||||
tempg1->y2=y;
|
||||
tempg1->pwha.x1=x;
|
||||
tempg1->pwha.y1=y;
|
||||
|
||||
c=Cos(-tempg->rot_angle);
|
||||
s=Sin(-tempg->rot_angle);
|
||||
c=Cos(-tempg->pwha.angle);
|
||||
s=Sin(-tempg->pwha.angle);
|
||||
|
||||
x=x_radius*c;
|
||||
y=x_radius*s;
|
||||
@@ -215,11 +201,11 @@ CSprite *SpriteTransformEllipse(I64 r[4][4],CSprite *tempg)
|
||||
R2P(&m2,&a2,x,y);
|
||||
m2*=Abs(Sin(a2-a1));
|
||||
|
||||
tempg1->width=ToI64(m1)/0x10000;
|
||||
if (tempg1->width<1) tempg1->width=1;
|
||||
tempg1->height=ToI64(m2)/0x10000;
|
||||
if (tempg1->height<1) tempg1->height=1;
|
||||
tempg1->rot_angle=-a1;
|
||||
tempg1->pwha.width=ToI64(m1)/0x10000;
|
||||
if (tempg1->pwha.width<1) tempg1->pwha.width=1;
|
||||
tempg1->pwha.height=ToI64(m2)/0x10000;
|
||||
if (tempg1->pwha.height<1) tempg1->pwha.height=1;
|
||||
tempg1->pwha.angle=-a1;
|
||||
|
||||
return tempg1;
|
||||
}
|
||||
@@ -228,15 +214,15 @@ CSprite *SpriteTransformRect(I64 r[4][4],CSprite *tempg,F64
|
||||
{
|
||||
I64 x,y,z,w,h;
|
||||
F64 m1,a1,m2,a2,s,c,
|
||||
x_radius=(tempg->x2-tempg->x1)<<16,
|
||||
y_radius=(tempg->y2-tempg->y1)<<16;
|
||||
x_radius=(tempg->pp.x2-tempg->pp.x1)<<16,
|
||||
y_radius=(tempg->pp.y2-tempg->pp.y1)<<16;
|
||||
CSprite *tempg1=CAlloc(SpriteElemQuedBaseSize(SPT_ROTATED_RECT));
|
||||
tempg1->type=SPT_ROTATED_RECT;
|
||||
|
||||
x=tempg->x1; y=tempg->y1; z=0;
|
||||
x=tempg->pp.x1; y=tempg->pp.y1; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
tempg1->x1=x;
|
||||
tempg1->y1=y;
|
||||
tempg1->ppa.x1=x;
|
||||
tempg1->ppa.y1=y;
|
||||
|
||||
c=Cos(-é);
|
||||
s=Sin(-é);
|
||||
@@ -258,9 +244,9 @@ CSprite *SpriteTransformRect(I64 r[4][4],CSprite *tempg,F64
|
||||
if (w<1) w=1;
|
||||
h=ToI64(m2)/0x10000;
|
||||
if (h<1) h=1;
|
||||
tempg1->x2=tempg1->x1+w;
|
||||
tempg1->y2=tempg1->y1+h;
|
||||
tempg1->rot_angle=-a1;
|
||||
tempg1->ppa.x2=tempg1->ppa.x1+w;
|
||||
tempg1->ppa.y2=tempg1->ppa.y1+h;
|
||||
tempg1->ppa.angle=-a1;
|
||||
|
||||
return tempg1;
|
||||
}
|
||||
@@ -278,7 +264,7 @@ CSprite *SpriteTransformBitmap(I64 r[4][4],CSprite *tempg)
|
||||
miny=maxy=y;
|
||||
minz=maxz=z;
|
||||
|
||||
x=0; y=tempg->height; z=0;
|
||||
x=0; y=tempg->pwhu.height; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
if (x<minx) minx=x;
|
||||
if (x>maxx) maxx=x;
|
||||
@@ -287,7 +273,7 @@ CSprite *SpriteTransformBitmap(I64 r[4][4],CSprite *tempg)
|
||||
if (z<minx) minz=z;
|
||||
if (z>maxx) maxz=z;
|
||||
|
||||
x=tempg->width; y=0; z=0;
|
||||
x=tempg->pwhu.width; y=0; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
if (x<minx) minx=x;
|
||||
if (x>maxx) maxx=x;
|
||||
@@ -296,7 +282,7 @@ CSprite *SpriteTransformBitmap(I64 r[4][4],CSprite *tempg)
|
||||
if (z<minx) minz=z;
|
||||
if (z>maxx) maxz=z;
|
||||
|
||||
x=tempg->width; y=tempg->height; z=0;
|
||||
x=tempg->pwhu.width; y=tempg->pwhu.height; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
if (x<minx) minx=x;
|
||||
if (x>maxx) maxx=x;
|
||||
@@ -308,11 +294,10 @@ CSprite *SpriteTransformBitmap(I64 r[4][4],CSprite *tempg)
|
||||
tempb=DCNew(maxx-minx+1,maxy-miny+1);
|
||||
|
||||
img=CAlloc(sizeof(CDC));
|
||||
img->width=tempg->width;
|
||||
img->width_internal=(tempg->width+7)&~7;
|
||||
img->height=tempg->height;
|
||||
img->body_size=img->width_internal*img->height;
|
||||
img->body=tempg(U8 *)+offset(CSprite.linespeed);
|
||||
img->width=tempg->pwhu.width;
|
||||
img->width_internal=(tempg->pwhu.width+7)&~7;
|
||||
img->height=tempg->pwhu.height;
|
||||
img->body=&tempg->pwhu.u;
|
||||
img->dc_signature=DCS_SIGNATURE_VAL;
|
||||
|
||||
tempb->color=TRANSPARENT;
|
||||
@@ -335,15 +320,15 @@ CSprite *SpriteTransformBitmap(I64 r[4][4],CSprite *tempg)
|
||||
MemCpy(tempg1(U8 *)+offset(CSprite.start),elems,MSize(elems));
|
||||
tempg1->type=tempg->type;
|
||||
|
||||
x=tempg->x2; y=tempg->y2; z=0;
|
||||
x=tempg->pwhu.x1; y=tempg->pwhu.y1; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
tempg1->x2=x;
|
||||
tempg1->y2=y;
|
||||
tempg1->pwhu.x1=x;
|
||||
tempg1->pwhu.y1=y;
|
||||
|
||||
x=0; y=0; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
tempg1->x2+=minx-x;
|
||||
tempg1->y2+=miny-y;
|
||||
tempg1->pwhu.x1+=minx-x;
|
||||
tempg1->pwhu.y1+=miny-y;
|
||||
|
||||
return tempg1;
|
||||
}
|
||||
@@ -358,32 +343,26 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
while (tempg!=root) {
|
||||
switch (tempg->type) {
|
||||
case SPT_WIDTH:
|
||||
// (1.0/Sqrt(3))*65536=37837.22
|
||||
x=37838;y=37838;z=37838;
|
||||
GrRot(r,&x,&y,&z);
|
||||
//scaled 32 bits
|
||||
tempg->width*=Sqrt(x*x+y*y+z*z)/65536;
|
||||
if (tempg->width<0) tempg->width=0;
|
||||
break;
|
||||
case SPT_PT:
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
x=tempg->x1; y=tempg->y1; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
tempg->x1=x;
|
||||
tempg->y1=y;
|
||||
tempg->w.width*=Sqrt(GrRotNormSqr65536(r))/65536;
|
||||
if (tempg->w.width<0) tempg->w.width=0;
|
||||
break;
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
case SPT_ARROW:
|
||||
case SPT_LINE:
|
||||
x=tempg->x1; y=tempg->y1; z=0;
|
||||
x=tempg->pp.x2; y=tempg->pp.y2; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
tempg->x1=x;
|
||||
tempg->y1=y;
|
||||
x=tempg->x2; y=tempg->y2; z=0;
|
||||
tempg->pp.x2=x;
|
||||
tempg->pp.y2=y;
|
||||
case SPT_PT:
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
case SPT_TEXT:
|
||||
case SPT_TEXT_BOX:
|
||||
case SPT_TEXT_DIAMOND:
|
||||
x=tempg->p.x1; y=tempg->p.y1; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
tempg->x2=x;
|
||||
tempg->y2=y;
|
||||
tempg->p.x1=x;
|
||||
tempg->p.y1=y;
|
||||
break;
|
||||
case SPT_BITMAP:
|
||||
tempg1=SpriteTransformBitmap(r,tempg);
|
||||
@@ -393,7 +372,7 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
tempg=tempg1;
|
||||
break;
|
||||
case SPT_ROTATED_RECT:
|
||||
tempg1=SpriteTransformRect(r,tempg,tempg->rot_angle);
|
||||
tempg1=SpriteTransformRect(r,tempg,tempg->ppa.angle);
|
||||
QueIns(tempg1,tempg);
|
||||
QueRem(tempg);
|
||||
Free(tempg);
|
||||
@@ -406,14 +385,6 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
Free(tempg);
|
||||
tempg=tempg1;
|
||||
break;
|
||||
case SPT_TEXT:
|
||||
case SPT_TEXT_BOX:
|
||||
case SPT_TEXT_DIAMOND:
|
||||
x=tempg->x1; y=tempg->y1; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
tempg->x1=x;
|
||||
tempg->y1=y;
|
||||
break;
|
||||
case SPT_CIRCLE:
|
||||
tempg1=SpriteTransformCircle(r,tempg);
|
||||
QueIns(tempg1,tempg);
|
||||
@@ -430,8 +401,8 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
tempg=tempg1;
|
||||
break;
|
||||
case SPT_POLYLINE:
|
||||
ptr=&tempg->y1;
|
||||
for (i=0;i<tempg->num;i++) {
|
||||
ptr=&tempg->nu.u;
|
||||
for (i=0;i<tempg->nu.num;i++) {
|
||||
x=ptr[i<<1]; y=ptr[i<<1+1]; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
ptr[i<<1]=x;
|
||||
@@ -440,12 +411,11 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
break;
|
||||
case SPT_POLYPT:
|
||||
QueInit(&root2);
|
||||
ptr=&tempg->y1;
|
||||
x=ptr[0]; y=ptr[1]; z=0;
|
||||
x=tempg->npu.x; y=tempg->npu.y; z=0;
|
||||
x1=x; y1=y; z1=z; //unrotated cur coordinates
|
||||
GrRot(r,&x,&y,&z);
|
||||
ptr+=2;
|
||||
k=tempg->num*3;
|
||||
ptr=&tempg->npu.u;
|
||||
k=tempg->npu.num*3;
|
||||
x2=x; y2=y; z2=z; //rotated start coordinates
|
||||
x3=x; y3=y; z3=z; //lag 1 rotated coordinates
|
||||
for (i=0;i<k;i+=3) {
|
||||
@@ -463,38 +433,37 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
x3=0; y3=0; z3=0;
|
||||
while (tempg1!=&root2) {
|
||||
tempg2=tempg1->next;
|
||||
if (tempg1->x1==x3 && tempg1->y1==y3) {
|
||||
if (tempg1->p.x1==x3 && tempg1->p.y1==y3) {
|
||||
QueRem(tempg1);
|
||||
Free(tempg1);
|
||||
} else {
|
||||
num++;
|
||||
x3=tempg1->x1;
|
||||
y3=tempg1->y1;
|
||||
x3=tempg1->p.x1;
|
||||
y3=tempg1->p.y1;
|
||||
}
|
||||
tempg1=tempg2;
|
||||
}
|
||||
|
||||
tempg3=CAlloc(SpriteElemQuedBaseSize(SPT_POLYPT)+(num*3+7)>>3);
|
||||
ptr=&tempg3->y1;
|
||||
ptr[0]=x2;
|
||||
ptr[1]=y2;
|
||||
ptr+=2;
|
||||
tempg3->npu.x=x2;
|
||||
tempg3->npu.y=y2;
|
||||
ptr=&tempg3->npu.u;
|
||||
x3=0;y3=0; z3=0;
|
||||
i=0;
|
||||
tempg1=root2.next;
|
||||
while (tempg1!=&root2) {
|
||||
tempg2=tempg1->next;
|
||||
BFieldOrU32(ptr,i,
|
||||
polypt_map[SignI64(tempg1->x1-x3)+1+
|
||||
3*(SignI64(tempg1->y1-y3)+1)]);
|
||||
polypt_map[SignI64(tempg1->p.x1-x3)+1+
|
||||
3*(SignI64(tempg1->p.y1-y3)+1)]);
|
||||
i+=3;
|
||||
x3=tempg1->x1;y3=tempg1->y1;
|
||||
x3=tempg1->p.x1;y3=tempg1->p.y1;
|
||||
QueRem(tempg1);
|
||||
Free(tempg1);
|
||||
tempg1=tempg2;
|
||||
}
|
||||
tempg3->type=SPT_POLYPT;
|
||||
tempg3->num=num;
|
||||
tempg3->npu.num=num;
|
||||
QueIns(tempg3,tempg);
|
||||
QueRem(tempg);
|
||||
Free(tempg);
|
||||
@@ -504,8 +473,8 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
case SPT_BSPLINE3:
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
p=&tempg->y1;
|
||||
for (i=0;i<tempg->num;i++,p++) {
|
||||
p=&tempg->nu.u;
|
||||
for (i=0;i<tempg->nu.num;i++,p++) {
|
||||
x=p->x; y=p->y; z=p->z;
|
||||
GrRot(r,&x,&y,&z);
|
||||
p->x=x;
|
||||
@@ -514,13 +483,13 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
}
|
||||
break;
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
x=tempg->x1; y=tempg->y1; z=tempg->z1;
|
||||
x=tempg->pmu.x; y=tempg->pmu.y; z=tempg->pmu.z;
|
||||
GrRot(r,&x,&y,&z);
|
||||
tempg->x1=x;
|
||||
tempg->y1=y;
|
||||
tempg->z1=z;
|
||||
p=(&tempg->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
for (i=0;i<tempg->shiftable_vertex_cnt;i++,p++) {
|
||||
tempg->pmu.x=x;
|
||||
tempg->pmu.y=y;
|
||||
tempg->pmu.z=z;
|
||||
p=&tempg->pmu.u;
|
||||
for (i=0;i<tempg->pmu.vertex_cnt;i++,p++) {
|
||||
x=p->x; y=p->y; z=p->z;
|
||||
GrRot(r,&x,&y,&z);
|
||||
p->x=x;
|
||||
@@ -529,8 +498,8 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
}
|
||||
break;
|
||||
case SPT_MESH:
|
||||
p=&tempg->x2;
|
||||
for (i=0;i<tempg->vertex_cnt;i++,p++) {
|
||||
p=&tempg->mu.u;
|
||||
for (i=0;i<tempg->mu.vertex_cnt;i++,p++) {
|
||||
x=p->x; y=p->y; z=p->z;
|
||||
GrRot(r,&x,&y,&z);
|
||||
p->x=x;
|
||||
@@ -614,9 +583,9 @@ U0 SpriteSideBarTask2(CTask *grand_parent)
|
||||
pu_task=grand_parent->popup_task;
|
||||
if (TaskValidate(pu_task)) {
|
||||
w=parent->win_right-parent->win_left;
|
||||
SetWinHorz(pu_task->win_right+2,pu_task->win_right+2+w,parent);
|
||||
WinHorz(pu_task->win_right+2,pu_task->win_right+2+w,parent);
|
||||
h=parent->win_bottom-parent->win_top;
|
||||
SetWinVert(pu_task->win_top,pu_task->win_top+h,parent);
|
||||
WinVert(pu_task->win_top,pu_task->win_top+h,parent);
|
||||
}
|
||||
WinMgrSync;
|
||||
}
|
||||
@@ -651,7 +620,7 @@ Bool SpriteEdText(CSprite **_root,I64 *_cur_elem_num)
|
||||
Sprite2Code(doc,elems);
|
||||
Free(elems);
|
||||
while (TRUE) {
|
||||
if (result=SrvUser("DocDo(0x%X,0x%X);",doc,0)) {
|
||||
if (result=PopUpPrint("DocDo(0x%X,0x%X);",doc,0)) {
|
||||
Fs->put_doc=doc2=DocNew;
|
||||
"$$WW,1$$";
|
||||
if (elems=Code2Sprite(doc)) {
|
||||
@@ -664,7 +633,7 @@ Bool SpriteEdText(CSprite **_root,I64 *_cur_elem_num)
|
||||
*_cur_elem_num=QueCnt(root); //TODO: Might want to improve this.
|
||||
break;
|
||||
} else {
|
||||
SrvUser("DocDo(0x%X,0x%X);",doc2,0);
|
||||
PopUpPrint("DocDo(0x%X,0x%X);",doc2,0);
|
||||
DocDel(doc2);
|
||||
Fs->put_doc=old_put;
|
||||
}
|
||||
@@ -730,24 +699,24 @@ I64 PopUpSpriteEd(CSprite **_root,I64 *_cur_elem_num)
|
||||
return i;
|
||||
}
|
||||
|
||||
#define GSPT_SIMPLE_PT 0
|
||||
#define GSPT_SIMPLE_PT 0
|
||||
#define GSPT_WIDTH_HEIGHT 1
|
||||
|
||||
#define GSPF_SELECTED 1
|
||||
|
||||
class CSpritePt
|
||||
class CEdSprite
|
||||
{
|
||||
CSpritePt *next,*last;
|
||||
CEdSprite *next,*last;
|
||||
I32 type,num,flags,xx,yy,zz;
|
||||
I32 *x,*y,*z,*w,*h;
|
||||
};
|
||||
|
||||
U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CSpritePt *root)
|
||||
U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CEdSprite *root)
|
||||
{
|
||||
I64 i,num=0;
|
||||
I32 *ptr;
|
||||
CD3I32 *p;
|
||||
CSpritePt *temppe;
|
||||
CEdSprite *temppe;
|
||||
CSprite *tempg=elems-offset(CSprite.start);
|
||||
QueInit(root);
|
||||
while (tempg->type) {
|
||||
@@ -757,60 +726,52 @@ U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CSpritePt *root)
|
||||
case SPT_LINE:
|
||||
case SPT_ARROW:
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
temppe=CAlloc(sizeof(CSpritePt));
|
||||
temppe=CAlloc(sizeof(CEdSprite));
|
||||
temppe->type=GSPT_SIMPLE_PT;
|
||||
temppe->xx=x;
|
||||
temppe->yy=y;
|
||||
temppe->x=&tempg->x2;
|
||||
temppe->y=&tempg->y2;
|
||||
temppe->x=&tempg->pp.x2;
|
||||
temppe->y=&tempg->pp.y2;
|
||||
temppe->num=num;
|
||||
QueIns(temppe,root->last);
|
||||
case SPT_TEXT:
|
||||
case SPT_TEXT_BOX:
|
||||
case SPT_TEXT_DIAMOND:
|
||||
case SPT_PT:
|
||||
case SPT_BITMAP:
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
case SPT_CIRCLE:
|
||||
temppe=CAlloc(sizeof(CSpritePt));
|
||||
temppe=CAlloc(sizeof(CEdSprite));
|
||||
temppe->type=GSPT_SIMPLE_PT;
|
||||
temppe->xx=x;
|
||||
temppe->yy=y;
|
||||
temppe->x=&tempg->x1;
|
||||
temppe->y=&tempg->y1;
|
||||
temppe->x=&tempg->p.x1;
|
||||
temppe->y=&tempg->p.y1;
|
||||
temppe->num=num;
|
||||
QueIns(temppe,root->last);
|
||||
break;
|
||||
case SPT_SHIFT:
|
||||
x+=tempg->x1;
|
||||
y+=tempg->y1;
|
||||
x+=tempg->p.x1;
|
||||
y+=tempg->p.y1;
|
||||
break;
|
||||
case SPT_ELLIPSE:
|
||||
case SPT_POLYGON:
|
||||
temppe=CAlloc(sizeof(CSpritePt));
|
||||
temppe=CAlloc(sizeof(CEdSprite));
|
||||
temppe->type=GSPT_WIDTH_HEIGHT;
|
||||
temppe->xx=x;
|
||||
temppe->yy=y;
|
||||
temppe->x=&tempg->x2;
|
||||
temppe->y=&tempg->y2;
|
||||
temppe->w=&tempg->width;
|
||||
temppe->h=&tempg->height;
|
||||
temppe->num=num;
|
||||
QueIns(temppe,root->last);
|
||||
case SPT_BITMAP:
|
||||
temppe=CAlloc(sizeof(CSpritePt));
|
||||
temppe->type=GSPT_SIMPLE_PT;
|
||||
temppe->xx=x;
|
||||
temppe->yy=y;
|
||||
temppe->x=&tempg->x2;
|
||||
temppe->y=&tempg->y2;
|
||||
temppe->x=&tempg->pwha.x1;
|
||||
temppe->y=&tempg->pwha.y1;
|
||||
temppe->w=&tempg->pwha.width;
|
||||
temppe->h=&tempg->pwha.height;
|
||||
temppe->num=num;
|
||||
QueIns(temppe,root->last);
|
||||
break;
|
||||
case SPT_POLYLINE:
|
||||
ptr=&tempg->y1;
|
||||
for (i=0;i<tempg->num;i++) {
|
||||
temppe=CAlloc(sizeof(CSpritePt));
|
||||
ptr=&tempg->nu.u;
|
||||
for (i=0;i<tempg->nu.num;i++) {
|
||||
temppe=CAlloc(sizeof(CEdSprite));
|
||||
temppe->type=GSPT_SIMPLE_PT;
|
||||
temppe->xx=x;
|
||||
temppe->yy=y;
|
||||
@@ -821,13 +782,12 @@ U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CSpritePt *root)
|
||||
}
|
||||
break;
|
||||
case SPT_POLYPT:
|
||||
ptr=&tempg->y1;
|
||||
temppe=CAlloc(sizeof(CSpritePt));
|
||||
temppe=CAlloc(sizeof(CEdSprite));
|
||||
temppe->type=GSPT_SIMPLE_PT;
|
||||
temppe->xx=x;
|
||||
temppe->yy=y;
|
||||
temppe->x=&ptr[0];
|
||||
temppe->y=&ptr[1];
|
||||
temppe->x=&tempg->npu.x;
|
||||
temppe->y=&tempg->npu.y;
|
||||
temppe->num=num;
|
||||
QueIns(temppe,root->last);
|
||||
break;
|
||||
@@ -835,9 +795,9 @@ U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CSpritePt *root)
|
||||
case SPT_BSPLINE3:
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
p=&tempg->y1;
|
||||
for (i=0;i<tempg->num;i++) {
|
||||
temppe=CAlloc(sizeof(CSpritePt));
|
||||
p=&tempg->nu.u;
|
||||
for (i=0;i<tempg->nu.num;i++) {
|
||||
temppe=CAlloc(sizeof(CEdSprite));
|
||||
temppe->type=GSPT_SIMPLE_PT;
|
||||
temppe->xx=x;
|
||||
temppe->yy=y;
|
||||
@@ -851,13 +811,13 @@ U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CSpritePt *root)
|
||||
case SPT_MESH:
|
||||
break;
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
temppe=CAlloc(sizeof(CSpritePt));
|
||||
temppe=CAlloc(sizeof(CEdSprite));
|
||||
temppe->type=GSPT_SIMPLE_PT;
|
||||
temppe->xx=x;
|
||||
temppe->yy=y;
|
||||
temppe->x=&tempg->x1;
|
||||
temppe->y=&tempg->y1;
|
||||
temppe->z=&tempg->z1;
|
||||
temppe->x=&tempg->pmu.x;
|
||||
temppe->y=&tempg->pmu.y;
|
||||
temppe->z=&tempg->pmu.z;
|
||||
temppe->num=num;
|
||||
QueIns(temppe,root->last);
|
||||
break;
|
||||
@@ -867,10 +827,10 @@ U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CSpritePt *root)
|
||||
}
|
||||
}
|
||||
|
||||
U0 SpriteCtrlPtsDraw(CDC *dc,CSpritePt *root)
|
||||
U0 SpriteCtrlPtsDraw(CDC *dc,CEdSprite *root)
|
||||
{
|
||||
I64 x,y;
|
||||
CSpritePt *temppe;
|
||||
CEdSprite *temppe;
|
||||
WinMgrSync;
|
||||
DCFill(dc);
|
||||
if (Blink(20)) {
|
||||
@@ -898,9 +858,9 @@ U0 SpriteCtrlPtsDraw(CDC *dc,CSpritePt *root)
|
||||
}
|
||||
}
|
||||
|
||||
U0 SpriteCtrlPtsMove(CSpritePt *root,I64 dx,I64 dy)
|
||||
U0 SpriteCtrlPtsMove(CEdSprite *root,I64 dx,I64 dy)
|
||||
{
|
||||
CSpritePt *temppe;
|
||||
CEdSprite *temppe;
|
||||
temppe=root->next;
|
||||
while (temppe!=root) {
|
||||
if (temppe->flags&GSPF_SELECTED)
|
||||
@@ -923,7 +883,7 @@ Bool SpriteShiftPts(U8 *elems,I64 x,I64 y,I64 *_cur_elem_num,I64 mode)
|
||||
I64 msg_code,a1,a2,xx,yy,xx2,yy2,dd,best_dd,cur_elem_num;
|
||||
Bool old_preempt,result=TRUE;
|
||||
CDC *dc=DCAlias;
|
||||
CSpritePt root,*temppe,*best_pe;
|
||||
CEdSprite root,*temppe,*best_pe;
|
||||
|
||||
SpritePtQueNew(elems,x,y,&root);
|
||||
cur_elem_num=0;
|
||||
@@ -1140,16 +1100,16 @@ I64 SpriteEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y,CSprite **_root,I64 *_cur_el
|
||||
insert_pt=SpriteElemNum2QueEntry(*_root,*_cur_elem_num);
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_SHIFT));
|
||||
tempg->type=SPT_SHIFT;
|
||||
tempg->x1=0;
|
||||
tempg->y1=0;
|
||||
tempg->p.x1=0;
|
||||
tempg->p.y1=0;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
GetMsg(&a1,&a2,1<<MSG_IP_L_DOWN);
|
||||
xx=a1; yy=a2;
|
||||
do {
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
tempg->x1=a1-xx;
|
||||
tempg->y1=a2-yy;
|
||||
tempg->p.x1=a1-xx;
|
||||
tempg->p.y1=a2-yy;
|
||||
SpriteEdUpdate(doc,tempb,*_root);
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
*_cur_elem_num+=1;
|
||||
|
||||
+217
-186
@@ -46,8 +46,8 @@ I64 PopUpSpriteMain(CSprite **_root,I64 *_cur_elem_num)
|
||||
"\n"
|
||||
"$$PURPLE$$$$MU-UL,\"+] Sprite Edit Menu\",LE=SPT_ED_MENU$$$$LTBLUE$$\n"
|
||||
"$$MU-UL,\"Exit Sprite\",LE=SPT_EXIT$$\n"
|
||||
"$$MU-UL,\"Abort Sprite\",LE=DOCM_CANCEL$$\n");
|
||||
DocPrint(doc,"\nRight-Click to get back to this menu.");
|
||||
"$$MU-UL,\"Abort Sprite\",LE=DOCM_CANCEL$$\n"
|
||||
"\nRight-Click to get back to this menu.");
|
||||
st=MStrPrint("SpriteSideBarTask(0x%X,0x%X,0x%X);",Fs,_root,_cur_elem_num);
|
||||
PopUp(st,NULL,&pu_task);
|
||||
Free(st);
|
||||
@@ -97,18 +97,18 @@ U0 SpriteSetSettings(CDC *dc,CSprite *root,I64 cur_elem_num,CColorROPU32 *_color
|
||||
while (cur_elem_num>0 && tempg!=root) {
|
||||
switch (tempg->type) {
|
||||
case SPT_COLOR:
|
||||
dc->color=*_color=tempg->color;
|
||||
dc->color=*_color=tempg->c.color;
|
||||
break;
|
||||
case SPT_DITHER_COLOR:
|
||||
dc->color=*_color=
|
||||
tempg->dither_color.u8[0]|
|
||||
tempg->dither_color.u8[1]<<COLORROP_BITS|ROPF_DITHER;
|
||||
tempg->d.dither_color.u8[0]|
|
||||
tempg->d.dither_color.u8[1]<<COLORROP_BITS|ROPF_DITHER;
|
||||
break;
|
||||
case SPT_WIDTH:
|
||||
dc->pen_width=*_width=tempg->width;
|
||||
dc->pen_width=*_width=tempg->w.width;
|
||||
break;
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
if (GrSetSymmetry3(dc,tempg->x1+x,tempg->y1+y,0,tempg->x2+x,tempg->y2+y,0,tempg->x2+x,tempg->y2+y,1))
|
||||
if (GrSetSymmetry3(dc,tempg->pp.x1+x,tempg->pp.y1+y,0,tempg->pp.x2+x,tempg->pp.y2+y,0,tempg->pp.x2+x,tempg->pp.y2+y,1))
|
||||
dc->flags|=DCF_SYMMETRY;
|
||||
else
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
@@ -166,7 +166,7 @@ I64 SpriteMainEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
U8 *st,*old_task_title=StrNew(Fs->task_title);
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
WordStat;
|
||||
AutoComplete;
|
||||
WinMgrSync(2,TRUE);
|
||||
dc2->flags|=DCF_ON_TOP;
|
||||
root=Sprite2SpriteQue(tempb->data);
|
||||
@@ -229,7 +229,7 @@ I64 SpriteMainEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
color=i;
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_COLOR));
|
||||
tempg->type=SPT_COLOR;
|
||||
tempg->color=color;
|
||||
tempg->c.color=color;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,tempb,root);
|
||||
cur_elem_num++;
|
||||
@@ -244,7 +244,7 @@ I64 SpriteMainEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
color=i;
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_DITHER_COLOR));
|
||||
tempg->type=SPT_DITHER_COLOR;
|
||||
tempg->dither_color=color.c0.color|color.c1.color<<8;
|
||||
tempg->d.dither_color=color.c0.color|color.c1.color<<8;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,tempb,root);
|
||||
cur_elem_num++;
|
||||
@@ -270,24 +270,24 @@ I64 SpriteMainEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
|
||||
tempg1=insert_pt;
|
||||
if (tempg1!=root && tempg1->type==SPT_MESH)
|
||||
old_mesh=&tempg1->vertex_cnt;
|
||||
old_mesh=&tempg1->mu.vertex_cnt;
|
||||
else if (tempg1!=root && tempg1->type==SPT_SHIFTABLE_MESH) {
|
||||
x1=tempg1->x1;
|
||||
y1=tempg1->y1;
|
||||
z1=tempg1->z1;
|
||||
p=(&tempg1->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
for (i=0;i<tempg1->shiftable_vertex_cnt;i++,p++) {
|
||||
x1=tempg1->pmu.x;
|
||||
y1=tempg1->pmu.y;
|
||||
z1=tempg1->pmu.z;
|
||||
p=&tempg1->pmu.u;
|
||||
for (i=0;i<tempg1->pmu.vertex_cnt;i++,p++) {
|
||||
p->x+=x1;
|
||||
p->y+=y1;
|
||||
p->z+=z1;
|
||||
}
|
||||
old_mesh=&tempg1->shiftable_vertex_cnt;
|
||||
old_mesh=&tempg1->pmu.vertex_cnt;
|
||||
} else
|
||||
old_mesh=NULL;
|
||||
if (mesh=SpriteMeshEd(old_mesh,&size,TRUE)) {
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_MESH)-sizeof(I32)*2+size);
|
||||
tempg->type=SPT_MESH;
|
||||
MemCpy(&tempg->vertex_cnt,mesh,size);
|
||||
MemCpy(&tempg->mu.vertex_cnt,mesh,size);
|
||||
Free(mesh);
|
||||
QueIns(tempg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,tempb,root);
|
||||
@@ -299,11 +299,11 @@ I64 SpriteMainEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
} else
|
||||
cur_elem_num++;
|
||||
} else if (old_mesh && tempg1->type==SPT_SHIFTABLE_MESH) {
|
||||
x1=tempg1->x1;
|
||||
y1=tempg1->y1;
|
||||
z1=tempg1->z1;
|
||||
p=(&tempg1->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
for (i=0;i<tempg1->shiftable_vertex_cnt;i++,p++) {
|
||||
x1=tempg1->pmu.x;
|
||||
y1=tempg1->pmu.y;
|
||||
z1=tempg1->pmu.z;
|
||||
p=&tempg1->pmu.u;
|
||||
for (i=0;i<tempg1->pmu.vertex_cnt;i++,p++) {
|
||||
p->x-=x1;
|
||||
p->y-=y1;
|
||||
p->z-=z1;
|
||||
@@ -328,7 +328,7 @@ I64 SpriteMainEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
"bitmap.\n");
|
||||
doc_e->de_flags=old_de_flags;
|
||||
Fs->win_inhibit=WIG_TASK_DFT|WIF_FOCUS_TASK_IP_L|WIF_FOCUS_TASK_IP_R|
|
||||
WIF_FOCUS_TASK_BORDER-WIF_SELF_FOCUS-WIF_SELF_GRAB_SCROLL;
|
||||
WIF_FOCUS_TASK_BORDER-WIF_SELF_FOCUS-WIF_SELF_GRAB_SCROLL;
|
||||
break;
|
||||
case SPT_BITMAP:
|
||||
doc_e->de_flags|=DOCEF_DONT_DRAW;
|
||||
@@ -363,7 +363,7 @@ I64 SpriteMainEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
}
|
||||
doc_e->de_flags=old_de_flags;
|
||||
Fs->win_inhibit=WIG_TASK_DFT|WIF_FOCUS_TASK_IP_L|WIF_FOCUS_TASK_IP_R|
|
||||
WIF_FOCUS_TASK_BORDER-WIF_SELF_FOCUS-WIF_SELF_GRAB_SCROLL;
|
||||
WIF_FOCUS_TASK_BORDER-WIF_SELF_FOCUS-WIF_SELF_GRAB_SCROLL;
|
||||
break;
|
||||
case SPT_WIDTH:
|
||||
doc_e->de_flags|=DOCEF_DONT_DRAW;
|
||||
@@ -372,7 +372,7 @@ I64 SpriteMainEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
width=i;
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_WIDTH));
|
||||
tempg->type=SPT_WIDTH;
|
||||
tempg->width=width;
|
||||
tempg->w.width=width;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,tempb,root);
|
||||
cur_elem_num++;
|
||||
@@ -415,9 +415,9 @@ I64 SpriteMainEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_TEXT)+StrLen(st)+1);
|
||||
tempg->type=SPT_TEXT;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
StrCpy(tempg->st,st);
|
||||
tempg->ps.x1=x1-x;
|
||||
tempg->ps.y1=y1-y;
|
||||
StrCpy(tempg->ps.st,st);
|
||||
QueIns(tempg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,tempb,root);
|
||||
cur_elem_num++;
|
||||
@@ -441,9 +441,9 @@ I64 SpriteMainEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_TEXT_BOX)+StrLen(st)+1);
|
||||
tempg->type=SPT_TEXT_BOX;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
StrCpy(tempg->st,st);
|
||||
tempg->ps.x1=x1-x;
|
||||
tempg->ps.y1=y1-y;
|
||||
StrCpy(tempg->ps.st,st);
|
||||
QueIns(tempg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,tempb,root);
|
||||
cur_elem_num++;
|
||||
@@ -467,9 +467,9 @@ I64 SpriteMainEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_TEXT_DIAMOND)+StrLen(st)+1);
|
||||
tempg->type=SPT_TEXT_DIAMOND;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
StrCpy(tempg->st,st);
|
||||
tempg->ps.x1=x1-x;
|
||||
tempg->ps.y1=y1-y;
|
||||
StrCpy(tempg->ps.st,st);
|
||||
QueIns(tempg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,tempb,root);
|
||||
cur_elem_num++;
|
||||
@@ -502,14 +502,34 @@ ei_restart:
|
||||
eletype=SPT_MENU;
|
||||
}
|
||||
if (msg_code==MSG_KEY_DOWN) {
|
||||
if (a1==CH_ESC) {
|
||||
result=GE_EXIT;
|
||||
goto ei_done;
|
||||
} else if (a1==CH_SHIFT_ESC) {
|
||||
result=GE_ABORT;
|
||||
goto ei_done;
|
||||
} else
|
||||
goto ei_restart;
|
||||
switch (a1) {
|
||||
case CH_ESC:
|
||||
result=GE_EXIT;
|
||||
goto ei_done;
|
||||
case CH_SHIFT_ESC:
|
||||
result=GE_ABORT;
|
||||
goto ei_done;
|
||||
case 'c': //eye-dropper
|
||||
dc3=DCCaptureScreen(FALSE);
|
||||
color=GrPeek(dc3,ip.pos.x,ip.pos.y)^15;//Mouse cursor is XORed.
|
||||
DCDel(dc3);
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_COLOR));
|
||||
tempg->type=SPT_COLOR;
|
||||
tempg->c.color=color;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,tempb,root);
|
||||
cur_elem_num++;
|
||||
break;
|
||||
case 't': //Set to transparent color
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_COLOR));
|
||||
tempg->type=SPT_COLOR;
|
||||
tempg->c.color=TRANSPARENT;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,tempb,root);
|
||||
cur_elem_num++;
|
||||
break;
|
||||
}
|
||||
goto ei_restart;
|
||||
} else {
|
||||
x1=a1; y1=a2;
|
||||
x2=a1; y2=a2;
|
||||
@@ -564,10 +584,10 @@ ei_restart:
|
||||
tempg->type=SPT_PLANAR_SYMMETRY;
|
||||
break;
|
||||
sub_switch_end:
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
tempg->x2=x2-x;
|
||||
tempg->y2=y2-y;
|
||||
tempg->pp.x1=x1-x;
|
||||
tempg->pp.y1=y1-y;
|
||||
tempg->pp.x2=x2-x;
|
||||
tempg->pp.y2=y2-y;
|
||||
break;
|
||||
case SPT_RECT:
|
||||
xx1=a1; yy1=a2;
|
||||
@@ -594,10 +614,10 @@ ei_restart:
|
||||
GrRect3(dc,xx1,yy1,0,xx2-xx1,yy2-yy1);
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_RECT));
|
||||
tempg->type=SPT_RECT;
|
||||
tempg->x1=xx1-x;
|
||||
tempg->y1=yy1-y;
|
||||
tempg->x2=xx2-x;
|
||||
tempg->y2=yy2-y;
|
||||
tempg->pp.x1=xx1-x;
|
||||
tempg->pp.y1=yy1-y;
|
||||
tempg->pp.x2=xx2-x;
|
||||
tempg->pp.y2=yy2-y;
|
||||
break;
|
||||
case SPT_INS_SCREEN_BITMAP:
|
||||
case SPT_INS_TRANSPARENT_SCREEN_BITMAP:
|
||||
@@ -628,10 +648,10 @@ ei_restart:
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_BITMAP)+
|
||||
((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
tempg->type=SPT_BITMAP;
|
||||
tempg->width=xx2-xx1;
|
||||
tempg->height=yy2-yy1;
|
||||
tempg->x2=0;
|
||||
tempg->y2=0;
|
||||
tempg->pwhu.width=xx2-xx1;
|
||||
tempg->pwhu.height=yy2-yy1;
|
||||
tempg->pwhu.x1=0;
|
||||
tempg->pwhu.y1=0;
|
||||
SpriteScreenInit(dc,x,y);
|
||||
i=gr.screen_zoom;
|
||||
GrScaleZoom(1.0/i);
|
||||
@@ -644,7 +664,7 @@ ei_restart:
|
||||
if (eletype==SPT_INS_TRANSPARENT_SCREEN_BITMAP)
|
||||
DCColorChg(img,bm_bkcolor);
|
||||
GrScaleZoom(i);
|
||||
MemCpy(tempg(U8 *)+offset(CSprite.linespeed),img->body,((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
MemCpy(&tempg->pwhu.u,img->body,((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
DCDel(img);
|
||||
DCDel(dc3);
|
||||
dc2->pen_width=old_width;
|
||||
@@ -664,9 +684,9 @@ ei_restart:
|
||||
GrCircle3(dc,x1,y1,0,Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2)));
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_CIRCLE));
|
||||
tempg->type=SPT_CIRCLE;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
tempg->x2=Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2));
|
||||
tempg->pr.x1=x1-x;
|
||||
tempg->pr.y1=y1-y;
|
||||
tempg->pr.radius=Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2));
|
||||
break;
|
||||
case SPT_ELLIPSE:
|
||||
do {
|
||||
@@ -680,37 +700,37 @@ ei_restart:
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_ELLIPSE));
|
||||
tempg->type=SPT_ELLIPSE;
|
||||
tempg->x2=(x1+x2)>>1-x;
|
||||
tempg->y2=(y1+y2)>>1-y;
|
||||
tempg->width =AbsI64(x1-x2)>>1;
|
||||
tempg->height=AbsI64(y1-y2)>>1;
|
||||
angle2=Arg(x2-(tempg->x2+x),y2-(tempg->y2+y));
|
||||
if (tempg->width<tempg->height)
|
||||
tempg->pwha.x1=(x1+x2)>>1-x;
|
||||
tempg->pwha.y1=(y1+y2)>>1-y;
|
||||
tempg->pwha.width =AbsI64(x1-x2)>>1;
|
||||
tempg->pwha.height=AbsI64(y1-y2)>>1;
|
||||
angle2=Arg(x2-(tempg->pwha.x1+x),y2-(tempg->pwha.y1+y));
|
||||
if (tempg->pwha.width<tempg->pwha.height)
|
||||
angle2-=ă/2.0;
|
||||
do {
|
||||
angle1=Arg(x2-(tempg->x2+x),y2-(tempg->y2+y));
|
||||
if (tempg->width>=tempg->height)
|
||||
tempg->rot_angle=-(angle1-angle2);
|
||||
angle1=Arg(x2-(tempg->pwha.x1+x),y2-(tempg->pwha.y1+y));
|
||||
if (tempg->pwha.width>=tempg->pwha.height)
|
||||
tempg->pwha.angle=-(angle1-angle2);
|
||||
else
|
||||
tempg->rot_angle=-(angle1-angle2)+ã/2.0;
|
||||
tempg->pwha.angle=-(angle1-angle2)+ã/2.0;
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrEllipse3(dc,tempg->x2+x,tempg->y2+y,0,
|
||||
tempg->width,tempg->height,tempg->rot_angle);
|
||||
GrEllipse3(dc,tempg->pwha.x1+x,tempg->pwha.y1+y,0,
|
||||
tempg->pwha.width,tempg->pwha.height,tempg->pwha.angle);
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
SpriteScreenInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
|
||||
angle1=Arg(x2-(tempg->x2+x),y2-(tempg->y2+y));
|
||||
if (tempg->width>=tempg->height)
|
||||
tempg->rot_angle=-(angle1-angle2);
|
||||
angle1=Arg(x2-(tempg->pwha.x1+x),y2-(tempg->pwha.y1+y));
|
||||
if (tempg->pwha.width>=tempg->pwha.height)
|
||||
tempg->pwha.angle=-(angle1-angle2);
|
||||
else
|
||||
tempg->rot_angle=-(angle1-angle2)+ã/2.0;
|
||||
tempg->pwha.angle=-(angle1-angle2)+ã/2.0;
|
||||
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrEllipse3(dc,tempg->x2+x,tempg->y2+y,0,
|
||||
tempg->width,tempg->height,tempg->rot_angle);
|
||||
GrEllipse3(dc,tempg->pwha.x1+x,tempg->pwha.y1+y,0,
|
||||
tempg->pwha.width,tempg->pwha.height,tempg->pwha.angle);
|
||||
break;
|
||||
case SPT_POLYGON:
|
||||
eletype=SPT_MENU;
|
||||
@@ -729,115 +749,128 @@ ei_restart:
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_POLYGON));
|
||||
tempg->type=SPT_POLYGON;
|
||||
tempg->x2=(x1+x2)>>1-x;
|
||||
tempg->y2=(y1+y2)>>1-y;
|
||||
tempg->width =AbsI64(x1-x2)>>1;
|
||||
tempg->height=AbsI64(y1-y2)>>1;
|
||||
tempg->sides=i;
|
||||
angle2=Arg(x2-(tempg->x2+x),y2-(tempg->y2+y));
|
||||
if (tempg->width<tempg->height)
|
||||
tempg->pwhas.x1=(x1+x2)>>1-x;
|
||||
tempg->pwhas.y1=(y1+y2)>>1-y;
|
||||
tempg->pwhas.width =AbsI64(x1-x2)>>1;
|
||||
tempg->pwhas.height=AbsI64(y1-y2)>>1;
|
||||
tempg->pwhas.sides=i;
|
||||
angle2=Arg(x2-(tempg->pwhas.x1+x),y2-(tempg->pwhas.y1+y));
|
||||
if (tempg->pwhas.width<tempg->pwhas.height)
|
||||
angle2-=ă/2.0;
|
||||
do {
|
||||
angle1=Arg(x2-(tempg->x2+x),y2-(tempg->y2+y));
|
||||
if (tempg->width>=tempg->height)
|
||||
tempg->rot_angle=-(angle1-angle2);
|
||||
angle1=Arg(x2-(tempg->pwhas.x1+x),y2-(tempg->pwhas.y1+y));
|
||||
if (tempg->pwhas.width>=tempg->pwhas.height)
|
||||
tempg->pwhas.angle=-(angle1-angle2);
|
||||
else
|
||||
tempg->rot_angle=-(angle1-angle2)+ã/2.0;
|
||||
tempg->pwhas.angle=-(angle1-angle2)+ã/2.0;
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrRegPoly3(dc,tempg->x2+x,tempg->y2+y,0,
|
||||
tempg->width,tempg->height,tempg->sides,tempg->rot_angle);
|
||||
GrRegPoly3(dc,tempg->pwhas.x1+x,tempg->pwhas.y1+y,0,
|
||||
tempg->pwhas.width,tempg->pwhas.height,
|
||||
tempg->pwhas.sides,tempg->pwhas.angle);
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
SpriteScreenInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
|
||||
angle1=Arg(x2-(tempg->x2+x),y2-(tempg->y2+y));
|
||||
if (tempg->width>=tempg->height)
|
||||
tempg->rot_angle=-(angle1-angle2);
|
||||
angle1=Arg(x2-(tempg->pwhas.x1+x),y2-(tempg->pwhas.y1+y));
|
||||
if (tempg->pwhas.width>=tempg->pwhas.height)
|
||||
tempg->pwhas.angle=-(angle1-angle2);
|
||||
else
|
||||
tempg->rot_angle=-(angle1-angle2)+ã/2.0;
|
||||
tempg->pwhas.angle=-(angle1-angle2)+ã/2.0;
|
||||
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrRegPoly3(dc,tempg->x2+x,tempg->y2+y,0,
|
||||
tempg->width,tempg->height,tempg->sides,tempg->rot_angle);
|
||||
GrRegPoly3(dc,tempg->pwhas.x1+x,tempg->pwhas.y1+y,0,
|
||||
tempg->pwhas.width,tempg->pwhas.height,tempg->pwhas.sides,
|
||||
tempg->pwhas.angle);
|
||||
break;
|
||||
case SPT_PT:
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(eletype));
|
||||
tempg->type=eletype;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
tempg->p.x1=x1-x;
|
||||
tempg->p.y1=y1-y;
|
||||
break;
|
||||
sub_switch_start:
|
||||
QueInit(&root2);
|
||||
num=0;
|
||||
x3=a1-x; y3=a2-y;
|
||||
do {
|
||||
do {
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
if (num)
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE+
|
||||
1<<MSG_IP_R_UP);
|
||||
dc->color=TRANSPARENT;
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
if (num)
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP && msg_code!=MSG_IP_R_UP);
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
if (msg_code==MSG_IP_L_UP) {
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
if (num)
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_PT));
|
||||
tempg->type=SPT_PT;
|
||||
tempg->x1=x2-x;
|
||||
tempg->y1=y2-y;
|
||||
tempg->p.x1=x2-x;
|
||||
tempg->p.y1=y2-y;
|
||||
QueIns(tempg,root2.last);
|
||||
x1=x2;y1=y2;
|
||||
num++;
|
||||
}
|
||||
} while (msg_code!=MSG_IP_R_UP);
|
||||
if (!num) {
|
||||
tempg=NULL;
|
||||
break;
|
||||
}
|
||||
case SPT_POLYLINE:
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_POLYLINE)+
|
||||
(num+1)<<1*sizeof(I32));
|
||||
ptr=&tempg->y1;
|
||||
tempg2=root2.next;
|
||||
ptr[0]=x3;
|
||||
ptr[1]=y3;
|
||||
ptr+=2;
|
||||
for (i=0;i<num;i++) {
|
||||
tempg1=tempg2->next;
|
||||
ptr[i<<1]=tempg2->x1;
|
||||
ptr[i<<1+1]=tempg2->y1;
|
||||
Free(tempg2);
|
||||
tempg2=tempg1;
|
||||
if (num>1) {
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_POLYLINE)+num*sizeof(CD2I32));
|
||||
ptr=&tempg->nu.u;
|
||||
tempg2=root2.next;
|
||||
for (i=0;i<num;i++) {
|
||||
tempg1=tempg2->next;
|
||||
ptr[i<<1]=tempg2->p.x1;
|
||||
ptr[i<<1+1]=tempg2->p.y1;
|
||||
Free(tempg2);
|
||||
tempg2=tempg1;
|
||||
}
|
||||
tempg->type=SPT_POLYLINE;
|
||||
tempg->nu.num=num;
|
||||
} else {
|
||||
tempg2=root2.next;
|
||||
for (i=0;i<num;i++) {
|
||||
tempg1=tempg2->next;
|
||||
Free(tempg2);
|
||||
tempg2=tempg1;
|
||||
}
|
||||
tempg=NULL;
|
||||
}
|
||||
tempg->type=SPT_POLYLINE;
|
||||
tempg->num=num+1;
|
||||
break;
|
||||
case SPT_BSPLINE2:
|
||||
case SPT_BSPLINE3:
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_POLYLINE)+
|
||||
(num+1)*sizeof(CD3I32));
|
||||
p=&tempg->y1;
|
||||
tempg2=root2.next;
|
||||
p[0].x=x3;
|
||||
p[0].y=y3;
|
||||
for (i=1;i<=num;i++) {
|
||||
tempg1=tempg2->next;
|
||||
p[i].x=tempg2->x1;
|
||||
p[i].y=tempg2->y1;
|
||||
Free(tempg2);
|
||||
tempg2=tempg1;
|
||||
if (num>2) {
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(eletype)+num*sizeof(CD3I32));
|
||||
p=&tempg->nu.u;
|
||||
tempg2=root2.next;
|
||||
for (i=0;i<num;i++) {
|
||||
tempg1=tempg2->next;
|
||||
p[i].x=tempg2->p.x1;
|
||||
p[i].y=tempg2->p.y1;
|
||||
Free(tempg2);
|
||||
tempg2=tempg1;
|
||||
}
|
||||
tempg->type=eletype;
|
||||
tempg->nu.num=num;
|
||||
} else {
|
||||
tempg2=root2.next;
|
||||
for (i=0;i<num;i++) {
|
||||
tempg1=tempg2->next;
|
||||
Free(tempg2);
|
||||
tempg2=tempg1;
|
||||
}
|
||||
tempg=NULL;
|
||||
}
|
||||
tempg->type=eletype;
|
||||
tempg->num=num+1;
|
||||
break;
|
||||
sub_switch_end:
|
||||
break;
|
||||
@@ -846,8 +879,7 @@ ei_restart:
|
||||
x3=a1-x; y3=a2-y;
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
do {
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
x2=a1; y2=a2;
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
Line(&root2,x1-x,y1-y,0,x2-x,y2-y,0,&SpritePolyPtPlot);
|
||||
@@ -859,38 +891,37 @@ ei_restart:
|
||||
x1=x3;y1=y3;
|
||||
while (tempg!=&root2) {
|
||||
tempg1=tempg->next;
|
||||
if (tempg->x1==x1 && tempg->y1==y1) {
|
||||
if (tempg->p.x1==x1 && tempg->p.y1==y1) {
|
||||
QueRem(tempg);
|
||||
Free(tempg);
|
||||
} else {
|
||||
num++;
|
||||
x1=tempg->x1;
|
||||
y1=tempg->y1;
|
||||
x1=tempg->p.x1;
|
||||
y1=tempg->p.y1;
|
||||
}
|
||||
tempg=tempg1;
|
||||
}
|
||||
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_POLYPT)+(num*3+7)>>3);
|
||||
ptr=&tempg->y1;
|
||||
ptr[0]=x3;
|
||||
ptr[1]=y3;
|
||||
ptr+=2;
|
||||
tempg->npu.x=x3;
|
||||
tempg->npu.y=y3;
|
||||
ptr=&tempg->npu.u;
|
||||
x1=x3;y1=y3;
|
||||
i=0;
|
||||
tempg2=root2.next;
|
||||
while (tempg2!=&root2) {
|
||||
tempg1=tempg2->next;
|
||||
BFieldOrU32(ptr,i,
|
||||
polypt_map[SignI64(tempg2->x1-x1)+1+
|
||||
3*(SignI64(tempg2->y1-y1)+1)]);
|
||||
polypt_map[SignI64(tempg2->p.x1-x1)+1+
|
||||
3*(SignI64(tempg2->p.y1-y1)+1)]);
|
||||
i+=3;
|
||||
x1=tempg2->x1;y1=tempg2->y1;
|
||||
x1=tempg2->p.x1;y1=tempg2->p.y1;
|
||||
QueRem(tempg2);
|
||||
Free(tempg2);
|
||||
tempg2=tempg1;
|
||||
}
|
||||
tempg->type=SPT_POLYPT;
|
||||
tempg->num=num;
|
||||
tempg->npu.num=num;
|
||||
break;
|
||||
sub_switch_end:
|
||||
if (tempg) {
|
||||
@@ -926,14 +957,14 @@ ei_bitmap:
|
||||
xx2++; yy2++;
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_BITMAP)+
|
||||
((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
tempg->type=eletype;
|
||||
tempg->width=xx2-xx1;
|
||||
tempg->height=yy2-yy1;
|
||||
tempg->x2=xx1-x;
|
||||
tempg->y2=yy1-y;
|
||||
img=DCNew(tempg->width,tempg->height,Fs);
|
||||
tempg->type=SPT_BITMAP;
|
||||
tempg->pwhu.width=xx2-xx1;
|
||||
tempg->pwhu.height=yy2-yy1;
|
||||
tempg->pwhu.x1=xx1-x;
|
||||
tempg->pwhu.y1=yy1-y;
|
||||
img=DCNew(tempg->pwhu.width,tempg->pwhu.height,Fs);
|
||||
img->color=bm_bkcolor;
|
||||
GrRect(img,0,0,tempg->width,tempg->height);
|
||||
GrRect(img,0,0,tempg->pwhu.width,tempg->pwhu.height);
|
||||
tempg1=insert_pt;
|
||||
if (tempg1==root || tempg1->type!=SPT_BITMAP) {
|
||||
SpriteSetSettings(img,root,0,&color,&width,-(xx1-x),-(yy1-y));
|
||||
@@ -943,12 +974,12 @@ ei_bitmap:
|
||||
cur_elem_num=1;
|
||||
} else {
|
||||
SpriteSetSettings(img,root,cur_elem_num,&color,&width,-(xx1-x),-(yy1-y));
|
||||
Sprite3(img,-(xx1-x),-(yy1-y),0,tempg1(U8 *)+offset(CSprite.start),TRUE);
|
||||
Sprite3(img,-(xx1-x),-(yy1-y),0,&tempg1->start,TRUE);
|
||||
insert_pt=tempg1->next;
|
||||
QueRem(tempg1);
|
||||
Free(tempg1);
|
||||
}
|
||||
MemCpy(tempg(U8 *)+offset(CSprite.linespeed),img->body,((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
MemCpy(&tempg->pwhu.u,img->body,((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
|
||||
switch (i=SpriteBitMapEd(doc,doc_e,dc,&xx1,&yy1,&xx2,&yy2,&img,bm_bkcolor)) {
|
||||
case GE_EXIT:
|
||||
@@ -957,11 +988,11 @@ ei_bitmap:
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_BITMAP)+
|
||||
((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
tempg->type=eletype;
|
||||
tempg->width=xx2-xx1;
|
||||
tempg->height=yy2-yy1;
|
||||
tempg->x2=xx1-x;
|
||||
tempg->y2=yy1-y;
|
||||
MemCpy(tempg(U8 *)+offset(CSprite.linespeed),img->body,((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
tempg->pwhu.width=xx2-xx1;
|
||||
tempg->pwhu.height=yy2-yy1;
|
||||
tempg->pwhu.x1=xx1-x;
|
||||
tempg->pwhu.y1=yy1-y;
|
||||
MemCpy(&tempg->pwhu.u,img->body,((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
break;
|
||||
}
|
||||
doc_e->de_flags=old_de_flags;
|
||||
@@ -987,25 +1018,25 @@ ei_shiftable_mesh:
|
||||
x1=-(a1-x);
|
||||
y1=-(a2-y);
|
||||
z1=z;
|
||||
p=&tempg1->x2;
|
||||
for (i=0;i<tempg1->vertex_cnt;i++,p++) {
|
||||
p=&tempg1->mu.u;
|
||||
for (i=0;i<tempg1->mu.vertex_cnt;i++,p++) {
|
||||
p->x+=x1;
|
||||
p->y+=y1;
|
||||
p->z+=z1;
|
||||
}
|
||||
old_mesh=&tempg1->vertex_cnt;
|
||||
old_mesh=&tempg1->mu.vertex_cnt;
|
||||
} else if (tempg1!=root && tempg1->type==SPT_SHIFTABLE_MESH) {
|
||||
z=-tempg1->z1;
|
||||
x1=tempg1->x1-(a1-x);
|
||||
y1=tempg1->y1-(a2-y);
|
||||
z1=tempg1->z1+z;
|
||||
p=(&tempg1->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
for (i=0;i<tempg1->shiftable_vertex_cnt;i++,p++) {
|
||||
z=-tempg1->pmu.z;
|
||||
x1=tempg1->pmu.x-(a1-x);
|
||||
y1=tempg1->pmu.y-(a2-y);
|
||||
z1=tempg1->pmu.z+z;
|
||||
p=&tempg1->pmu.u;
|
||||
for (i=0;i<tempg1->pmu.vertex_cnt;i++,p++) {
|
||||
p->x+=x1;
|
||||
p->y+=y1;
|
||||
p->z+=z1;
|
||||
}
|
||||
old_mesh=&tempg1->shiftable_vertex_cnt;
|
||||
old_mesh=&tempg1->pmu.vertex_cnt;
|
||||
} else {
|
||||
z=0;
|
||||
old_mesh=NULL;
|
||||
@@ -1013,11 +1044,11 @@ ei_shiftable_mesh:
|
||||
if (mesh=SpriteMeshEd(old_mesh,&size,TRUE)) {
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_SHIFTABLE_MESH)-sizeof(I32)*2+size);
|
||||
tempg->type=SPT_SHIFTABLE_MESH;
|
||||
MemCpy(&tempg->shiftable_vertex_cnt,mesh,size);
|
||||
MemCpy(&tempg->pmu.vertex_cnt,mesh,size);
|
||||
Free(mesh);
|
||||
tempg->x1=a1-x;
|
||||
tempg->y1=a2-y;
|
||||
tempg->z1=-z;
|
||||
tempg->pmu.x=a1-x;
|
||||
tempg->pmu.y=a2-y;
|
||||
tempg->pmu.z=-z;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,tempb,root);
|
||||
if (old_mesh) {
|
||||
@@ -1028,11 +1059,11 @@ ei_shiftable_mesh:
|
||||
} else
|
||||
cur_elem_num++;
|
||||
} else if (old_mesh && tempg1->type==SPT_SHIFTABLE_MESH) {
|
||||
x1=tempg1->x1-(a1-x);
|
||||
y1=tempg1->y1-(a2-y);
|
||||
z1=tempg1->z1+z;
|
||||
p=(&tempg1->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
for (i=0;i<tempg1->shiftable_vertex_cnt;i++,p++) {
|
||||
x1=tempg1->pmu.x-(a1-x);
|
||||
y1=tempg1->pmu.y-(a2-y);
|
||||
z1=tempg1->pmu.z+z;
|
||||
p=&tempg1->pmu.u;
|
||||
for (i=0;i<tempg1->pmu.vertex_cnt;i++,p++) {
|
||||
p->x-=x1;
|
||||
p->y-=y1;
|
||||
p->z-=z1;
|
||||
@@ -1041,8 +1072,8 @@ ei_shiftable_mesh:
|
||||
x1=-(a1-x);
|
||||
y1=-(a2-y);
|
||||
z1= z;
|
||||
p=&tempg1->x2;
|
||||
for (i=0;i<tempg1->vertex_cnt;i++,p++) {
|
||||
p=&tempg1->mu.u;
|
||||
for (i=0;i<tempg1->mu.vertex_cnt;i++,p++) {
|
||||
p->x-=x1;
|
||||
p->y-=y1;
|
||||
p->z-=z1;
|
||||
@@ -1077,7 +1108,7 @@ U0 EdSpriteIns(CDoc *doc,I64 x,I64 y)
|
||||
CDocEntry *doc_e;
|
||||
CDocBin *tempb;
|
||||
if (Fs!=doc->mem_task)
|
||||
Dbg;
|
||||
throw('Graphics');
|
||||
if (st=EdSprite(doc->cur_bin_num)) {
|
||||
unlock=DocLock(doc);
|
||||
tempb=CAlloc(sizeof(CDocBin),doc->mem_task);
|
||||
|
||||
@@ -384,7 +384,7 @@ U0 MPDrawIt(CMeshFrame *e)
|
||||
CMeshEdTri *tempt=e->tri_root.next;
|
||||
I64 i,*old_r=dc->r;
|
||||
|
||||
//$LK,"DCAlias",A="MN:DCAlias"$() allocates a new identity rotation matrix.
|
||||
//$LK,"DCAlias",A="MN:DCAlias"$() alllocs a new identity rotation matrix.
|
||||
//We want e->dc's rotation matrix.
|
||||
dc->r=e->dc->r;
|
||||
|
||||
@@ -955,7 +955,7 @@ $WW,0$*/
|
||||
"}");
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
WordStat;
|
||||
AutoComplete;
|
||||
Preempt(OFF); //We don't really want window update while modifying links
|
||||
AcctOneTimePopUp(ARf_MESH_ED,
|
||||
"$$GREEN$$Right Mouse$$FG$$: Hold and move to shift cursor z\n"
|
||||
|
||||
+55
-56
@@ -5,36 +5,36 @@ U8 polypt_map[9]={0,1,2,3,0,4,5,6,7};
|
||||
|
||||
I64 sprite_elem_base_sizes[SPT_NUM_TYPES]=
|
||||
{
|
||||
offset(CSprite.x1)-offset(CSprite.start), //SPT_END
|
||||
1+offset(CSprite.color)-offset(CSprite.start), //SPT_COLOR
|
||||
2+offset(CSprite.dither_color)-offset(CSprite.start), //SPT_DITHER_COLOR
|
||||
offset(CSprite.y1)-offset(CSprite.start), //SPT_WIDTH
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //SPT_PLANAR_SYMMETRY
|
||||
offset(CSprite.x1)-offset(CSprite.start), //SPT_TRANSFORM_ON
|
||||
offset(CSprite.x1)-offset(CSprite.start), //SPT_TRANSFORM_OFF
|
||||
offset(CSprite.x2)-offset(CSprite.start), //SPT_SHIFT
|
||||
offset(CSprite.x2)-offset(CSprite.start), //SPT_PT
|
||||
offset(CSprite.y2)-offset(CSprite.start), //SPT_POLYPT
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //SPT_LINE
|
||||
offset(CSprite.y1)-offset(CSprite.start), //SPT_POLYLINE
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //SPT_RECT
|
||||
offset(CSprite.sides)-offset(CSprite.start), //SPT_ROTATED_RECT
|
||||
offset(CSprite.y2)-offset(CSprite.start), //SPT_CIRCLE
|
||||
offset(CSprite.sides)-offset(CSprite.start), //SPT_ELLIPSE
|
||||
sizeof(CSprite)-offset(CSprite.start), //SPT_POLYGON
|
||||
offset(CSprite.y1)-offset(CSprite.start), //SPT_BSPLINE2
|
||||
offset(CSprite.y1)-offset(CSprite.start), //SPT_BSPLINE2_CLOSED
|
||||
offset(CSprite.y1)-offset(CSprite.start), //SPT_BSPLINE3
|
||||
offset(CSprite.y1)-offset(CSprite.start), //SPT_BSPLINE3_CLOSED
|
||||
offset(CSprite.x2)-offset(CSprite.start), //SPT_FLOOD_FILL
|
||||
offset(CSprite.x2)-offset(CSprite.start), //SPT_FLOOD_FILL_NOT
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //SPT_BITMAP
|
||||
offset(CSprite.x2)-offset(CSprite.start), //SPT_MESH
|
||||
offset(CSprite.shiftable_tri_cnt)+sizeof(I32)-offset(CSprite.start), //SPT_SHIFTABLE_MESH
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //SPT_ARROW
|
||||
offset(CSprite.st)-offset(CSprite.start), //SPT_TEXT
|
||||
offset(CSprite.st)-offset(CSprite.start), //SPT_TEXT_BOX
|
||||
offset(CSprite.st)-offset(CSprite.start), //SPT_TEXT_DIAMOND
|
||||
sizeof(CSpriteBase), //SPT_END
|
||||
sizeof(CSpriteColor), //SPT_COLOR
|
||||
sizeof(CSpriteDitherColor), //SPT_DITHER_COLOR
|
||||
sizeof(CSpriteWidth), //SPT_WIDTH
|
||||
sizeof(CSpritePtPt), //SPT_PLANAR_SYMMETRY
|
||||
sizeof(CSpriteBase), //SPT_TRANSFORM_ON
|
||||
sizeof(CSpriteBase), //SPT_TRANSFORM_OFF
|
||||
sizeof(CSpritePt), //SPT_SHIFT
|
||||
sizeof(CSpritePt), //SPT_PT
|
||||
sizeof(CSpriteNumPtU8s), //SPT_POLYPT
|
||||
sizeof(CSpritePtPt), //SPT_LINE
|
||||
sizeof(CSpriteNumU8s), //SPT_POLYLINE
|
||||
sizeof(CSpritePtPt), //SPT_RECT
|
||||
sizeof(CSpritePtPtAng), //SPT_ROTATED_RECT
|
||||
sizeof(CSpritePtRad), //SPT_CIRCLE
|
||||
sizeof(CSpritePtWHAng), //SPT_ELLIPSE
|
||||
sizeof(CSpritePtWHAngSides), //SPT_POLYGON
|
||||
sizeof(CSpriteNumU8s), //SPT_BSPLINE2
|
||||
sizeof(CSpriteNumU8s), //SPT_BSPLINE2_CLOSED
|
||||
sizeof(CSpriteNumU8s), //SPT_BSPLINE3
|
||||
sizeof(CSpriteNumU8s), //SPT_BSPLINE3_CLOSED
|
||||
sizeof(CSpritePt), //SPT_FLOOD_FILL
|
||||
sizeof(CSpritePt), //SPT_FLOOD_FILL_NOT
|
||||
sizeof(CSpritePtWHU8s), //SPT_BITMAP
|
||||
sizeof(CSpriteMeshU8s), //SPT_MESH
|
||||
sizeof(CSpritePtMeshU8s), //SPT_SHIFTABLE_MESH
|
||||
sizeof(CSpritePtPt), //SPT_ARROW
|
||||
sizeof(CSpritePtStr), //SPT_TEXT
|
||||
sizeof(CSpritePtStr), //SPT_TEXT_BOX
|
||||
sizeof(CSpritePtStr), //SPT_TEXT_DIAMOND
|
||||
};
|
||||
|
||||
I64 SpriteElemQuedBaseSize(I64 type)
|
||||
@@ -47,30 +47,30 @@ I64 SpriteElemSize(CSprite *tempg)
|
||||
I64 i=sprite_elem_base_sizes[tempg->type];
|
||||
switch (tempg->type) {
|
||||
case SPT_POLYLINE:
|
||||
i+=tempg->num*sizeof(CD2I32);
|
||||
i+=tempg->nu.num*sizeof(CD2I32);
|
||||
break;
|
||||
case SPT_TEXT:
|
||||
case SPT_TEXT_BOX:
|
||||
case SPT_TEXT_DIAMOND:
|
||||
i+=StrLen(tempg->st)+1;
|
||||
i+=StrLen(tempg->ps.st)+1;
|
||||
break;
|
||||
case SPT_BITMAP:
|
||||
i+=((tempg->width+7)&~7)*tempg->height;
|
||||
i+=((tempg->pwhu.width+7)&~7)*tempg->pwhu.height;
|
||||
break;
|
||||
case SPT_POLYPT:
|
||||
i+=(tempg->num*3+7)>>3;
|
||||
i+=(tempg->npu.num*3+7)>>3;
|
||||
break;
|
||||
case SPT_BSPLINE2:
|
||||
case SPT_BSPLINE3:
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
i+=tempg->num*sizeof(CD3I32);
|
||||
i+=tempg->nu.num*sizeof(CD3I32);
|
||||
break;
|
||||
case SPT_MESH:
|
||||
i+=tempg->vertex_cnt*sizeof(CD3I32)+tempg->tri_cnt*sizeof(CMeshTri);
|
||||
i+=tempg->mu.vertex_cnt*sizeof(CD3I32)+tempg->mu.tri_cnt*sizeof(CMeshTri);
|
||||
break;
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
i+=tempg->shiftable_vertex_cnt*sizeof(CD3I32)+tempg->shiftable_tri_cnt*sizeof(CMeshTri);
|
||||
i+=tempg->pmu.vertex_cnt*sizeof(CD3I32)+tempg->pmu.tri_cnt*sizeof(CMeshTri);
|
||||
break;
|
||||
}
|
||||
return i;
|
||||
@@ -105,12 +105,11 @@ public U8 *DC2Sprite(CDC *tempb)
|
||||
sprite_elem_base_sizes[SPT_END])
|
||||
(U8 *)-offset(CSprite.start);
|
||||
tempg->type=SPT_BITMAP;
|
||||
tempg->width=tempb->width;
|
||||
tempg->height=tempb->height;
|
||||
tempg->x2=0;
|
||||
tempg->y2=0;
|
||||
MemCpy(tempg(U8 *)+offset(CSprite.linespeed),tempb->body,
|
||||
tempb->width_internal*tempb->height);
|
||||
tempg->pwhu.width=tempb->width;
|
||||
tempg->pwhu.height=tempb->height;
|
||||
tempg->pwhu.x1=0;
|
||||
tempg->pwhu.y1=0;
|
||||
MemCpy(&tempg->pwhu.u,tempb->body,tempb->width_internal*tempb->height);
|
||||
return tempg(U8 *)+offset(CSprite.start);
|
||||
}
|
||||
|
||||
@@ -121,56 +120,56 @@ public U8 *SpriteElem2OneLineSummary(CSprite *tempg)
|
||||
StrPrint(buf,"%Z",tempg->type,"ST_SPRITE_ELEM_TYPES");
|
||||
switch (tempg->type) {
|
||||
case SPT_COLOR:
|
||||
CatPrint(buf," %s",Color2Str(buf2,tempg->color));
|
||||
CatPrint(buf," %s",Color2Str(buf2,tempg->c.color));
|
||||
break;
|
||||
case SPT_DITHER_COLOR:
|
||||
CatPrint(buf," %s",Color2Str(buf2,ROPF_DITHER|tempg->dither_color.u8[0]|tempg->dither_color.u8[1]<<COLORROP_BITS));
|
||||
CatPrint(buf," %s",Color2Str(buf2,ROPF_DITHER|tempg->d.dither_color.u8[0]|tempg->d.dither_color.u8[1]<<COLORROP_BITS));
|
||||
break;
|
||||
case SPT_PT:
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
case SPT_SHIFT:
|
||||
CatPrint(buf," (%d,%d)",tempg->x1,tempg->y1);
|
||||
CatPrint(buf," (%d,%d)",tempg->p.x1,tempg->p.y1);
|
||||
break;
|
||||
case SPT_LINE:
|
||||
case SPT_ARROW:
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
case SPT_RECT:
|
||||
case SPT_ROTATED_RECT:
|
||||
CatPrint(buf," (%d,%d),(%d,%d)",tempg->x1,tempg->y1,tempg->x2,tempg->y2);
|
||||
CatPrint(buf," (%d,%d),(%d,%d)",tempg->pp.x1,tempg->pp.y1,tempg->pp.x2,tempg->pp.y2);
|
||||
break;
|
||||
case SPT_CIRCLE:
|
||||
CatPrint(buf," (%d,%d):%dR",tempg->x1,tempg->y1,tempg->x2);
|
||||
CatPrint(buf," (%d,%d):%dR",tempg->pr.x1,tempg->pr.y1,tempg->pr.radius);
|
||||
break;
|
||||
case SPT_WIDTH:
|
||||
CatPrint(buf," %d",tempg->width);
|
||||
CatPrint(buf," %d",tempg->w.width);
|
||||
break;
|
||||
case SPT_TEXT:
|
||||
case SPT_TEXT_BOX:
|
||||
case SPT_TEXT_DIAMOND:
|
||||
CatPrint(buf," %d,%d:%-16tQ",tempg->x1,tempg->y1,tempg->st);
|
||||
CatPrint(buf," %d,%d:%-16tQ",tempg->ps.x1,tempg->ps.y1,tempg->ps.st);
|
||||
break;
|
||||
case SPT_POLYLINE:
|
||||
case SPT_POLYPT:
|
||||
ptr=&tempg->y1;
|
||||
CatPrint(buf," %d (%d,%d)",tempg->num,ptr[0],ptr[1]);
|
||||
ptr=&tempg->npu.x;
|
||||
CatPrint(buf," %d (%d,%d)",tempg->npu.num,ptr[0],ptr[1]);
|
||||
break;
|
||||
case SPT_ELLIPSE:
|
||||
case SPT_POLYGON:
|
||||
case SPT_BITMAP:
|
||||
CatPrint(buf," (%d,%d):%dW,%dH",tempg->x2,tempg->y2,tempg->width,tempg->height);
|
||||
CatPrint(buf," (%d,%d):%dW,%dH",tempg->pwhu.x1,tempg->pwhu.y1,tempg->pwhu.width,tempg->pwhu.height);
|
||||
break;
|
||||
case SPT_BSPLINE2:
|
||||
case SPT_BSPLINE3:
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
CatPrint(buf," %d",tempg->num);
|
||||
CatPrint(buf," %d",tempg->nu.num);
|
||||
break;
|
||||
case SPT_MESH:
|
||||
CatPrint(buf," %dV,%dT",tempg->vertex_cnt,tempg->tri_cnt);
|
||||
CatPrint(buf," %dV,%dT",tempg->mu.vertex_cnt,tempg->mu.tri_cnt);
|
||||
break;
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
CatPrint(buf," %dV,%dT",tempg->shiftable_vertex_cnt,tempg->shiftable_tri_cnt);
|
||||
CatPrint(buf," %dV,%dT",tempg->pmu.vertex_cnt,tempg->pmu.tri_cnt);
|
||||
break;
|
||||
}
|
||||
return StrNew(buf);
|
||||
|
||||
+5
-11
@@ -26,7 +26,7 @@ public CMenuEntry *MenuEntryFind(CMenu *haystack_menu,U8 *needle_full_name)
|
||||
//Just 2 levels -- across top and down are valid, currently.
|
||||
U8 *st,*st2;
|
||||
CMenuEntry *tempse;
|
||||
if (!haystack_menu || haystack_menu->mu_signature!=MENU_SIGNATURE_VAL || !needle_full_name)
|
||||
if (!haystack_menu || !needle_full_name)
|
||||
return NULL;
|
||||
st=StrNew(needle_full_name);
|
||||
st2=StrNew(needle_full_name);
|
||||
@@ -91,13 +91,11 @@ public CMenu *MenuNew(U8 *st,I64 flags=0,CTask *task=NULL)
|
||||
m=CAlloc(sizeof(CMenu),task);
|
||||
m->task=task;
|
||||
m->flags=flags;
|
||||
m->attr =LTBLUE<<4 +YELLOW;
|
||||
m->checked_attr=LTGREEN<<4+BROWN;
|
||||
m->attr =BLUE<<4+YELLOW;
|
||||
tempse=&m->sub;
|
||||
while (tempse)
|
||||
tempse=tempse->next=MenuNewSub(lx,task);
|
||||
LexDel(lx);
|
||||
m->mu_signature=MENU_SIGNATURE_VAL;
|
||||
return m;
|
||||
}
|
||||
|
||||
@@ -127,9 +125,7 @@ U0 MenuDelSub(CMenuEntry *tempme)
|
||||
public U0 MenuDel(CMenu *m)
|
||||
{//Delete a manu. You probably don't need this.
|
||||
CMenuEntry *tempme,*tempme1;
|
||||
if (!m || m->mu_signature!=MENU_SIGNATURE_VAL)
|
||||
return;
|
||||
m->mu_signature=0;
|
||||
if (!m) return;
|
||||
tempme=m->sub;
|
||||
while (tempme) {
|
||||
tempme1=tempme->next;
|
||||
@@ -181,12 +177,10 @@ U0 DrawMenu(CDC *dc)
|
||||
U8 *st=NULL;
|
||||
CTask *task=MenuTask;
|
||||
I64 i,w,x0,y0,x1=ip.pos.x,y1=ip.pos.y;
|
||||
if (!TaskValidate(task) || !(m=task->cur_menu) ||
|
||||
m->mu_signature!=MENU_SIGNATURE_VAL) {
|
||||
if (!TaskValidate(task) || !(m=task->cur_menu)) {
|
||||
sys_cur_submenu_entry=NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
dc->color=m->attr>>4;
|
||||
GrRect(dc,0,0,GR_WIDTH,FONT_HEIGHT);
|
||||
x0=0;
|
||||
@@ -205,7 +199,7 @@ U0 DrawMenu(CDC *dc)
|
||||
tempse=tempme->sub;
|
||||
while (tempse) {
|
||||
if (tempse->checked)
|
||||
i=m->checked_attr;
|
||||
i=m->attr^0xFF;
|
||||
else
|
||||
i=m->attr;
|
||||
if (y0<=y1<y0+FONT_HEIGHT) {
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@ public U0 SndTaskEndCB()
|
||||
Exit;
|
||||
}
|
||||
|
||||
#include "MathAudio"
|
||||
#include "Music"
|
||||
#include "SndMath"
|
||||
#include "SndMusic"
|
||||
#include "SndEffects"
|
||||
#include "SndFile"
|
||||
+15
-1
@@ -17,7 +17,7 @@ class CFileSND
|
||||
#define MAX_SND_FILE_DATA 0x7FFFFF00
|
||||
|
||||
public I64 SndFileCreate(U8 *base_filename,F64 normalized_vol=1.0,F64 averaging=0.0,I64 waveform=WF_SQUARE,
|
||||
F64 reverb_delay=0,F64 reverb_intensity=0)
|
||||
F64 reverb_delay=0,F64 reverb_intensity=0,F64 time_shift=0)
|
||||
{//Use "snd.record" flag to start or stop recording, then call this routine.
|
||||
//Averaging should be a num from 0.0 to 0.999.
|
||||
//Vol should be from 0.0 to 1.0.
|
||||
@@ -46,6 +46,20 @@ public I64 SndFileCreate(U8 *base_filename,F64 normalized_vol=1.0,F64 averaging=
|
||||
s->sample_rate=EndianU32(SNDFILE_SAMPLE_RATE);
|
||||
s->channels=EndianU32(1);
|
||||
|
||||
if (time_shift) {
|
||||
d=snd.record_root.next;
|
||||
d->time-=time_shift;
|
||||
while (d->next!=&snd.record_root) {
|
||||
d1=d->next;
|
||||
dt=d1->time-d->time;
|
||||
if (dt<0) {
|
||||
QueRem(d1);
|
||||
Free(d1);
|
||||
} else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
d=snd.record_root.next;
|
||||
k=0;
|
||||
while (d->next!=&snd.record_root) {
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -1,12 +0,0 @@
|
||||
U0 Start()
|
||||
{
|
||||
Type("::/Doc/Splash.TXT");
|
||||
SetWinHorz(TEXT_COLS/4-1,3*TEXT_COLS/4);
|
||||
SetWinVert(6,Fs->win_bottom);
|
||||
"$$GREEN$$Tip of day$$FG$$\n";
|
||||
TipOfDay;
|
||||
"$$GREEN$$<SHIFT-ESC>$$FG$$ to exit.\n";
|
||||
View;
|
||||
}
|
||||
|
||||
Start;
|
||||
@@ -10,6 +10,7 @@ public CTaskSettings *SettingsPush(CTask *task=NULL,I64 flags=0)
|
||||
if (!task) task=Fs;
|
||||
if (!TaskValidate(task)) return NULL;
|
||||
tempse=CAlloc(sizeof(CTaskSettings),task);
|
||||
tempse->cur_dir=CurDir(task,task);
|
||||
tempse->draw_it=task->draw_it;
|
||||
GetVGAPalette4(tempse->palette4);
|
||||
tempse->task_end_cb=task->task_end_cb;
|
||||
@@ -48,10 +49,10 @@ public CTaskSettings *SettingsPush(CTask *task=NULL,I64 flags=0)
|
||||
tempse->border_src =task->border_src;
|
||||
tempse->border=!Bt(&task->display_flags,DISPLAYf_NO_BORDER);
|
||||
tempse->preempt=Bt(&task->task_flags,TASKf_PREEMPT);
|
||||
if (TaskValidate(ws.task))
|
||||
tempse->wordstat=TRUE;
|
||||
if (TaskValidate(ac.task))
|
||||
tempse->autocomplete=TRUE;
|
||||
else
|
||||
tempse->wordstat=FALSE;
|
||||
tempse->autocomplete=FALSE;
|
||||
|
||||
tempse->next=task->next_settings;
|
||||
task->next_settings=tempse;
|
||||
@@ -68,8 +69,8 @@ U0 SettingsPop2(CTask *task,CTaskSettings *tempse)
|
||||
}
|
||||
|
||||
WinBorder(tempse->border,task);
|
||||
SetWinHorz(tempse->left,tempse->right,task);
|
||||
SetWinVert(tempse->top,tempse->bottom,task);
|
||||
WinHorz(tempse->left,tempse->right,task);
|
||||
WinVert(tempse->top,tempse->bottom,task);
|
||||
task->scroll_x=tempse->scroll_x;
|
||||
task->scroll_y=tempse->scroll_y;
|
||||
task->scroll_z=tempse->scroll_z;
|
||||
@@ -79,7 +80,7 @@ U0 SettingsPop2(CTask *task,CTaskSettings *tempse)
|
||||
task->border_src =tempse->border_src;
|
||||
task->title_src =tempse->title_src;
|
||||
StrCpy(task->task_title,tempse->task_title);
|
||||
WordStat(tempse->wordstat);
|
||||
AutoComplete(tempse->autocomplete);
|
||||
SetVGAPalette4(tempse->palette4);
|
||||
Snd(0);
|
||||
}
|
||||
@@ -95,6 +96,8 @@ public U0 SettingsPop(CTask *task=NULL,I64 flags=0)
|
||||
}
|
||||
if (tempse=task->next_settings) {
|
||||
task->next_settings=tempse->next;
|
||||
Cd(tempse->cur_dir);
|
||||
Free(tempse->cur_dir);
|
||||
task->draw_it=tempse->draw_it;
|
||||
task->task_end_cb=tempse->task_end_cb;
|
||||
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ U0 KeyMapCtrlAltFamily()
|
||||
|
||||
a2=SC_ESC+SCF_CTRL+SCF_ALT;
|
||||
st2=ScanCode2KeyName(a2);
|
||||
st=SrcEdLink(&SpawnUser,256);
|
||||
st=SrcEdLink(&User,256);
|
||||
"%20s $$LK,\"%s\",A=\"%s\"$$\n",st2,"Sys/Spawn New User Task",st;
|
||||
Free(st);
|
||||
Free(st2);
|
||||
|
||||
+105
-64
@@ -24,23 +24,21 @@ class CFileBMP
|
||||
CBGR palette[16];
|
||||
};
|
||||
|
||||
public CFileBMP *BMPFile4To(CDC *dc)
|
||||
public CFileBMP *BMP4To(CDC *dc)
|
||||
{//To Windows 4-bit BMP.
|
||||
U8 *src,*ptr;
|
||||
I64 x,y,w=dc->width>>1,
|
||||
size=offset(CFileBMP.end)+dc->width*dc->height>>1+16*sizeof(CBGR);
|
||||
CFileBMP *r=CAlloc(size);
|
||||
r->type='BM';
|
||||
r->planes=1;
|
||||
r->file_size=size;
|
||||
r->data_offset=offset(CFileBMP.end);
|
||||
r->header_size=offset(CFileBMP.end)-
|
||||
offset(CFileBMP.header_size);
|
||||
r->width=dc->width;
|
||||
r->height=dc->height;
|
||||
r->bit_cnt=4;
|
||||
r->image_size=dc->width*dc->height>>1;
|
||||
r->data_offset+=16*sizeof(CBGR);
|
||||
size=sizeof(CFileBMP)+dc->width*dc->height>>1;
|
||||
CFileBMP *r =CAlloc(size);
|
||||
r->type ='BM';
|
||||
r->planes =1;
|
||||
r->file_size =size;
|
||||
r->data_offset=sizeof(CFileBMP);
|
||||
r->header_size=offset(CFileBMP.end)-offset(CFileBMP.header_size);
|
||||
r->width =dc->width;
|
||||
r->height =dc->height;
|
||||
r->bit_cnt =4;
|
||||
r->image_size =dc->width*dc->height>>1;
|
||||
GetVGAPalette4(r->palette);
|
||||
ptr=r(U8 *)+r->data_offset;
|
||||
for (y=dc->height-1;y>=0;y--) {
|
||||
@@ -54,23 +52,21 @@ public CFileBMP *BMPFile4To(CDC *dc)
|
||||
return r;
|
||||
}
|
||||
|
||||
public CFileBMP *BMPFileRLE4To(CDC *dc)
|
||||
public CFileBMP *BMPRLE4To(CDC *dc)
|
||||
{//To Windows RLE4 bit BMP.
|
||||
U8 *src,*ptr;
|
||||
U8 *src,*ptr,*start;
|
||||
I64 x,y,w=dc->width,cnt,pattern;
|
||||
CFileBMP *r=CAlloc(offset(CFileBMP.end)+2*(dc->width+1)*dc->height+16*sizeof(CBGR));
|
||||
r->type='BM';
|
||||
r->planes=1;
|
||||
r->data_offset=offset(CFileBMP.end);
|
||||
r->header_size=offset(CFileBMP.end)-
|
||||
offset(CFileBMP.header_size);
|
||||
r->width=dc->width;
|
||||
r->height=dc->height;
|
||||
r->bit_cnt=4;
|
||||
CFileBMP *r =CAlloc(sizeof(CFileBMP)+2*(dc->width+1)*dc->height);
|
||||
r->type ='BM';
|
||||
r->planes =1;
|
||||
r->data_offset=sizeof(CFileBMP);
|
||||
r->header_size=offset(CFileBMP.end)-offset(CFileBMP.header_size);
|
||||
r->width =dc->width;
|
||||
r->height =dc->height;
|
||||
r->bit_cnt =4;
|
||||
r->compression=2; //RLE4
|
||||
r->data_offset+=16*sizeof(CBGR);
|
||||
GetVGAPalette4(r->palette);
|
||||
ptr=r(U8 *)+r->data_offset;
|
||||
start=ptr=r(U8 *)+r->data_offset;
|
||||
for (y=dc->height-1;y>=0;y--) {
|
||||
src=y*dc->width_internal+dc->body;
|
||||
x=0;
|
||||
@@ -101,27 +97,26 @@ public CFileBMP *BMPFileRLE4To(CDC *dc)
|
||||
}
|
||||
*ptr(U16 *)++=0;
|
||||
}
|
||||
r->image_size=ptr-(&r->data_offset)(U8 *);
|
||||
r->file_size=offset(CFileBMP.end)+r->image_size+16*sizeof(CBGR);
|
||||
r->image_size=ptr-start;
|
||||
r->file_size=sizeof(CFileBMP)+r->image_size;
|
||||
return r;
|
||||
}
|
||||
|
||||
public CFileBMP *BMPFile24To(CDC *dc)
|
||||
public CFileBMP *BMP24To(CDC *dc)
|
||||
{//To Windows 24-bit BMP.
|
||||
U8 *src;
|
||||
I64 i,x,y,size=offset(CFileBMP.end)+dc->width*dc->height*sizeof(CRGB);
|
||||
CBGR *bgr;
|
||||
CFileBMP *r=CAlloc(size);
|
||||
r->type='BM';
|
||||
r->planes=1;
|
||||
r->file_size=size;
|
||||
CFileBMP *r =CAlloc(size);
|
||||
r->type ='BM';
|
||||
r->planes =1;
|
||||
r->file_size =size;
|
||||
r->data_offset=offset(CFileBMP.end);
|
||||
r->header_size=offset(CFileBMP.end)-
|
||||
offset(CFileBMP.header_size);
|
||||
r->width=dc->width;
|
||||
r->height=dc->height;
|
||||
r->bit_cnt=32;
|
||||
r->image_size=dc->width*dc->height<<2;
|
||||
r->header_size=offset(CFileBMP.end)-offset(CFileBMP.header_size);
|
||||
r->width =dc->width;
|
||||
r->height =dc->height;
|
||||
r->bit_cnt =32;
|
||||
r->image_size =dc->width*dc->height<<2;
|
||||
|
||||
bgr=r(U8 *)+r->data_offset;
|
||||
for (y=dc->height-1;y>=0;y--) {
|
||||
@@ -142,22 +137,22 @@ public CFileBMP *BMPFile24To(CDC *dc)
|
||||
return r;
|
||||
}
|
||||
|
||||
public I64 BMPFileWrite(U8 *filename,CDC *dc,I64 bits=4)
|
||||
public I64 BMPWrite(U8 *filename,CDC *dc,I64 bits=4)
|
||||
{//Window's BMP Files.
|
||||
I64 size;
|
||||
CFileBMP *r;
|
||||
if (bits==4) {
|
||||
if (IsDotZ(filename)) //.Z compression is better than RLE
|
||||
r=BMPFile4To(dc);
|
||||
r=BMP4To(dc);
|
||||
else {
|
||||
r=BMPFileRLE4To(dc);
|
||||
if (r->file_size>offset(CFileBMP.end)+dc->width*dc->height>>1+16*sizeof(CBGR)) {
|
||||
r=BMPRLE4To(dc);
|
||||
if (r->file_size>sizeof(CFileBMP)+dc->width*dc->height>>1) {
|
||||
Free(r);
|
||||
r=BMPFile4To(dc);
|
||||
r=BMP4To(dc);
|
||||
}
|
||||
}
|
||||
} else if (bits==24)
|
||||
r=BMPFile24To(dc);
|
||||
r=BMP24To(dc);
|
||||
else {
|
||||
"Format Not Supported.\n";
|
||||
return 0;
|
||||
@@ -168,7 +163,7 @@ public I64 BMPFileWrite(U8 *filename,CDC *dc,I64 bits=4)
|
||||
return size;
|
||||
}
|
||||
|
||||
U8 *BMPFilePaletteNew(CFileBMP *r)
|
||||
U8 *BMPPaletteNew(CFileBMP *r)
|
||||
{
|
||||
I64 i,j,best,score,best_score;
|
||||
CBGR palette[16];
|
||||
@@ -193,11 +188,39 @@ U8 *BMPFilePaletteNew(CFileBMP *r)
|
||||
|
||||
U8 ms_paint_palette[16]={0,4,2,6,1,5,3,8,7,12,10,14,9,13,11,15};
|
||||
|
||||
public CDC *BMPFileRead(U8 *filename,Bool use_ms_paint_palette=FALSE)
|
||||
I64 BMP24Color(CBGR *ptr,Bool dither_probability)
|
||||
{
|
||||
I64 result,k;
|
||||
if (dither_probability) {
|
||||
k=RandU32;
|
||||
if (SqrI64(ptr->r)+SqrI64(ptr->g)+SqrI64(ptr->b)>=3*SqrI64(k.u8[0]))
|
||||
result=8;
|
||||
else
|
||||
result=0;
|
||||
if (ptr->r>=k.u8[1]) result|=RED;
|
||||
if (ptr->g>=k.u8[2]) result|=GREEN;
|
||||
if (ptr->b>=k.u8[3]) result|=BLUE;
|
||||
} else {
|
||||
if (SqrI64(ptr->r)+SqrI64(ptr->g)+SqrI64(ptr->b)>=SqrI64(0x80)) {
|
||||
result=8;
|
||||
if (ptr->r>=0x80) result|=RED;
|
||||
if (ptr->g>=0x80) result|=GREEN;
|
||||
if (ptr->b>=0x80) result|=BLUE;
|
||||
} else {
|
||||
result=0;
|
||||
if (ptr->r>=0x40) result|=RED;
|
||||
if (ptr->g>=0x40) result|=GREEN;
|
||||
if (ptr->b>=0x40) result|=BLUE;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public CDC *BMPRead(U8 *filename,Bool dither_probability=FALSE,Bool use_ms_paint_palette=FALSE)
|
||||
{//Window's BMP Files.
|
||||
I64 i,j,cnt;
|
||||
U8 *palette_map,*ptr;
|
||||
Bool rle4;
|
||||
Bool rle;
|
||||
CFileBMP *r;
|
||||
CDC *result=NULL;
|
||||
if (ptr=FileRead(filename)) {
|
||||
@@ -205,17 +228,17 @@ public CDC *BMPFileRead(U8 *filename,Bool use_ms_paint_palette=FALSE)
|
||||
if (0<r->width<MAX_I32 && 0<r->height<MAX_I32) {
|
||||
result=DCNew(r->width,r->height);
|
||||
ptr+=r->data_offset;
|
||||
if (r->compression==2)
|
||||
rle=TRUE;
|
||||
else
|
||||
rle=FALSE;
|
||||
if (use_ms_paint_palette)
|
||||
palette_map=ms_paint_palette;
|
||||
else
|
||||
palette_map=BMPPaletteNew(r);
|
||||
if (r->bit_cnt==4) {
|
||||
if (r->compression==2)
|
||||
rle4=TRUE;
|
||||
else
|
||||
rle4=FALSE;
|
||||
if (use_ms_paint_palette)
|
||||
palette_map=ms_paint_palette;
|
||||
else
|
||||
palette_map=BMPFilePaletteNew(r);
|
||||
for (i=r->height-1;i>=0;i--)
|
||||
if (rle4) {//We don't support full RLE4, just our own subset
|
||||
if (rle) {//We don't support full RLE4, just our own subset
|
||||
j=0;
|
||||
while (cnt=*ptr++) {
|
||||
if (cnt==1) {
|
||||
@@ -238,7 +261,7 @@ public CDC *BMPFileRead(U8 *filename,Bool use_ms_paint_palette=FALSE)
|
||||
}
|
||||
ptr++;
|
||||
} else
|
||||
for (j=0;j<(r->width+7)&-8;) {
|
||||
for (j=0;j<(r->width+7)&~7;) {
|
||||
result->color=palette_map[*ptr&15];
|
||||
GrPlot(result,j+1,i);
|
||||
result->color=palette_map[*ptr>>4];
|
||||
@@ -248,6 +271,24 @@ public CDC *BMPFileRead(U8 *filename,Bool use_ms_paint_palette=FALSE)
|
||||
}
|
||||
if (!use_ms_paint_palette)
|
||||
Free(palette_map);
|
||||
} else if (r->bit_cnt==24) {
|
||||
for (i=r->height-1;i>=0;i--) {
|
||||
for (j=0;j<r->width;j++,ptr+=3) {
|
||||
result->color=BMP24Color(ptr,dither_probability);
|
||||
GrPlot(result,j,i);
|
||||
}
|
||||
ptr+=r->width&3;
|
||||
}
|
||||
if (!use_ms_paint_palette)
|
||||
Free(palette_map);
|
||||
} else if (r->bit_cnt>=32) {
|
||||
for (i=r->height-1;i>=0;i--)
|
||||
for (j=0;j<r->width;j++,ptr+=4) {
|
||||
result->color=BMP24Color(ptr,dither_probability);
|
||||
GrPlot(result,j,i);
|
||||
}
|
||||
if (!use_ms_paint_palette)
|
||||
Free(palette_map);
|
||||
} else {
|
||||
"Format Not Supported.\n";
|
||||
DCDel(result);
|
||||
@@ -261,9 +302,9 @@ public CDC *BMPFileRead(U8 *filename,Bool use_ms_paint_palette=FALSE)
|
||||
}
|
||||
|
||||
#help_index "Graphics/Sprite;Graphics/Windows BMP Files;DolDoc/Output"
|
||||
public U0 DocBMPFile(CDoc *doc=NULL,U8 *filename,Bool use_ms_paint_palette=FALSE)
|
||||
public U0 DocBMP(CDoc *doc=NULL,U8 *filename,Bool dither_probability=FALSE,Bool use_ms_paint_palette=FALSE)
|
||||
{//Put a BMP file into a document as a sprite.
|
||||
CDC *dc=BMPFileRead(filename,use_ms_paint_palette);
|
||||
CDC *dc=BMPRead(filename,dither_probability,use_ms_paint_palette);
|
||||
CSprite *elems=DC2Sprite(dc);
|
||||
DocSprite(doc,elems);
|
||||
Free(elems);
|
||||
@@ -271,10 +312,10 @@ public U0 DocBMPFile(CDoc *doc=NULL,U8 *filename,Bool use_ms_paint_palette=FALSE
|
||||
}
|
||||
|
||||
#help_index "Graphics/Windows BMP Files;Graphics/Screen"
|
||||
public I64 BMPFileCaptureScreen(U8 *filename,I64 bits=4)
|
||||
public I64 BMPCaptureScreen(U8 *filename,I64 bits=4,Bool include_zoom=TRUE)
|
||||
{//Capture screen as BMP file.
|
||||
CDC *dc=DCCaptureScreen;
|
||||
I64 size=BMPFileWrite(filename,dc,bits);
|
||||
CDC *dc=DCCaptureScreen(include_zoom);
|
||||
I64 size=BMPWrite(filename,dc,bits);
|
||||
DCDel(dc);
|
||||
return size;
|
||||
}
|
||||
@@ -140,7 +140,7 @@ I64 GrepFile(U8 *needle_str,U8 *haystack_filename,I64 *_fuf_flags,U8 *replace_te
|
||||
return cnt;
|
||||
}
|
||||
|
||||
public I64 Grep(U8 *needle_str,U8 *files_find_mask="*",U8 *fu_flags=NULL,U8 *replace_text=NULL)
|
||||
public I64 Find(U8 *needle_str,U8 *files_find_mask="*",U8 *fu_flags=NULL,U8 *replace_text=NULL)
|
||||
{/*Find occurrences of a string in files.
|
||||
This does not do regular expressions.
|
||||
Anyway, it's good for searching and replacing.
|
||||
@@ -184,7 +184,7 @@ public I64 FileOcc(U8 *needle_str,U8 *files_find_mask="*",U8 *fu_flags="+r+i+l")
|
||||
*/
|
||||
I64 cnt=0;
|
||||
Bool old_silent=Silent(TRUE);
|
||||
cnt=Grep(needle_str,files_find_mask,fu_flags);
|
||||
cnt=Find(needle_str,files_find_mask,fu_flags);
|
||||
Silent(old_silent);
|
||||
return cnt;
|
||||
}
|
||||
@@ -215,7 +215,7 @@ I64 GrepWiz()
|
||||
g->match_case=doc->find_replace->match_case;
|
||||
g->whole_labels=doc->find_replace->whole_labels;
|
||||
}
|
||||
if (DocFormDo(g,,0,"$$PURPLE$$$$TX+CX,\"Grep\"$$\n$$FG$$")) {
|
||||
if (DocFormDo(g,,0,"$$PURPLE$$$$TX+CX,\"Find\"$$\n$$FG$$")) {
|
||||
if (doc) {
|
||||
StrCpy(doc->find_replace->find_text,g->find_text);
|
||||
StrCpy(doc->find_replace->replace_text,g->replace_text);
|
||||
@@ -233,9 +233,9 @@ I64 GrepWiz()
|
||||
if (g->whole_labels)
|
||||
CatPrint(buf,"+l");
|
||||
if (g->replace)
|
||||
st=MStrPrint("\"$$$$WW+H,1$$$$\";Cd(\"%s\");Grep(\"%Q\",\"%Q\",\"%Q\",\"%Q\");UserTaskCont;",dir,g->find_text,g->filemask,buf,g->replace_text);
|
||||
st=MStrPrint("\"$$$$WW+H,1$$$$\";Cd(\"%s\");Find(\"%Q\",\"%Q\",\"%Q\",\"%Q\");UserTaskCont;",dir,g->find_text,g->filemask,buf,g->replace_text);
|
||||
else
|
||||
st=MStrPrint("\"$$$$WW+H,1$$$$\";Cd(\"%s\");Grep(\"%Q\",\"%Q\",\"%Q\");UserTaskCont;",dir,g->find_text,g->filemask,buf);
|
||||
st=MStrPrint("\"$$$$WW+H,1$$$$\";Cd(\"%s\");Find(\"%Q\",\"%Q\",\"%Q\");UserTaskCont;",dir,g->find_text,g->filemask,buf);
|
||||
result=PopUp(st);
|
||||
}
|
||||
Free(dir);
|
||||
@@ -56,14 +56,14 @@ I64 SizeRep1(CDirEntry *tempde,I64 *_fuf_flags)
|
||||
{
|
||||
I64 result=0,i;
|
||||
U8 buf[BLK_SIZE];
|
||||
CPrt *p;
|
||||
CDrv *dv;
|
||||
while (tempde) {
|
||||
if (tempde->attr&RS_ATTR_DIR)
|
||||
i=SizeRep1(tempde->sub,_fuf_flags);
|
||||
else if ((i=tempde->size) && Bt(_fuf_flags,FUf_EXPAND) &&
|
||||
FileAttr(tempde->name)&RS_ATTR_COMPRESSED) {
|
||||
p=Drv2Prt(*tempde->full_name);
|
||||
RBlks(p,buf,Cluster2Blk(p,tempde->cluster),1);
|
||||
dv=Let2Drv(*tempde->full_name);
|
||||
RBlks(dv,buf,Cluster2Blk(dv,tempde->cluster),1);
|
||||
i=(&buf)(CArcCompress *)->expanded_size;
|
||||
}
|
||||
tempde->user_data=i;
|
||||
|
||||
+29
-37
@@ -2,21 +2,15 @@
|
||||
|
||||
I64 TSSSize(CTSS *tss)
|
||||
{
|
||||
return MSize2(tss)+
|
||||
MSize2(tss->st0)+
|
||||
MSize2(tss->st1)+
|
||||
MSize2(tss->st2);
|
||||
return MSize2(tss)+MSize2(tss->st0)+MSize2(tss->st1)+MSize2(tss->st2);
|
||||
}
|
||||
|
||||
I64 PenBrushesSize()
|
||||
{
|
||||
I64 result=0,i;
|
||||
for (i=0;i<GR_NUM_PEN_BRUSHES;i++)
|
||||
result+=
|
||||
DCSize(gr.pen_brushes[i])+
|
||||
DCSize(gr.collision_pen_brushes[i])+
|
||||
DCSize(gr.even_pen_brushes[i])+
|
||||
DCSize(gr.odd_pen_brushes[i] );
|
||||
result+=DCSize(gr.pen_brushes[i])+DCSize(gr.collision_pen_brushes[i])+
|
||||
DCSize(gr.even_pen_brushes[i])+DCSize(gr.odd_pen_brushes[i]);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -70,26 +64,25 @@ I64 TaskQueSize(CTask *task)
|
||||
I64 BlkDevsSize()
|
||||
{
|
||||
I64 i,result=MSize2(dsk.blkdevs);
|
||||
CBlkDev *bdev;
|
||||
CBlkDev *bd;
|
||||
for (i=0;i<NUM_BLKDEVS;i++) {
|
||||
bdev=&dsk.blkdevs[i];
|
||||
if (bdev->bd_signature==BD_SIGNATURE_VAL) {
|
||||
if (bdev->type==BDT_RAM)
|
||||
bd=&dsk.blkdevs[i];
|
||||
if (bd->bd_signature==BD_SIGNATURE_VAL) {
|
||||
if (bd->type==BDT_RAM)
|
||||
"RAMDsk %C\t:%010X Unused:%010X\n",
|
||||
bdev->first_drv_let,(bdev->max_blk+1)<<BLK_SIZE_BITS,
|
||||
UnusedDrvSpace(bdev->first_drv_let);
|
||||
result+=MSize2(bdev->dev_id_record);
|
||||
bd->first_drv_let,(bd->max_blk+1)<<BLK_SIZE_BITS,
|
||||
UnusedDrvSpace(bd->first_drv_let);
|
||||
result+=MSize2(bd->dev_id_record);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
I64 PrtsSize()
|
||||
I64 DrvsSize()
|
||||
{
|
||||
I64 i,result=MSize2(dsk.prts);
|
||||
for (i=0;i<NUM_PRTS;i++)
|
||||
result+=MSize2(dsk.prts[i].buffered_map_dirty_bits)+
|
||||
MSize2(dsk.prts[i].fis);
|
||||
I64 i,result=MSize2(dsk.drvs);
|
||||
for (i=0;i<NUM_DRVS;i++)
|
||||
result+=MSize2(dsk.drvs[i].cur_map_blk)+MSize2(dsk.drvs[i].fis);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -110,10 +103,9 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
|
||||
st=MStrUtil(task->task_title,SUF_REM_CTRL_CHARS|SUF_SAFE_DOLLAR);
|
||||
"$$GREEN$$Task:%010X$$CYAN$$ %-30ts$$FG$$\n$$ID,2$$",task,st;
|
||||
Free(st);
|
||||
"$$PURPLE$$Alloced:%010X Used:%010X $$RED$$Unused:%010X$$FG$$\n",
|
||||
TaskAllocatedMem(task,override_validate),
|
||||
TaskUsedMem(task,override_validate),
|
||||
TaskUnusedAllocatedMem(task,override_validate);
|
||||
"$$PURPLE$$Alloced:%010X Used:%010X$$FG$$\n",
|
||||
TaskMemAlloced(task,override_validate),
|
||||
TaskMemUsed(task,override_validate);
|
||||
"HashTable\t:%010X\n",HashTableSize2(task->hash_table);
|
||||
|
||||
i=UnusedStk(task);
|
||||
@@ -169,15 +161,15 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
|
||||
"TaskStructs\t:%010X\n",j;
|
||||
"TSSes\t:%010X\n",k;
|
||||
"HeapCtrls\t:%010X\n",m;
|
||||
"TaskQues\t:%010X\n",n;
|
||||
if (n)
|
||||
"TaskQues\t:%010X\n",n;
|
||||
"BlkDevs\t:%010X\n",BlkDevsSize;
|
||||
"Prts\t:%010X\n",PrtsSize;
|
||||
"Audio\t:%010X\n",CallExtStr("AudioSize");
|
||||
"Drvs\t:%010X\n",DrvsSize;
|
||||
if (dsk.cache_base)
|
||||
"DskCache\t:%010X\n",
|
||||
MSize2(dsk.cache_base)+MSize2(dsk.cache_hash_table)+MSize2(dsk.cache_ctrl);
|
||||
"WordStat\t:%010X\n",CallExtStr("WordStatSize");
|
||||
"Clipboard\t:%010X\n",DocSize(sys_clipboard_doc);
|
||||
"AutoComplete:%010X\n",CallExtStr("AutoCompleteSize");
|
||||
"gr.to_8_bits\t:%010X\n",MSize2(gr.to_8_bits);
|
||||
"gr.to_8_colors\t:%010X\n",MSize2(gr.to_8_colors);
|
||||
"gr.text_base\t:%010X\n",MSize2(gr.text_base);
|
||||
@@ -214,13 +206,13 @@ public U0 MemRep()
|
||||
"$$ID,-2$$";
|
||||
|
||||
if (sys_data_bp) {
|
||||
"$$BLACK$$Code Heap:%010X Used:%010X $$RED$$Unused:%010X$$FG$$\n",
|
||||
sys_code_bp->size*PAGE_SIZE,sys_code_bp->allocated_u8s,UnusedBPMem(sys_code_bp);
|
||||
"$$BLACK$$Data Heap:%010X Used:%010X $$RED$$Unused:%010X$$FG$$\n",
|
||||
sys_data_bp->size*PAGE_SIZE,sys_data_bp->allocated_u8s,UnusedBPMem(sys_data_bp);
|
||||
"$$BLACK$$Code Heap:%010X Used:%010X$$FG$$\n",
|
||||
sys_code_bp->alloced_u8s,sys_code_bp->used_u8s;
|
||||
"$$BLACK$$Data Heap:%010X Used:%010X$$FG$$\n",
|
||||
sys_data_bp->alloced_u8s,sys_data_bp->used_u8s;
|
||||
} else
|
||||
"$$BLACK$$Code/Data Heap:%010X Used:%010X $$RED$$Unused:%010X$$FG$$\n",
|
||||
sys_code_bp->size*PAGE_SIZE,sys_code_bp->allocated_u8s,UnusedBPMem(sys_code_bp);
|
||||
"$$BLACK$$Code/Data Heap:%010X Used:%010X$$FG$$\n",
|
||||
sys_code_bp->alloced_u8s,sys_code_bp->used_u8s;
|
||||
|
||||
for (i=0;i<mp_cnt;i++) {
|
||||
c=&cpu_structs[i];
|
||||
@@ -236,8 +228,8 @@ public U0 MemRep()
|
||||
}
|
||||
|
||||
"$$GREEN$$Independent Heaps$$FG$$\n$$ID,2$$";
|
||||
"$$BLACK$$dev.uncached_heap:%010X Used:%010X $$RED$$Unused:%010X$$FG$$\n",
|
||||
dev.uncached_heap->bp->size*PAGE_SIZE,dev.uncached_heap->used_u8s,UnusedBPMem(dev.uncached_heap->bp);
|
||||
"$$BLACK$$dev.uncached_heap:%010X Used:%010X$$FG$$\n",
|
||||
dev.uncached_heap->bp->alloced_u8s,dev.uncached_heap->used_u8s;
|
||||
"$$ID,-2$$\n";
|
||||
Preempt(old_preempt);
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
#help_index "DolDoc/Conversion"
|
||||
|
||||
//See $LK,"::/Doc/Acknowledgements.TXT"$.
|
||||
//See $LK,"::/Doc/Credits.TXT"$.
|
||||
|
||||
U0 HtmlPutS(CDoc *doc,I64 u32_attr,I64 *_old_u32_attr,U8 *st,I64 *_col,U8 *style_bitmap=NULL)
|
||||
{
|
||||
@@ -61,7 +61,7 @@ U0 HtmlPutS(CDoc *doc,I64 u32_attr,I64 *_old_u32_attr,U8 *st,I64 *_col,U8 *style
|
||||
}
|
||||
}
|
||||
|
||||
U8 *TSLinkCvt2(U8 *filename,I64 line_num)
|
||||
U8 *TOSLinkCvt2(U8 *filename,I64 line_num)
|
||||
{// ::/ --> http://www.templeos.org/Wb/
|
||||
//Make your own LinkCvt routine
|
||||
U8 *result=NULL,*st;
|
||||
@@ -74,7 +74,7 @@ U8 *TSLinkCvt2(U8 *filename,I64 line_num)
|
||||
return result;
|
||||
}
|
||||
|
||||
U8 *TSLinkCvt1(U8 *link_st)
|
||||
U8 *TOSLinkCvt1(U8 *link_st)
|
||||
{
|
||||
static CDoc *bible=NULL;
|
||||
static I64 locks=0;
|
||||
@@ -85,7 +85,7 @@ U8 *TSLinkCvt1(U8 *link_st)
|
||||
case LK_FILE_LINE:
|
||||
case LK_PLAIN_LINE:
|
||||
case LK_FILE:
|
||||
result=TSLinkCvt2(filename,num);
|
||||
result=TOSLinkCvt2(filename,num);
|
||||
break;
|
||||
case -1:
|
||||
case LK_DEF:
|
||||
@@ -101,12 +101,12 @@ U8 *TSLinkCvt1(U8 *link_st)
|
||||
if (!bible)
|
||||
bible=Adam("DocRead(\"%s\");",filename);
|
||||
if (DocFind(bible,num,needle))
|
||||
result=TSLinkCvt2(filename,bible->cur_entry->y+1);
|
||||
result=TOSLinkCvt2(filename,bible->cur_entry->y+1);
|
||||
LBtr(&locks,0);
|
||||
break;
|
||||
default:
|
||||
if (DocFileEd(i,filename,needle,&num,EDF_UNCOLLAPSE|EDF_BAIL))
|
||||
result=TSLinkCvt2(filename,num);
|
||||
result=TOSLinkCvt2(filename,num);
|
||||
}
|
||||
Free(filename);
|
||||
Free(needle);
|
||||
@@ -117,7 +117,7 @@ U8 *TSLinkCvt1(U8 *link_st)
|
||||
public CDoc *Doc2Html(CDoc *doc_in,
|
||||
U8 *html_header=NULL,
|
||||
U8 *body_header=NULL,U8 *body_footer=NULL,Bool line_anchors=TRUE,
|
||||
U8 (*link_cvt)(U8 *link_st)=&TSLinkCvt1)
|
||||
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;
|
||||
@@ -279,14 +279,14 @@ public CDoc *Doc2Html(CDoc *doc_in,
|
||||
#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,I64 width=80,
|
||||
Bool line_anchors=TRUE,U8 (*link_cvt)(U8 *link_st)=&TSLinkCvt1)
|
||||
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"$
|
||||
SetWinHorz(0,width-1); //Sets doc width for word wrap.
|
||||
WinHorz(0,width-1); //Sets doc width for word wrap.
|
||||
|
||||
in_name=DftExt(_in_name,"CPP.Z"),
|
||||
if (_out_name)
|
||||
|
||||
@@ -108,7 +108,7 @@ public U0 ToTXT(U8 *_in_name,U8 *_out_name=NULL,I64 width=70)
|
||||
CDoc *doc_in,*doc_out;
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
SetWinHorz(0,width-1); //Sets doc width for word wrap.
|
||||
WinHorz(0,width-1); //Sets doc width for word wrap.
|
||||
|
||||
in_name=DftExt(_in_name,"TXT.Z"),
|
||||
if (_out_name)
|
||||
|
||||
@@ -1,416 +0,0 @@
|
||||
#help_index "Memory/Blk Pool"
|
||||
public I64 UnusedBPMem(CBlkPool *bp)
|
||||
{//Count of unused bytes in bp.
|
||||
I64 result=0,i;
|
||||
CMemBlk *tempm;
|
||||
|
||||
if (!bp) return 0;
|
||||
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&bp->locked_flags,BPlf_LOCKED))
|
||||
PAUSE
|
||||
|
||||
tempm=bp->mem_free_lst;
|
||||
while (tempm) {
|
||||
if (tempm->mb_signature!=MBS_UNUSED_SIGNATURE_VAL)
|
||||
Dbg("Corrupt Sys Memory");
|
||||
result+=tempm->pages;
|
||||
tempm=tempm->next;
|
||||
}
|
||||
for (i=0;i<FREE_PAGE_HASH_SIZE;i++) {
|
||||
tempm=bp->free_page_hash[i];
|
||||
while (tempm) {
|
||||
if (tempm->mb_signature!=MBS_UNUSED_SIGNATURE_VAL)
|
||||
Dbg("Corrupt Sys Memory");
|
||||
result+=tempm->pages;
|
||||
tempm=tempm->next;
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0;i<64-PAGE_BITS;i++) {
|
||||
tempm=bp->free_page_hash2[i];
|
||||
while (tempm) {
|
||||
if (tempm->mb_signature!=MBS_UNUSED_SIGNATURE_VAL)
|
||||
Dbg("Corrupt Sys Memory");
|
||||
result+=tempm->pages;
|
||||
tempm=tempm->next;
|
||||
}
|
||||
}
|
||||
LBtr(&bp->locked_flags,BPlf_LOCKED);
|
||||
POPFD
|
||||
return result*PAGE_SIZE;
|
||||
}
|
||||
|
||||
#help_index "Memory/Heap Ctrl"
|
||||
I64 MemBlkLstSize(CHeapCtrl *hc)
|
||||
{
|
||||
CMemBlk *m;
|
||||
I64 result=0;
|
||||
m=hc->next_mem_blk;
|
||||
while (m!=&hc->next_mem_blk) {
|
||||
result+=sizeof(CMemBlk);
|
||||
m=m->next;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 UnusedHCMem(CHeapCtrl *hc)
|
||||
{//Unused bytes alloced to a heap ctrl.
|
||||
I64 result,i;
|
||||
CMemUnusedAllocated *u;
|
||||
|
||||
if (!hc) return 0;
|
||||
|
||||
result=UnusedBPMem(hc->bp);
|
||||
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&hc->locked_flags,HClf_LOCKED))
|
||||
PAUSE
|
||||
|
||||
for (i=0;i<HEAP_HASH_SIZE>>3;i++) {
|
||||
u=hc->heap_hash[i];
|
||||
while (u) {
|
||||
result+=u->size;
|
||||
u=u->next;
|
||||
}
|
||||
}
|
||||
u=hc->malloc_free_lst;
|
||||
while (u) {
|
||||
result+=u->size;
|
||||
u=u->next;
|
||||
}
|
||||
|
||||
LBtr(&hc->locked_flags,HClf_LOCKED);
|
||||
POPFD
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "Memory/Task"
|
||||
public I64 TaskAllocatedMem(CTask *task=NULL,Bool override_validate=FALSE)
|
||||
{//Count of bytes alloced to a task, used+unused.
|
||||
CMemBlk *m,*m1;
|
||||
I64 result=0;
|
||||
|
||||
if (!task) task=Fs;
|
||||
if (!override_validate && !TaskValidate(task)) return 0;
|
||||
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&task->code_heap->locked_flags,HClf_LOCKED))
|
||||
PAUSE
|
||||
if (task->code_heap!=task->data_heap)
|
||||
while (LBts(&task->data_heap->locked_flags,HClf_LOCKED))
|
||||
PAUSE
|
||||
|
||||
m=task->code_heap->next_mem_blk;
|
||||
m1=&task->code_heap->next_mem_blk;
|
||||
while (m!=m1) {
|
||||
if (m->mb_signature!=MBS_USED_SIGNATURE_VAL)
|
||||
Dbg("Corrupt Task Memory");
|
||||
result+=m->pages*PAGE_SIZE;
|
||||
m=m->next;
|
||||
}
|
||||
|
||||
if (task->code_heap!=task->data_heap) {
|
||||
m=task->data_heap->next_mem_blk;
|
||||
m1=&task->data_heap->next_mem_blk;
|
||||
while (m!=m1) {
|
||||
if (m->mb_signature!=MBS_USED_SIGNATURE_VAL)
|
||||
Dbg("Corrupt Task Memory");
|
||||
result+=m->pages*PAGE_SIZE;
|
||||
m=m->next;
|
||||
}
|
||||
}
|
||||
|
||||
if (task->code_heap!=task->data_heap)
|
||||
LBtr(&task->data_heap->locked_flags,HClf_LOCKED);
|
||||
LBtr(&task->code_heap->locked_flags,HClf_LOCKED);
|
||||
POPFD
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 TaskUnusedAllocatedMem(CTask *task=NULL,Bool override_validate=FALSE)
|
||||
{//Count of bytes alloced to a task but unused.
|
||||
I64 result=0,i;
|
||||
CMemUnusedAllocated *uum;
|
||||
if (!task) task=Fs;
|
||||
if (!override_validate && !TaskValidate(task)) return 0;
|
||||
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&task->code_heap->locked_flags,HClf_LOCKED))
|
||||
PAUSE
|
||||
if (task->data_heap!=task->code_heap)
|
||||
while (LBts(&task->data_heap->locked_flags,HClf_LOCKED))
|
||||
PAUSE
|
||||
|
||||
result+=MemBlkLstSize(task->code_heap);
|
||||
for (i=0;i<HEAP_HASH_SIZE>>3;i++) {
|
||||
uum=task->code_heap->heap_hash[i];
|
||||
while (uum) {
|
||||
result+=uum->size;
|
||||
uum=uum->next;
|
||||
}
|
||||
}
|
||||
uum=task->code_heap->malloc_free_lst;
|
||||
while (uum) {
|
||||
result+=uum->size;
|
||||
uum=uum->next;
|
||||
}
|
||||
|
||||
if (task->data_heap!=task->code_heap) {
|
||||
result+=MemBlkLstSize(task->data_heap);
|
||||
for (i=0;i<HEAP_HASH_SIZE>>3;i++) {
|
||||
uum=task->data_heap->heap_hash[i];
|
||||
while (uum) {
|
||||
result+=uum->size;
|
||||
uum=uum->next;
|
||||
}
|
||||
}
|
||||
uum=task->data_heap->malloc_free_lst;
|
||||
while (uum) {
|
||||
result+=uum->size;
|
||||
uum=uum->next;
|
||||
}
|
||||
}
|
||||
|
||||
if (task->data_heap!=task->code_heap)
|
||||
LBtr(&task->data_heap->locked_flags,HClf_LOCKED);
|
||||
LBtr(&task->code_heap->locked_flags,HClf_LOCKED);
|
||||
POPFD
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 TaskUsedMem(CTask *task=NULL,Bool override_validate=FALSE)
|
||||
{//Count of bytes alloced to a task and in use.
|
||||
I64 result=0;
|
||||
if (!task) task=Fs;
|
||||
if (!override_validate && !TaskValidate(task)) return 0;
|
||||
result=task->code_heap->used_u8s;
|
||||
if (task->data_heap!=task->code_heap)
|
||||
result+=task->data_heap->used_u8s;
|
||||
return result;
|
||||
}
|
||||
|
||||
public Bool HeapRep(CTask *task)
|
||||
{//Report status of task's heap.
|
||||
I64 i,cnt;
|
||||
CMemUnusedAllocated *uum;
|
||||
|
||||
if (!task || task==Fs) {
|
||||
"Task can't HeapRep on self.\n";
|
||||
return FALSE;
|
||||
}
|
||||
if (!TaskValidate(task)) return FALSE;
|
||||
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&task->code_heap->locked_flags,HClf_LOCKED))
|
||||
PAUSE
|
||||
if (task->data_heap!=task->code_heap)
|
||||
while (LBts(&task->data_heap->locked_flags,HClf_LOCKED))
|
||||
PAUSE
|
||||
|
||||
for (i=0;i<HEAP_HASH_SIZE>>3;i++) {
|
||||
cnt=0;
|
||||
uum=task->code_heap->heap_hash[i];
|
||||
while (uum) {
|
||||
cnt+=uum->size;
|
||||
uum=uum->next;
|
||||
}
|
||||
if (task->data_heap!=task->code_heap) {
|
||||
uum=task->data_heap->heap_hash[i];
|
||||
while (uum) {
|
||||
cnt+=uum->size;
|
||||
uum=uum->next;
|
||||
}
|
||||
}
|
||||
if (cnt)
|
||||
"%03X:%08X\n",i<<3,cnt;
|
||||
}
|
||||
'\n';
|
||||
|
||||
uum=task->code_heap->malloc_free_lst;
|
||||
while (uum) {
|
||||
"%X, ",uum->size;
|
||||
uum=uum->next;
|
||||
}
|
||||
if (task->data_heap!=task->code_heap) {
|
||||
uum=task->data_heap->malloc_free_lst;
|
||||
while (uum) {
|
||||
"%X, ",uum->size;
|
||||
uum=uum->next;
|
||||
}
|
||||
}
|
||||
|
||||
if (task->data_heap!=task->code_heap)
|
||||
LBtr(&task->data_heap->locked_flags,HClf_LOCKED);
|
||||
LBtr(&task->code_heap->locked_flags,HClf_LOCKED);
|
||||
POPFD
|
||||
|
||||
'\n';
|
||||
}
|
||||
|
||||
#help_index "Memory/Task;Debugging/Heap"
|
||||
public Bool IsInHeap(U8 *a,CTask *task=NULL,Bool lock=TRUE)
|
||||
{//Check addr if on heap.
|
||||
CMemBlk *m;
|
||||
|
||||
if (!task) task=Fs;
|
||||
if (!TaskValidate(task)) return FALSE;
|
||||
|
||||
PUSHFD
|
||||
CLI
|
||||
if (lock) {
|
||||
while (LBts(&task->code_heap->locked_flags,HClf_LOCKED))
|
||||
PAUSE
|
||||
if (task->data_heap!=task->code_heap)
|
||||
while (LBts(&task->data_heap->locked_flags,HClf_LOCKED))
|
||||
PAUSE
|
||||
}
|
||||
|
||||
m=task->code_heap->next_mem_blk;
|
||||
while (m!=&task->code_heap->next_mem_blk) {
|
||||
if (a>=m && a<m(U8 *)+m->pages*PAGE_SIZE) {
|
||||
if (lock)
|
||||
LBtr(&task->code_heap->locked_flags,HClf_LOCKED);
|
||||
POPFD
|
||||
return TRUE;
|
||||
}
|
||||
m=m->next;
|
||||
}
|
||||
if (task->data_heap!=task->code_heap) {
|
||||
m=task->data_heap->next_mem_blk;
|
||||
while (m!=&task->code_heap->next_mem_blk) {
|
||||
if (a>=m && a<m(U8 *)+m->pages*PAGE_SIZE) {
|
||||
if (lock)
|
||||
LBtr(&task->data_heap->locked_flags,HClf_LOCKED);
|
||||
POPFD
|
||||
return TRUE;
|
||||
}
|
||||
m=m->next;
|
||||
}
|
||||
}
|
||||
|
||||
if (lock) {
|
||||
LBtr(&task->code_heap->locked_flags,HClf_LOCKED);
|
||||
if (task->data_heap!=task->code_heap)
|
||||
LBtr(&task->data_heap->locked_flags,HClf_LOCKED);
|
||||
}
|
||||
POPFD
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
public Bool HeapWalk(CTask *task=NULL)
|
||||
{//Check integrity of task's heap.
|
||||
I64 i;
|
||||
CMemUnusedAllocated *uum;
|
||||
Bool result=TRUE;
|
||||
|
||||
if (!task) task=Fs;
|
||||
if (!TaskValidate(task)) return FALSE;
|
||||
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&task->code_heap->locked_flags,HClf_LOCKED))
|
||||
PAUSE
|
||||
if (task->data_heap!=task->code_heap)
|
||||
while (LBts(&task->data_heap->locked_flags,HClf_LOCKED))
|
||||
PAUSE
|
||||
|
||||
for (i=0;i<HEAP_HASH_SIZE>>3;i++) {
|
||||
uum=task->code_heap->heap_hash[i];
|
||||
while (uum) {
|
||||
if (!IsInHeap(uum,task,FALSE))
|
||||
result=FALSE;
|
||||
uum=uum->next;
|
||||
}
|
||||
if (task->data_heap!=task->code_heap) {
|
||||
uum=task->data_heap->heap_hash[i];
|
||||
while (uum) {
|
||||
if (!IsInHeap(uum,task,FALSE))
|
||||
result=FALSE;
|
||||
uum=uum->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uum=task->code_heap->malloc_free_lst;
|
||||
while (uum) {
|
||||
if (!IsInHeap(uum,task,FALSE))
|
||||
result=FALSE;
|
||||
uum=uum->next;
|
||||
}
|
||||
|
||||
if (task->data_heap!=task->code_heap) {
|
||||
uum=task->data_heap->malloc_free_lst;
|
||||
while (uum) {
|
||||
if (!IsInHeap(uum,task,FALSE))
|
||||
result=FALSE;
|
||||
uum=uum->next;
|
||||
}
|
||||
}
|
||||
|
||||
#if _CFG_HEAP_DBG
|
||||
CMemUsedAllocated *um,*um1;
|
||||
um1=(&task->code_heap->next_um)(U8 *)-offset(CMemUsedAllocated.next);
|
||||
um=um1->next;
|
||||
while (um!=um1) {
|
||||
if (!IsInHeap(um,task,FALSE))
|
||||
result=FALSE;
|
||||
um=um->next;
|
||||
}
|
||||
if (task->data_heap!=task->code_heap) {
|
||||
um1=(&task->data_heap->next_um)(U8 *)-offset(CMemUsedAllocated.next);
|
||||
um=um1->next;
|
||||
while (um!=um1) {
|
||||
if (!IsInHeap(um,task,FALSE))
|
||||
result=FALSE;
|
||||
um=um->next;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (task->data_heap!=task->code_heap)
|
||||
LBtr(&task->data_heap->locked_flags,HClf_LOCKED);
|
||||
LBtr(&task->code_heap->locked_flags,HClf_LOCKED);
|
||||
POPFD
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "Info;Task"
|
||||
U0 TaskRepTask(CTask *task,I64 indent)
|
||||
{
|
||||
CTask *task1;
|
||||
U8 *st,*desc=MStrUtil(task->task_title,SUF_SAFE_DOLLAR);
|
||||
st=MStrPrint("$$MA,T=\"%08X\",LM=\"Kill(0x%X);\n\",$$",task,task,task);
|
||||
"%h*c%s $$TX,\"%Q...\",SCX=16$$ Mem:%08X\n",indent,CH_SPACE,
|
||||
st,desc,TaskAllocatedMem(task);
|
||||
"%h*cFlags:%04X:%04X Time:%0.2fm\n",indent+2,CH_SPACE,
|
||||
task->task_flags,task->display_flags,
|
||||
task->total_time/60.0/cnts.time_stamp_freq_initial;
|
||||
Free(st);
|
||||
Free(desc);
|
||||
task1=task->next_child_task;
|
||||
while (task1!=(&task->next_child_task)(U8 *)-offset(CTask.next_sibling_task)) {
|
||||
TaskRepTask(task1,indent+2);
|
||||
task1=task1->next_sibling_task;
|
||||
}
|
||||
}
|
||||
|
||||
public U0 TaskRep()
|
||||
{//Report current tasks on all cores.
|
||||
I64 i;
|
||||
CCPU *c;
|
||||
PUSHFD
|
||||
CLI
|
||||
for (i=0;i<mp_cnt;i++) {
|
||||
c=&cpu_structs[i];
|
||||
"$$RED$$CPU:%d$$FG$$\n",i;
|
||||
TaskRepTask(c->seth_task,2);
|
||||
}
|
||||
POPFD
|
||||
}
|
||||
Binary file not shown.
@@ -5,9 +5,9 @@ CIPStateGlbls old_ip={IP_NULL,{-1000,-1000,0},{-1000,-1000,0},{-1000,-1000,0},
|
||||
0,(MAX_I32+1)>>3,0.0,GetTSC,0.350,0,0,
|
||||
FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE};
|
||||
|
||||
public CWinMgrGlbls winmgr={0,0,0,15,15,NULL,NULL,FALSE,FALSE,FALSE,FALSE};
|
||||
public CWinMgrGlbls winmgr={0,0,0,WMG_FPS,tS,NULL,NULL,FALSE,FALSE,FALSE};
|
||||
winmgr.t=CAlloc(sizeof(CWinMgrTimingGlbls));
|
||||
winmgr.t->last_refresh_time=tS;
|
||||
winmgr.t->last_calc_idle_time=tS;
|
||||
|
||||
#define PROGRESS_BAR_HEIGHT 20
|
||||
#define PROGRESS_BAR_WIDTH (3*GR_WIDTH/4)
|
||||
@@ -90,7 +90,7 @@ U0 CtrlAltG(I64 sc)
|
||||
else
|
||||
PopUp("WinGrid(TRUE);");
|
||||
}
|
||||
SetCtrlAltLetCB('G',&CtrlAltG,"Sys/Grid On or Off");
|
||||
CtrlAltLetCBSet('G',&CtrlAltG,"Sys/Grid On or Off");
|
||||
|
||||
CTask *ext_ASCII_task;
|
||||
U0 ExtendedASCII()
|
||||
@@ -99,11 +99,11 @@ U0 ExtendedASCII()
|
||||
CDoc *doc=DocNew;
|
||||
DocPrint(doc,"Select Char and Press <ESC>\n$$LTBLUE$$");
|
||||
for (i=0;i<256;i++) {
|
||||
if (i>=CH_SHIFT_SPACE && i!=127) {
|
||||
if (i>=CH_SHIFT_SPACE && i!=0x7F) {
|
||||
if (i==CH_SHIFT_SPACE)
|
||||
DocPrint(doc,"$$MU-UL,\"\\37\",LE=%d$$",i);
|
||||
DocPrint(doc,"$$MU-UL,\"\\x1F\",LE=%d$$",i);
|
||||
else if (i=='$$')
|
||||
DocPrint(doc,"$$MU-UL,\"\\44\",LE=%d$$",i);
|
||||
DocPrint(doc,"$$MU-UL,\"\\x24\",LE=%d$$",i);
|
||||
else if (i=='\"'||i=='\\')
|
||||
DocPrint(doc,"$$MU-UL,\"\\%c\",LE=%d$$",i,i);
|
||||
else
|
||||
@@ -124,7 +124,7 @@ U0 CtrlAltA(I64)
|
||||
if (ext_ASCII_task=sys_focus_task)
|
||||
Spawn(&ExtendedASCII);
|
||||
}
|
||||
SetCtrlAltLetCB('A',&CtrlAltA,"Sys/Extended ASCII");
|
||||
CtrlAltLetCBSet('A',&CtrlAltA,"Sys/Extended ASCII");
|
||||
|
||||
public U0 WinScrollNull(CTask *task,CD3I64 *s)
|
||||
{//If panning a window has been done, restore to zero.
|
||||
@@ -152,7 +152,7 @@ U0 DrawInputPtr(CDC *dc)
|
||||
y=ip.pos.y;
|
||||
POPFD
|
||||
if (ip.show && ip.dev!=IP_NULL) {
|
||||
if (!sys_bios_gr_mode) //if text mode
|
||||
if (!Bt(&sys_run_level,RLf_VGA)) //if text mode
|
||||
gr.text_base[ip.pos_text.x+ip.pos_text.y*TEXT_COLS]^=0x7F00;
|
||||
else {
|
||||
if (gr.fp_draw_input_ptr) {
|
||||
@@ -223,12 +223,10 @@ U0 WinIPUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
CTask *WinRefocus()
|
||||
{
|
||||
CTask *task;
|
||||
public CTask *WinRefocus(CTask *task=NULL)
|
||||
{//Reset the focus task if NULL.
|
||||
PUSHFD
|
||||
CLI
|
||||
task=sys_focus_task;
|
||||
if (!task) {
|
||||
task=sys_winmgr_task->last_task;
|
||||
while (TaskValidate(task) && task!=sys_winmgr_task) {
|
||||
@@ -313,18 +311,19 @@ public I64 WinToTop(CTask *task=NULL,Bool update_z_buf=TRUE)
|
||||
}
|
||||
ext[EXT_WIN_TO_TOP]=&WinToTop;
|
||||
|
||||
public U0 WinFocus(CTask *task=NULL)
|
||||
public CTask *WinFocus(CTask *task=NULL)
|
||||
{//Set task as focus task.
|
||||
PUSHFD
|
||||
CLI
|
||||
if (!TaskValidate(task)||Bt(&task->win_inhibit,WIf_SELF_FOCUS))
|
||||
task=WinRefocus;
|
||||
task=WinRefocus(sys_focus_task);
|
||||
WinToTop(sys_focus_task=task);
|
||||
POPFD
|
||||
return sys_focus_task;
|
||||
}
|
||||
ext[EXT_WIN_FOCUS]=&WinFocus;
|
||||
|
||||
public Bool SetWinHorz(I64 left,I64 right,CTask *task=NULL)
|
||||
public Bool WinHorz(I64 left,I64 right,CTask *task=NULL)
|
||||
{//Set task's win left and right columns.
|
||||
I64 d=right-left;
|
||||
if (!task) task=Fs;
|
||||
@@ -358,7 +357,7 @@ public Bool SetWinHorz(I64 left,I64 right,CTask *task=NULL)
|
||||
}
|
||||
}
|
||||
|
||||
public Bool SetWinVert(I64 top,I64 bottom,CTask *task=NULL)
|
||||
public Bool WinVert(I64 top,I64 bottom,CTask *task=NULL)
|
||||
{//Set task's win top and bottom rows.
|
||||
I64 d=bottom-top;
|
||||
if (!task) task=Fs;
|
||||
@@ -419,16 +418,16 @@ public U0 WinTileHorz()
|
||||
c=4;
|
||||
vert_size=(TEXT_ROWS-1)/c;
|
||||
|
||||
SetWinHorz(1-no_border,TEXT_COLS-2+no_border,task);
|
||||
SetWinVert((i&3)*vert_size+2-no_border,(i&3+1)*vert_size+no_border,task);
|
||||
WinHorz(1-no_border,TEXT_COLS-2+no_border,task);
|
||||
WinVert((i&3)*vert_size+2-no_border,(i&3+1)*vert_size+no_border,task);
|
||||
last_task=task;
|
||||
if (i&3==3)
|
||||
SetWinVert(task->win_top,TEXT_ROWS-2,task);
|
||||
WinVert(task->win_top,TEXT_ROWS-2,task);
|
||||
i++;
|
||||
}
|
||||
task=task->last_task;
|
||||
} while (task!=sys_winmgr_task);
|
||||
SetWinVert(last_task->win_top,TEXT_ROWS-2,last_task);
|
||||
WinVert(last_task->win_top,TEXT_ROWS-2,last_task);
|
||||
POPFD
|
||||
}
|
||||
|
||||
@@ -457,16 +456,16 @@ public U0 WinTileVert()
|
||||
else if (c>4)
|
||||
c=4;
|
||||
horz_size=TEXT_COLS/c;
|
||||
SetWinHorz((i&3)*horz_size+1-no_border,(i&3+1)*horz_size-1+no_border,task);
|
||||
SetWinVert(2-no_border,TEXT_ROWS-2+no_border,task);
|
||||
WinHorz((i&3)*horz_size+1-no_border,(i&3+1)*horz_size-1+no_border,task);
|
||||
WinVert(2-no_border,TEXT_ROWS-2+no_border,task);
|
||||
last_task=task;
|
||||
if (i&3==3)
|
||||
SetWinHorz(task->win_left,TEXT_COLS-2,task);
|
||||
WinHorz(task->win_left,TEXT_COLS-2,task);
|
||||
i++;
|
||||
}
|
||||
task=task->last_task;
|
||||
} while (task!=sys_winmgr_task);
|
||||
SetWinHorz(last_task->win_left,TEXT_COLS-2,last_task);
|
||||
WinHorz(last_task->win_left,TEXT_COLS-2,last_task);
|
||||
POPFD
|
||||
}
|
||||
|
||||
@@ -478,8 +477,8 @@ public U0 WinMax(CTask *task=NULL)
|
||||
PUSHFD
|
||||
CLI //TODO Multiprocessor safe
|
||||
no_border=Bt(&task->display_flags,DISPLAYf_NO_BORDER);
|
||||
SetWinHorz(1-no_border,TEXT_COLS-2+no_border,task);
|
||||
SetWinVert(2-no_border,TEXT_ROWS-2+no_border,task);
|
||||
WinHorz(1-no_border,TEXT_COLS-2+no_border,task);
|
||||
WinVert(2-no_border,TEXT_ROWS-2+no_border,task);
|
||||
WinToTop(task);
|
||||
POPFD
|
||||
}
|
||||
@@ -7,8 +7,8 @@ public U0 WinMgrSync(I64 cnt=1,Bool force=FALSE)
|
||||
//2 Cnt Make Sure to do a Full Refresh
|
||||
// and Set Cur Pos.
|
||||
Bool old_preempt=Preempt(OFF),
|
||||
old_full_refresh,
|
||||
old_idle=LBts(&Fs->task_flags,TASKf_IDLE);
|
||||
old_full_refresh,
|
||||
old_idle=LBts(&Fs->task_flags,TASKf_IDLE);
|
||||
CDoc *old_doc=DocPut;
|
||||
I64 update_cnt;
|
||||
while (Bt(&sys_semas[SYS_SEMA_REFRESH_IN_PROGRESS],0)) {
|
||||
@@ -189,16 +189,14 @@ I64 WinQueIPMsgs(Bool que)
|
||||
return msg_code;
|
||||
}
|
||||
|
||||
I64 WinCalcRefreshTimeOut(Bool was_forced)
|
||||
U0 WinCalcIdles()
|
||||
{
|
||||
F64 d,d1;
|
||||
I64 i,k,total,
|
||||
total_jiffies,idle_pt_hits[MP_MAX_PROCESSORS];
|
||||
F64 calc_idle_time;
|
||||
I64 i,k,total_jiffies,total_jiffies_delta,idle_pt_hits[MP_MAX_PROCESSORS];
|
||||
CCPU *c;
|
||||
CWinMgrTimingGlbls *t=winmgr.t;
|
||||
|
||||
t->refresh_skips++;
|
||||
if ((t->refresh_time=tS)-t->last_refresh_time>.25) {
|
||||
if ((t->calc_idle_delta_time=(calc_idle_time=tS)-t->last_calc_idle_time)>.25) {
|
||||
PUSHFD
|
||||
CLI
|
||||
total_jiffies=cpu_structs[0].total_jiffies;
|
||||
@@ -206,67 +204,35 @@ I64 WinCalcRefreshTimeOut(Bool was_forced)
|
||||
idle_pt_hits[i]=cpu_structs[i].idle_pt_hits;
|
||||
POPFD
|
||||
|
||||
t->refresh_delta_time=t->refresh_time-t->last_refresh_time;
|
||||
total=total_jiffies-t->last_total_jiffies;
|
||||
total_jiffies_delta=total_jiffies-t->last_total_jiffies;
|
||||
for (i=0;i<mp_cnt;i++) {
|
||||
c=&cpu_structs[i];
|
||||
d1=0.01;
|
||||
if (t->refresh_delta_time>0) {
|
||||
if (total) {
|
||||
if ((k=idle_pt_hits[i]-t->last_idle_pt_hits[i])>=0) {
|
||||
d1=ToF64(k)/total;
|
||||
d=ToF64(k*cnts.time_stamp_freq)
|
||||
/(JIFFY_FREQ*t->refresh_delta_time);
|
||||
if (d<d1) d1=d;
|
||||
}
|
||||
} else {
|
||||
if ((k=idle_pt_hits[i]-t->last_idle_pt_hits[i])>=0)
|
||||
d1=ToF64(k*cnts.time_stamp_freq)
|
||||
/(JIFFY_FREQ*t->refresh_delta_time);
|
||||
}
|
||||
}
|
||||
if (total_jiffies_delta && (k=idle_pt_hits[i]-t->last_idle_pt_hits[i])>=0)
|
||||
c->idle_factor=Clamp(ToF64(k)/total_jiffies_delta,0.01,0.99);
|
||||
else
|
||||
c->idle_factor=0.01;
|
||||
t->last_idle_pt_hits[i]=idle_pt_hits[i];
|
||||
c->idle_factor=Clamp(d1,0.01,0.99);
|
||||
}
|
||||
t->last_total_jiffies=total_jiffies;
|
||||
t->last_refresh_time=t->refresh_time;
|
||||
if (!was_forced) {
|
||||
if (winmgr.first) {
|
||||
d=Gs->idle_factor;
|
||||
d1=(t->last_refresh_end_time-t->last_refresh_start_time)/
|
||||
(t->refresh_delta_time/t->refresh_skips);
|
||||
if (d1<0.2)
|
||||
winmgr.desired_fps*=1.25;
|
||||
else if (d<=0.0)
|
||||
winmgr.desired_fps=15.0;
|
||||
else if (d<0.02) {
|
||||
d=15.0/winmgr.fps;
|
||||
winmgr.desired_fps=d*15.0+0.5*(1.0-d)*winmgr.desired_fps;
|
||||
} else if (d<0.99) {
|
||||
if (d=(1.0-d)`0.25)
|
||||
winmgr.desired_fps*= 0.8`0.25/d;
|
||||
} else
|
||||
winmgr.desired_fps=30.0;
|
||||
t->refresh_cnt++;
|
||||
t->refresh_skips=0;
|
||||
} else {
|
||||
winmgr.desired_fps=30.0;
|
||||
winmgr.first=TRUE;
|
||||
}
|
||||
}
|
||||
t->last_calc_idle_time=calc_idle_time;
|
||||
t->calc_idle_cnt++;
|
||||
}
|
||||
winmgr.desired_fps=Clamp(winmgr.desired_fps,15.0,30.0);
|
||||
return cnts.jiffies+JIFFY_FREQ/winmgr.desired_fps;
|
||||
}
|
||||
|
||||
I64 WinMgrSleep(Bool flush_msgs=FALSE)
|
||||
{
|
||||
static Bool was_forced=FALSE;
|
||||
I64 timeout_val,msg_code=0;
|
||||
CCtrl *c;
|
||||
Bool que;
|
||||
F64 t,t_delta;
|
||||
|
||||
TimeStampFreqCal;
|
||||
if ((t_delta=(t=tS)-winmgr.last_refresh_tS)>0.01)
|
||||
winmgr.fps=Max(1.0/t_delta,1);
|
||||
else
|
||||
winmgr.fps=99;
|
||||
winmgr.last_refresh_tS=t;
|
||||
WinCalcIdles;
|
||||
|
||||
if (!flush_msgs && winmgr.old_focus_task!=sys_focus_task) {
|
||||
TaskMsg(winmgr.old_focus_task,0,MSG_FOCUS,FALSE,0,0);
|
||||
@@ -293,20 +259,17 @@ I64 WinMgrSleep(Bool flush_msgs=FALSE)
|
||||
}
|
||||
msg_code=WinQueIPMsgs(que);
|
||||
} else {
|
||||
WinRefocus;
|
||||
WinRefocus(sys_focus_task);
|
||||
if (!TaskValidate(sys_focus_task))
|
||||
FifoI64Flush(kbd.scan_code_fifo);
|
||||
}
|
||||
|
||||
if (sys_focus_task)
|
||||
LBtr(&sys_focus_task->task_flags,TASKf_HAS_SONG);
|
||||
|
||||
timeout_val=WinCalcRefreshTimeOut(was_forced);
|
||||
WinIPUpdate;
|
||||
|
||||
timeout_val=cnts.jiffies+JIFFY_FREQ/WMG_FPS;
|
||||
LBts(&sys_semas[SYS_SEMA_REFRESH_IN_PROGRESS],0);
|
||||
winmgr.t->last_refresh_start_time=tS;
|
||||
GrUpdateScreen;
|
||||
winmgr.t->last_refresh_end_time=tS;
|
||||
LBtr(&sys_semas[SYS_SEMA_REFRESH_IN_PROGRESS],0);
|
||||
|
||||
if (sys_focus_task && !Bt(&sys_focus_task->task_flags,TASKf_HAS_SONG)) {
|
||||
@@ -322,17 +285,17 @@ I64 WinMgrSleep(Bool flush_msgs=FALSE)
|
||||
}
|
||||
winmgr.updates++;
|
||||
if (!mouse.install_attempts)
|
||||
SleepUntil(timeout_val);
|
||||
SleepUntil(timeout_val); //Just for before mouse install attempt at boot.
|
||||
else
|
||||
do {
|
||||
KbdMouseHandler(FALSE,TRUE);
|
||||
SleepUntil(MinI64(timeout_val,cnts.jiffies+JIFFY_FREQ/500));
|
||||
} while (!Bt(&sys_semas[SYS_SEMA_FORCE_WINMGR],0)&&cnts.jiffies<timeout_val);
|
||||
was_forced=LBtr(&sys_semas[SYS_SEMA_FORCE_WINMGR],0);
|
||||
} while (cnts.jiffies<timeout_val && !Bt(&sys_semas[SYS_SEMA_FORCE_WINMGR],0));
|
||||
LBtr(&sys_semas[SYS_SEMA_FORCE_WINMGR],0);
|
||||
return msg_code;
|
||||
}
|
||||
|
||||
CDoc *SetCursorPos(CTask *task,I64 ip_text_x,I64 ip_text_y,Bool set_cursor=TRUE)
|
||||
CDoc *WinCursorPosSet(CTask *task,I64 ip_text_x,I64 ip_text_y,Bool set_cursor=TRUE)
|
||||
{
|
||||
CDoc *result=NULL;
|
||||
Bool unlock;
|
||||
@@ -368,10 +331,8 @@ CDoc *SetCursorPos(CTask *task,I64 ip_text_x,I64 ip_text_y,Bool set_cursor=TRUE)
|
||||
|
||||
U0 WinChkMoveSize(CTask *task)
|
||||
{
|
||||
if (task->win_left!=task->win_old_left ||
|
||||
task->win_top!=task->win_old_top)
|
||||
TaskMsg(task,0,
|
||||
MSG_MOVE,task->win_left,task->win_top,0);
|
||||
if (task->win_left!=task->win_old_left || task->win_top!=task->win_old_top)
|
||||
TaskMsg(task,0,MSG_MOVE,task->win_left,task->win_top,0);
|
||||
if (task->win_right-task->win_left!=task->win_old_right-task->win_old_left ||
|
||||
task->win_bottom-task->win_top!=task->win_old_bottom-task->win_old_top)
|
||||
TaskMsg(task,0,
|
||||
@@ -389,13 +350,12 @@ Bool WinKeyNavMenu()
|
||||
CMenu *m;
|
||||
CMenuEntry *tempme;
|
||||
CTask *focus=MenuTask;
|
||||
if (Bt(kbd.down_bitmap,SC_GUI) &&
|
||||
focus && (m=focus->cur_menu)) {
|
||||
if (Bt(kbd.down_bitmap,SC_GUI) && focus && (m=focus->cur_menu)) {
|
||||
winmgr.show_menu=TRUE;
|
||||
sys_cur_submenu_entry=NULL;
|
||||
old_pos.x=ip.pos.x; old_pos.y=ip.pos.y;
|
||||
ip.pos.x=new_pos.x=ip.pos.y=new_pos.y=0;
|
||||
while (m->mu_signature==MENU_SIGNATURE_VAL && Bt(kbd.down_bitmap,SC_GUI)) {
|
||||
while (Bt(kbd.down_bitmap,SC_GUI)) {
|
||||
old_key_cnt=kbd.cnt;
|
||||
if (Bt(kbd.down_bitmap,SC_CURSOR_LEFT)) {
|
||||
while (Bt(kbd.down_bitmap,SC_CURSOR_LEFT) && kbd.cnt==old_key_cnt)
|
||||
@@ -466,8 +426,8 @@ U0 WinMgrTask(I64)
|
||||
old_flags=GetRFlags;
|
||||
Bool has_border;
|
||||
CCtrl *c;
|
||||
SetWinHorz(0,TEXT_COLS-1);
|
||||
SetWinVert(0,TEXT_ROWS-1);
|
||||
WinHorz(0,TEXT_COLS-1);
|
||||
WinVert(0,TEXT_ROWS-1);
|
||||
LBts(&Fs->display_flags,DISPLAYf_NO_BORDER);
|
||||
LBts(&Fs->display_flags,DISPLAYf_SHOW);
|
||||
gr.dc->win_task=Fs;
|
||||
@@ -703,7 +663,7 @@ wmt_start:
|
||||
if (!Bt(&task->win_inhibit,WIf_SELF_IP_L)&&
|
||||
(!TaskValidate(sys_focus_task)||!Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_IP_L))) {
|
||||
if (!old_ip.lb && ip.lb) {
|
||||
if (doc=SetCursorPos(task,ip.pos_text.x,ip.pos_text.y)) {
|
||||
if (doc=WinCursorPosSet(task,ip.pos_text.x,ip.pos_text.y)) {
|
||||
DocLock(doc);
|
||||
if (doc->doc_signature==DOC_SIGNATURE_VAL) {
|
||||
doc_e=doc->cur_entry;
|
||||
@@ -721,7 +681,7 @@ wmt_start:
|
||||
if (!Bt(&task->win_inhibit,WIf_SELF_IP_R)&&
|
||||
(!TaskValidate(sys_focus_task)||!Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_IP_R))) {
|
||||
if (!old_ip.rb && ip.rb) {
|
||||
if (SetCursorPos(task,ip.pos_text.x,ip.pos_text.y)) {
|
||||
if (WinCursorPosSet(task,ip.pos_text.x,ip.pos_text.y)) {
|
||||
old_ip.rb=TRUE;
|
||||
goto wmt_start;
|
||||
}
|
||||
@@ -749,7 +709,7 @@ wmt_start:
|
||||
if (!Bt(&task->win_inhibit,WIf_SELF_IP_L)&&
|
||||
(!TaskValidate(sys_focus_task)||!Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_IP_L))) {
|
||||
if (old_ip.lb && !ip.lb) {
|
||||
if (doc=SetCursorPos(task,ip.pos_text.x,ip.pos_text.y,FALSE)) {
|
||||
if (doc=WinCursorPosSet(task,ip.pos_text.x,ip.pos_text.y,FALSE)) {
|
||||
do msg_code=WinMgrSleep;
|
||||
while (TaskValidate(task) &&
|
||||
(ip.lb || ip.left_dbl_time));
|
||||
@@ -783,7 +743,7 @@ wmt_start:
|
||||
if (!Bt(&task->win_inhibit,WIf_SELF_IP_R)&&
|
||||
(!TaskValidate(sys_focus_task)||!Bt(&sys_focus_task->win_inhibit,WIf_FOCUS_TASK_IP_R))) {
|
||||
if (old_ip.rb && !ip.rb) {
|
||||
if (doc=SetCursorPos(task,ip.pos_text.x,ip.pos_text.y,FALSE)) {
|
||||
if (doc=WinCursorPosSet(task,ip.pos_text.x,ip.pos_text.y,FALSE)) {
|
||||
do msg_code=WinMgrSleep;
|
||||
while (TaskValidate(task) &&
|
||||
(ip.rb || ip.right_dbl_time));
|
||||
@@ -829,8 +789,8 @@ wmt_start:
|
||||
if (ip.lb) {
|
||||
WinToTop(task);
|
||||
while (ip.lb && TaskValidate(task)) {
|
||||
SetWinHorz(ip.pos_text.x-x,task->win_width-1+ip.pos_text.x-x,task);
|
||||
SetWinVert(ip.pos_text.y+1,task->win_height+ip.pos_text.y,task);
|
||||
WinHorz(ip.pos_text.x-x,task->win_width-1+ip.pos_text.x-x,task);
|
||||
WinVert(ip.pos_text.y+1,task->win_height+ip.pos_text.y,task);
|
||||
WinChkMoveSize(task);
|
||||
WinMgrSleep;
|
||||
}
|
||||
@@ -844,8 +804,8 @@ wmt_start:
|
||||
if (ip.lb) {
|
||||
WinToTop(task);
|
||||
while (ip.lb && TaskValidate(task)) {
|
||||
SetWinHorz(ip.pos_text.x+1,task->win_width+ip.pos_text.x,task);
|
||||
SetWinVert(ip.pos_text.y-y,task->win_height-1+ip.pos_text.y-y,task);
|
||||
WinHorz(ip.pos_text.x+1,task->win_width+ip.pos_text.x,task);
|
||||
WinVert(ip.pos_text.y-y,task->win_height-1+ip.pos_text.y-y,task);
|
||||
WinChkMoveSize(task);
|
||||
WinMgrSleep;
|
||||
}
|
||||
@@ -857,8 +817,8 @@ wmt_start:
|
||||
if (ip.lb) {
|
||||
WinToTop(task);
|
||||
while (ip.lb && TaskValidate(task)) {
|
||||
SetWinHorz(task->win_left,ip.pos_text.x-1,task);
|
||||
SetWinVert(task->win_top,ip.pos_text.y-1,task);
|
||||
WinHorz(task->win_left,ip.pos_text.x-1,task);
|
||||
WinVert(task->win_top,ip.pos_text.y-1,task);
|
||||
WinChkMoveSize(task);
|
||||
WinMgrSleep;
|
||||
}
|
||||
@@ -871,7 +831,7 @@ wmt_start:
|
||||
if (ip.lb) {
|
||||
WinToTop(task);
|
||||
while (ip.lb && TaskValidate(task)) {
|
||||
SetWinVert(task->win_top,ip.pos_text.y-1,task);
|
||||
WinVert(task->win_top,ip.pos_text.y-1,task);
|
||||
WinChkMoveSize(task);
|
||||
WinMgrSleep;
|
||||
}
|
||||
@@ -884,7 +844,7 @@ wmt_start:
|
||||
if (ip.lb) {
|
||||
WinToTop(task);
|
||||
while (ip.lb && TaskValidate(task)) {
|
||||
SetWinHorz(task->win_left,ip.pos_text.x-1,task);
|
||||
WinHorz(task->win_left,ip.pos_text.x-1,task);
|
||||
WinChkMoveSize(task);
|
||||
WinMgrSleep;
|
||||
}
|
||||
@@ -1,688 +0,0 @@
|
||||
#help_index "WordStat"
|
||||
|
||||
CHashWS *WSHashAdd(U8 *w)
|
||||
{
|
||||
CHashWS *tempw=HashFind(w,ws.hash_table,HTT_WORD);
|
||||
if (tempw) {
|
||||
tempw->hits++;
|
||||
return tempw;
|
||||
}
|
||||
tempw=ACAlloc(sizeof(CHashWS));
|
||||
tempw->str=AStrNew(w);
|
||||
tempw->type=HTT_WORD;
|
||||
tempw->use_cnt=1;
|
||||
tempw->hits=1;
|
||||
tempw->num=-1;
|
||||
HashAdd(tempw,ws.hash_table);
|
||||
ws.num_words++;
|
||||
return tempw;
|
||||
}
|
||||
|
||||
U0 WSSidesInit(CWSMatrix *m)
|
||||
{
|
||||
I64 i;
|
||||
CWS *tempa;
|
||||
m->n=0;
|
||||
for (i=0;i<WS_MAX_MATRIX_WORDS;i++) {
|
||||
m->side[i].next=m->side[i].last=&m->side[i].next;
|
||||
m->side[i].const_minus_one=-1;
|
||||
m->side[i].row_hits=0;
|
||||
m->side[i].col_hits=0;
|
||||
tempa=AMAlloc(sizeof(CWS));
|
||||
ws.structs_size+=MSize2(tempa);
|
||||
tempa->subs[0].hits=0;
|
||||
tempa->subs[0].repeats=ws.num_matrix_words;
|
||||
tempa->entries=ws.num_matrix_words;
|
||||
tempa->substructs=1;
|
||||
QueIns(tempa,m->side[i].last);
|
||||
}
|
||||
}
|
||||
|
||||
CWS *WSStructFind(CWSMatrix *m,I64 col,I64 row,
|
||||
I64 *_row_base,I64 *_substruct)
|
||||
{
|
||||
CWS *tempa;
|
||||
I64 row_base,i,j;
|
||||
|
||||
if (row>=ws.num_matrix_words ||
|
||||
col>=ws.num_matrix_words)
|
||||
return NULL;
|
||||
if (row<ws.num_matrix_words>>1) {
|
||||
tempa=m->side[col].next;
|
||||
row_base=0;
|
||||
j=row;
|
||||
while (row>=(i=tempa->entries)) {
|
||||
row-=i;
|
||||
tempa=tempa->next;
|
||||
}
|
||||
row_base+=j-row;
|
||||
for (*_substruct=0;row>=tempa->subs[*_substruct].repeats;*_substruct=*_substruct+1) {
|
||||
row-=tempa->subs[*_substruct].repeats;
|
||||
row_base+=tempa->subs[*_substruct].repeats;
|
||||
}
|
||||
} else {
|
||||
row=ws.num_matrix_words-row;
|
||||
tempa=m->side[col].last;
|
||||
row_base=ws.num_matrix_words;
|
||||
j=row;
|
||||
while (row>(i=tempa->entries)) {
|
||||
row-=i;
|
||||
tempa=tempa->last;
|
||||
}
|
||||
row_base+=j-row;
|
||||
for (*_substruct=tempa->substructs-1;row>tempa->subs[*_substruct].repeats;
|
||||
*_substruct=*_substruct-1) {
|
||||
row-=tempa->subs[*_substruct].repeats;
|
||||
row_base-=tempa->subs[*_substruct].repeats;
|
||||
}
|
||||
row_base-=tempa->subs[*_substruct].repeats;
|
||||
}
|
||||
*_row_base=row_base;
|
||||
return tempa;
|
||||
}
|
||||
|
||||
public I64 WSHitsGet(CWSMatrix *m,I64 col,I64 row)
|
||||
{//Look-up markov stats for word followed by word.
|
||||
I64 row_base,substruct;
|
||||
CWS *tempa;
|
||||
if (row>=ws.num_matrix_words ||
|
||||
col>=ws.num_matrix_words)
|
||||
return 0;
|
||||
tempa=WSStructFind(m,col,row,
|
||||
&row_base,&substruct);
|
||||
return tempa->subs[substruct].hits;
|
||||
}
|
||||
|
||||
CWSSub *WSNext(CWSSub *s,CWS **_parent)
|
||||
{
|
||||
I64 i=(s(U8 *)-(&(*_parent)->subs)(U8 *))/sizeof(CWSSub)+1;
|
||||
if (i>=(*_parent)->substructs) {
|
||||
i=0;
|
||||
*_parent=(*_parent)->next;
|
||||
if ((*_parent)->substructs==-1)
|
||||
return NULL;
|
||||
}
|
||||
return &(*_parent)->subs[i];
|
||||
}
|
||||
|
||||
CWSSub *WSLast(CWSSub *s,CWS **_parent)
|
||||
{
|
||||
I64 i=(s(U8 *)-(&(*_parent)->subs)(U8 *))/sizeof(CWSSub)-1;
|
||||
if (i<0) {
|
||||
*_parent=(*_parent)->last;
|
||||
if ((*_parent)->substructs==-1)
|
||||
return NULL;
|
||||
i=(*_parent)->substructs-1;
|
||||
}
|
||||
return &(*_parent)->subs[i];
|
||||
}
|
||||
|
||||
U0 WSRem(CWSSub *s,CWS *parent)
|
||||
{
|
||||
I64 i=(s(U8 *)-(&parent->subs)(U8 *))/sizeof(CWSSub);
|
||||
if (i<0 || i>=WS_SUBSTRUCTS_PER_STRUCT || parent->substructs<1)
|
||||
return;
|
||||
if (parent->substructs==1) {
|
||||
QueRem(parent);
|
||||
ws.structs_size-=MSize2(parent);
|
||||
Free(parent);
|
||||
} else {
|
||||
parent->entries-=s->repeats;
|
||||
parent->substructs--;
|
||||
MemCpy(&parent->subs[i],&parent->subs[i+1],
|
||||
(parent->substructs-i)*sizeof(CWSSub));
|
||||
}
|
||||
}
|
||||
|
||||
CWSSub *WSIns(CWSSub *s,CWS **_parent,CWSSub *last)
|
||||
{
|
||||
CWS *tempa,*parent=*_parent;
|
||||
I64 j,k,i=(last(U8 *)-(&parent->subs)(U8 *))/sizeof(CWSSub)+1;
|
||||
if (i>=WS_SUBSTRUCTS_PER_STRUCT) {
|
||||
i=0;
|
||||
parent=parent->next;
|
||||
*_parent=parent;
|
||||
if (parent->substructs==-1) {
|
||||
tempa=AMAlloc(sizeof(CWS));
|
||||
ws.structs_size+=MSize2(tempa);
|
||||
QueIns(tempa,parent->last);
|
||||
parent=tempa;
|
||||
*_parent=parent;
|
||||
tempa->entries=0;
|
||||
tempa->substructs=0;
|
||||
}
|
||||
}
|
||||
if (parent->substructs==WS_SUBSTRUCTS_PER_STRUCT) {
|
||||
tempa=parent->next;
|
||||
if (tempa->substructs==-1 || tempa->substructs==WS_SUBSTRUCTS_PER_STRUCT) {
|
||||
tempa=AMAlloc(sizeof(CWS));
|
||||
ws.structs_size+=MSize2(tempa);
|
||||
tempa->entries=0;
|
||||
tempa->substructs=0;
|
||||
QueIns(tempa,parent);
|
||||
k=0;
|
||||
for (j=i;j<parent->substructs;j++) {
|
||||
MemCpy(&tempa->subs[k],&parent->subs[j],sizeof(CWSSub));
|
||||
tempa->entries+=tempa->subs[k++].repeats;
|
||||
tempa->substructs++;
|
||||
}
|
||||
parent->entries-=tempa->entries;
|
||||
parent->substructs-=tempa->substructs;
|
||||
} else {
|
||||
for (j=tempa->substructs-1;j>=0;j--)
|
||||
MemCpy(&tempa->subs[j+1],&tempa->subs[j],sizeof(CWSSub));
|
||||
MemCpy(&tempa->subs[0],
|
||||
&parent->subs[WS_SUBSTRUCTS_PER_STRUCT-1],
|
||||
sizeof(CWSSub));
|
||||
parent->entries-=tempa->subs[0].repeats;
|
||||
parent->substructs--;
|
||||
tempa->entries+=tempa->subs[0].repeats;
|
||||
tempa->substructs++;
|
||||
for (j=WS_SUBSTRUCTS_PER_STRUCT-2;j>=i;j--)
|
||||
MemCpy(&parent->subs[j+1],
|
||||
&parent->subs[j],sizeof(CWSSub));
|
||||
}
|
||||
} else {
|
||||
for (j=parent->substructs-1;j>=i;j--)
|
||||
MemCpy(&parent->subs[j+1],
|
||||
&parent->subs[j],sizeof(CWSSub));
|
||||
}
|
||||
parent->entries+=s->repeats;
|
||||
parent->substructs++;
|
||||
MemCpy(&parent->subs[i],s,sizeof(CWSSub));
|
||||
return &parent->subs[i];
|
||||
}
|
||||
|
||||
CWSSub *WSCondense(CWSSub *s,CWS **_parent)
|
||||
{
|
||||
CWSSub *temps,*temps_l,*temps_n;
|
||||
CWS *tempa_l,*tempa_n;
|
||||
if ((*_parent)->substructs==-1)
|
||||
return NULL;
|
||||
temps=s;
|
||||
tempa_l=*_parent;
|
||||
temps_l=WSLast(temps,&tempa_l);
|
||||
if (temps_l && temps_l->hits==temps->hits) {
|
||||
temps_l->repeats+=temps->repeats;
|
||||
tempa_l->entries+=temps->repeats;
|
||||
WSRem(temps,*_parent);
|
||||
*_parent=tempa_l;
|
||||
temps=temps_l;
|
||||
}
|
||||
tempa_n=*_parent;
|
||||
temps_n=WSNext(temps,&tempa_n);
|
||||
if (temps_n && temps_n->hits==temps->hits) {
|
||||
temps->repeats=temps->repeats+temps_n->repeats;
|
||||
(*_parent)->entries=(*_parent)->entries+temps_n->repeats;
|
||||
WSRem(temps_n,tempa_n);
|
||||
}
|
||||
return temps;
|
||||
}
|
||||
|
||||
I64 WSHitsInc(CWSMatrix *m,I64 col,I64 row)
|
||||
{
|
||||
I64 row_base,substruct,repeats;
|
||||
CWSSub sn,*temps,*temps1,*temps_l;
|
||||
CWS *tempa,*tempa1,*tempa_l;
|
||||
|
||||
if (row>=ws.num_matrix_words ||
|
||||
col>=ws.num_matrix_words)
|
||||
return 0;
|
||||
tempa=WSStructFind(m,col,row,&row_base,&substruct);
|
||||
temps=&tempa->subs[substruct];
|
||||
repeats=temps->repeats;
|
||||
if (repeats==1) {
|
||||
temps->hits++;
|
||||
temps=WSCondense(temps,&tempa);
|
||||
} else {
|
||||
if (row==row_base) {
|
||||
temps->repeats--;
|
||||
tempa->entries--;
|
||||
sn.hits=1;
|
||||
sn.repeats=1;
|
||||
tempa_l=tempa;
|
||||
if (!(temps_l=WSLast(&tempa->subs[substruct],&tempa_l))) {
|
||||
tempa_l=tempa->last; //header
|
||||
temps_l=&tempa_l->subs[WS_SUBSTRUCTS_PER_STRUCT-1];
|
||||
}
|
||||
temps=WSIns(&sn,&tempa_l,temps_l);
|
||||
temps=WSCondense(temps,&tempa_l);
|
||||
} else if (row==repeats-1+row_base) {
|
||||
temps->repeats--;
|
||||
tempa->entries--;
|
||||
sn.hits=1;
|
||||
sn.repeats=1;
|
||||
temps=WSIns(&sn,&tempa,temps);
|
||||
temps=WSCondense(temps,&tempa);
|
||||
} else {
|
||||
tempa->entries-=repeats;
|
||||
sn.hits=temps->hits+1;
|
||||
sn.repeats=1;
|
||||
tempa1=tempa;
|
||||
temps1=temps;
|
||||
temps=WSIns(&sn,&tempa1,temps1);
|
||||
temps1->repeats=row-row_base;
|
||||
tempa->entries+=temps1->repeats;
|
||||
sn.repeats=row_base+repeats-(row+1);
|
||||
sn.hits=temps1->hits;
|
||||
WSIns(&sn,&tempa1,temps);
|
||||
}
|
||||
}
|
||||
m->n++;
|
||||
m->side[col].col_hits++;
|
||||
m->side[row].row_hits++;
|
||||
return temps->hits;
|
||||
}
|
||||
|
||||
U0 WSSingleFileAdd(U8 *buf,I64 pass)
|
||||
{
|
||||
I64 ch;
|
||||
U8 *ptr=buf,*ptr2,*ptr3;
|
||||
CHashWS *cur_ptr,*last_ptr=NULL;
|
||||
while (TRUE) {
|
||||
while (TRUE) {
|
||||
if (ch=*ptr++) {
|
||||
if (Bt(chars_bitmap_alpha_numeric,ch))
|
||||
break;
|
||||
} else
|
||||
return;
|
||||
}
|
||||
ptr3=ptr;
|
||||
ptr2=ptr;
|
||||
ptr--;
|
||||
while (TRUE) {
|
||||
if (ch=*ptr2++) {
|
||||
if (Bt(chars_bitmap_alpha_numeric,ch))
|
||||
*ptr3++=ch;
|
||||
else if (ch!=CH_CURSOR)
|
||||
break;
|
||||
} else {
|
||||
ptr2--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
*ptr3=0;
|
||||
if (pass==1)
|
||||
WSHashAdd(ptr);
|
||||
else {
|
||||
cur_ptr=HashFind(ptr,ws.hash_table,HTT_WORD);
|
||||
if (cur_ptr->num<0)
|
||||
cur_ptr=NULL;
|
||||
else
|
||||
if (last_ptr)
|
||||
WSHitsInc(ws.matrix,last_ptr->num,cur_ptr->num);
|
||||
last_ptr=cur_ptr;
|
||||
}
|
||||
ptr=ptr2;
|
||||
}
|
||||
}
|
||||
|
||||
I64 WSCompare(CHashWS *e1,CHashWS *e2)
|
||||
{
|
||||
I64 r;
|
||||
if (!(r=e2->hits - e1->hits))
|
||||
r=StrCmp(e1->str,e2->str);
|
||||
return r;
|
||||
}
|
||||
|
||||
I64 WSSkipCrap(U8 *src,I64 len)
|
||||
{
|
||||
I64 j;
|
||||
j=len-1;
|
||||
while (j>=0) {
|
||||
if (Bt(chars_bitmap_alpha_numeric,src[j]))
|
||||
break;
|
||||
else
|
||||
j--;
|
||||
}
|
||||
return j+1;
|
||||
}
|
||||
|
||||
I64 WSPriorWordInStr(U8 *src,U8 *dst,I64 len,I64 buf_size)
|
||||
{
|
||||
I64 i,j=0,k;
|
||||
Bool cont=TRUE;
|
||||
i=len-1;
|
||||
while (i>=0 && cont) {
|
||||
if (!Bt(chars_bitmap_alpha_numeric,src[i]))
|
||||
cont=FALSE;
|
||||
else
|
||||
i--;
|
||||
}
|
||||
if (i>=-1 && len>0)
|
||||
for (k=i+1;k<len && j<buf_size-1;k++)
|
||||
dst[j++]=src[k];
|
||||
dst[j]=0;
|
||||
return i+1;
|
||||
}
|
||||
|
||||
Bool WSPartialMatch(U8 *partial,U8 *complete)
|
||||
{
|
||||
I64 i,l=StrLen(partial);
|
||||
for (i=0;i<l;i++)
|
||||
if (partial[i]!=complete[i])
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
U0 WSFillIn(I64 n)
|
||||
{
|
||||
U8 *s;
|
||||
I64 len;
|
||||
if (0<=--n<ws.num_fillins) {
|
||||
s=ws.sorted_words[ws.fillin_matches[n]]->str;
|
||||
len=StrLen(s);
|
||||
if (len>ws.partial_len)
|
||||
Auto(s+ws.partial_len);
|
||||
}
|
||||
}
|
||||
|
||||
U0 WSMan(I64 n,CTask *parent_task=NULL)
|
||||
{
|
||||
CHashWS *tempw;
|
||||
CHashSrcSym *temph;
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
if (0<=--n<ws.num_fillins && (tempw=ws.sorted_words[ws.fillin_matches[n]]) &&
|
||||
(temph=HashFind(tempw->str,Fs->hash_table,HTG_SRC_SYM)) &&
|
||||
temph->src_link) {
|
||||
Preempt(old_preempt);
|
||||
PopUpEd(temph->src_link,parent_task);
|
||||
}
|
||||
Preempt(old_preempt);
|
||||
}
|
||||
|
||||
U0 WSFillInAdd(I64 i,I64 j,I64 old_num_fillins)
|
||||
{
|
||||
Bool cont;
|
||||
I64 k;
|
||||
if (ws.num_fillins<WS_MAX_FILLINS || i>ws.fillin_scores[ws.num_fillins-1] ||
|
||||
i==ws.fillin_scores[ws.num_fillins-1] && ws.sorted_words[j]->hits>ws.fillin_hits[ws.num_fillins-1]) {
|
||||
cont=TRUE;
|
||||
for (k=ws.num_fillins-1;k>=old_num_fillins && cont;k--)
|
||||
if (i<=ws.fillin_scores[k] || i==ws.fillin_scores[k] && ws.sorted_words[j]->hits<=ws.fillin_hits[k]) {
|
||||
cont=FALSE;
|
||||
k++; //offset k--
|
||||
} else {
|
||||
ws.fillin_scores[k+1]=ws.fillin_scores[k];
|
||||
ws.fillin_matches[k+1]=ws.fillin_matches[k];
|
||||
ws.fillin_hits[k+1]=ws.fillin_hits[k];
|
||||
}
|
||||
if (ws.num_fillins<WS_MAX_FILLINS)
|
||||
ws.num_fillins++;
|
||||
ws.fillin_scores[k+1]=i;
|
||||
ws.fillin_hits[k+1]=ws.sorted_words[j]->hits;
|
||||
ws.fillin_matches[k+1]=j;
|
||||
}
|
||||
}
|
||||
|
||||
U0 WSPutChoices(CDoc *focus_l,CDocEntry *doc_e,CTask *focus_task)
|
||||
{
|
||||
I64 i,j,k,data_col;
|
||||
U8 ch=0,*buf,*buf1,*src=NULL,*st;
|
||||
CHashWS *w2;
|
||||
F64 timeout_time=tS+0.5;
|
||||
CHashSrcSym *temph;
|
||||
CDoc *doc=DocPut;
|
||||
|
||||
src=DocScanLine(focus_l,doc_e,&data_col);
|
||||
DocUnlock(focus_l);
|
||||
i=StrLen(src);
|
||||
buf =MAlloc(MaxI64(i+1,256));
|
||||
buf1=MAlloc(MaxI64(i+1,256));
|
||||
if (data_col==-1)
|
||||
data_col=0;
|
||||
data_col=WSPriorWordInStr(src,buf,data_col,256);
|
||||
ws.partial_len=StrLen(buf);
|
||||
data_col=WSSkipCrap(src,data_col);
|
||||
data_col=WSPriorWordInStr(src,buf1,data_col,256);
|
||||
|
||||
if (ws.cur_word && !StrCmp(ws.cur_word,buf))
|
||||
goto pc_done;
|
||||
|
||||
st=ws.cur_word;
|
||||
ws.cur_word=AStrNew(buf);
|
||||
Free(st);
|
||||
Preempt(ON);
|
||||
if (StrLen(buf1)&&ws.hash_table)
|
||||
w2=HashFind(buf1,ws.hash_table,HTT_WORD);
|
||||
else
|
||||
w2=NULL;
|
||||
ws.num_fillins=0;
|
||||
if (w2 && w2->num<ws.num_matrix_words)
|
||||
for (j=0;j<ws.num_matrix_words && tS<timeout_time;j++)
|
||||
if (WSPartialMatch(ws.cur_word,ws.sorted_words[j]->str)) {
|
||||
i=WSHitsGet(ws.matrix,w2->num,ws.sorted_words[j]->num);
|
||||
WSFillInAdd(i,j,0);
|
||||
}
|
||||
k=ws.num_fillins;
|
||||
for (j=0;j<ws.num_words && tS<timeout_time;j++)
|
||||
if (WSPartialMatch(ws.cur_word,ws.sorted_words[j]->str))
|
||||
WSFillInAdd(0,j,k);
|
||||
Preempt(OFF);
|
||||
|
||||
pc_done:
|
||||
DocRst(doc,TRUE);
|
||||
doc->flags|=DOCF_MIN_SIZE;
|
||||
DocCursor;
|
||||
Fs->text_attr=LTBLUE<<4+WHITE;
|
||||
Fs->border_src =BDS_CONST;
|
||||
Fs->border_attr=LTBLUE<<4+BLACK;
|
||||
DocPrint(doc,"Word:%s\n",ws.cur_word);
|
||||
for (i=0;i<ws.num_fillins;i++) {
|
||||
st=ws.sorted_words[ws.fillin_matches[i]]->str;
|
||||
ch=CH_SPACE;
|
||||
DocPrint(doc,"F%02d ",i+1);
|
||||
if (TaskValidate(focus_task) &&
|
||||
(temph=HashFind(st,focus_task->hash_table,HTG_SRC_SYM)) &&
|
||||
temph->src_link) {
|
||||
if (temph->type&HTF_PUBLIC)
|
||||
DocPrint(doc,"$$RED$$");
|
||||
DocPrint(doc,"$$TX+UL+L+PU,\"%Q\",A=\"%s\"$$$$FG$$\n",st,temph->src_link);
|
||||
} else
|
||||
DocPrint(doc,"%s\n",st);
|
||||
}
|
||||
if (wsd.has_words)
|
||||
WSDDictWordsAdd(doc);
|
||||
|
||||
DocRecalc(doc);
|
||||
if (!LBts(&Fs->display_flags,DISPLAYf_SHOW))
|
||||
WinZBufUpdate;
|
||||
|
||||
Free(src);
|
||||
Free(buf);
|
||||
Free(buf1);
|
||||
}
|
||||
|
||||
U0 WSTask(I64)
|
||||
{
|
||||
CTask *focus_task,*original_focus_task;
|
||||
CDoc *doc;
|
||||
CDocEntry *doc_e;
|
||||
I64 ch;
|
||||
DocTermNew;
|
||||
SetWinHorz(51,Fs->win_right);
|
||||
LBts(&Fs->display_flags,DISPLAYf_WIN_ON_TOP);
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_BORDER-WIF_SELF_IP_L-WIF_SELF_IP_R-WIG_DBL_CLICK;
|
||||
while (TRUE) {
|
||||
if (Bt(&ws.flags,WSf_ENABLE)) {
|
||||
original_focus_task=focus_task=sys_focus_task;
|
||||
while (TaskValidate(focus_task) && Bt(&focus_task->task_flags,TASKf_INPUT_FILTER_TASK))
|
||||
focus_task=focus_task->parent_task;
|
||||
if (TaskValidate(focus_task) && (doc=DocPut(focus_task)) &&
|
||||
focus_task!=Fs && Bt(&focus_task->display_flags,DISPLAYf_SHOW)) {
|
||||
DocLock(doc);
|
||||
if (TaskValidate(focus_task) && original_focus_task==sys_focus_task &&
|
||||
doc && doc==DocPut(focus_task) && (doc_e=doc->cur_entry)) {
|
||||
if (doc_e==doc) doc_e=doc_e->last;
|
||||
while (doc_e->last!=doc && (doc_e->type_u8==DOCT_NEW_LINE ||
|
||||
doc_e->type_u8==DOCT_SOFT_NEW_LINE))
|
||||
doc_e=doc_e->last;
|
||||
while (doc_e->last->type_u8 !=DOCT_NEW_LINE && doc_e->last!=doc)
|
||||
doc_e=doc_e->last;
|
||||
if (Bt(&ws.flags,WSf_ENABLE))
|
||||
WSPutChoices(doc,doc_e,focus_task);
|
||||
else
|
||||
DocUnlock(doc);
|
||||
} else
|
||||
DocUnlock(doc);
|
||||
}
|
||||
}
|
||||
Sleep(333);
|
||||
if (ScanMsg(&ch,,1<<MSG_KEY_DOWN) && (ch==CH_ESC||ch==CH_SHIFT_ESC))
|
||||
break;
|
||||
doc=DocPut;
|
||||
DocLock(doc);
|
||||
if (doc->cur_entry!=doc && doc->cur_entry->de_flags & DOCEF_LINK)
|
||||
'' CH_SPACE;
|
||||
DocUnlock(doc);
|
||||
}
|
||||
ws.task=NULL;
|
||||
}
|
||||
|
||||
U0 WSMainFileLstTraverse(U8 *files_find_mask,I64 pass)
|
||||
{
|
||||
U8 *buf;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
try {
|
||||
tempde=tempde1=FilesFind(files_find_mask,FUF_RECURSE|FUF_JUST_TXT|FUF_JUST_FILES|FUF_CLUSTER_ORDER);
|
||||
while (tempde) {
|
||||
"%s\n",tempde->full_name;
|
||||
buf=FileRead(tempde->full_name);
|
||||
WSSingleFileAdd(buf,pass);
|
||||
Free(buf);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
} catch
|
||||
Fs->catch_except=TRUE;
|
||||
DirTreeDel(tempde1);
|
||||
}
|
||||
|
||||
U0 WSMatrixDel(CWSMatrix *m)
|
||||
{
|
||||
I64 i;
|
||||
CWS *tempw,*tempw1,*tempw2;
|
||||
if (!m) return;
|
||||
for (i=0;i<WS_MAX_MATRIX_WORDS;i++) {
|
||||
tempw1=&m->side[i];
|
||||
tempw=tempw1->next;
|
||||
while (tempw!=tempw1) {
|
||||
tempw2=tempw->next;
|
||||
Free(tempw);
|
||||
tempw=tempw2;
|
||||
}
|
||||
}
|
||||
Free(m);
|
||||
}
|
||||
|
||||
public Bool WordStat(Bool val=OFF)
|
||||
{//Turn WordStat OFF (or ON).
|
||||
Bool old_wordstat=FALSE,
|
||||
old_preempt=Preempt(OFF);
|
||||
if (val) {
|
||||
while (Bt(&ws.flags,WSf_INIT_IN_PROGRESS))
|
||||
Sleep(10);
|
||||
if (TaskValidate(ws.task))
|
||||
old_wordstat=TRUE;
|
||||
else {
|
||||
ws.task=Spawn(&WSTask,NULL,"WordStat");
|
||||
TaskWait(ws.task);
|
||||
}
|
||||
if (!LBts(&ws.flags,WSf_ENABLE))
|
||||
WinToTop(ws.task);
|
||||
} else {
|
||||
LBtr(&ws.flags,WSf_ENABLE);
|
||||
if (TaskValidate(ws.task)) {
|
||||
old_wordstat=TRUE;
|
||||
Kill(ws.task);
|
||||
while (TaskValidate(ws.task))
|
||||
Yield;
|
||||
ws.task=NULL;
|
||||
}
|
||||
}
|
||||
Preempt(old_preempt);
|
||||
return old_wordstat;
|
||||
}
|
||||
|
||||
U0 WSProgressTask(Bool *_start_flag)
|
||||
{
|
||||
I64 start=dsk.write_cnt;
|
||||
progress1=0;
|
||||
progress1_max=(Size(WSD_DEF_FILENAME_Z,"+x+s")+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
StrCpy(progress1_desc,"Uncompressing Dictionary");
|
||||
start=dsk.write_cnt;
|
||||
*_start_flag=TRUE;
|
||||
while (progress1<progress1_max) {
|
||||
progress1=dsk.write_cnt-start;
|
||||
Sleep(10);
|
||||
}
|
||||
*progress1_desc=progress1=progress1_max=0;
|
||||
}
|
||||
|
||||
public U0 WSInit(U8 *mask=NULL)
|
||||
{//Read files and build WordStat statistics.
|
||||
I64 i,j=0;
|
||||
Bool start_flag;
|
||||
CHashWS *tempw;
|
||||
CBlkDev *bdev=Drv2BlkDev;
|
||||
|
||||
while (LBts(&ws.flags,WSf_INIT_IN_PROGRESS))
|
||||
Yield;
|
||||
WordStat;
|
||||
|
||||
if (IsDrvWritable && FileFind(WSD_DEF_FILENAME_Z) && !FileFind(WSD_DEF_FILENAME)) {
|
||||
if (bdev->type!=BDT_RAM) {
|
||||
start_flag=FALSE;
|
||||
Spawn(&WSProgressTask,&start_flag);
|
||||
while (!start_flag)
|
||||
Yield;
|
||||
}
|
||||
Move(WSD_DEF_FILENAME_Z,WSD_DEF_FILENAME);
|
||||
}
|
||||
|
||||
HashTableDel(ws.hash_table);
|
||||
ws.hash_table=HashTableNew(0x4000,adam_task);
|
||||
|
||||
ws.num_words=0;
|
||||
ws.num_matrix_words=0;
|
||||
ws.structs_size=0;
|
||||
Free(ws.cur_word);
|
||||
ws.cur_word=NULL;
|
||||
|
||||
"\n\nPass #1\n";
|
||||
if (mask) WSMainFileLstTraverse(mask,1);
|
||||
Free(ws.sorted_words);
|
||||
ws.sorted_words=AMAlloc(sizeof(U8 *)*ws.num_words);
|
||||
|
||||
tempw=ws.hash_table->next_added;
|
||||
while (tempw!=ws.hash_table) {
|
||||
ws.sorted_words[j++]=tempw;
|
||||
tempw=tempw->next_added;
|
||||
}
|
||||
QSortI64(ws.sorted_words,ws.num_words,&WSCompare);
|
||||
for (i=0;i<ws.num_words;i++)
|
||||
ws.sorted_words[i]->num=i;
|
||||
if (ws.num_words<=WS_MAX_MATRIX_WORDS)
|
||||
ws.num_matrix_words=ws.num_words;
|
||||
else
|
||||
ws.num_matrix_words=WS_MAX_MATRIX_WORDS;
|
||||
|
||||
WSMatrixDel(ws.matrix);
|
||||
ws.matrix=AMAlloc(sizeof(CWSMatrix));
|
||||
WSSidesInit(ws.matrix);
|
||||
|
||||
"\n\nPass #2\n";
|
||||
if (mask) WSMainFileLstTraverse(mask,2);
|
||||
|
||||
WSDWordsLoad;
|
||||
LBtr(&ws.flags,WSf_INIT_IN_PROGRESS);
|
||||
WordStat(ON);
|
||||
}
|
||||
|
||||
I64 WordStatSize()
|
||||
{
|
||||
if (ws.hash_table)
|
||||
return HashTableSize2(ws.hash_table)+ws.structs_size+
|
||||
MSize2(ws.sorted_words)+MSize2(ws.matrix)+MSize2(wsd.word_lst);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
#help_index "WordStat"
|
||||
#help_file "::/Doc/WordStat"
|
||||
|
||||
//See $LK,"::/Doc/WordStat.TXT"$
|
||||
|
||||
class CWSSub
|
||||
{
|
||||
I32 hits,repeats;
|
||||
};
|
||||
|
||||
#define WS_SUBSTRUCTS_PER_STRUCT 8
|
||||
class CWS
|
||||
{
|
||||
CWS *next,*last;
|
||||
I64 substructs, //-1 means CWSMatrixSide
|
||||
entries;
|
||||
CWSSub subs[WS_SUBSTRUCTS_PER_STRUCT];
|
||||
};
|
||||
|
||||
class CWSMatrixSide
|
||||
{
|
||||
CWS *next,*last;
|
||||
I64 const_minus_one, //-1 used to header in que
|
||||
row_hits,col_hits;
|
||||
};
|
||||
|
||||
#define WS_MAX_MATRIX_WORDS 0x8000
|
||||
class CWSMatrix
|
||||
{
|
||||
I64 n;
|
||||
CWSMatrixSide side[WS_MAX_MATRIX_WORDS];
|
||||
};
|
||||
|
||||
#define WSf_ENABLE 0
|
||||
#define WSf_INIT_IN_PROGRESS 1
|
||||
|
||||
#define WS_MAX_FILLINS 10
|
||||
|
||||
public class CWordStatGlbls
|
||||
{
|
||||
I64 num_words,num_matrix_words;
|
||||
CHashTable *hash_table;
|
||||
U8 *cur_word;
|
||||
I64 flags;
|
||||
CWSMatrix *matrix;
|
||||
CHashWS **sorted_words;
|
||||
CTask *task;
|
||||
I64 partial_len,num_fillins,
|
||||
structs_size,
|
||||
fillin_matches [WS_MAX_FILLINS+1],
|
||||
fillin_scores [WS_MAX_FILLINS+1],
|
||||
fillin_hits [WS_MAX_FILLINS+1];
|
||||
|
||||
} ws={0,0,NULL,NULL,0,NULL,NULL,NULL,0,0,0,
|
||||
{0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0},
|
||||
{0,0,0,0,0,0,0,0,0,0,0}};
|
||||
|
||||
//Dictionary Stuff
|
||||
#help_index "WordStat/Dictionary"
|
||||
|
||||
#define WSD_WORD_FILENAME "/Adam/WordStat/WSWords.DAT.Z"
|
||||
#define WSD_DEF_FILENAME "/Adam/WordStat/WSDefs.DAT"
|
||||
#define WSD_DEF_FILENAME_Z "/Adam/WordStat/WSDefs.DAT.Z"
|
||||
|
||||
#define WSD_H1 0
|
||||
#define WSD_H1_END 1
|
||||
#define WSD_DEF 2
|
||||
#define WSD_DEF_END 3
|
||||
#define WSD_PRONUNCIATION 4
|
||||
#define WSD_PRONUNCIATION_END 5
|
||||
#define WSD_POS 6
|
||||
#define WSD_POS_END 7
|
||||
#define WSD_EXTRA 8
|
||||
#define WSD_EXTRA_END 9
|
||||
#define WSD_BLK_SIZE 0x4000
|
||||
|
||||
#define WSD_END_CHAR 0x00
|
||||
#define WSD_WORD_CHAR 0x01
|
||||
#define WSD_DEF_CHAR 0x02
|
||||
#define WSD_PRONUNCIATION_CHAR 0x03
|
||||
#define WSD_POS_CHAR 0x04
|
||||
#define WSD_EXTRA_CHAR 0x05
|
||||
|
||||
#define WSD_MAX_FILLINS 10
|
||||
|
||||
public class CWordStatDictGlbls
|
||||
{
|
||||
U8 *word_lst;
|
||||
I64 word_lst_size,num_words,num_fillins;
|
||||
U8 *fillins[WSD_MAX_FILLINS];
|
||||
Bool has_words,has_defs;
|
||||
} wsd={NULL,0,0,0,{0,0,0,0,0,0,0,0,0,0},FALSE,FALSE};
|
||||
wsd.has_words=FileFind(WSD_WORD_FILENAME);
|
||||
wsd.has_defs =FileFind(WSD_DEF_FILENAME)||FileFind(WSD_DEF_FILENAME_Z);
|
||||
|
||||
extern U0 WSDWordsLoad();
|
||||
extern U0 WSDDictWordsAdd(CDoc *doc,U8 *st=NULL);
|
||||
|
||||
#include "WSMain"
|
||||
#include "WSDict"
|
||||
Reference in new issue
Block a user