TempleOSTS_131005.ISO
This commit is contained in:
1 parent
1343005a29
commit
2d2a65d572
547 files changed
+33608
-12549
No files matched your search
@@ -1,13 +1,12 @@
|
||||
#exe {OptOn(OPTf_WARN_PAREN);};
|
||||
#exe {OptOn(OPTf_WARN_DUP_TYPES);};
|
||||
#help_index "Task/Login"
|
||||
#help_index "Misc"
|
||||
|
||||
//Use Dbg("Type 'G;'"); to debug before window mgr is running.
|
||||
|
||||
public F64 os_version=1.04;
|
||||
public F64 os_version=1.06;
|
||||
|
||||
#include "AdamExt.HPP"
|
||||
|
||||
#include "Math2a"
|
||||
#include "Training"
|
||||
#include "Utils2a"
|
||||
|
||||
@@ -16,7 +16,6 @@ extern I64 doc_tag_types[],doc_nontag_invisible_types[],
|
||||
extern I64 doc_dft_flags1[],doc_dft_flags2[],doc_dft_type_flags[];
|
||||
|
||||
extern I64 PopUp(U8 *msg,CTask *parent=NULL,CTask **_pu_task=NULL);
|
||||
extern CDocEntry *DocPutS(CDoc *doc,U8 *st);
|
||||
extern Bool PopUpNoYes(U8 *header=NULL,U8 *footer=NULL);
|
||||
extern I64 PopUpMenu(CDoc *doc,I64 doc_flags=0);
|
||||
extern I64 PopUpRangeI64(I64 lo,I64 hi,I64 step=1,U8 *header=NULL,U8 *footer=NULL);
|
||||
@@ -31,7 +30,7 @@ extern CDoc *DocRead(U8 *name,I64 flags=0);
|
||||
extern U0 EdCodeTools(CDoc *doc);
|
||||
extern U0 DocDel(CDoc *doc);
|
||||
extern U0 DocMax(I64 i=MAX_I32);
|
||||
extern CDocEntry *DocPrintF(CDoc *doc,U8 *src,...);
|
||||
extern CDocEntry *DocPrint(CDoc *doc,U8 *src,...);
|
||||
extern U8 *EdSprite(I64 bin_num);
|
||||
extern Bool View();
|
||||
extern Bool DocLock(CDoc *doc);
|
||||
@@ -46,7 +45,7 @@ extern CDocEntry *DocEntryCopy(CDoc *doc,CDocEntry *doc_e);
|
||||
extern U0 DocInsDoc(CDoc *doc,CDoc *doc2);
|
||||
extern U0 DocD(U8 *buf,I64 cnt=0x80);
|
||||
extern Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC_ALL);
|
||||
extern Bool DocFormDo(U8 *D,U8 *class_name,I64 doc_flags=0,U8 *header=NULL,U8 *footer=NULL);
|
||||
extern Bool DocFormDo(U8 *_d,U8 *class_name=lastclass,I64 doc_flags=0,U8 *header=NULL,U8 *footer=NULL);
|
||||
extern CDoc *DocPut(CTask *task=NULL);
|
||||
extern CDoc *DocDisplay(CTask *task=NULL);
|
||||
extern U0 DocClear(CDoc *doc=NULL);
|
||||
@@ -59,7 +58,7 @@ extern U0 DocRst(CDoc *doc,Bool is_old);
|
||||
extern U0 DocUpdateTaskDocs(CTask *task);
|
||||
extern I64 PmtI64(U8 *msg,I64 dft,I64 lo=MIN_I64,I64 hi=MAX_I64);
|
||||
extern F64 PmtF64(U8 *msg,F64 dft,F64 lo=MIN_F64,F64 hi=MAX_F64);
|
||||
extern U0 ClassRep(U8 *class_name,U8 *d,I64 max_depth=2,Bool fun=FALSE,I64 offset=0);
|
||||
extern U0 ClassRep(U8 *_d,U8 *class_name=lastclass,I64 max_depth=2,Bool fun=FALSE,I64 offset=0);
|
||||
extern U8 *DocLinkFile(U8 *link_st,CTask *mem_task=NULL);
|
||||
extern Bool Ed(U8 *link_st,I64 ed_flags=0);
|
||||
extern Bool Plain(U8 *filename);
|
||||
|
||||
@@ -14,24 +14,26 @@ public U0 AFPmtStr(U8 *st)
|
||||
st++;
|
||||
} else {
|
||||
if (*st=='\n')
|
||||
SPrintF(buf,"Press the '$$FG,GREEN$$<ENTER>$$FG$$' key");
|
||||
SPrint(buf,"Press the '$$FG,GREEN$$<ENTER>$$FG$$' key");
|
||||
else if (*st==CH_SPACE)
|
||||
SPrintF(buf,"Press the '$$FG,GREEN$$<SPACE BAR>$$FG$$' key");
|
||||
SPrint(buf,"Press the '$$FG,GREEN$$<SPACE BAR>$$FG$$' key");
|
||||
else
|
||||
SPrintF(buf,"Press the '$$FG,GREEN$$%c$$FG$$' key",*st);
|
||||
SPrint(buf,"Press the '$$FG,GREEN$$%c$$FG$$' key",*st);
|
||||
PopUpOk(buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public U0 AFDelayedPutS(U8 *st,I64 mS=100)
|
||||
public U0 AFPrint(I64 mS=100,U8 *fmt,...)
|
||||
{
|
||||
U8 *buf=SPrintJoin(NULL,fmt,argc,argv),*st=buf;
|
||||
I64 ch;
|
||||
while (ch=*st++) {
|
||||
'' ch;
|
||||
Sleep(mS);
|
||||
}
|
||||
Free(buf);
|
||||
}
|
||||
|
||||
public U0 AFGetKey(I64 scancode,I64 sc_mask=0xFF|SCF_SHIFT|SCF_CTRL|SCF_ALT)
|
||||
@@ -46,7 +48,7 @@ public U0 AFGetKey(I64 scancode,I64 sc_mask=0xFF|SCF_SHIFT|SCF_CTRL|SCF_ALT)
|
||||
!(sc.u8[0]==SC_ALT && scancode&SCF_ALT) ) {
|
||||
if (sc&sc_mask!=scancode&sc_mask) {
|
||||
st=ScanCode2KeyName(scancode);
|
||||
SPrintF(buf,"Press the '$$FG,GREEN$$%s$$FG$$' key",st);
|
||||
SPrint(buf,"Press the '$$FG,GREEN$$%s$$FG$$' key",st);
|
||||
Free(st);
|
||||
PopUpOk(buf);
|
||||
}
|
||||
@@ -67,12 +69,12 @@ public U0 AFGetChar(I64 ch1,I64 ch2=0)
|
||||
if (ch!=ch1 && (!ch2 || ch!=ch2)) {
|
||||
if (!ch2) {
|
||||
st1=A2KeyName(ch1);
|
||||
SPrintF(buf,"Press the '$$FG,GREEN$$%s$$FG$$' key",st1);
|
||||
SPrint(buf,"Press the '$$FG,GREEN$$%s$$FG$$' key",st1);
|
||||
Free(st1);
|
||||
} else {
|
||||
st1=A2KeyName(ch1);
|
||||
st2=A2KeyName(ch2);
|
||||
SPrintF(buf,"Press the '$$FG,GREEN$$%s$$FG$$' key or\n"
|
||||
SPrint(buf,"Press the '$$FG,GREEN$$%s$$FG$$' key or\n"
|
||||
"the '$$FG,GREEN$$%s$$FG$$' key.",st1,st2);
|
||||
Free(st1);
|
||||
Free(st2);
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
asm {
|
||||
#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)
|
||||
#assert BOOT_HIGH_LOC>=KERNEL_BIN_LIMIT
|
||||
|
||||
DefinePrint(
|
||||
"DD_BOOT_HIGH_LOC","%08X",BOOT_HIGH_LOC<<4);
|
||||
DefinePrint(
|
||||
"DD_BOOT_HIGH_LOC_END","%08X",BOOT_RAM_LIMIT-1);
|
||||
|
||||
asm {
|
||||
USE16
|
||||
BCD_START::
|
||||
//DL is supposed to have the BIOS drive number
|
||||
@@ -65,7 +70,7 @@ BCD_RET::
|
||||
RET
|
||||
BCD_PUTS::
|
||||
@@1: LODSB
|
||||
OR AL,AL
|
||||
TEST AL,AL
|
||||
JZ BCD_RET
|
||||
CALL BCD_PUTCHAR
|
||||
JMP @@1
|
||||
@@ -147,7 +152,7 @@ BCD_MAIN::
|
||||
//See $LK,"BootCdProbe","MN:BootCdProbe"$().
|
||||
MOV EBX,U32 [BCD_BLK_LO-BCD_START] //TODO: oops overflow?
|
||||
SHL EBX,16
|
||||
MOV BX,BOOT_CODE_CDROM //$MA+A-X+PU,"See sys_boot_code","Grep(\"sys_boot_code\",\"/TempleOS/\"FILENAME_MASK_TXT);View;\n"$
|
||||
MOV BX,BOOT_CODE_CDROM //$MA+A-X+PU,"See sys_boot_code","Grep(\"sys_boot_code\",\"/TempleOS/*\");View;\n"$
|
||||
|
||||
//My assembler doesn't support 16-bit very well.
|
||||
DU8 0xEA; //JMP BOOT_RAM_BASE:0000
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
asm {
|
||||
#define MODULE_SIZE 1*BLK_SIZE
|
||||
#define BOOT_HIGH_LOC ((BOOT_RAM_LIMIT-(BOOT_STK_SIZE+MODULE_SIZE))>>4)
|
||||
#assert BOOT_HIGH_LOC>=KERNEL_BIN_LIMIT
|
||||
|
||||
asm {
|
||||
USE16
|
||||
BHD_CODE::
|
||||
|
||||
@@ -84,7 +83,7 @@ BHD_HISTART:
|
||||
@@10: POP CX
|
||||
LOOP @@05
|
||||
|
||||
MOV EBX,BOOT_CODE_HARDDRV //$MA+A-X+PU,"See sys_boot_code","Grep(\"sys_boot_code\",\"/TempleOS/\"FILENAME_MASK_TXT);View;\n"$
|
||||
MOV EBX,BOOT_CODE_HARDDRV //$MA+A-X+PU,"See sys_boot_code","Grep(\"sys_boot_code\",\"/TempleOS/*\");View;\n"$
|
||||
//My assembler doesn't support 16-bit very well.
|
||||
DU8 0xEA; //JMP BOOT_RAM_BASE:0000
|
||||
DU16 0,BOOT_RAM_BASE/16;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
asm {
|
||||
#define MODULE_SIZE 1*BLK_SIZE
|
||||
#define BOOT_HIGH_LOC ((BOOT_RAM_LIMIT-(BOOT_STK_SIZE+MODULE_SIZE))>>4)
|
||||
#assert BOOT_HIGH_LOC>=KERNEL_BIN_LIMIT
|
||||
|
||||
asm {
|
||||
USE16
|
||||
BMHD_START::
|
||||
BMHD_CODE::
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
asm {
|
||||
#define MODULE_SIZE 2*BLK_SIZE
|
||||
#define BOOT_HIGH_LOC ((BOOT_RAM_LIMIT-(BOOT_STK_SIZE+MODULE_SIZE))>>4)
|
||||
#assert BOOT_HIGH_LOC>=KERNEL_BIN_LIMIT
|
||||
|
||||
asm {
|
||||
USE16
|
||||
BMHD2_START::
|
||||
MOV U32 FS:[0],'B'+0x2000+('2'+0x2000)<<16
|
||||
@@ -48,7 +48,7 @@ BMHD2_RET::
|
||||
RET
|
||||
BMHD2_PUTS::
|
||||
@@1: LODSB
|
||||
OR AL,AL
|
||||
TEST AL,AL
|
||||
JZ BMHD2_RET
|
||||
CALL BMHD2_PUTCHAR
|
||||
JMP @@1
|
||||
@@ -81,9 +81,9 @@ BMHD2_HISTART:
|
||||
MOV EBX,U32 BMHD2_BLK_ARRAY-BMHD2_START[EAX*8]
|
||||
MOV EAX,U32 BMHD2_BLK_ARRAY+4-BMHD2_START[EAX*8]
|
||||
|
||||
OR EBX,EBX
|
||||
TEST EBX,EBX
|
||||
JNZ @@10
|
||||
OR EAX,EAX
|
||||
TEST EAX,EAX
|
||||
JZ @@5
|
||||
|
||||
@@10: MOV U32 [BMHD2_DAP_BLK_LO-BMHD2_START],EBX
|
||||
|
||||
@@ -19,14 +19,14 @@ class CCCDUserData //Create CD
|
||||
short_dir_blks,long_dir_blks;
|
||||
};
|
||||
|
||||
I64 CDFileCreate2(CFile *out_file,CDirEntry *tempm,
|
||||
I64 CDFileCreate2(CFile *out_file,CDirEntry *tempde,
|
||||
CISO1DirEntry *tempi,CISO1DirEntry *tempi2,
|
||||
I64 *_cur_blk,
|
||||
CDirEntry *parent,Bool write,
|
||||
U8 *stage2_filename,I64 *_stage2_blk)
|
||||
{
|
||||
CCCDUserData *tempc;
|
||||
CDirEntry *tempm1,*tempm2;
|
||||
CDirEntry *tempde1,*tempde2;
|
||||
CFile *in_file;
|
||||
U8 *buf=MAlloc(CD_BLK_SIZE),*ptr1,*ptr2;
|
||||
CISO1DirEntry *dir_blk_buf =CAlloc(CD_BLK_SIZE*128),
|
||||
@@ -40,7 +40,7 @@ I64 CDFileCreate2(CFile *out_file,CDirEntry *tempm,
|
||||
de->len=sizeof(CISO1DirEntry)-1;
|
||||
de->ext_attr_len=0;
|
||||
FillU16Palindrome(&de->vol_seq_num,1);
|
||||
Date2ISO1(&de->date,tempm->datetime);
|
||||
Date2ISO1(&de->date,tempde->datetime);
|
||||
de->flags=ISO1_ATTR_DIR;
|
||||
de->name_len=1;
|
||||
de->name=0;
|
||||
@@ -62,7 +62,7 @@ I64 CDFileCreate2(CFile *out_file,CDirEntry *tempm,
|
||||
de2->len=sizeof(CISO1DirEntry)-1;
|
||||
de2->ext_attr_len=0;
|
||||
FillU16Palindrome(&de2->vol_seq_num,1);
|
||||
Date2ISO1(&de2->date,tempm->datetime);
|
||||
Date2ISO1(&de2->date,tempde->datetime);
|
||||
de2->flags=ISO1_ATTR_DIR;
|
||||
de2->name_len=1;
|
||||
de2->name=0;
|
||||
@@ -81,48 +81,48 @@ I64 CDFileCreate2(CFile *out_file,CDirEntry *tempm,
|
||||
de2->len+=de2->name_len;
|
||||
de2(U8 *)+=de2->len;
|
||||
|
||||
tempm1=tempm->sub;
|
||||
while (tempm1) {
|
||||
tempm2=tempm1->next;
|
||||
if (!write) tempm1->user_data=CAlloc(sizeof(CCCDUserData));
|
||||
tempde1=tempde->sub;
|
||||
while (tempde1) {
|
||||
tempde2=tempde1->next;
|
||||
if (!write) tempde1->user_data=CAlloc(sizeof(CCCDUserData));
|
||||
de1=de;
|
||||
de12=de2;
|
||||
if (tempm1->attr & _ATTR_DIR) {
|
||||
n=CDFileCreate2(out_file,tempm1,de,de2,_cur_blk,tempm,write,stage2_filename,_stage2_blk);
|
||||
if (tempde1->attr & _ATTR_DIR) {
|
||||
n=CDFileCreate2(out_file,tempde1,de,de2,_cur_blk,tempde,write,stage2_filename,_stage2_blk);
|
||||
de(U8 *)+=sizeof(CISO1DirEntry)-1+n;
|
||||
de2(U8 *)+=sizeof(CISO1DirEntry)-1+n<<1;
|
||||
} else {
|
||||
tempc=tempm1->user_data;
|
||||
tempc=tempde1->user_data;
|
||||
de->len=sizeof(CISO1DirEntry)-1;
|
||||
de->ext_attr_len=0;
|
||||
FillU32Palindrome(&de->loc,*_cur_blk);
|
||||
tempc->loc=*_cur_blk;
|
||||
if (write) {
|
||||
if (stage2_filename && !StrCmp(tempm1->full_name,stage2_filename)) {
|
||||
if (stage2_filename && !StrCmp(tempde1->full_name,stage2_filename)) {
|
||||
"$$FG,RED$$!!! Boot Stage 2 !!!$$FG$$\n";
|
||||
if (_stage2_blk) *_stage2_blk=*_cur_blk;
|
||||
}
|
||||
"%X:%s\n",*_cur_blk,tempm1->full_name;
|
||||
"%X:%s\n",*_cur_blk,tempde1->full_name;
|
||||
}
|
||||
FillU32Palindrome(&de->size,tempm1->size);
|
||||
FillU32Palindrome(&de->size,tempde1->size);
|
||||
FillU16Palindrome(&de->vol_seq_num,1);
|
||||
Date2ISO1(&de->date,tempm1->datetime);
|
||||
Date2ISO1(&de->date,tempde1->datetime);
|
||||
de->flags=0;
|
||||
de->name_len=StrLen(tempm1->name);
|
||||
StrCpy(&de->name,tempm1->name);
|
||||
de->name_len=StrLen(tempde1->name);
|
||||
StrCpy(&de->name,tempde1->name);
|
||||
de->len=de->len+de->name_len;
|
||||
de(U8 *)+=de->len;
|
||||
|
||||
de2->len=sizeof(CISO1DirEntry)-1;
|
||||
de2->ext_attr_len=0;
|
||||
FillU32Palindrome(&de2->loc,*_cur_blk);
|
||||
FillU32Palindrome(&de2->size,tempm1->size);
|
||||
FillU32Palindrome(&de2->size,tempde1->size);
|
||||
FillU16Palindrome(&de2->vol_seq_num,1);
|
||||
Date2ISO1(&de2->date,tempm1->datetime);
|
||||
Date2ISO1(&de2->date,tempde1->datetime);
|
||||
de2->flags=0;
|
||||
de2->name_len=StrLen(tempm1->name)<<1;
|
||||
de2->name_len=StrLen(tempde1->name)<<1;
|
||||
ptr1=&de2->name;
|
||||
ptr2=&tempm1->name;
|
||||
ptr2=&tempde1->name;
|
||||
for (i=0;i<de2->name_len;i=i+2) {
|
||||
ptr1++;
|
||||
*ptr1++=*ptr2++;
|
||||
@@ -130,7 +130,7 @@ I64 CDFileCreate2(CFile *out_file,CDirEntry *tempm,
|
||||
de2->len+=de2->name_len;
|
||||
de2(U8 *)+=de2->len;
|
||||
|
||||
in_file=FOpen(tempm1->full_name,"r");
|
||||
in_file=FOpen(tempde1->full_name,"r");
|
||||
for (i=0;i<(FSize(in_file)+CD_BLK_SIZE-1)/CD_BLK_SIZE;i++) {
|
||||
n=4;
|
||||
if ((i+1)<<2>(FSize(in_file)+BLK_SIZE-1)>>BLK_SIZE_BITS) {
|
||||
@@ -163,20 +163,20 @@ I64 CDFileCreate2(CFile *out_file,CDirEntry *tempm,
|
||||
MemCpy(de2,buf,i);
|
||||
de2(U8 *)+=i;
|
||||
}
|
||||
tempm1=tempm2;
|
||||
tempde1=tempde2;
|
||||
}
|
||||
|
||||
tempc=tempm->user_data;
|
||||
tempc=tempde->user_data;
|
||||
|
||||
tempi->len=sizeof(CISO1DirEntry)-1;
|
||||
tempi->ext_attr_len=0;
|
||||
tempi->flags=ISO1_ATTR_DIR;
|
||||
if (!tempm->name[0]) {
|
||||
if (!tempde->name[0]) {
|
||||
tempi->name_len=1;
|
||||
tempi->name=1;
|
||||
} else {
|
||||
tempi->name_len=StrLen(tempm->name);
|
||||
StrCpy(&tempi->name,tempm->name);
|
||||
tempi->name_len=StrLen(tempde->name);
|
||||
StrCpy(&tempi->name,tempde->name);
|
||||
}
|
||||
tempi->len+=tempi->name_len;
|
||||
|
||||
@@ -189,9 +189,9 @@ I64 CDFileCreate2(CFile *out_file,CDirEntry *tempm,
|
||||
FillU32Palindrome(&dir_blk_buf->size,n*CD_BLK_SIZE);
|
||||
FillU32Palindrome(&dir_blk_buf->loc,*_cur_blk);
|
||||
FillU16Palindrome(&tempi->vol_seq_num,1);
|
||||
Date2ISO1(&tempi->date,tempm->datetime);
|
||||
Date2ISO1(&tempi->date,tempde->datetime);
|
||||
if (write)
|
||||
"%X:%s\n",*_cur_blk,tempm->full_name;
|
||||
"%X:%s\n",*_cur_blk,tempde->full_name;
|
||||
if (write)
|
||||
FWBlks(out_file,dir_blk_buf,*_cur_blk<<2,n<<2);
|
||||
*_cur_blk+=n;
|
||||
@@ -199,13 +199,13 @@ I64 CDFileCreate2(CFile *out_file,CDirEntry *tempm,
|
||||
tempi2->len=sizeof(CISO1DirEntry)-1;
|
||||
tempi2->ext_attr_len=0;
|
||||
tempi2->flags=ISO1_ATTR_DIR;
|
||||
if (!tempm->name[0]) {
|
||||
if (!tempde->name[0]) {
|
||||
tempi2->name_len=1;
|
||||
tempi->name=1;
|
||||
} else {
|
||||
tempi2->name_len=StrLen(tempm->name)<<1;
|
||||
tempi2->name_len=StrLen(tempde->name)<<1;
|
||||
ptr1=&tempi2->name;
|
||||
ptr2=&tempm->name;
|
||||
ptr2=&tempde->name;
|
||||
for (i=0;i<tempi2->name_len;i=i+2) {
|
||||
ptr1++;
|
||||
*ptr1++=*ptr2++;
|
||||
@@ -220,9 +220,9 @@ I64 CDFileCreate2(CFile *out_file,CDirEntry *tempm,
|
||||
FillU32Palindrome(&dir_blk_buf2->size,n*CD_BLK_SIZE);
|
||||
FillU32Palindrome(&dir_blk_buf2->loc,*_cur_blk);
|
||||
FillU16Palindrome(&tempi2->vol_seq_num,1);
|
||||
Date2ISO1(&tempi2->date,tempm->datetime);
|
||||
Date2ISO1(&tempi2->date,tempde->datetime);
|
||||
if (write)
|
||||
"%X:%s\n",*_cur_blk,tempm->full_name;
|
||||
"%X:%s\n",*_cur_blk,tempde->full_name;
|
||||
if (write)
|
||||
FWBlks(out_file,dir_blk_buf2,*_cur_blk<<2,n<<2);
|
||||
*_cur_blk+=n;
|
||||
@@ -233,39 +233,39 @@ I64 CDFileCreate2(CFile *out_file,CDirEntry *tempm,
|
||||
return tempi->name_len;
|
||||
}
|
||||
|
||||
I64 CDTableLen(CDirEntry *tempm,I64 *size1,I64 *size2,I64 cur_depth)
|
||||
I64 CDTableLen(CDirEntry *tempde,I64 *size1,I64 *size2,I64 cur_depth)
|
||||
//returns depth
|
||||
{
|
||||
CDirEntry *tempm1=tempm->sub;
|
||||
CDirEntry *tempde1=tempde->sub;
|
||||
I64 max_depth=cur_depth,i;
|
||||
while (tempm1) {
|
||||
if (tempm1->attr & _ATTR_DIR) {
|
||||
*size1+=sizeof(CISO1PathEntry)-2+ (StrLen(tempm1->name)+1)&-0x2;
|
||||
*size2+=sizeof(CISO1PathEntry)-2+StrLen(tempm1->name)<<1;
|
||||
i=CDTableLen(tempm1,size1,size2,cur_depth+1);
|
||||
while (tempde1) {
|
||||
if (tempde1->attr & _ATTR_DIR) {
|
||||
*size1+=sizeof(CISO1PathEntry)-2+ (StrLen(tempde1->name)+1)&-0x2;
|
||||
*size2+=sizeof(CISO1PathEntry)-2+StrLen(tempde1->name)<<1;
|
||||
i=CDTableLen(tempde1,size1,size2,cur_depth+1);
|
||||
if (i>max_depth) max_depth=i;
|
||||
}
|
||||
tempm1=tempm1->next;
|
||||
tempde1=tempde1->next;
|
||||
}
|
||||
return max_depth;
|
||||
}
|
||||
|
||||
U0 CDFillPathTable(CDirEntry *tempm,
|
||||
U0 CDFillPathTable(CDirEntry *tempde,
|
||||
CISO1PathEntry **_itabbuf,CISO1PathEntry **_itabbuf2,
|
||||
I64 parent_entry_num,Bool big_endian,I64 *first_free,I64 cur_level,I64 output_level)
|
||||
{
|
||||
U8 *ptr1,*ptr2;
|
||||
I64 i;
|
||||
CISO1PathEntry *tabbuf=*_itabbuf,*tabbuf2=*_itabbuf2;
|
||||
CDirEntry *tempm1=tempm->sub,*tempm2;
|
||||
CDirEntry *tempde1=tempde->sub,*tempde2;
|
||||
CCCDUserData *tempc;
|
||||
|
||||
if (cur_level==output_level) {
|
||||
while (tempm1) {
|
||||
if (tempm1->attr & _ATTR_DIR) {
|
||||
tempc=tempm1->user_data;
|
||||
while (tempde1) {
|
||||
if (tempde1->attr & _ATTR_DIR) {
|
||||
tempc=tempde1->user_data;
|
||||
tempc->path_entry_num=*first_free;
|
||||
tabbuf->name_len=StrLen(tempm1->name);
|
||||
tabbuf->name_len=StrLen(tempde1->name);
|
||||
if (big_endian) {
|
||||
tabbuf->blk=EndianU32(tempc->loc);
|
||||
tabbuf->parent_entry_num=EndianU16(parent_entry_num);
|
||||
@@ -273,11 +273,11 @@ U0 CDFillPathTable(CDirEntry *tempm,
|
||||
tabbuf->blk=tempc->loc;
|
||||
tabbuf->parent_entry_num=parent_entry_num;
|
||||
}
|
||||
StrCpy(&tabbuf->name,tempm1->name);
|
||||
StrCpy(&tabbuf->name,tempde1->name);
|
||||
|
||||
tabbuf(U8 *)+=sizeof(CISO1PathEntry)-2+(StrLen(tempm1->name)+1) & -0x2;
|
||||
tabbuf(U8 *)+=sizeof(CISO1PathEntry)-2+(StrLen(tempde1->name)+1) & -0x2;
|
||||
|
||||
tabbuf2->name_len=StrLen(tempm1->name)<<1;
|
||||
tabbuf2->name_len=StrLen(tempde1->name)<<1;
|
||||
if (big_endian) {
|
||||
tabbuf2->blk=EndianU32(tempc->loc+tempc->short_dir_blks);
|
||||
tabbuf2->parent_entry_num=EndianU16(parent_entry_num);
|
||||
@@ -286,29 +286,29 @@ U0 CDFillPathTable(CDirEntry *tempm,
|
||||
tabbuf2->parent_entry_num=parent_entry_num;
|
||||
}
|
||||
ptr1=&tabbuf2->name;
|
||||
ptr2=&tempm1->name;
|
||||
ptr2=&tempde1->name;
|
||||
for (i=0;i<tabbuf2->name_len;i=i+2) {
|
||||
ptr1++;
|
||||
*ptr1++=*ptr2++;
|
||||
}
|
||||
tabbuf2(U8 *)+=sizeof(CISO1PathEntry)-2+
|
||||
StrLen(tempm1->name)<<1;
|
||||
StrLen(tempde1->name)<<1;
|
||||
*first_free+=1;
|
||||
}
|
||||
tempm1=tempm1->next;
|
||||
tempde1=tempde1->next;
|
||||
}
|
||||
*_itabbuf=tabbuf;
|
||||
*_itabbuf2=tabbuf2;
|
||||
}
|
||||
tempm1=tempm->sub;
|
||||
while (tempm1) {
|
||||
tempm2=tempm1->next;
|
||||
if (tempm1->attr & _ATTR_DIR) {
|
||||
tempc=tempm1->user_data;
|
||||
CDFillPathTable(tempm1,_itabbuf,_itabbuf2,tempc->path_entry_num,
|
||||
tempde1=tempde->sub;
|
||||
while (tempde1) {
|
||||
tempde2=tempde1->next;
|
||||
if (tempde1->attr & _ATTR_DIR) {
|
||||
tempc=tempde1->user_data;
|
||||
CDFillPathTable(tempde1,_itabbuf,_itabbuf2,tempc->path_entry_num,
|
||||
big_endian,first_free,cur_level+1,output_level);
|
||||
}
|
||||
tempm1=tempm2;
|
||||
tempde1=tempde2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -351,8 +351,8 @@ public I64 CDFileCreate(U8 *_filename=NULL,U8 *src_files_find_mask,U8 *fu_flags=
|
||||
CISO1DirEntry *tempi;
|
||||
CCCDUserData *tempc;
|
||||
|
||||
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
|
||||
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
|
||||
if (!_filename)
|
||||
_filename=sys_dft_iso_name;
|
||||
@@ -365,7 +365,7 @@ public I64 CDFileCreate(U8 *_filename=NULL,U8 *src_files_find_mask,U8 *fu_flags=
|
||||
|
||||
rootdir->attr=_ATTR_DIR;
|
||||
rootdir->sub=FilesFind(src_files_find_mask,fuf_flags);
|
||||
rootdir->datetime=GetCurTimeDate;
|
||||
rootdir->datetime=GetDateTime;
|
||||
rootdir->user_data=CAlloc(sizeof(CCCDUserData));
|
||||
tempc=rootdir->user_data;
|
||||
tempc->path_entry_num=1;
|
||||
@@ -493,7 +493,7 @@ public I64 CDFileCreate(U8 *_filename=NULL,U8 *src_files_find_mask,U8 *fu_flags=
|
||||
FWBlks(out_file,tabbuf2,cur_blk<<2,tabsize2<<2);
|
||||
cur_blk+=tabsize2;
|
||||
|
||||
CDirLstDel2(rootdir);
|
||||
DirLstDel2(rootdir);
|
||||
FillU32Palindrome(&iso_pri->vol_space_size,cur_blk);
|
||||
FillU32Palindrome(&iso_sup->vol_space_size,cur_blk);
|
||||
FWBlks(out_file,iso_pri,16<<2,4);
|
||||
|
||||
@@ -28,7 +28,7 @@ USE64
|
||||
_HI_CALL::
|
||||
ENTER 0
|
||||
MOV RAX,U64 16[RBP]
|
||||
OR RAX,RAX
|
||||
TEST RAX,RAX
|
||||
JZ @@05
|
||||
CALL RAX
|
||||
@@05: LEAVE
|
||||
@@ -90,8 +90,8 @@ U0 InstallCDir(U8 src,U8 dst)
|
||||
{
|
||||
U8 buf_s[136],buf_d[136];
|
||||
if (src==dst) return;
|
||||
SPrintF(buf_s,"%c:/TempleOS",src);
|
||||
SPrintF(buf_d,"%c:/TempleOS",dst);
|
||||
SPrint(buf_s,"%c:/TempleOS",src);
|
||||
SPrint(buf_d,"%c:/TempleOS",dst);
|
||||
DelTree(buf_d);
|
||||
CopyTree(buf_s,buf_d);
|
||||
}
|
||||
@@ -170,7 +170,7 @@ public Bool MakeOSInstallPrtBootLoader(U8 src_drv=0,U8 dst_drv=0)
|
||||
//within a #exe {} statement.
|
||||
//See $LK,"InsBootDstDrv","FF:::/TempleOS/Kernel/KCfg.CPP,InsBootDstDrv"$
|
||||
//(There is no way to set compiler options.)
|
||||
NamedFramePtrAdd("InsBootDstDrv",dst_drv);
|
||||
FramePtrAdd("InsBootDstDrv",dst_drv);
|
||||
src_drv=ChkWritable(src_drv);
|
||||
if (!Drv(src_drv))
|
||||
throw;
|
||||
@@ -209,7 +209,7 @@ public Bool MakeOSInstallPrtBootLoader(U8 src_drv=0,U8 dst_drv=0)
|
||||
}
|
||||
} catch
|
||||
CatchAll;
|
||||
NamedFramePtrDel("InsBootDstDrv");
|
||||
FramePtrDel("InsBootDstDrv");
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -301,7 +301,7 @@ public Bool InstallMasterBootLoader(U8 drv_let,U8 *drv_lst=NULL)
|
||||
_q=BMHD2_BLK_ARRAY;
|
||||
MemSet(_q,0,sizeof(I64)*8);
|
||||
menu_ptr=BMHD2_BOOT_MSG;
|
||||
SPrintF(menu_ptr,"\n\r\n\rTempleOS Boot Loader\n\r\n\r");
|
||||
SPrint(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);
|
||||
@@ -323,7 +323,7 @@ public Bool InstallMasterBootLoader(U8 drv_let,U8 *drv_lst=NULL)
|
||||
if (p1 && bdev1==bdev) {
|
||||
*_q=p1->offset;
|
||||
"Drive %C:%16X\n",Prt2Drv(p1),*_q;
|
||||
SPrintF(buf,"%d. Drive %C\n\r",j++,Prt2Drv(p1));
|
||||
SPrint(buf,"%d. Drive %C\n\r",j++,Prt2Drv(p1));
|
||||
StrCat(menu_ptr,buf);
|
||||
_q++;
|
||||
}
|
||||
|
||||
@@ -23,15 +23,15 @@ U0 CtrlsUpdate(CTask *task)
|
||||
if (c->update_derived_vals)
|
||||
(*c->update_derived_vals)(c);
|
||||
if (c->flags&CTRLF_BORDER) {
|
||||
c->screen_left =task->win_pixel_left+c->left-FONT_WIDTH;
|
||||
c->screen_right =task->win_pixel_left+c->right-FONT_WIDTH;
|
||||
c->screen_top =task->win_pixel_top+c->top-FONT_HEIGHT;
|
||||
c->screen_bottom=task->win_pixel_top+c->bottom-FONT_HEIGHT;
|
||||
c->screen_left =gr_pan_text_x+task->win_pixel_left+c->left-FONT_WIDTH;
|
||||
c->screen_right =gr_pan_text_x+task->win_pixel_left+c->right-FONT_WIDTH;
|
||||
c->screen_top =gr_pan_text_y+task->win_pixel_top+c->top-FONT_HEIGHT;
|
||||
c->screen_bottom=gr_pan_text_y+task->win_pixel_top+c->bottom-FONT_HEIGHT;
|
||||
} else {
|
||||
c->screen_left =task->win_pixel_left+c->left;
|
||||
c->screen_right =task->win_pixel_left+c->right;
|
||||
c->screen_top =task->win_pixel_top+c->top;
|
||||
c->screen_bottom=task->win_pixel_top+c->bottom;
|
||||
c->screen_left =gr_pan_text_x+task->win_pixel_left+c->left;
|
||||
c->screen_right =gr_pan_text_x+task->win_pixel_left+c->right;
|
||||
c->screen_top =gr_pan_text_y+task->win_pixel_top+c->top;
|
||||
c->screen_bottom=gr_pan_text_y+task->win_pixel_top+c->bottom;
|
||||
}
|
||||
c=c->next;
|
||||
}
|
||||
@@ -147,15 +147,15 @@ U0 WinDerivedScrollValsUpdate(CCtrl *c)
|
||||
if (!range) range=1;
|
||||
switch (c->type) {
|
||||
case CTRLT_WIN_HSCROLL:
|
||||
c->left=FONT_WIDTH-WIN_SCROLL_BORDER_BONUS+(s->pos-s->min)*(c->win_task->win_pixel_width+2*WIN_SCROLL_BORDER_BONUS-WIN_SCROLL_SIZE)/range;
|
||||
c->right=c->left+WIN_SCROLL_SIZE-1;
|
||||
c->top=FONT_HEIGHT+(FONT_WIDTH-WIN_SCROLL_SIZE)/2+c->win_task->win_pixel_height;
|
||||
c->left =gr_pan_text_x+FONT_WIDTH-WIN_SCROLL_BORDER_BONUS+(s->pos-s->min)*(c->win_task->win_pixel_width+2*WIN_SCROLL_BORDER_BONUS-WIN_SCROLL_SIZE)/range;
|
||||
c->right =c->left+WIN_SCROLL_SIZE-1;
|
||||
c->top =gr_pan_text_y+FONT_HEIGHT+(FONT_WIDTH-WIN_SCROLL_SIZE)/2+c->win_task->win_pixel_height;
|
||||
c->bottom=c->top+WIN_SCROLL_SIZE-1;
|
||||
break;
|
||||
case CTRLT_WIN_VSCROLL:
|
||||
c->left=FONT_WIDTH+(FONT_WIDTH-WIN_SCROLL_SIZE)/2+c->win_task->win_pixel_width;
|
||||
c->right=c->left+WIN_SCROLL_SIZE-1;
|
||||
c->top=FONT_HEIGHT-WIN_SCROLL_BORDER_BONUS+(s->pos-s->min)*(c->win_task->win_pixel_height+2*WIN_SCROLL_BORDER_BONUS-WIN_SCROLL_SIZE)/range;
|
||||
c->left =gr_pan_text_x+FONT_WIDTH+(FONT_WIDTH-WIN_SCROLL_SIZE)/2+c->win_task->win_pixel_width;
|
||||
c->right =c->left+WIN_SCROLL_SIZE-1;
|
||||
c->top =gr_pan_text_y+FONT_HEIGHT-WIN_SCROLL_BORDER_BONUS+(s->pos-s->min)*(c->win_task->win_pixel_height+2*WIN_SCROLL_BORDER_BONUS-WIN_SCROLL_SIZE)/range;
|
||||
c->bottom=c->top+WIN_SCROLL_SIZE-1;
|
||||
break;
|
||||
}
|
||||
@@ -265,9 +265,9 @@ U0 DrawViewAnglesCtrl(CDC *dc,CCtrl *c)
|
||||
}
|
||||
|
||||
dc->color=s->cx;
|
||||
GrPrintF(dc,c->left+VIEWANGLES_SPACING-FONT_WIDTH/2,
|
||||
GrPrint(dc,c->left+VIEWANGLES_SPACING-FONT_WIDTH/2,
|
||||
c->top+VIEWANGLES_SPACING-(1+FONT_HEIGHT),"X");
|
||||
GrPrintF(dc,c->left+VIEWANGLES_SPACING-3*FONT_WIDTH/2,
|
||||
GrPrint(dc,c->left+VIEWANGLES_SPACING-3*FONT_WIDTH/2,
|
||||
c->top+VIEWANGLES_SPACING+VIEWANGLES_RANGE+3,
|
||||
"%3d",s->sx*360/VIEWANGLES_RANGE);
|
||||
i=c->left+VIEWANGLES_SPACING;
|
||||
@@ -282,9 +282,9 @@ U0 DrawViewAnglesCtrl(CDC *dc,CCtrl *c)
|
||||
|
||||
|
||||
dc->color=s->cy;
|
||||
GrPrintF(dc,c->left+2*VIEWANGLES_SPACING+1-FONT_WIDTH/2,
|
||||
GrPrint(dc,c->left+2*VIEWANGLES_SPACING+1-FONT_WIDTH/2,
|
||||
c->top+VIEWANGLES_SPACING-(1+FONT_HEIGHT),"Y");
|
||||
GrPrintF(dc,c->left+2*VIEWANGLES_SPACING+1-3*FONT_WIDTH/2,
|
||||
GrPrint(dc,c->left+2*VIEWANGLES_SPACING+1-3*FONT_WIDTH/2,
|
||||
c->top+VIEWANGLES_SPACING+VIEWANGLES_RANGE+3,
|
||||
"%3d",s->sy*360/VIEWANGLES_RANGE);
|
||||
i=c->left+2*VIEWANGLES_SPACING+1;
|
||||
@@ -299,9 +299,9 @@ U0 DrawViewAnglesCtrl(CDC *dc,CCtrl *c)
|
||||
|
||||
|
||||
dc->color=s->cz;
|
||||
GrPrintF(dc,c->left+3*VIEWANGLES_SPACING+2-FONT_WIDTH/2,
|
||||
GrPrint(dc,c->left+3*VIEWANGLES_SPACING+2-FONT_WIDTH/2,
|
||||
c->top+VIEWANGLES_SPACING-(1+FONT_HEIGHT),"Z");
|
||||
GrPrintF(dc,c->left+3*VIEWANGLES_SPACING+2-3*FONT_WIDTH/2,
|
||||
GrPrint(dc,c->left+3*VIEWANGLES_SPACING+2-3*FONT_WIDTH/2,
|
||||
c->top+VIEWANGLES_SPACING+VIEWANGLES_RANGE+3,
|
||||
"%3d",s->sz*360/VIEWANGLES_RANGE);
|
||||
i=c->left+3*VIEWANGLES_SPACING+2;
|
||||
|
||||
@@ -17,15 +17,15 @@ U0 DrawCtrlButton(CDC *dc,CCtrl *c)
|
||||
|
||||
dc->color=BLACK;
|
||||
GrRect(dc,c->left,c->top,c->right-c->left+1,c->bottom-c->top+1);
|
||||
if (!(st=LstEntryPt(s->state,s->state_texts)))
|
||||
if (!(st=LstSub(s->state,s->state_texts)))
|
||||
st=s->state_texts;
|
||||
dc->color=s->state_colors[s->state];
|
||||
l=StrLen(st);
|
||||
GrRect(dc,c->left+BUTTON_BORDER,c->top+BUTTON_BORDER,
|
||||
c->right-c->left+1-BUTTON_BORDER*2,c->bottom-c->top+1-BUTTON_BORDER*2);
|
||||
dc->color=s->state_colors[s->state]^(WHITE<<16+WHITE);
|
||||
GrPutS(dc,(c->left+c->right+1-l*FONT_WIDTH)>>1,
|
||||
(c->top+c->bottom+1-FONT_HEIGHT)>>1,st);
|
||||
GrPrint(dc,(c->left+c->right+1-l*FONT_WIDTH)>>1,
|
||||
(c->top+c->bottom+1-FONT_HEIGHT)>>1,"%s",st);
|
||||
}
|
||||
|
||||
U0 LeftClickCtrlButton(CCtrl *c,I64,I64,Bool down)
|
||||
@@ -49,7 +49,7 @@ public CCtrl *CtrlButtonNew(I64 x,I64 y,I64 width=-1,I64 height=-1,
|
||||
if (width<0) {
|
||||
l=1;
|
||||
for (i=0;i<num_states;i++)
|
||||
if (st=LstEntryPt(i,state_texts)) {
|
||||
if (st=LstSub(i,state_texts)) {
|
||||
j=StrLen(st);
|
||||
if (j>l) l=j;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ CMgdSC *PmtSliderCtrl()
|
||||
|
||||
result->next_slider=result->last_slider=&result->next_slider;
|
||||
while (TRUE) {
|
||||
SPrintF(pmt,"Slider #%d Name:",result->num_sliders+1);
|
||||
SPrint(pmt,"Slider #%d Name:",result->num_sliders+1);
|
||||
st=PmtStr(pmt);
|
||||
if (!*st) {
|
||||
Free(st);
|
||||
@@ -57,7 +57,7 @@ U0 MgdSliderCtrl(CDoc *doc)
|
||||
while (!m)
|
||||
Yield;
|
||||
|
||||
DocPrintF(doc,
|
||||
DocPrint(doc,
|
||||
"#define SLIDER_RANGE %d
|
||||
#define SLIDER_SPACING %d
|
||||
#define SLIDER_BORDER %d
|
||||
@@ -69,16 +69,16 @@ class CSliderState
|
||||
|
||||
temps=m->next_slider;
|
||||
while (temps!=&m->next_slider) {
|
||||
DocPrintF(doc," I64 %s;\n",temps->name);
|
||||
DocPrint(doc," I64 %s;\n",temps->name);
|
||||
temps=temps->next;
|
||||
}
|
||||
if (*m->glbl_name)
|
||||
DocPrintF(doc,"} %s;\n",m->glbl_name);
|
||||
DocPrint(doc,"} %s;\n",m->glbl_name);
|
||||
else
|
||||
DocPutS(doc,"};\n");
|
||||
DocPrint(doc,"};\n");
|
||||
|
||||
|
||||
DocPrintF(doc,
|
||||
DocPrint(doc,
|
||||
"
|
||||
U0 DrawSliderCtrl(CDC *dc,CCtrl *c)
|
||||
{
|
||||
@@ -93,17 +93,17 @@ U0 DrawSliderCtrl(CDC *dc,CCtrl *c)
|
||||
",m->num_sliders+1,m->num_sliders,m->num_sliders+1,m->num_sliders);
|
||||
|
||||
for (i=0;i<m->num_sliders;i++)
|
||||
DocPrintF(doc,
|
||||
DocPrint(doc,
|
||||
" GrLine(dc,c->left+%d*SLIDER_SPACING+%d,c->top+SLIDER_SPACING,
|
||||
c->left+%d*SLIDER_SPACING+%d,c->top+SLIDER_SPACING+SLIDER_RANGE-1);
|
||||
",i+1,i,i+1,i);
|
||||
|
||||
DocPutS(doc," dc->color=LTRED;\n");
|
||||
DocPrint(doc," dc->color=LTRED;\n");
|
||||
|
||||
temps=m->next_slider;
|
||||
while (temps!=&m->next_slider) {
|
||||
DocPrintF(doc,
|
||||
" GrPrintF(dc,c->left+%d*SLIDER_SPACING+%d-FONT_WIDTH/2,
|
||||
DocPrint(doc,
|
||||
" GrPrint(dc,c->left+%d*SLIDER_SPACING+%d-FONT_WIDTH/2,
|
||||
c->top+SLIDER_SPACING+SLIDER_RANGE+3,
|
||||
\"%%d\",s->%s*10/SLIDER_RANGE);\n",
|
||||
temps->num+1,temps->num,temps->name);
|
||||
@@ -112,19 +112,19 @@ U0 DrawSliderCtrl(CDC *dc,CCtrl *c)
|
||||
|
||||
temps=m->next_slider;
|
||||
while (temps!=&m->next_slider) {
|
||||
DocPrintF(doc," GrRect(dc,c->left+%d*SLIDER_SPACING+%d-3,c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->%s-2,7,5);\n",
|
||||
DocPrint(doc," GrRect(dc,c->left+%d*SLIDER_SPACING+%d-3,c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->%s-2,7,5);\n",
|
||||
temps->num+1,temps->num,temps->name);
|
||||
temps=temps->next;
|
||||
}
|
||||
DocPutS(doc," dc->color=YELLOW;\n");
|
||||
DocPrint(doc," dc->color=YELLOW;\n");
|
||||
|
||||
temps=m->next_slider;
|
||||
while (temps!=&m->next_slider) {
|
||||
DocPrintF(doc," GrRect(dc,c->left+%d*SLIDER_SPACING+%d-2,c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->%s-1,5,3);\n",
|
||||
DocPrint(doc," GrRect(dc,c->left+%d*SLIDER_SPACING+%d-2,c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->%s-1,5,3);\n",
|
||||
temps->num+1,temps->num,temps->name);
|
||||
temps=temps->next;
|
||||
}
|
||||
DocPrintF(doc,
|
||||
DocPrint(doc,
|
||||
"}
|
||||
|
||||
U0 UpdateDerivedSliderCtrl(CCtrl *c)
|
||||
@@ -138,10 +138,10 @@ U0 UpdateDerivedSliderCtrl(CCtrl *c)
|
||||
|
||||
temps=m->next_slider;
|
||||
while (temps!=&m->next_slider) {
|
||||
DocPrintF(doc," s->%s=LimitI64(s->%s,0,SLIDER_RANGE-1);\n",temps->name,temps->name);
|
||||
DocPrint(doc," s->%s=LimitI64(s->%s,0,SLIDER_RANGE-1);\n",temps->name,temps->name);
|
||||
temps=temps->next;
|
||||
}
|
||||
DocPutS(doc,
|
||||
DocPrint(doc,
|
||||
"}
|
||||
|
||||
U0 LeftClickSlider(CCtrl *c,I64 x,I64 y,Bool down)
|
||||
@@ -152,20 +152,20 @@ U0 LeftClickSlider(CCtrl *c,I64 x,I64 y,Bool down)
|
||||
|
||||
temps=m->next_slider;
|
||||
while (temps!=&m->next_slider) {
|
||||
DocPutS(doc," ");
|
||||
DocPrint(doc," ");
|
||||
if (temps!=m->next_slider)
|
||||
DocPutS(doc,"else ");
|
||||
DocPrint(doc,"else ");
|
||||
if (temps->next==&m->next_slider)
|
||||
DocPutS(doc,"\n");
|
||||
DocPrint(doc,"\n");
|
||||
else
|
||||
DocPrintF(doc,"if (x<c->left+%d*SLIDER_SPACING+%d+SLIDER_SPACING/2)\n",
|
||||
DocPrint(doc,"if (x<c->left+%d*SLIDER_SPACING+%d+SLIDER_SPACING/2)\n",
|
||||
temps->num+1,temps->num);
|
||||
DocPrintF(doc," s->%s=SLIDER_RANGE-1-(y-(c->top+SLIDER_SPACING));\n",
|
||||
DocPrint(doc," s->%s=SLIDER_RANGE-1-(y-(c->top+SLIDER_SPACING));\n",
|
||||
temps->name);
|
||||
temps=temps->next;
|
||||
}
|
||||
|
||||
DocPutS(doc,
|
||||
DocPrint(doc,
|
||||
" if (c->update_derived_vals)
|
||||
(*c->update_derived_vals)(c);
|
||||
}
|
||||
@@ -179,11 +179,11 @@ CCtrl *SliderNew()
|
||||
c->type=CTRLT_GENERIC;
|
||||
");
|
||||
if (*m->glbl_name)
|
||||
DocPrintF(doc," c->state=&%s;\n"
|
||||
DocPrint(doc," c->state=&%s;\n"
|
||||
" MemSet(&%s,0,sizeof(CSliderState));\n",m->glbl_name,m->glbl_name);
|
||||
else
|
||||
DocPutS(doc, " c->state=CAlloc(sizeof(CSliderState));\n");
|
||||
DocPutS(doc,
|
||||
DocPrint(doc, " c->state=CAlloc(sizeof(CSliderState));\n");
|
||||
DocPrint(doc,
|
||||
" c->draw_it=&DrawSliderCtrl;
|
||||
c->left_click=&LeftClickSlider;
|
||||
c->update_derived_vals=&UpdateDerivedSliderCtrl;
|
||||
@@ -201,8 +201,8 @@ U0 SliderDel(CCtrl *c)
|
||||
Preempt(old_preempt);
|
||||
");
|
||||
if (!*m->glbl_name)
|
||||
DocPutS(doc," Free(c->state);\n");
|
||||
DocPutS(doc,
|
||||
DocPrint(doc," Free(c->state);\n");
|
||||
DocPrint(doc,
|
||||
" Free(c);
|
||||
}
|
||||
");
|
||||
|
||||
+45
-45
@@ -1,5 +1,5 @@
|
||||
#help_index "Debugging/Dump"
|
||||
Bool ClassRep2(CDoc *doc,U8 *class_name,U8 *_b,I64 depth,I64 max_depth,Bool dynamic,I64 types=HTT_CLASS,I64 offset=0)
|
||||
Bool ClassRep2(CDoc *doc,U8 *_d,U8 *class_name=lastclass,I64 depth,I64 max_depth,Bool dynamic,I64 types=HTT_CLASS,I64 offset=0)
|
||||
{
|
||||
I64 i,j,*ptr;
|
||||
CMemberLst *ml;
|
||||
@@ -8,53 +8,53 @@ Bool ClassRep2(CDoc *doc,U8 *class_name,U8 *_b,I64 depth,I64 max_depth,Bool dyna
|
||||
CHashClass *tempc,*tempc2;
|
||||
if (depth>=max_depth) return TRUE;
|
||||
if (!(tempc=HashFind(class_name,Fs->hash_table,types))) {
|
||||
DocPutS(doc,"Class Not Found.\n");
|
||||
DocPrint(doc,"Class Not Found.\n");
|
||||
return FALSE;
|
||||
}
|
||||
if (!ChkPtr(_b) || !ChkPtr(_b(U8 *)+tempc->size)) {
|
||||
DocPrintF(doc,"Bad Ptr:%016X\n",_b);
|
||||
if (!ChkPtr(_d) || !ChkPtr(_d(U8 *)+tempc->size)) {
|
||||
DocPrint(doc,"Bad Ptr:%016X\n",_d);
|
||||
return FALSE;
|
||||
}
|
||||
if (tempc->base_class && !ClassRep2(doc,tempc->base_class->str,_b,depth,max_depth,dynamic,types,offset))
|
||||
if (tempc->base_class && !ClassRep2(doc,_d,tempc->base_class->str,depth,max_depth,dynamic,types,offset))
|
||||
return FALSE;
|
||||
unlock=DocLock(doc);
|
||||
DocPrintF(doc,"Class:\"%s\"\n",class_name);
|
||||
DocPrint(doc,"Class:\"%s\"\n",class_name);
|
||||
ml=tempc->member_lst;
|
||||
while (ml) {
|
||||
tempc2=ml->member_class;
|
||||
ptr=_b(U8 *)+ml->offset;
|
||||
DocPrintF(doc,"%08X ",ptr(U8 *)+offset);
|
||||
ptr=_d(U8 *)+ml->offset;
|
||||
DocPrint(doc,"%08X ",ptr(U8 *)+offset);
|
||||
j=tempc2->ptr_cnt;
|
||||
tempc2=OptClassFwd(tempc2);
|
||||
tempc2-=tempc2->ptr_cnt;
|
||||
if (tempc2->type & HTT_INTERNAL_TYPE) {
|
||||
DocPrintF(doc,"$$FG,GREEN$$%-20ts:$$FG$$",ml->str);
|
||||
DocPrint(doc,"$$FG,GREEN$$%-20ts:$$FG$$",ml->str);
|
||||
if (j==1 && (tempc2->sub_type==IT_I8 || tempc2->sub_type==IT_U8)) {
|
||||
ptr=*ptr;
|
||||
if (ChkPtr(ptr)) {
|
||||
if (dynamic) {
|
||||
doc_e=DocPutS(doc,"$$DA-T-P+RD,64,\"%40ts\"$$\n");
|
||||
doc_e=DocPrint(doc,"$$DA-T-P+RD,64,\"%%40ts\"$$\n");
|
||||
doc_e->data=ptr;
|
||||
DocDataFmt(doc_e);
|
||||
} else
|
||||
DocPrintF(doc,"%40ts\n",ptr);
|
||||
DocPrint(doc,"%40ts\n",ptr);
|
||||
}
|
||||
} else if (!j) {
|
||||
j=MinI64(ml->dim.total_cnt,32);
|
||||
if (tempc2->sub_type==IT_I8 || tempc2->sub_type==IT_U8) {
|
||||
if (j==1) {
|
||||
if (dynamic) {
|
||||
doc_e=DocPutS(doc,"$$DA-T+RD+UD-I64+U8,32,\"%c\"$$\n");
|
||||
doc_e=DocPrint(doc,"$$DA-T+RD+UD-I64+U8,32,\"%%c\"$$\n");
|
||||
doc_e->data=ptr;
|
||||
} else
|
||||
DocPrintF(doc,"%c\n",*ptr(U8 *));
|
||||
DocPrint(doc,"%c\n",*ptr(U8 *));
|
||||
} else {
|
||||
if (dynamic) {
|
||||
doc_e=DocPutS(doc,"$$DA-T-P+RD,64,\"%40ts\"$$\n");
|
||||
doc_e=DocPrint(doc,"$$DA-T-P+RD,64,\"%%40ts\"$$\n");
|
||||
doc_e->data=ptr;
|
||||
DocDataFmt(doc_e);
|
||||
} else
|
||||
DocPrintF(doc,"%40ts\n",ptr);
|
||||
DocPrint(doc,"%40ts\n",ptr);
|
||||
}
|
||||
}
|
||||
for (i=0;i<j;i++) {
|
||||
@@ -65,64 +65,64 @@ Bool ClassRep2(CDoc *doc,U8 *class_name,U8 *_b,I64 depth,I64 max_depth,Bool dyna
|
||||
case IT_I8:
|
||||
case IT_U8:
|
||||
if (dynamic) {
|
||||
doc_e=DocPutS(doc,"$$DA-T+RD+UD-I64+U8,32,\"%02X\"$$ ");
|
||||
doc_e=DocPrint(doc,"$$DA-T+RD+UD-I64+U8,32,\"%%02X\"$$ ");
|
||||
doc_e->data=ptr(U8 *)++;
|
||||
} else
|
||||
DocPrintF(doc,"%02X ",*ptr(U8 *)++);
|
||||
DocPrint(doc,"%02X ",*ptr(U8 *)++);
|
||||
break;
|
||||
case IT_I16:
|
||||
case IT_U16:
|
||||
if (dynamic) {
|
||||
doc_e=DocPutS(doc,"$$DA-T+RD+UD-I64+U16,32,\"%04X\"$$ ");
|
||||
doc_e=DocPrint(doc,"$$DA-T+RD+UD-I64+U16,32,\"%%04X\"$$ ");
|
||||
doc_e->data=ptr(U16 *)++;
|
||||
} else
|
||||
DocPrintF(doc,"%04X ",*ptr(U16 *)++);
|
||||
DocPrint(doc,"%04X ",*ptr(U16 *)++);
|
||||
break;
|
||||
case IT_I32:
|
||||
case IT_U32:
|
||||
if (dynamic) {
|
||||
doc_e=DocPutS(doc,"$$DA-T+RD+UD-I64+U32,32,\"%08X\"$$ ");
|
||||
doc_e=DocPrint(doc,"$$DA-T+RD+UD-I64+U32,32,\"%%08X\"$$ ");
|
||||
doc_e->data=ptr(U32 *)++;
|
||||
} else
|
||||
DocPrintF(doc,"%08X ",*ptr(U32 *)++);
|
||||
DocPrint(doc,"%08X ",*ptr(U32 *)++);
|
||||
break;
|
||||
case IT_F64:
|
||||
if (dynamic) {
|
||||
doc_e=DocPutS(doc,"$$DA-T+RD+UD,32,\"%16g\"$$ ");
|
||||
doc_e=DocPrint(doc,"$$DA-T+RD+UD,32,\"%%16g\"$$ ");
|
||||
doc_e->data=ptr(I64 *)++;
|
||||
} else
|
||||
DocPrintF(doc,"%16g ",*ptr(I64 *)++);
|
||||
DocPrint(doc,"%16g ",*ptr(I64 *)++);
|
||||
break;
|
||||
default:
|
||||
if (dynamic) {
|
||||
doc_e=DocPutS(doc,"$$DA-T+RD+UD,32,\"%016X\"$$ ");
|
||||
doc_e=DocPrint(doc,"$$DA-T+RD+UD,32,\"%%016X\"$$ ");
|
||||
doc_e->data=ptr(I64 *)++;
|
||||
} else
|
||||
DocPrintF(doc,"%016X ",*ptr(I64 *)++);
|
||||
DocPrint(doc,"%016X ",*ptr(I64 *)++);
|
||||
}
|
||||
if (dynamic)
|
||||
DocDataFmt(doc_e);
|
||||
}
|
||||
if (j<ml->dim.total_cnt)
|
||||
DocPutS(doc,"...");
|
||||
DocPrint(doc,"...");
|
||||
} else
|
||||
DocPrintF(doc,"%016X",*ptr);
|
||||
DocPutS(doc,"\n");
|
||||
DocPrint(doc,"%016X",*ptr);
|
||||
DocPrint(doc,"\n");
|
||||
} else {
|
||||
if (depth<2) {
|
||||
if (j==1 && !ChkPtr(*ptr))
|
||||
DocPrintF(doc,"%-20ts:%016X\n",ml->str,*ptr);
|
||||
DocPrint(doc,"%-20ts:%016X\n",ml->str,*ptr);
|
||||
else {
|
||||
DocPrintF(doc,"$$TR,\"%s\"$$\n",ml->str);
|
||||
DocPutS(doc,"$$ID,2$$");
|
||||
DocPrint(doc,"$$TR,\"%s\"$$\n",ml->str);
|
||||
DocPrint(doc,"$$ID,2$$");
|
||||
if (!j)
|
||||
ClassRep2(doc,tempc2->str,ptr,depth+1,max_depth,dynamic);
|
||||
ClassRep2(doc,ptr,tempc2->str,depth+1,max_depth,dynamic);
|
||||
else if (j==1)
|
||||
ClassRep2(doc,tempc2->str,*ptr,depth+1,max_depth,dynamic);
|
||||
DocPutS(doc,"$$ID,-2$$");
|
||||
ClassRep2(doc,*ptr,tempc2->str,depth+1,max_depth,dynamic);
|
||||
DocPrint(doc,"$$ID,-2$$");
|
||||
}
|
||||
} else
|
||||
DocPrintF(doc,"%-20ts\n",ml->str);
|
||||
DocPrint(doc,"%-20ts\n",ml->str);
|
||||
}
|
||||
ml=ml->next;
|
||||
}
|
||||
@@ -131,7 +131,7 @@ Bool ClassRep2(CDoc *doc,U8 *class_name,U8 *_b,I64 depth,I64 max_depth,Bool dyna
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public U0 ClassRep(U8 *class_name,U8 *_b,I64 max_depth=2,Bool fun=FALSE,I64 offset=0)
|
||||
public U0 ClassRep(U8 *_d,U8 *class_name=lastclass,I64 max_depth=2,Bool fun=FALSE,I64 offset=0)
|
||||
//Displays members of a record
|
||||
//by using the compiler's info.
|
||||
{
|
||||
@@ -145,10 +145,10 @@ public U0 ClassRep(U8 *class_name,U8 *_b,I64 max_depth=2,Bool fun=FALSE,I64 offs
|
||||
doc=DocPut;
|
||||
}
|
||||
if (fun)
|
||||
ClassRep2(doc,class_name,_b,0,max_depth,FALSE,HTT_FUN,offset);
|
||||
ClassRep2(doc,_d,class_name,0,max_depth,FALSE,HTT_FUN,offset);
|
||||
else
|
||||
ClassRep2(doc,class_name,_b,0,max_depth,FALSE,HTT_CLASS,offset);
|
||||
DocPutS(doc,"\n");
|
||||
ClassRep2(doc,_d,class_name,0,max_depth,FALSE,HTT_CLASS,offset);
|
||||
DocPrint(doc,"\n");
|
||||
DocRecalc(doc);
|
||||
if (IsRaw) {
|
||||
DocDump(doc,100000);
|
||||
@@ -157,7 +157,7 @@ public U0 ClassRep(U8 *class_name,U8 *_b,I64 max_depth=2,Bool fun=FALSE,I64 offs
|
||||
Preempt(old_preempt);
|
||||
}
|
||||
|
||||
public U0 ClassRepD(U8 *class_name,U8 *_b,I64 max_depth=2,Bool fun=FALSE,I64 offset=0)
|
||||
public U0 ClassRepD(U8 *_d,U8 *class_name=lastclass,I64 max_depth=2,Bool fun=FALSE,I64 offset=0)
|
||||
//Dynamic classrep (uses hex_ed widgit for live changes)
|
||||
{
|
||||
CDoc *doc;
|
||||
@@ -170,10 +170,10 @@ public U0 ClassRepD(U8 *class_name,U8 *_b,I64 max_depth=2,Bool fun=FALSE,I64 off
|
||||
doc=DocPut;
|
||||
}
|
||||
if (fun)
|
||||
ClassRep2(doc,class_name,_b,0,max_depth,TRUE,HTT_FUN,offset);
|
||||
ClassRep2(doc,_d,class_name,0,max_depth,TRUE,HTT_FUN,offset);
|
||||
else
|
||||
ClassRep2(doc,class_name,_b,0,max_depth,TRUE,HTT_CLASS,offset);
|
||||
DocPutS(doc,"\n");
|
||||
ClassRep2(doc,_d,class_name,0,max_depth,TRUE,HTT_CLASS,offset);
|
||||
DocPrint(doc,"\n");
|
||||
DocRecalc(doc);
|
||||
if (IsRaw) {
|
||||
DocDump(doc,100000);
|
||||
@@ -215,10 +215,10 @@ public U0 FunRep(U8 *st,U8 *rbp=NULL,I64 max_depth=2,CTask *task=NULL)
|
||||
img=MAlloc(size);
|
||||
MemCpy(img,rbp+tempf->size,size);
|
||||
UpdateRegVarImg(tempf,img-tempf->size,task);
|
||||
ClassRep(st,img-tempf->size,max_depth,TRUE,rbp-img+tempf->size);
|
||||
ClassRep(img-tempf->size,st,max_depth,TRUE,rbp-img+tempf->size);
|
||||
Free(img);
|
||||
} else
|
||||
ClassRep(st,rbp,max_depth,TRUE);
|
||||
ClassRep(rbp,st,max_depth,TRUE);
|
||||
} else {
|
||||
tempm=tempf->member_lst;
|
||||
while (tempm) {
|
||||
|
||||
@@ -13,7 +13,7 @@ U0 DocInit()
|
||||
DefineLstLoad("ST_DOC_CMDS",
|
||||
"TX\0CR\0SR\0CU\0TB\0CL\0PB\0DA\0PL\0LM\0RM\0HD\0FO\0ID\0"
|
||||
"FG\0BG\0FD\0BD\0PT\0WW\0UL\0IV\0BK\0SX\0SY\0CM\0AN\0LK\0BT\0"
|
||||
"CB\0MA\0MU\0HX\0HS\0HE\0TR\0SP\0IB\0IT\0IS\0BP\0SO\0HL\0LP\0CC\0HI\0HV\0HC\0ER\0");
|
||||
"CB\0MA\0MU\0HX\0TR\0SP\0IB\0IT\0IS\0BP\0SO\0HL\0LP\0CC\0HI\0HV\0HC\0ER\0");
|
||||
DefineLstLoad("ST_DOC_FLAGS",
|
||||
//flags1
|
||||
"A\0L\0"
|
||||
@@ -31,8 +31,6 @@ U0 DocInit()
|
||||
|
||||
DocInit;
|
||||
|
||||
|
||||
|
||||
//--TEMPLEOS LINK TYPES--
|
||||
// "filename"
|
||||
// "FI:filename"
|
||||
|
||||
@@ -18,22 +18,15 @@ DefineLstLoad("ST_BIBLE_BOOKS",
|
||||
"2 Chronicles\0"
|
||||
"Ezra\0"
|
||||
"Nehemiah\0"
|
||||
"Tobit\0"
|
||||
"Judith\0"
|
||||
"Esther\0"
|
||||
"1 Maccabees\0"
|
||||
"2 Maccabees\0"
|
||||
"Job\0"
|
||||
"Psalms\0"
|
||||
"Proverbs\0"
|
||||
"Ecclesiastes\0"
|
||||
"Song of Songs\0"
|
||||
"Wisdom\0"
|
||||
"Sirach\0"
|
||||
"Isaiah\0"
|
||||
"Jeremiah\0"
|
||||
"Lamentations\0"
|
||||
"Baruch\0"
|
||||
"Ezekiel\0"
|
||||
"Daniel\0"
|
||||
"Hosea\0"
|
||||
@@ -94,22 +87,15 @@ DefineLstLoad("ST_BIBLE_BOOK_LINES",
|
||||
"37633\0"
|
||||
"40756\0"
|
||||
"41671\0"
|
||||
"Tobit\0"
|
||||
"Judith\0"
|
||||
"42963\0"
|
||||
"1 Maccabees\0"
|
||||
"2 Maccabees\0"
|
||||
"43605\0"
|
||||
"46190\0"
|
||||
"53793\0"
|
||||
"56267\0"
|
||||
"56966\0"
|
||||
"Wisdom\0"
|
||||
"Sirach\0"
|
||||
"57332\0"
|
||||
"61806\0"
|
||||
"66736\0"
|
||||
"Baruch\0"
|
||||
"67217\0"
|
||||
"71804\0"
|
||||
"73189\0"
|
||||
@@ -153,6 +139,23 @@ DefineLstLoad("ST_BIBLE_BOOK_LINES",
|
||||
"98684\0"
|
||||
"\0");
|
||||
|
||||
public U0 PutBibleLines(I64 start,I64 lines)
|
||||
{
|
||||
CDoc *doc=DocRead(Define("ST_BIBLE_FILE"),DOCF_PLAIN_TEXT);
|
||||
CDocEntry *doc_e;
|
||||
DocLineNumGoTo(doc,start); //one based
|
||||
doc_e=doc->cur_entry;
|
||||
while (lines>0 && doc_e!=doc) {
|
||||
if (doc_e->type_u8==DOCT_TEXT)
|
||||
"%s",doc_e->tag;
|
||||
else if (doc_e->type_u8==DOCT_NEW_LINE) {
|
||||
NewLine;
|
||||
lines--;
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
DocDel(doc);
|
||||
}
|
||||
|
||||
public U0 PutBibleVerse(U8 *verse,I64 lines)
|
||||
{
|
||||
@@ -166,7 +169,7 @@ public U0 PutBibleVerse(U8 *verse,I64 lines)
|
||||
else
|
||||
*st2=0;
|
||||
|
||||
i=DefineMatch(st,"ST_BIBLE_BOOKS",LEF_IGNORE_CASE);
|
||||
i=DefineMatch(st,"ST_BIBLE_BOOKS",LMF_IGNORE_CASE);
|
||||
if (i>=0) {
|
||||
i=A2I(DefineSub(i,"ST_BIBLE_BOOK_LINES"));
|
||||
doc=DocRead(Define("ST_BIBLE_FILE"),DOCF_PLAIN_TEXT);
|
||||
@@ -176,9 +179,9 @@ public U0 PutBibleVerse(U8 *verse,I64 lines)
|
||||
EdFindNext(doc);
|
||||
}
|
||||
doc_e=doc->cur_entry;
|
||||
while (lines) {
|
||||
while (lines>0 && doc_e!=doc) {
|
||||
if (doc_e->type_u8==DOCT_TEXT)
|
||||
"" doc_e->tag;
|
||||
"%s",doc_e->tag;
|
||||
else if (doc_e->type_u8==DOCT_NEW_LINE) {
|
||||
NewLine;
|
||||
lines--;
|
||||
|
||||
@@ -11,7 +11,7 @@ I64 PopUpEdFmt()
|
||||
{
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
DocPutS(doc,"$$FG,LTBLUE$$$$MU,\"Check Compile\",EF_CHK_COMPILE$$\n"
|
||||
DocPrint(doc,"$$FG,LTBLUE$$$$MU,\"Check Compile\",EF_CHK_COMPILE$$\n"
|
||||
"$$MU,\"Reindent CPP.Z Fun\",EF_REINDENT$$\n"
|
||||
"$$MU,\"Renum Asm Local @@ Labels for Fun\",EF_RENUM_ASM$$\n"
|
||||
"$$MU,\"Insert Mgd Code: Slider Ctrl\",EF_SLIDER_CTRL$$\n"
|
||||
@@ -332,15 +332,15 @@ U0 EdRenumAsm(CDoc *doc)
|
||||
while (tempr!=&root) {
|
||||
tempr1=tempr->next;
|
||||
num+=ASM_RENUM_SPACING;
|
||||
SPrintF(buf,"@#%02d",num);
|
||||
SPrint(buf,"@#%02d",num);
|
||||
EdReplace(doc,tempr->label,buf,TRUE,TRUE,TRUE);
|
||||
Free(tempr);
|
||||
tempr=tempr1;
|
||||
}
|
||||
|
||||
while (num) {
|
||||
SPrintF(buf, "@#%02d",num);
|
||||
SPrintF(buf2,"@@%02d",num);
|
||||
SPrint(buf, "@#%02d",num);
|
||||
SPrint(buf2,"@@%02d",num);
|
||||
EdReplace(doc,buf,buf2,TRUE,TRUE,TRUE);
|
||||
num-=ASM_RENUM_SPACING;
|
||||
}
|
||||
@@ -373,7 +373,7 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action)
|
||||
DocWrite(doc);
|
||||
task=Spawn(&SrvUserCmdLine,NULL,"Srv",,Fs);
|
||||
st2=CurDir;
|
||||
st=MSPrintF("Cd(\"%s\");",st2);
|
||||
st=MPrint("Cd(\"%s\");",st2);
|
||||
tempc=TaskExeStrQue(task,Fs,st,1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
Free(st2);
|
||||
Free(st);
|
||||
@@ -385,11 +385,11 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action)
|
||||
Free(st);
|
||||
if (FileFind(prj_file)) {
|
||||
st2=DirFile(prj_file),
|
||||
st=MSPrintF("Cd(\"%s\");",st2);
|
||||
st=MPrint("Cd(\"%s\");",st2);
|
||||
Free(st2);
|
||||
tempc=TaskExeStrQue(task,Fs,st,1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER|1<<SVCf_FREE_ON_COMPLETE);
|
||||
Free(st);
|
||||
st=MSPrintF("\"$$WW,1$$\";Cmp(\"%s\",\"SysTemp\",\"SysTemp\");",prj_file);
|
||||
st=MPrint("\"$$WW,1$$\";Cmp(\"%s\",\"SysTemp\",\"SysTemp\");",prj_file);
|
||||
tempc=TaskExeStrQue(task,Fs,st,1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
Free(st);
|
||||
if (ScanResult(tempc,&r))
|
||||
@@ -407,9 +407,9 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action)
|
||||
prj_file=FileNameAbs(st,FUF_Z_OR_NOT_Z);
|
||||
Free(st);
|
||||
if (FileFind(prj_file))
|
||||
st=MSPrintF("\"$$WW,1$$\";ExeFile(\"%s\",TRUE);",prj_file);
|
||||
st=MPrint("\"$$WW,1$$\";ExeFile(\"%s\",TRUE);",prj_file);
|
||||
else
|
||||
st=MSPrintF("\"$$WW,1$$\";ExeFile(\"%s\",TRUE);",doc->filename.name);
|
||||
st=MPrint("\"$$WW,1$$\";ExeFile(\"%s\",TRUE);",doc->filename.name);
|
||||
tempc=TaskExeStrQue(task,Fs,st,1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
Free(st);
|
||||
if (ScanResult(tempc,&r) && r)
|
||||
@@ -528,32 +528,32 @@ U0 EdChSC(CDoc *doc)
|
||||
{
|
||||
I64 ch,sc;
|
||||
U8 buf[136];
|
||||
SPrintF(buf,"EdPopUpChSC(%d,%d);",&ch,&sc);
|
||||
SPrint(buf,"EdPopUpChSC(%d,%d);",&ch,&sc);
|
||||
PopUp(buf,Fs);
|
||||
if (ch==CH_BACKSPACE)
|
||||
DocPrintF(doc,"CH_BACKSPACE,0x%X",sc);
|
||||
DocPrint(doc,"CH_BACKSPACE,0x%X",sc);
|
||||
else if (ch=='\n')
|
||||
DocPrintF(doc,"'\n',0x%X",sc);
|
||||
DocPrint(doc,"'\n',0x%X",sc);
|
||||
else if (CH_CTRLA<=ch<=CH_CTRLZ)
|
||||
DocPrintF(doc,"CH_CTRL%C,0x%X",ch+'@',sc);
|
||||
DocPrint(doc,"CH_CTRL%C,0x%X",ch+'@',sc);
|
||||
else if (ch=='$$')
|
||||
DocPrintF(doc,"'$$$$',0x%X",sc);
|
||||
DocPrint(doc,"'$$$$',0x%X",sc);
|
||||
else if (ch=='\\')
|
||||
DocPrintF(doc,"'\\\\',0x%X",sc);
|
||||
DocPrint(doc,"'\\\\',0x%X",sc);
|
||||
else if (ch=='\'')
|
||||
DocPrintF(doc,"'\\\'',0x%X",sc);
|
||||
DocPrint(doc,"'\\\'',0x%X",sc);
|
||||
else if (ch==CH_ESC)
|
||||
DocPrintF(doc,"CH_ESC,0x%X",sc);
|
||||
DocPrint(doc,"CH_ESC,0x%X",sc);
|
||||
else if (ch==CH_SHIFT_ESC)
|
||||
DocPrintF(doc,"CH_SHIFT_ESC,0x%X",sc);
|
||||
DocPrint(doc,"CH_SHIFT_ESC,0x%X",sc);
|
||||
else if (ch==CH_SPACE)
|
||||
DocPrintF(doc,"CH_SPACE,0x%X",sc);
|
||||
DocPrint(doc,"CH_SPACE,0x%X",sc);
|
||||
else if (ch==CH_SHIFT_SPACE)
|
||||
DocPrintF(doc,"CH_SHIFT_SPACE,0x%X",sc);
|
||||
DocPrint(doc,"CH_SHIFT_SPACE,0x%X",sc);
|
||||
else if (Bt(displayable_chars_bitmap,ch))
|
||||
DocPrintF(doc,"'%c',0x%X",ch,sc);
|
||||
DocPrint(doc,"'%c',0x%X",ch,sc);
|
||||
else
|
||||
DocPrintF(doc,"0x%X,0x%X",ch,sc);
|
||||
DocPrint(doc,"0x%X,0x%X",ch,sc);
|
||||
}
|
||||
|
||||
U0 EdCodeTools(CDoc *doc)
|
||||
|
||||
@@ -8,7 +8,7 @@ I64 PopUpLinkType(Bool include_anchor)
|
||||
{
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
DocPutS(doc,"$$FG,PURPLE$$$$TX+CX,\"Link Type Menu\"$$\n"
|
||||
DocPrint(doc,"$$FG,PURPLE$$$$TX+CX,\"Link Type Menu\"$$\n"
|
||||
"\n$$FG,LTBLUE$$$$MU,\"To file\",LK_FILE$$\n"
|
||||
"$$MU,\"To anchor in file\",LK_FILE_ANCHOR$$\n"
|
||||
"$$MU,\"To str in file\",LK_FILE_FIND$$\n"
|
||||
@@ -22,8 +22,8 @@ I64 PopUpLinkType(Bool include_anchor)
|
||||
"$$MU,\"To Help Index\",LK_HELP_INDEX$$\n"
|
||||
"$$MU,\"To Addr\",LK_ADDR$$\n");
|
||||
if (include_anchor)
|
||||
DocPutS(doc,"$$MU,\"Place Anchor\",LK_PLACE_ANCHOR$$\n");
|
||||
DocPrintF(doc,"%s",ctrl_L_footer);
|
||||
DocPrint(doc,"$$MU,\"Place Anchor\",LK_PLACE_ANCHOR$$\n");
|
||||
DocPrint(doc,"%s",ctrl_L_footer);
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
return i;
|
||||
@@ -158,23 +158,23 @@ Bool PmtLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
el->num=1;
|
||||
switch (type) {
|
||||
case LK_FILE:
|
||||
if (DocFormDo(el,"CEdFileLink",,,ctrl_L_footer)) {
|
||||
if (DocFormDo(el,,,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (!*el->tag)
|
||||
*_tag=StrNew(el->file);
|
||||
else
|
||||
*_tag=StrNew(el->tag);
|
||||
*_link=MSPrintF("FI:%s",el->file);
|
||||
*_link=MPrint("FI:%s",el->file);
|
||||
}
|
||||
break;
|
||||
case LK_PLAIN:
|
||||
if (DocFormDo(el,"CEdFileLink",,,ctrl_L_footer)) {
|
||||
if (DocFormDo(el,,,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (!*el->tag)
|
||||
*_tag=StrNew(el->file);
|
||||
else
|
||||
*_tag=StrNew(el->tag);
|
||||
*_link=MSPrintF("PI:%s",el->file);
|
||||
*_link=MPrint("PI:%s",el->file);
|
||||
}
|
||||
break;
|
||||
case LK_FILE_ANCHOR:
|
||||
@@ -184,7 +184,7 @@ Bool PmtLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
*_tag=StrNew(el->aux);
|
||||
else
|
||||
*_tag=StrNew(el->tag);
|
||||
*_link=MSPrintF("FA:%s,%s",el->file,el->aux);
|
||||
*_link=MPrint("FA:%s,%s",el->file,el->aux);
|
||||
}
|
||||
break;
|
||||
case LK_FILE_FIND:
|
||||
@@ -195,13 +195,13 @@ Bool PmtLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
*_tag=StrNew(el->aux);
|
||||
else
|
||||
*_tag=StrNew(el->tag);
|
||||
*_link=MSPrintF("FF:%s,%s",el->file,el->aux);
|
||||
*_link=MPrint("FF:%s,%s",el->file,el->aux);
|
||||
} else {
|
||||
if (!*el->tag)
|
||||
*_tag=StrNew(el->aux);
|
||||
else
|
||||
*_tag=StrNew(el->tag);
|
||||
*_link=MSPrintF("FF:%s,%s:%d",el->file,el->aux,el->num);
|
||||
*_link=MPrint("FF:%s,%s:%d",el->file,el->aux,el->num);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -213,13 +213,13 @@ Bool PmtLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
*_tag=StrNew(el->aux);
|
||||
else
|
||||
*_tag=StrNew(el->tag);
|
||||
*_link=MSPrintF("PF:%s,%s",el->file,el->aux);
|
||||
*_link=MPrint("PF:%s,%s",el->file,el->aux);
|
||||
} else {
|
||||
if (!*el->tag)
|
||||
*_tag=StrNew(el->aux);
|
||||
else
|
||||
*_tag=StrNew(el->tag);
|
||||
*_link=MSPrintF("PF:%s,%s:%d",el->file,el->aux,el->num);
|
||||
*_link=MPrint("PF:%s,%s:%d",el->file,el->aux,el->num);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -230,7 +230,7 @@ Bool PmtLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
*_tag=StrNew(el->file);
|
||||
else
|
||||
*_tag=StrNew(el->tag);
|
||||
*_link=MSPrintF("FL:%s,%d",el->file,el->num);
|
||||
*_link=MPrint("FL:%s,%d",el->file,el->num);
|
||||
}
|
||||
break;
|
||||
case LK_PLAIN_LINE:
|
||||
@@ -240,7 +240,7 @@ Bool PmtLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
*_tag=StrNew(el->file);
|
||||
else
|
||||
*_tag=StrNew(el->tag);
|
||||
*_link=MSPrintF("PL:%s,%d",el->file,el->num);
|
||||
*_link=MPrint("PL:%s,%d",el->file,el->num);
|
||||
}
|
||||
break;
|
||||
case LK_MAN_PAGE:
|
||||
@@ -250,7 +250,7 @@ Bool PmtLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
*_tag=StrNew(el->aux);
|
||||
else
|
||||
*_tag=StrNew(el->tag);
|
||||
*_link=MSPrintF("MN:%s",el->aux);
|
||||
*_link=MPrint("MN:%s",el->aux);
|
||||
}
|
||||
break;
|
||||
case LK_PLACE_ANCHOR:
|
||||
@@ -272,10 +272,10 @@ Bool PmtLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
if (DocFormDo(el,"CEdBibleLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
if (!*el->tag)
|
||||
*_tag=MSPrintF("%Z,%s",i,"ST_BIBLE_BOOKS",el->aux);
|
||||
*_tag=MPrint("%Z,%s",i,"ST_BIBLE_BOOKS",el->aux);
|
||||
else
|
||||
*_tag=StrNew(el->tag);
|
||||
*_link=MSPrintF("BF:%Z,%s",i,"ST_BIBLE_BOOKS",el->aux);
|
||||
*_link=MPrint("BF:%Z,%s",i,"ST_BIBLE_BOOKS",el->aux);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -288,9 +288,9 @@ Bool PmtLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
else
|
||||
*_tag=StrNew(el->tag);
|
||||
if (el->num<0)
|
||||
*_link=MSPrintF("DF:%s",el->aux);
|
||||
*_link=MPrint("DF:%s",el->aux);
|
||||
else
|
||||
*_link=MSPrintF("DF:%s,%d",el->aux,el->num);
|
||||
*_link=MPrint("DF:%s,%d",el->aux,el->num);
|
||||
|
||||
}
|
||||
break;
|
||||
@@ -301,7 +301,7 @@ Bool PmtLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
*_tag=StrNew(el->aux);
|
||||
else
|
||||
*_tag=StrNew(el->tag);
|
||||
*_link=MSPrintF("HI:%s",el->aux);
|
||||
*_link=MPrint("HI:%s",el->aux);
|
||||
}
|
||||
break;
|
||||
case LK_ADDR:
|
||||
@@ -313,13 +313,13 @@ Bool PmtLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,Bool *_quote,U8 **_html
|
||||
*_tag=StrNew(el->aux);
|
||||
else
|
||||
*_tag=StrNew(el->tag);
|
||||
*_link=MSPrintF("AD:%s",el->aux);
|
||||
*_link=MPrint("AD:%s",el->aux);
|
||||
} else {
|
||||
if (!*el->tag)
|
||||
*_tag=MSPrintF("%s,%d",el->aux,el->num);
|
||||
*_tag=MPrint("%s,%d",el->aux,el->num);
|
||||
else
|
||||
*_tag=StrNew(el->tag);
|
||||
*_link=MSPrintF("AD:%s,%d",el->aux,el->num);
|
||||
*_link=MPrint("AD:%s,%d",el->aux,el->num);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -355,15 +355,15 @@ U0 EdInsLink()
|
||||
switch (type) {
|
||||
case LK_PLACE_ANCHOR:
|
||||
if (html_link)
|
||||
st=MSPrintF("$$AN+HTML,\"%Q\",\"%Q\",\"%Q\"$$",tag,link,html_link);
|
||||
st=MPrint("$$AN+HTML,\"%Q\",\"%Q\",\"%Q\"$$",tag,link,html_link);
|
||||
else
|
||||
st=MSPrintF("$$AN,\"%Q\",\"%Q\"$$",tag,link);
|
||||
st=MPrint("$$AN,\"%Q\",\"%Q\"$$",tag,link);
|
||||
break;
|
||||
default:
|
||||
if (html_link)
|
||||
st=MSPrintF("$$LK%s+HTML,\"%Q\",\"%Q\",\"%Q\"$$",pop_up_st,tag,link,html_link);
|
||||
st=MPrint("$$LK%s+HTML,\"%Q\",\"%Q\",\"%Q\"$$",pop_up_st,tag,link,html_link);
|
||||
else
|
||||
st=MSPrintF("$$LK%s,\"%Q\",\"%Q\"$$",pop_up_st,tag,link);
|
||||
st=MPrint("$$LK%s,\"%Q\",\"%Q\"$$",pop_up_st,tag,link);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -371,7 +371,7 @@ U0 EdInsLink()
|
||||
if (quote)
|
||||
"%Q",st;
|
||||
else
|
||||
"" st;
|
||||
"%s",st;
|
||||
}
|
||||
Free(tag);
|
||||
Free(link);
|
||||
@@ -383,7 +383,7 @@ I64 PopUpColorType()
|
||||
{
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
DocPrintF(doc,"$$FG,PURPLE$$$$TX+CX,\"Color Type Menu\"$$\n"
|
||||
DocPrint(doc,"$$FG,PURPLE$$$$TX+CX,\"Color Type Menu\"$$\n"
|
||||
"\n$$FG,LTBLUE$$$$MU,\"Foreground\",DOCT_FOREGROUND$$\n"
|
||||
"$$MU,\"Background\",DOCT_BACKGROUND$$\n"
|
||||
"$$MU,\"Default Foreground\",DOCT_DFT_FOREGROUND$$\n"
|
||||
@@ -398,7 +398,7 @@ I64 PopUpPageSettingType()
|
||||
{
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
DocPrintF(doc,"$$FG,PURPLE$$$$TX+CX,\"Page Setting Menu\"$$\n"
|
||||
DocPrint(doc,"$$FG,PURPLE$$$$TX+CX,\"Page Setting Menu\"$$\n"
|
||||
"\n$$FG,LTBLUE$$$$MU,\"Page Length\",DOCT_PAGE_LEN$$\n"
|
||||
"$$MU,\"Page Header\",DOCT_HEADER$$\n"
|
||||
"$$MU,\"Page Footer\",DOCT_FOOTER$$\n"
|
||||
@@ -455,7 +455,7 @@ U0 EdInsPageSetting()
|
||||
CEdPageSetting4 *el4=CAlloc(sizeof(CEdPageSetting4));
|
||||
if (type>=0) {
|
||||
if (type==DOCT_RIGHT_MARGIN||type==DOCT_PAGE_LEN) {
|
||||
if (DocFormDo(el2,"CEdPageSetting2")) {
|
||||
if (DocFormDo(el2)) {
|
||||
if (el2->winrel) {
|
||||
if (*el2->val)
|
||||
"$$%Z+WR,%s$$",type,"ST_DOC_CMDS",el2->val;
|
||||
@@ -470,7 +470,7 @@ U0 EdInsPageSetting()
|
||||
}
|
||||
} else if (type==DOCT_LOCK_TO_PAGE) {
|
||||
el3->lock=TRUE;
|
||||
if (DocFormDo(el3,"CEdPageSetting3")) {
|
||||
if (DocFormDo(el3)) {
|
||||
if (el3->lock)
|
||||
"$$%Z,1$$",type,"ST_DOC_CMDS",el->val;
|
||||
else
|
||||
@@ -478,14 +478,14 @@ U0 EdInsPageSetting()
|
||||
}
|
||||
} else if (type==DOCT_LOCK_TO_CENTER) {
|
||||
el4->lock=TRUE;
|
||||
if (DocFormDo(el4,"CEdPageSetting4")) {
|
||||
if (DocFormDo(el4)) {
|
||||
if (el4->lock)
|
||||
"$$%Z,1$$",type,"ST_DOC_CMDS",el->val;
|
||||
else
|
||||
"$$%Z,0$$",type,"ST_DOC_CMDS";
|
||||
}
|
||||
} else {
|
||||
if (DocFormDo(el,"CEdPageSetting1")) {
|
||||
if (DocFormDo(el)) {
|
||||
if (*el->val)
|
||||
"$$%Z,%s$$",type,"ST_DOC_CMDS",el->val;
|
||||
else
|
||||
@@ -503,7 +503,7 @@ I64 PopUpDollarType()
|
||||
{
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
DocPrintF(doc,"$$FG,PURPLE$$$$TX+CX,\"Text Widget Menu\"$$\n"
|
||||
DocPrint(doc,"$$FG,PURPLE$$$$TX+CX,\"Text Widget Menu\"$$\n"
|
||||
"\n$$FG,LTBLUE$$$$MU,\"Link\",DOCT_LINK$$\n"
|
||||
"$$MU,\"Text\",DOCT_TEXT$$\n"
|
||||
"$$MU,\"Tree Branch\",DOCT_TREE$$\n"
|
||||
@@ -516,7 +516,6 @@ I64 PopUpDollarType()
|
||||
"$$MU,\"Menu Val\",DOCT_MENU_VAL$$\n"
|
||||
"$$MU,\"Data\",DOCT_DATA$$\n"
|
||||
"$$MU,\"Hex Edit\",DOCT_HEX_ED$$\n"
|
||||
"$$MU,\"Hidden Widget\",DOCT_HIDE_START$$\n"
|
||||
"$$MU,\"Syntax Highlighting\",DOCT_HIGHLIGHT$$\n"
|
||||
"$$MU,\"HTML\",DOCT_HTML_CODE$$\n"
|
||||
"$$MU,\"Song\",DOCT_SONG$$\n"
|
||||
@@ -550,7 +549,7 @@ U0 EdInsDollarText()
|
||||
{
|
||||
U8 *st,buf[136];
|
||||
CEdDollarText *dt=CAlloc(sizeof(CEdDollarText));
|
||||
if (DocFormDo(dt,"CEdDollarText",,,ctrl_L_footer)) {
|
||||
if (DocFormDo(dt,,,,ctrl_L_footer)) {
|
||||
*buf=0;
|
||||
if (dt->left_x ) StrCat(buf,"+LX");
|
||||
if (dt->center_x) StrCat(buf,"+CX");
|
||||
@@ -567,7 +566,7 @@ U0 EdInsDollarText()
|
||||
if (*dt->shift_y) StrCat(buf,"+SY");
|
||||
if (*dt->define_str) StrCat(buf,"+D");
|
||||
if (*dt->html_link) StrCat(buf,"+HTML");
|
||||
st=MSPrintF("%q",dt->tag);
|
||||
st=MPrint("%q",dt->tag);
|
||||
"$$TX%s,\"%Q\"",buf,st;
|
||||
Free(st);
|
||||
if (*dt->shift_x)
|
||||
@@ -577,12 +576,12 @@ U0 EdInsDollarText()
|
||||
if (*dt->scroll_x)
|
||||
",%s",dt->scroll_x;
|
||||
if (*dt->define_str) {
|
||||
st=MSPrintF("%q",dt->define_str);
|
||||
st=MPrint("%q",dt->define_str);
|
||||
",\"%Q\"",st;
|
||||
Free(st);
|
||||
}
|
||||
if (*dt->html_link) {
|
||||
st=MSPrintF("%q",dt->html_link);
|
||||
st=MPrint("%q",dt->html_link);
|
||||
",\"%Q\"",st;
|
||||
Free(st);
|
||||
}
|
||||
@@ -600,7 +599,7 @@ class CEdSong
|
||||
U0 EdInsSong()
|
||||
{
|
||||
CEdSong *dt=CAlloc(sizeof(CEdSong));
|
||||
if (DocFormDo(dt,"CEdSong",,,ctrl_L_footer))
|
||||
if (DocFormDo(dt,,,,ctrl_L_footer))
|
||||
"$$SO,\"%Q\",\"%s\"$$",dt->tag,dt->song;
|
||||
Free(dt);
|
||||
}
|
||||
@@ -613,7 +612,7 @@ class CEdHighlight
|
||||
U0 EdInsHighlight()
|
||||
{
|
||||
CEdHighlight *dt=CAlloc(sizeof(CEdHighlight));
|
||||
if (DocFormDo(dt,"CEdHighlight",,,ctrl_L_footer))
|
||||
if (DocFormDo(dt,,,,ctrl_L_footer))
|
||||
"$$HL,%d$$",dt->highlight_on;
|
||||
Free(dt);
|
||||
}
|
||||
@@ -626,7 +625,7 @@ I64 PopUpHtmlType()
|
||||
{
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
DocPutS(doc,"$$FG,LTBLUE$$$$MU,\"Html Code\",HT_CODE$$\n"
|
||||
DocPrint(doc,"$$FG,LTBLUE$$$$MU,\"Html Code\",HT_CODE$$\n"
|
||||
"$$MU,\"Html Image\",HT_IMAGE$$\n"
|
||||
"$$MU,\"Html Video\",HT_VIDEO$$\n"
|
||||
"\n$$MU,\"Abort\",DOCM_CANCEL$$");
|
||||
@@ -650,7 +649,7 @@ U0 EdInsHtml()
|
||||
CEdHtmlCode *dt=CAlloc(sizeof(CEdHtmlCode));
|
||||
switch (PopUpHtmlType) {
|
||||
case HT_CODE:
|
||||
if (DocFormDo(dt,"CEdHtmlCode",,,ctrl_L_footer))
|
||||
if (DocFormDo(dt,,,,ctrl_L_footer))
|
||||
"$$HC,\"%Q\"$$",dt->tag;
|
||||
break;
|
||||
case HT_IMAGE:
|
||||
@@ -691,7 +690,7 @@ U0 EdInsMacroMenu(Bool is_macro)
|
||||
CEdMacroMenu *dt=CAlloc(sizeof(CEdMacroMenu));
|
||||
dt->underline=TRUE;
|
||||
dt->escape=TRUE;
|
||||
if (DocFormDo(dt,"CEdMacroMenu",,,ctrl_L_footer)) {
|
||||
if (DocFormDo(dt,,,,ctrl_L_footer)) {
|
||||
*buf=0;
|
||||
if (is_macro && *dt->tag) StrCat(buf,"+A ");
|
||||
if (dt->popup) StrCat(buf,"+PU-X");
|
||||
@@ -717,20 +716,20 @@ U0 EdInsMacroMenu(Bool is_macro)
|
||||
if (*dt->tag || is_macro) {
|
||||
if (is_macro) {
|
||||
if (*dt->tag) {
|
||||
st=MSPrintF("%q",dt->tag);
|
||||
st=MPrint("%q",dt->tag);
|
||||
"$$MA%s,\"%Q\"",buf,st;
|
||||
Free(st);
|
||||
} else
|
||||
"$$MA%s,",buf;
|
||||
} else {
|
||||
st=MSPrintF("%q",dt->tag);
|
||||
st=MPrint("%q",dt->tag);
|
||||
"$$MU%s,\"%Q\"",buf,st;
|
||||
Free(st);
|
||||
}
|
||||
if (*dt->left_exp)
|
||||
",%s",dt->left_exp;
|
||||
if (*dt->left_macro) {
|
||||
st=MSPrintF("%q",dt->left_macro);
|
||||
st=MPrint("%q",dt->left_macro);
|
||||
",\"%Q\"",st;
|
||||
Free(st);
|
||||
}
|
||||
@@ -766,7 +765,7 @@ U0 EdInsButton()
|
||||
U8 *st,buf[136];
|
||||
CEdButton *dt=CAlloc(sizeof(CEdButton));
|
||||
dt->escape=TRUE;
|
||||
if (DocFormDo(dt,"CEdButton",,,ctrl_L_footer)) {
|
||||
if (DocFormDo(dt,,,,ctrl_L_footer)) {
|
||||
*buf=0;
|
||||
if (dt->popup) StrCat(buf,"+PU-X");
|
||||
if (dt->left_x ) StrCat(buf,"+LX");
|
||||
@@ -779,25 +778,25 @@ U0 EdInsButton()
|
||||
if (dt->left_is_auto) StrCat(buf,"+LA");
|
||||
if (*dt->tag) {
|
||||
if (dt->quote) {
|
||||
st=MSPrintF("%q",dt->tag);
|
||||
st=MPrint("%q",dt->tag);
|
||||
"$$$$BT%s,\\\"%Q\\\"",buf,st;
|
||||
Free(st);
|
||||
if (*dt->left_exp)
|
||||
",%s",dt->left_exp;
|
||||
if (*dt->left_macro) {
|
||||
st=MSPrintF("%q",dt->left_macro);
|
||||
st=MPrint("%q",dt->left_macro);
|
||||
",\\\"%Q\\\"",st;
|
||||
Free(st);
|
||||
}
|
||||
"$$$$";
|
||||
} else {
|
||||
st=MSPrintF("%q",dt->tag);
|
||||
st=MPrint("%q",dt->tag);
|
||||
"$$BT%s,\"%Q\"",buf,st;
|
||||
Free(st);
|
||||
if (*dt->left_exp)
|
||||
",%s",dt->left_exp;
|
||||
if (*dt->left_macro) {
|
||||
st=MSPrintF("%q",dt->left_macro);
|
||||
st=MPrint("%q",dt->left_macro);
|
||||
",\"%Q\"",st;
|
||||
Free(st);
|
||||
}
|
||||
@@ -828,7 +827,7 @@ U0 EdInsCursorMovement()
|
||||
{
|
||||
U8 buf[136];
|
||||
CEdCursorMovement *dt=CAlloc(sizeof(CEdCursorMovement));
|
||||
if (DocFormDo(dt,"CEdCursorMovement",,,ctrl_L_footer)) {
|
||||
if (DocFormDo(dt,,,,ctrl_L_footer)) {
|
||||
*buf=0;
|
||||
if (dt->left_x ) StrCat(buf,"+LX");
|
||||
if (dt->center_x) StrCat(buf,"+CX");
|
||||
@@ -875,7 +874,7 @@ U0 EdInsData()
|
||||
dt->term=TRUE;
|
||||
dt->len=256;
|
||||
dt->u64=TRUE;
|
||||
if (DocFormDo(dt,"CEdData",,,ctrl_L_footer)) {
|
||||
if (DocFormDo(dt,,,,ctrl_L_footer)) {
|
||||
*buf=0;
|
||||
if (dt->str) StrCat(buf,"-P");
|
||||
if (!dt->term) StrCat(buf,"-T");
|
||||
@@ -886,7 +885,7 @@ U0 EdInsData()
|
||||
else if (dt->u16) StrCat(buf,"-U64+U16");
|
||||
else if (dt->u32) StrCat(buf,"-U64+U32");
|
||||
|
||||
st=MSPrintF("%q",dt->fmt_str);
|
||||
st=MPrint("%q",dt->fmt_str);
|
||||
"$$$$DA%s,%d,\\\"%Q\\\"$$$$",buf,dt->len,st;
|
||||
Free(st);
|
||||
}
|
||||
@@ -903,10 +902,10 @@ U0 EdInsCheckBox()
|
||||
{
|
||||
U8 *st,buf[136];
|
||||
CEdCheckBox *dt=CAlloc(sizeof(CEdCheckBox));
|
||||
if (DocFormDo(dt,"CEdCheckBox",,,ctrl_L_footer)) {
|
||||
if (DocFormDo(dt,,,,ctrl_L_footer)) {
|
||||
*buf=0;
|
||||
if (dt->refresh) StrCat(buf,"+RD");
|
||||
st=MSPrintF("%q",dt->label);
|
||||
st=MPrint("%q",dt->label);
|
||||
"$$$$CB%s,\\\"%Q\\\"$$$$",buf,st;
|
||||
Free(st);
|
||||
}
|
||||
@@ -928,7 +927,7 @@ U0 EdInsHexEd()
|
||||
dt->cnt=128;
|
||||
dt->cols=4;
|
||||
dt->zero=TRUE;
|
||||
if (DocFormDo(dt,"CEdHexEd",,,ctrl_L_footer)) {
|
||||
if (DocFormDo(dt,,,,ctrl_L_footer)) {
|
||||
*buf=0;
|
||||
if (!dt->zero) StrCat(buf,"-Z");
|
||||
if (dt->refresh) StrCat(buf,"+RD");
|
||||
@@ -950,10 +949,10 @@ class CEdBinary
|
||||
U0 EdInsBinary(I64 bin_num,I64 type)
|
||||
{
|
||||
CEdBinary *dt=CAlloc(sizeof(CEdBinary));
|
||||
SPrintF(dt->tag,"<%d>",bin_num);
|
||||
SPrint(dt->tag,"<%d>",bin_num);
|
||||
dt->bin_num=bin_num;
|
||||
dt->bin_ptr_link_bin_num=1;
|
||||
if (DocFormDo(dt,"CEdBinary",,
|
||||
if (DocFormDo(dt,,,
|
||||
"Note: Normally, you enter no file,\n"
|
||||
"just a bin num. If You enter a\n"
|
||||
"file, enter a file bin num or a file\n"
|
||||
@@ -988,11 +987,11 @@ U0 EdInsTree()
|
||||
CEdTree *dt=CAlloc(sizeof(CEdTree));
|
||||
dt->collapsed=TRUE;
|
||||
dt->indent=2;
|
||||
if (DocFormDo(dt,"CEdTree",,,ctrl_L_footer)) {
|
||||
if (DocFormDo(dt,,,,ctrl_L_footer)) {
|
||||
*buf=0;
|
||||
if (!dt->collapsed) StrCat(buf,"-C");
|
||||
st=MSPrintF("%q",dt->label);
|
||||
st2=MSPrintF("$$TR%s,\"%Q\"$$\n$$ID,%d$$*\n$$ID,%d$$",
|
||||
st=MPrint("%q",dt->label);
|
||||
st2=MPrint("$$TR%s,\"%Q\"$$\n$$ID,%d$$*\n$$ID,%d$$",
|
||||
buf,st,dt->indent,-dt->indent);
|
||||
DocInsSafe(DocPut,st2);
|
||||
Free(st);
|
||||
@@ -1001,11 +1000,6 @@ U0 EdInsTree()
|
||||
Free(dt);
|
||||
}
|
||||
|
||||
U0 EdInsHidden()
|
||||
{
|
||||
DocInsSafe(DocPut,"$$HS$$*$$HE$$");
|
||||
}
|
||||
|
||||
U0 EdInsDollarCmd()
|
||||
{
|
||||
I64 type=PopUpDollarType;
|
||||
@@ -1046,9 +1040,6 @@ U0 EdInsDollarCmd()
|
||||
case DOCT_HEX_ED:
|
||||
EdInsHexEd;
|
||||
break;
|
||||
case DOCT_HIDE_START:
|
||||
EdInsHidden;
|
||||
break;
|
||||
case DOCT_SONG:
|
||||
EdInsSong;
|
||||
break;
|
||||
@@ -1073,7 +1064,7 @@ I64 PopUpSpriteType()
|
||||
{
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
DocPutS(doc,"$$FG,PURPLE$$$$TX+CX,\"Graphic Resource Menu\"$$\n"
|
||||
DocPrint(doc,"$$FG,PURPLE$$$$TX+CX,\"Graphic Resource Menu\"$$\n"
|
||||
"$$LK+PU+CX,\"Click for Help\",\"FI:::/TempleOS/Doc/Resource.TXT.Z\"$$\n"
|
||||
"\n$$FG,LTBLUE$$$$MU,\"Make Sprite\",PT_SPRITE$$\n"
|
||||
"$$MU,\"Pointer to Sprite\",PT_SPRITE_PTR$$\n"
|
||||
@@ -1117,7 +1108,7 @@ U8 *EdSpriteLink(Bool *_pop_up,U8 **_html_link)
|
||||
I64 type=PopUpLinkType(FALSE);
|
||||
*_html_link=NULL;
|
||||
if (type>=0 && PmtLink(type,&tag,&link,_pop_up,"e,_html_link))
|
||||
result=MSPrintF("\"%Q\",\"%Q\"",tag,link);
|
||||
result=MPrint("\"%Q\",\"%Q\"",tag,link);
|
||||
Free(tag);
|
||||
Free(link);
|
||||
return result;
|
||||
@@ -1132,19 +1123,19 @@ U8 *EdSprite(I64 bin_num)
|
||||
*buf=0;
|
||||
switch (type) {
|
||||
case PT_SPRITE:
|
||||
SPrintF(dt->tag,"<%d>",bin_num);
|
||||
SPrint(dt->tag,"<%d>",bin_num);
|
||||
if (DocFormDo(dt,"CEdJustSprite",,,ctrl_L_footer))
|
||||
st1=MSPrintF("\"%Q\"",dt->tag);
|
||||
st1=MPrint("\"%Q\"",dt->tag);
|
||||
break;
|
||||
case PT_SPRITE_MACRO:
|
||||
dt->escape=TRUE;
|
||||
if (DocFormDo(dt,"CEdMacroSprite",,,ctrl_L_footer)) {
|
||||
if (DocFormDo(dt,,,,ctrl_L_footer)) {
|
||||
StrCat(buf,"+LM+UL");
|
||||
if (dt->is_auto)StrCat(buf,"+LA");
|
||||
if (dt->popup) StrCat(buf,"+PU");
|
||||
if (dt->escape) StrCat(buf,"+X");
|
||||
st=MSPrintF("%q",dt->exp);
|
||||
st1=MSPrintF("\"%Q\",\"%Q\"",dt->tag,st);
|
||||
st=MPrint("%q",dt->exp);
|
||||
st1=MPrint("\"%Q\",\"%Q\"",dt->tag,st);
|
||||
Free(st);
|
||||
}
|
||||
break;
|
||||
@@ -1153,7 +1144,7 @@ U8 *EdSprite(I64 bin_num)
|
||||
if (DocFormDo(dt,"CEdMenuSprite",,,ctrl_L_footer)) {
|
||||
StrCat(buf,"+LE");
|
||||
if (dt->escape) StrCat(buf,"+X");
|
||||
st1=MSPrintF("\"%Q\",%s",dt->tag,dt->exp);
|
||||
st1=MPrint("\"%Q\",%s",dt->tag,dt->exp);
|
||||
}
|
||||
break;
|
||||
case PT_SPRITE_LINK:
|
||||
@@ -1178,9 +1169,9 @@ U8 *EdSprite(I64 bin_num)
|
||||
if (st1) {
|
||||
if (html_link) {
|
||||
StrCat(buf,"+HTML");
|
||||
st2=MSPrintF("$$SP%s,%s,\"%Q\",%d$$",buf,st1,html_link,bin_num);
|
||||
st2=MPrint("$$SP%s,%s,\"%Q\",%d$$",buf,st1,html_link,bin_num);
|
||||
} else
|
||||
st2=MSPrintF("$$SP%s,%s,%d$$",buf,st1,bin_num);
|
||||
st2=MPrint("$$SP%s,%s,%d$$",buf,st1,bin_num);
|
||||
Free(st1);
|
||||
}
|
||||
Free(dt);
|
||||
|
||||
+127
-297
@@ -37,17 +37,16 @@ public Bool DocPatternFind(CDoc *doc,I64 start_line_num=MIN_I64,
|
||||
if (pattern) {
|
||||
result=FALSE;
|
||||
while (doc_e!=doc) {
|
||||
if (Bt(doc_tag_types,doc_e->type_u8)) {
|
||||
if (ptr=StrIStr(doc_e->tag,pattern)) { //TODO: handle multientry strings
|
||||
i=ptr-doc_e->tag;
|
||||
if (!--match) {
|
||||
doc->cur_entry=doc_e;
|
||||
if (i<doc_e->min_col) i=doc_e->min_col;
|
||||
if (i>doc_e->max_col) i=doc_e->max_col;
|
||||
doc->cur_data_col=i;
|
||||
result=TRUE;
|
||||
break;
|
||||
}
|
||||
if (Bt(doc_tag_types,doc_e->type_u8) &&
|
||||
(ptr=StrIMatch(pattern,doc_e->tag))) { //TODO: handle multientry strings
|
||||
i=ptr-doc_e->tag;
|
||||
if (!--match) {
|
||||
doc->cur_entry=doc_e;
|
||||
if (i<doc_e->min_col) i=doc_e->min_col;
|
||||
if (i>doc_e->max_col) i=doc_e->max_col;
|
||||
doc->cur_data_col=i;
|
||||
result=TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
@@ -112,7 +111,7 @@ public U0 EdCursorLeft(CDoc *doc,I64 sc=MIN_I64)
|
||||
//See $LK,"EdRenumAsm","MN:EdRenumAsm"$ for an example.
|
||||
U8 *dst;
|
||||
Bool unlock=DocLock(doc);
|
||||
CDocEntry *doc_ce=doc->cur_entry,*original_cl=doc_ce,*doc_ne;
|
||||
CDocEntry *doc_ce=doc->cur_entry,*original_ce=doc_ce,*doc_ne;
|
||||
I64 cc=doc->cur_data_col,y=doc_ce->y;
|
||||
if (sc!=MIN_I64) sc=sc.u32[0];
|
||||
if (sc>=0 && sc&SCF_CTRL) {
|
||||
@@ -122,82 +121,41 @@ public U0 EdCursorLeft(CDoc *doc,I64 sc=MIN_I64)
|
||||
cc=doc_ce->min_col;
|
||||
} else {
|
||||
if (cc>doc_ce->min_col) {
|
||||
if (doc_ce->type_u8==DOCT_TEXT &&
|
||||
!(doc_ce->flags1&DOCEG1_DONT_EDIT) &&
|
||||
!(doc_ce->flags2&DOCEG2_DONT_EDIT) &&
|
||||
cc<doc_ce->max_col) {
|
||||
doc_ne=CAlloc(sizeof(CDocEntryBase),doc->mem_task);
|
||||
doc_ne->type=doc_ce->type;
|
||||
doc_ne->flags1=doc_ce->flags1;
|
||||
doc_ne->flags2=doc_ce->flags2;
|
||||
if (IsEditableText(doc_ce) && cc<doc_ce->max_col) {
|
||||
dst=doc_ce->tag+cc;
|
||||
doc_ne->tag=StrNew(dst,doc->mem_task);
|
||||
doc_ne->max_col=StrLen(dst);
|
||||
doc_ne->x=doc_ce->x;
|
||||
doc_ne->y=doc_ce->y;
|
||||
doc_ne->page_line_num=doc_ce->page_line_num;
|
||||
doc_ne=DocEntryNew(doc,doc_ce,StrNew(dst,doc->mem_task));
|
||||
*dst=0;
|
||||
doc_ce->max_col=cc;
|
||||
QueIns(doc_ne,doc_ce);
|
||||
}
|
||||
cc--;
|
||||
if (doc_ce->type_u8==DOCT_TEXT&&
|
||||
!(doc_ce->flags1&DOCEG1_DONT_EDIT) &&
|
||||
!(doc_ce->flags2&DOCEG2_DONT_EDIT) &&
|
||||
cc>doc_ce->min_col) {
|
||||
doc_ne=CAlloc(sizeof(CDocEntryBase),doc->mem_task);
|
||||
doc_ne->type=doc_ce->type;
|
||||
doc_ne->flags1=doc_ce->flags1;
|
||||
doc_ne->flags2=doc_ce->flags2;
|
||||
if (IsEditableText(doc_ce) && cc>doc_ce->min_col) {
|
||||
dst=doc_ce->tag+cc;
|
||||
doc_ne->tag=StrNew(dst,doc->mem_task);
|
||||
doc_ne->max_col=StrLen(dst);
|
||||
doc_ne->x=doc_ce->x;
|
||||
doc_ne->y=doc_ce->y;
|
||||
doc_ne->page_line_num=doc_ce->page_line_num;
|
||||
doc_ne=DocEntryNew(doc,doc_ce,StrNew(dst,doc->mem_task));
|
||||
*dst=0;
|
||||
doc_ce->max_col=cc;
|
||||
QueIns(doc_ne,doc_ce);
|
||||
doc_ce=doc_ne;
|
||||
cc=doc_ce->min_col;
|
||||
}
|
||||
if (sc>=0) {
|
||||
if (sc&SCF_SHIFT)
|
||||
doc_ce->type|=DOCET_SELECTED;
|
||||
else
|
||||
doc_ce->type&=~DOCET_SELECTED;
|
||||
}
|
||||
if (sc>=0)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
} else {
|
||||
cc=doc_ce->min_col;
|
||||
while (doc_ce->last!=doc &&
|
||||
(doc_ce->last->type_u8==DOCT_SOFT_NEW_LINE || doc_ce->last->type_u8==DOCT_INDENT ||
|
||||
doc_ce->last->flags1 & (DOCEF1_SKIP|DOCEF1_HARD_SKIP|DOCEF1_FILTER_SKIP))) {
|
||||
doc_ce=doc_ce->last;
|
||||
if (sc>=0) {
|
||||
if (sc&SCF_SHIFT)
|
||||
doc_ce->type|=DOCET_SELECTED;
|
||||
else
|
||||
doc_ce->type&=~DOCET_SELECTED;
|
||||
}
|
||||
if (sc>=0)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
}
|
||||
if (doc_ce->last!=doc) {
|
||||
doc_ce=doc_ce->last;
|
||||
if (doc_ce->max_col>doc_ce->min_col) {
|
||||
cc=doc_ce->max_col-1;
|
||||
if (doc_ce->type_u8==DOCT_TEXT &&
|
||||
!(doc_ce->flags1&DOCEG1_DONT_EDIT) &&
|
||||
!(doc_ce->flags2&DOCEG2_DONT_EDIT) &&
|
||||
cc>doc_ce->min_col) {
|
||||
doc_ne=CAlloc(sizeof(CDocEntryBase),doc->mem_task);
|
||||
doc_ne->type=doc_ce->type;
|
||||
doc_ne->flags1=doc_ce->flags1;
|
||||
doc_ne->flags2=doc_ce->flags2;
|
||||
if (IsEditableText(doc_ce) && cc>doc_ce->min_col) {
|
||||
dst=doc_ce->tag+cc;
|
||||
doc_ne->tag=StrNew(dst,doc->mem_task);
|
||||
doc_ne->max_col=StrLen(dst);
|
||||
doc_ne->x=doc_ce->x;
|
||||
doc_ne->y=doc_ce->y;
|
||||
doc_ne->page_line_num=doc_ce->page_line_num;
|
||||
doc_ne=DocEntryNew(doc,doc_ce,StrNew(dst,doc->mem_task));
|
||||
*dst=0;
|
||||
doc_ce->max_col=cc;
|
||||
QueIns(doc_ne,doc_ce);
|
||||
@@ -206,18 +164,14 @@ public U0 EdCursorLeft(CDoc *doc,I64 sc=MIN_I64)
|
||||
}
|
||||
} else
|
||||
cc=doc_ce->max_col;
|
||||
if (sc>=0) {
|
||||
if (sc&SCF_SHIFT)
|
||||
doc_ce->type|=DOCET_SELECTED;
|
||||
else
|
||||
doc_ce->type&=~DOCET_SELECTED;
|
||||
}
|
||||
if (sc>=0)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
}
|
||||
}
|
||||
}
|
||||
doc->cur_data_col=cc;
|
||||
doc->cur_entry=doc_ce;
|
||||
if (doc_ce!=original_cl)
|
||||
if (doc_ce!=original_ce)
|
||||
DocFormBackward(doc);
|
||||
doc->recalc_start=doc->cur_entry->last;
|
||||
if (unlock)
|
||||
@@ -229,7 +183,7 @@ public U0 EdCursorRight(CDoc *doc,I64 sc=MIN_I64)
|
||||
//See $LK,"EdRenumAsm","MN:EdRenumAsm"$ for an example.
|
||||
Bool unlock=DocLock(doc);
|
||||
U8 *dst;
|
||||
CDocEntry *doc_ce=doc->cur_entry,*original_cl=doc_ce,*doc_ne;
|
||||
CDocEntry *doc_ce=doc->cur_entry,*original_ce=doc_ce,*doc_ne;
|
||||
I64 cc=doc->cur_data_col,y=doc_ce->y,old_flags1,old_flags2,old_color;
|
||||
doc->recalc_start=doc_ce->last;
|
||||
if (sc!=MIN_I64) sc=sc.u32[0];
|
||||
@@ -244,20 +198,9 @@ public U0 EdCursorRight(CDoc *doc,I64 sc=MIN_I64)
|
||||
cc=doc_ce->min_col;
|
||||
} else {
|
||||
if (cc<doc_ce->max_col) {
|
||||
if (doc_ce->type_u8==DOCT_TEXT&&
|
||||
!(doc_ce->flags1&DOCEG1_DONT_EDIT) &&
|
||||
!(doc_ce->flags2&DOCEG2_DONT_EDIT) &&
|
||||
cc>doc_ce->min_col) {
|
||||
doc_ne=CAlloc(sizeof(CDocEntryBase),doc->mem_task);
|
||||
doc_ne->type=doc_ce->type;
|
||||
doc_ne->flags1=doc_ce->flags1;
|
||||
doc_ne->flags2=doc_ce->flags2;
|
||||
doc_ne->x=doc_ce->x;
|
||||
doc_ne->y=doc_ce->y;
|
||||
doc_ne->page_line_num=doc_ce->page_line_num;
|
||||
if (IsEditableText(doc_ce) && cc>doc_ce->min_col) {
|
||||
dst=doc_ce->tag+cc;
|
||||
doc_ne->tag=StrNew(dst,doc->mem_task);
|
||||
doc_ne->max_col=StrLen(dst);
|
||||
doc_ne=DocEntryNew(doc,doc_ce,StrNew(dst,doc->mem_task));
|
||||
*dst=0;
|
||||
doc_ce->max_col=cc;
|
||||
QueIns(doc_ne,doc_ce);
|
||||
@@ -268,28 +211,16 @@ public U0 EdCursorRight(CDoc *doc,I64 sc=MIN_I64)
|
||||
old_flags1=doc_ce->flags1;
|
||||
old_flags2=doc_ce->flags2;
|
||||
old_color=doc_ce->type;
|
||||
if (sc>=0) {
|
||||
if (sc&SCF_SHIFT)
|
||||
doc_ce->type|=DOCET_SELECTED;
|
||||
else
|
||||
doc_ce->type&=~DOCET_SELECTED;
|
||||
}
|
||||
if (doc_ce->type_u8==DOCT_TEXT&&
|
||||
!(doc_ce->flags1&DOCEG1_DONT_EDIT) &&
|
||||
!(doc_ce->flags2&DOCEG2_DONT_EDIT) &&
|
||||
cc<doc_ce->max_col) {
|
||||
doc_ne=CAlloc(sizeof(CDocEntryBase),doc->mem_task);
|
||||
if (sc>=0)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
if (IsEditableText(doc_ce) && cc<doc_ce->max_col) {
|
||||
dst=doc_ce->tag+cc;
|
||||
doc_ne=DocEntryNew(doc,doc_ce,StrNew(dst,doc->mem_task));
|
||||
*dst=0;
|
||||
doc_ne->type=DOCT_TEXT | old_color & -0x100;
|
||||
doc_ne->flags1=old_flags1;
|
||||
doc_ne->flags2=old_flags2;
|
||||
dst=doc_ce->tag+cc;
|
||||
doc_ne->tag=StrNew(dst,doc->mem_task);
|
||||
doc_ne->max_col=StrLen(dst);
|
||||
doc_ce->max_col=cc;
|
||||
*dst=0;
|
||||
doc_ne->x=doc_ce->x;
|
||||
doc_ne->y=doc_ce->y;
|
||||
doc_ne->page_line_num=doc_ce->page_line_num;
|
||||
QueIns(doc_ne,doc_ce);
|
||||
doc_ce=doc_ne;
|
||||
cc=doc_ce->min_col;
|
||||
@@ -299,30 +230,18 @@ public U0 EdCursorRight(CDoc *doc,I64 sc=MIN_I64)
|
||||
}
|
||||
} else {
|
||||
if (doc_ce!=doc) {
|
||||
if (cc<=doc_ce->min_col && sc>=0) {
|
||||
if (sc&SCF_SHIFT)
|
||||
doc_ce->type|=DOCET_SELECTED;
|
||||
else
|
||||
doc_ce->type&=~DOCET_SELECTED;
|
||||
}
|
||||
if (cc<=doc_ce->min_col && sc>=0)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
doc_ce=doc_ce->next;
|
||||
while (doc_ce!=doc && doc_ce->flags1 & (DOCEF1_SKIP|DOCEF1_HARD_SKIP|DOCEF1_FILTER_SKIP)) {
|
||||
if (sc>=0) {
|
||||
if (sc&SCF_SHIFT)
|
||||
doc_ce->type|=DOCET_SELECTED;
|
||||
else
|
||||
doc_ce->type&=~DOCET_SELECTED;
|
||||
}
|
||||
if (sc>=0)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
doc_ce=doc_ce->next;
|
||||
}
|
||||
cc=doc_ce->min_col;
|
||||
if (doc_ce->type_u8==DOCT_SOFT_NEW_LINE) {
|
||||
if (sc>=0) {
|
||||
if (sc&SCF_SHIFT)
|
||||
doc_ce->type|=DOCET_SELECTED;
|
||||
else
|
||||
doc_ce->type&=~DOCET_SELECTED;
|
||||
}
|
||||
if (sc>=0)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
doc_ce=doc_ce->next;
|
||||
cc=doc_ce->min_col;
|
||||
}
|
||||
@@ -331,7 +250,7 @@ public U0 EdCursorRight(CDoc *doc,I64 sc=MIN_I64)
|
||||
}
|
||||
doc->cur_data_col=cc;
|
||||
doc->cur_entry=doc_ce;
|
||||
if (doc_ce!=original_cl)
|
||||
if (doc_ce!=original_ce)
|
||||
DocFormFwd(doc);
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
@@ -356,21 +275,12 @@ public U0 EdLineUp(CDoc *doc,I64 sc=MIN_I64)
|
||||
doc->cur_data_col=0;
|
||||
}
|
||||
x=doc->x; y=doc->y;
|
||||
if (doc_ce->type_u8==DOCT_TEXT &&
|
||||
!(doc_ce->flags1&DOCEG1_DONT_EDIT) &&
|
||||
!(doc_ce->flags2&DOCEG2_DONT_EDIT)) {
|
||||
if (IsEditableText(doc_ce)) {
|
||||
if (doc_ce->min_col<doc->cur_data_col<doc_ce->max_col-1) {
|
||||
doc_ne=CAlloc(sizeof(CDocEntryBase),doc->mem_task);
|
||||
doc_ne->type=doc_ce->type;
|
||||
doc_ne->flags1=doc_ce->flags1;
|
||||
doc_ne->flags2=doc_ce->flags2;
|
||||
dst=doc_ce->tag+doc->cur_data_col;
|
||||
doc_ne->tag=StrNew(dst,doc->mem_task);
|
||||
doc_ne->max_col=StrLen(dst);
|
||||
doc_ne->y=doc_ce->y;
|
||||
doc_ne->x=doc_ce->x+doc->cur_data_col;
|
||||
doc_ne->page_line_num=doc_ce->page_line_num;
|
||||
doc_ne=DocEntryNew(doc,doc_ce,StrNew(dst,doc->mem_task));
|
||||
*dst=0;
|
||||
doc_ne->x=doc_ce->x+doc->cur_data_col;
|
||||
doc_ce->max_col=doc->cur_data_col;
|
||||
QueIns(doc_ne,doc_ce);
|
||||
} else
|
||||
@@ -379,48 +289,30 @@ public U0 EdLineUp(CDoc *doc,I64 sc=MIN_I64)
|
||||
} else
|
||||
if (doc_ce->last!=doc)
|
||||
doc_ce=doc_ce->last;
|
||||
if (sc>=0) {
|
||||
if (sc&SCF_SHIFT)
|
||||
doc_ce->type|=DOCET_SELECTED;
|
||||
else
|
||||
doc_ce->type&=~DOCET_SELECTED;
|
||||
}
|
||||
if (sc>=0)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
doc->cur_entry=doc_ce;
|
||||
DocFormBackward(doc);
|
||||
doc_ce=doc->cur_entry;
|
||||
while (doc_ce->last!=doc && (doc_ce->y>=y || doc_ce->flags1 & (DOCEF1_SKIP|DOCEF1_HARD_SKIP|DOCEF1_FILTER_SKIP))) {
|
||||
doc_ce=doc_ce->last;
|
||||
if (sc>=0) {
|
||||
if (sc&SCF_SHIFT)
|
||||
doc_ce->type|=DOCET_SELECTED;
|
||||
else
|
||||
doc_ce->type&=~DOCET_SELECTED;
|
||||
}
|
||||
if (sc>=0)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
}
|
||||
y=doc_ce->y;
|
||||
doc->y=y;
|
||||
while (doc_ce!=doc && (doc_ce->y>=y && doc_ce->x>=x || doc_ce->flags1 & (DOCEF1_SKIP|DOCEF1_HARD_SKIP|DOCEF1_FILTER_SKIP))) {
|
||||
if (sc>=0) {
|
||||
if (sc&SCF_SHIFT)
|
||||
doc_ce->type|=DOCET_SELECTED;
|
||||
else
|
||||
doc_ce->type&=~DOCET_SELECTED;
|
||||
}
|
||||
if (sc>=0)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
doc_ce=doc_ce->last;
|
||||
}
|
||||
|
||||
if (doc_ce==doc || doc_ce->y<y)
|
||||
doc_ce=doc_ce->next;
|
||||
else {
|
||||
if (doc_ce->type_u8!=DOCT_TEXT||
|
||||
doc_ce->flags1&DOCEG1_DONT_EDIT ||
|
||||
doc_ce->flags2&DOCEG2_DONT_EDIT) {
|
||||
if (sc>=0) {
|
||||
if (sc&SCF_SHIFT)
|
||||
doc_ce->type|=DOCET_SELECTED;
|
||||
else
|
||||
doc_ce->type&=~DOCET_SELECTED;
|
||||
}
|
||||
if (!IsEditableText(doc_ce)) {
|
||||
if (sc>=0)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
} else {
|
||||
if (doc_ce->next->x==x) {
|
||||
doc_ce=doc_ce->next;
|
||||
@@ -435,9 +327,7 @@ public U0 EdLineUp(CDoc *doc,I64 sc=MIN_I64)
|
||||
}
|
||||
if (Bt(doc_tag_types,doc_ce->type_u8)) {
|
||||
doc->cur_data_col=x-doc_ce->x;
|
||||
if (doc_ce->type_u8==DOCT_TEXT&&
|
||||
!(doc_ce->flags1&DOCEG1_DONT_EDIT) &&
|
||||
!(doc_ce->flags2&DOCEG2_DONT_EDIT)) {
|
||||
if (IsEditableText(doc_ce)) {
|
||||
if (doc->cur_data_col>doc_ce->max_col)
|
||||
doc->cur_data_col=doc_ce->max_col;
|
||||
} else {
|
||||
@@ -454,27 +344,18 @@ public U0 EdLineUp(CDoc *doc,I64 sc=MIN_I64)
|
||||
} else
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
}
|
||||
if (doc_ce->type_u8==DOCT_TEXT &&
|
||||
!(doc_ce->flags1&DOCEG1_DONT_EDIT) &&
|
||||
!(doc_ce->flags2&DOCEG2_DONT_EDIT) && doc_ce->x<x) {
|
||||
if (IsEditableText(doc_ce) && doc_ce->x<x) {
|
||||
if (doc->cur_data_col<doc_ce->max_col-1) {
|
||||
doc_ne=CAlloc(sizeof(CDocEntryBase),doc->mem_task);
|
||||
doc_ne->type=doc_ce->type;
|
||||
doc_ne->flags1=doc_ce->flags1;
|
||||
doc_ne->flags2=doc_ce->flags2;
|
||||
dst=doc_ce->tag+doc->cur_data_col;
|
||||
doc_ne=DocEntryNew(doc,doc_ce,StrNew(dst,doc->mem_task));
|
||||
*dst=0;
|
||||
if (sc>=0) {
|
||||
if (sc&SCF_SHIFT)
|
||||
doc_ne->type=doc_ce->type | DOCET_SELECTED;
|
||||
else
|
||||
doc_ne->type=doc_ce->type & ~DOCET_SELECTED;
|
||||
}
|
||||
dst=doc_ce->tag+doc->cur_data_col;
|
||||
doc_ne->tag=StrNew(dst,doc->mem_task);
|
||||
doc_ne->max_col=StrLen(dst);
|
||||
doc_ne->page_line_num=doc_ce->page_line_num;
|
||||
doc_ne->y=doc_ce->y;
|
||||
doc_ne->x=doc_ce->x+doc->cur_data_col;
|
||||
*dst=0;
|
||||
doc_ce->max_col=doc->cur_data_col;
|
||||
QueIns(doc_ne,doc_ce);
|
||||
doc_ce=doc_ne;
|
||||
@@ -511,27 +392,18 @@ public U0 EdLineDown(CDoc *doc,I64 sc=MIN_I64)
|
||||
}
|
||||
doc->recalc_start=doc_ce->last;
|
||||
x=doc->x; y=doc->y;
|
||||
if (doc_ce->type_u8==DOCT_TEXT &&
|
||||
!(doc_ce->flags1&DOCEG1_DONT_EDIT)&&
|
||||
!(doc_ce->flags2&DOCEG2_DONT_EDIT)) {
|
||||
if (IsEditableText(doc_ce)) {
|
||||
if (doc->cur_data_col>doc_ce->min_col && doc->cur_data_col<doc_ce->max_col-1) {
|
||||
doc_ne=CAlloc(sizeof(CDocEntryBase),doc->mem_task);
|
||||
doc_ne->type=doc_ce->type;
|
||||
doc_ne->flags1=doc_ce->flags1;
|
||||
doc_ne->flags2=doc_ce->flags2;
|
||||
dst=doc_ce->tag+doc->cur_data_col;
|
||||
doc_ne=DocEntryNew(doc,doc_ce,StrNew(dst,doc->mem_task));
|
||||
*dst=0;
|
||||
if (sc>=0) {
|
||||
if (sc&SCF_SHIFT)
|
||||
doc_ne->type=doc_ce->type | DOCET_SELECTED;
|
||||
else
|
||||
doc_ne->type=doc_ce->type & ~DOCET_SELECTED;
|
||||
}
|
||||
dst=doc_ce->tag+doc->cur_data_col;
|
||||
doc_ne->tag=StrNew(dst,doc->mem_task);
|
||||
doc_ne->max_col=StrLen(dst);
|
||||
doc_ne->page_line_num=doc_ce->page_line_num;
|
||||
doc_ne->y=doc_ce->y;
|
||||
doc_ne->x=doc_ce->x+doc->cur_data_col;
|
||||
*dst=0;
|
||||
doc_ce->max_col=doc->cur_data_col;
|
||||
QueIns(doc_ne,doc_ce);
|
||||
doc_ce=doc_ne;
|
||||
@@ -557,27 +429,19 @@ public U0 EdLineDown(CDoc *doc,I64 sc=MIN_I64)
|
||||
DocFormBackward(doc);
|
||||
doc_ce=doc->cur_entry;
|
||||
}
|
||||
while (doc_ce2!=doc && (doc_ce2!=doc_ce || doc_ce->type_u8==DOCT_TEXT &&
|
||||
!(doc_ce->flags1&DOCEG1_DONT_EDIT) &&
|
||||
!(doc_ce->flags2&DOCEG2_DONT_EDIT))) {
|
||||
while (doc_ce2!=doc && (doc_ce2!=doc_ce || IsEditableText(doc_ce))) {
|
||||
if (doc_ce2->y<y || doc_ce2->x<x || doc_ce2->flags1 & (DOCEF1_SKIP|DOCEF1_HARD_SKIP|DOCEF1_FILTER_SKIP) ||
|
||||
doc_ce2->x==x && !doc_ce2->max_col &&
|
||||
Bt(doc_nontag_invisible_types,doc_ce2->type_u8)) {
|
||||
if (sc>=0) {
|
||||
if (sc&SCF_SHIFT)
|
||||
doc_ce2->type|=DOCET_SELECTED;
|
||||
else
|
||||
doc_ce2->type&=~DOCET_SELECTED;
|
||||
}
|
||||
if (sc>=0)
|
||||
BEqu(&doc_ce2->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
}
|
||||
if (doc_ce2==doc_ce) break;
|
||||
doc_ce2=doc_ce2->next;
|
||||
}
|
||||
if (Bt(doc_tag_types,doc_ce->type_u8)) {
|
||||
doc->cur_data_col=x-doc_ce->x;
|
||||
if (doc_ce->type_u8==DOCT_TEXT&&
|
||||
!(doc_ce->flags1&DOCEG1_DONT_EDIT) &&
|
||||
!(doc_ce->flags2&DOCEG2_DONT_EDIT)) {
|
||||
if (IsEditableText(doc_ce)) {
|
||||
if (doc->cur_data_col>doc_ce->max_col)
|
||||
doc->cur_data_col=doc_ce->max_col;
|
||||
} else {
|
||||
@@ -588,21 +452,15 @@ public U0 EdLineDown(CDoc *doc,I64 sc=MIN_I64)
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
} else
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
if (doc_ce->type_u8==DOCT_TEXT&&
|
||||
!(doc_ce->flags1&DOCEG1_DONT_EDIT) &&
|
||||
!(doc_ce->flags2&DOCEG2_DONT_EDIT)) {
|
||||
if (IsEditableText(doc_ce)) {
|
||||
if (doc_ce->min_col<doc->cur_data_col<doc_ce->max_col-1) {
|
||||
doc_ne=CAlloc(sizeof(CDocEntryBase),doc->mem_task);
|
||||
dst=doc_ce->tag+doc->cur_data_col;
|
||||
doc_ne=DocEntryNew(doc,doc_ce,StrNew(dst,doc->mem_task));
|
||||
*dst=0;
|
||||
doc_ne->type=DOCT_TEXT | old_color & -0x100;
|
||||
doc_ne->flags1=old_flags1;
|
||||
doc_ne->flags2=old_flags2;
|
||||
dst=doc_ce->tag+doc->cur_data_col;
|
||||
doc_ne->tag=StrNew(dst,doc->mem_task);
|
||||
doc_ne->max_col=StrLen(dst);
|
||||
*dst=0;
|
||||
doc_ce->max_col=doc->cur_data_col;
|
||||
doc_ne->y=doc_ce->y;
|
||||
doc_ne->page_line_num=doc_ce->page_line_num;
|
||||
doc_ne->x=doc_ce->x+doc->cur_data_col;
|
||||
QueIns(doc_ne,doc_ce);
|
||||
doc_ce=doc_ne;
|
||||
@@ -613,12 +471,8 @@ public U0 EdLineDown(CDoc *doc,I64 sc=MIN_I64)
|
||||
DocFormFwd(doc);
|
||||
if (!(doc->flags & DOCF_FORM))
|
||||
while (doc_ce!=doc && doc_ce!=doc->cur_entry) {
|
||||
if (sc>=0) {
|
||||
if (sc&SCF_SHIFT)
|
||||
doc_ce->type|=DOCET_SELECTED;
|
||||
else
|
||||
doc_ce->type&=~DOCET_SELECTED;
|
||||
}
|
||||
if (sc>=0)
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
doc_ce=doc_ce->next;
|
||||
}
|
||||
doc->x=doc->cur_entry->x+doc->cur_data_col;
|
||||
@@ -637,9 +491,7 @@ U0 EdDelChar(CDoc *doc)
|
||||
return;
|
||||
} else
|
||||
doc->recalc_start=doc_ce->last;
|
||||
if (doc_ce->max_col!=0 && (doc_ce->type_u8==DOCT_TEXT&&
|
||||
!(doc_ce->flags1&DOCEG1_DONT_EDIT) &&
|
||||
!(doc_ce->flags2&DOCEG2_DONT_EDIT)|| doc_ce->type_u8==DOCT_DATA)) {
|
||||
if (doc_ce->max_col!=0 && (IsEditableText(doc_ce)||doc_ce->type_u8==DOCT_DATA)) {
|
||||
if (doc_ce->type_u8==DOCT_DATA) {
|
||||
if (doc_ce->flags1 & DOCEF1_HAS_TERMINATOR && doc->cur_data_col==doc_ce->max_col-1) {
|
||||
if (unlock)
|
||||
@@ -703,7 +555,7 @@ U0 EdInsChar(I64 ch,I64 sc,CDoc *doc)
|
||||
goto ic_cont;
|
||||
} else {
|
||||
doc->dollar_buf[doc->dollar_buf_ptr]=0;
|
||||
DocPutS(doc,doc->dollar_buf);
|
||||
DocPrint(doc,doc->dollar_buf);
|
||||
doc->flags&=~DOCF_IN_DOLLAR;
|
||||
doc->dollar_buf_ptr=0;
|
||||
goto ic_done;
|
||||
@@ -761,9 +613,7 @@ ic_cont:
|
||||
if (doc->flags & DOCF_OVERSTRIKE) {
|
||||
if (Bt(displayable_chars_bitmap,ch)) {
|
||||
ic_overstrike_char:
|
||||
if (doc_ce->type_u8==DOCT_TEXT&&
|
||||
!(doc_ce->flags1&DOCEG1_DONT_EDIT) &&
|
||||
!(doc_ce->flags2&DOCEG2_DONT_EDIT)) {
|
||||
if (IsEditableText(doc_ce)) {
|
||||
if (doc->cur_data_col<doc_ce->max_col) {
|
||||
if (doc_ce->tag[doc->cur_data_col]) {
|
||||
doc_ce->tag[doc->cur_data_col++]=ch;
|
||||
@@ -794,13 +644,10 @@ ic_overstrike_char:
|
||||
b=MAlloc(2,doc->mem_task);
|
||||
*b=ch;
|
||||
b[1]=0;
|
||||
doc_ne=CAlloc(sizeof(CDocEntryBase),doc->mem_task);
|
||||
doc_ne=DocEntryNew(doc,doc_ce,b);
|
||||
doc_ne->type=DOCT_TEXT | doc->settings_root.dft_text_attr << 8;
|
||||
doc_ne->tag=b;
|
||||
doc_ne->max_col=1;
|
||||
doc_ne->x=doc_ce->x;
|
||||
doc_ne->y=doc_ce->y;
|
||||
doc_ne->page_line_num=doc_ce->page_line_num;
|
||||
doc_ne->flags1=0;
|
||||
doc_ne->flags2=0;
|
||||
QueIns(doc_ne,doc_ce->last);
|
||||
} else if (ch=='\n') {
|
||||
while (doc->cur_entry->next!=doc && doc->cur_entry->y==y)
|
||||
@@ -846,9 +693,7 @@ ic_form_tab:
|
||||
b[i]=b[i-1];
|
||||
b[doc->cur_data_col++]=ch;
|
||||
}
|
||||
} else if (doc_ce->type_u8==DOCT_TEXT&&
|
||||
!(doc_ce->flags1&DOCEG1_DONT_EDIT) &&
|
||||
!(doc_ce->flags2&DOCEG2_DONT_EDIT)) {
|
||||
} else if (IsEditableText(doc_ce)) {
|
||||
dst=b=MAlloc(doc_ce->max_col+2,doc->mem_task);
|
||||
src=doc_ce->tag;
|
||||
i=doc->cur_data_col;
|
||||
@@ -864,13 +709,11 @@ ic_form_tab:
|
||||
b=MAlloc(2,doc->mem_task);
|
||||
*b=ch;
|
||||
b[1]=0;
|
||||
doc_ne=CAlloc(sizeof(CDocEntryBase),doc->mem_task);
|
||||
doc_ne=DocEntryNew(doc,doc_ce,b);
|
||||
doc_ne->type=DOCT_TEXT | doc->settings_root.dft_text_attr << 8;
|
||||
doc_ne->tag=b;
|
||||
doc_ne->max_col=1;
|
||||
doc_ne->flags1=0;
|
||||
doc_ne->flags2=0;
|
||||
doc_ne->x=doc_ce->x+1;
|
||||
doc_ne->y=doc_ce->y;
|
||||
doc_ne->page_line_num=doc_ce->page_line_num;
|
||||
QueIns(doc_ne,doc_ce->last);
|
||||
}
|
||||
}
|
||||
@@ -879,7 +722,7 @@ ic_done:
|
||||
DocRemSoftNewLines(doc,doc->cur_entry);
|
||||
if (doc->cur_entry->flags1 & DOCEF1_UPDATE_DATA) {
|
||||
if (doc->cur_entry->type_u8==DOCT_DATA || doc->cur_entry->type_u8==DOCT_CHECK_BOX)
|
||||
DocDataGet(doc->cur_entry);
|
||||
DocDataScan(doc->cur_entry);
|
||||
}
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
@@ -912,13 +755,13 @@ public U0 EdFindNext(CDoc *doc)
|
||||
Bool unlock=DocLock(doc);
|
||||
U8 *ptr,*ptr2,*ptr3;
|
||||
CDocEntry *doc_ce=doc->cur_entry,*doc_e=doc_ce;
|
||||
I64 ss_flags;
|
||||
I64 sf_flags;
|
||||
if (doc->find_replace->match_case)
|
||||
ss_flags=0;
|
||||
sf_flags=0;
|
||||
else
|
||||
ss_flags=SRF_IGNORE_CASE;
|
||||
sf_flags=SFF_IGNORE_CASE;
|
||||
if (doc->find_replace->whole_labels)
|
||||
ss_flags|=SRG_WHOLE_LABELS;
|
||||
sf_flags|=SFG_WHOLE_LABELS;
|
||||
do {
|
||||
if (doc_e!=doc) {
|
||||
if (Bt(doc_tag_types,doc_e->type_u8)&&
|
||||
@@ -934,7 +777,7 @@ public U0 EdFindNext(CDoc *doc)
|
||||
ptr=doc_ce->tag+doc_ce->min_col;
|
||||
} else
|
||||
ptr=doc_e->tag;
|
||||
if (ptr=SearchStr(ptr,doc->find_replace->find_text,ss_flags)) {
|
||||
if (ptr=StrFind(doc->find_replace->find_text,ptr,sf_flags)) {
|
||||
doc->cur_entry=doc_e;
|
||||
doc->cur_data_col=ptr-doc_e->tag;
|
||||
if (doc->cur_data_col>=doc_e->max_col)
|
||||
@@ -953,7 +796,7 @@ public U0 EdFindNext(CDoc *doc)
|
||||
ptr3=doc_ce->tag+doc->cur_data_col;
|
||||
else
|
||||
ptr3=doc_e->tag+doc_e->max_col;
|
||||
while (ptr=SearchStr(ptr,doc->find_replace->find_text,ss_flags)) {
|
||||
while (ptr=StrFind(doc->find_replace->find_text,ptr,sf_flags)) {
|
||||
if (ptr>=ptr3)
|
||||
break;
|
||||
ptr2=ptr++;
|
||||
@@ -989,10 +832,7 @@ public U0 EdSelectAll(CDoc *doc,Bool select)
|
||||
Bool unlock=DocLock(doc);
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
if (select)
|
||||
doc_e->type|=DOCET_SELECTED;
|
||||
else
|
||||
doc_e->type&=~DOCET_SELECTED;
|
||||
BEqu(&doc_e->type,DOCEt_SELECTED,select);
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
if (unlock)
|
||||
@@ -1005,7 +845,7 @@ public Bool EdFindPaired(CDoc *doc,U8 plus,U8 minus,Bool fwd,Bool abort_on_dbl_c
|
||||
Bool unlock=DocLock(doc),result=FALSE;
|
||||
U8 ch,*ptr,original_col=doc->cur_data_col;
|
||||
I64 levels=0,colons=0;
|
||||
CDocEntry *doc_ce=doc->cur_entry,*doc_e=doc_ce,*original_cl=doc_ce;
|
||||
CDocEntry *doc_ce=doc->cur_entry,*doc_e=doc_ce,*original_ce=doc_ce;
|
||||
if (abort_on_dbl_colon && EdCurU8(doc)==':')
|
||||
colons=1;
|
||||
else
|
||||
@@ -1039,7 +879,7 @@ public Bool EdFindPaired(CDoc *doc,U8 plus,U8 minus,Bool fwd,Bool abort_on_dbl_c
|
||||
if (!levels--) {
|
||||
doc->cur_entry=doc_e;
|
||||
doc->cur_data_col=ptr-doc_e->tag-1;
|
||||
result=doc->cur_entry!=original_cl || doc->cur_data_col!=original_col;
|
||||
result=doc->cur_entry!=original_ce || doc->cur_data_col!=original_col;
|
||||
goto pa_done;
|
||||
}
|
||||
}
|
||||
@@ -1070,7 +910,7 @@ public Bool EdFindPaired(CDoc *doc,U8 plus,U8 minus,Bool fwd,Bool abort_on_dbl_c
|
||||
if (!levels--) {
|
||||
doc->cur_entry=doc_e;
|
||||
doc->cur_data_col=ptr-doc_e->tag+1;
|
||||
result=doc->cur_entry!=original_cl || doc->cur_data_col!=original_col;
|
||||
result=doc->cur_entry!=original_ce || doc->cur_data_col!=original_col;
|
||||
goto pa_done;
|
||||
}
|
||||
}
|
||||
@@ -1195,28 +1035,28 @@ U0 EdUndoFilter(CDoc *doc)
|
||||
I64 EdFindReplace(CDoc *doc)
|
||||
{
|
||||
Bool first=TRUE,found,unlock;
|
||||
I64 cmd,i,j,plen,rlen,dlen,result=-1,ss_flags;
|
||||
I64 cmd,i,j,plen,rlen,dlen,result=-1,sf_flags;
|
||||
U8 *src,*dst,*dst2;
|
||||
CDocEntry *doc_ce=doc->cur_entry,*doc_e;
|
||||
if (doc->find_replace->pmt)
|
||||
cmd=RSAC_REPLACE;
|
||||
else
|
||||
cmd=RSAC_ALL;
|
||||
if (!doc->find_replace->pmt || DocFormDo(doc->find_replace,"CEdFindText")) {
|
||||
if (!doc->find_replace->pmt || DocFormDo(doc->find_replace)) {
|
||||
result=0;
|
||||
unlock=DocLock(doc);
|
||||
if (doc->find_replace->match_case || doc->find_replace->local_var)
|
||||
ss_flags=0;
|
||||
sf_flags=0;
|
||||
else
|
||||
ss_flags=SRF_IGNORE_CASE;
|
||||
sf_flags=SFF_IGNORE_CASE;
|
||||
if (doc->find_replace->whole_labels || doc->find_replace->local_var)
|
||||
ss_flags|=SRG_WHOLE_LABELS;
|
||||
sf_flags|=SFG_WHOLE_LABELS;
|
||||
|
||||
if (i=doc->find_replace->filter_lines) {
|
||||
doc_ce=doc->root.next;
|
||||
while (doc_ce!=doc) {
|
||||
if (doc_ce->type_u8==DOCT_TEXT && !(doc_ce->flags1&(DOCEF1_TAG_CB|DOCEF1_DEFINE|DOCEF1_HARD_SKIP|DOCEF1_FILTER_SKIP))&&
|
||||
SearchStr(doc_ce->tag,doc->find_replace->find_text,ss_flags)) {
|
||||
StrFind(doc->find_replace->find_text,doc_ce->tag,sf_flags)) {
|
||||
doc_ce->type|=DOCET_SELECTED;
|
||||
result++;
|
||||
} else
|
||||
@@ -1281,7 +1121,7 @@ I64 EdFindReplace(CDoc *doc)
|
||||
(doc_e->type & DOCET_SELECTED || !doc->find_replace->scan_selected_text&&!doc->find_replace->local_var)) {
|
||||
src=doc_e->tag;
|
||||
while (src) {
|
||||
src=SearchStr(src,doc->find_replace->find_text,ss_flags);
|
||||
src=StrFind(doc->find_replace->find_text,src,sf_flags);
|
||||
if (src) {
|
||||
doc->cur_data_col=src-doc_e->tag;
|
||||
doc->cur_entry=doc_e;
|
||||
@@ -1388,7 +1228,7 @@ public U0 EdGoToLine(CDoc *doc)
|
||||
{
|
||||
CEdLineGoTo gtl;
|
||||
gtl.line=1;
|
||||
if (DocFormDo(>l,"CEdLineGoTo"))
|
||||
if (DocFormDo(>l))
|
||||
DocLineNumGoTo(doc,gtl.line);
|
||||
}
|
||||
|
||||
@@ -1458,8 +1298,8 @@ U0 DocEntryToggle(CDoc *doc)
|
||||
doc_ce->tag[j+1]=ch;
|
||||
StrCpy(doc_ce->tag+i,doc_ce->tag+j+1);
|
||||
doc->cur_data_col=i;
|
||||
st2=MSPrintF("%q",st);
|
||||
if (doc_ce=DocPutS(doc,st2)) {
|
||||
st2=MPrint("%q",st);
|
||||
if (doc_ce=DocPrint(doc,st2)) {
|
||||
doc->cur_entry=doc_ce;
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
}
|
||||
@@ -1469,7 +1309,7 @@ U0 DocEntryToggle(CDoc *doc)
|
||||
} else {
|
||||
st=Doc2PlainText(doc,doc_ce);
|
||||
DocEntryDel(doc,doc_ce);
|
||||
DocPrintF(doc,"$$$$%Q$$$$",st);
|
||||
DocPrint(doc,"$$$$%Q$$$$",st);
|
||||
}
|
||||
DocRecalc(doc);
|
||||
}
|
||||
@@ -1614,12 +1454,12 @@ public U0 DocPutKey(CDoc *doc,I64 ch,I64 sc)
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Dollar/Indent Out");
|
||||
else
|
||||
DocPutS(doc,"$$ID,-2$$");
|
||||
DocPrint(doc,"$$ID,-2$$");
|
||||
} else {
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Dollar/Indent In");
|
||||
else
|
||||
DocPutS(doc,"$$ID,2$$");
|
||||
DocPrint(doc,"$$ID,2$$");
|
||||
}
|
||||
break;
|
||||
case '\n':
|
||||
@@ -1635,9 +1475,9 @@ public U0 DocPutKey(CDoc *doc,I64 ch,I64 sc)
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Dollar/Toggle Blinking Text");
|
||||
else if (sc&SCF_SHIFT)
|
||||
DocPutS(doc,"$$BK,0$$");
|
||||
DocPrint(doc,"$$BK,0$$");
|
||||
else
|
||||
DocPutS(doc,"$$BK,1$$");
|
||||
DocPrint(doc,"$$BK,1$$");
|
||||
break;
|
||||
case CH_CTRLL:
|
||||
if (sc&SCF_KEY_DESC) {
|
||||
@@ -1689,21 +1529,21 @@ public U0 DocPutKey(CDoc *doc,I64 ch,I64 sc)
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Dollar/Toggle Super or Sub script");
|
||||
else {
|
||||
DocPutS(doc,"$$SY,0$$");
|
||||
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");
|
||||
else {
|
||||
DocPutS(doc,"$$SY,3$$");
|
||||
DocPrint(doc,"$$SY,3$$");
|
||||
doc->flags|=DOCF_SUBSCRIPT_MODE;
|
||||
}
|
||||
} else {
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Dollar/Toggle Superscript");
|
||||
else {
|
||||
DocPutS(doc,"$$SY,-3$$");
|
||||
DocPrint(doc,"$$SY,-3$$");
|
||||
doc->flags|=DOCF_SUPERSCRIPT_MODE;
|
||||
}
|
||||
}
|
||||
@@ -1759,9 +1599,9 @@ public U0 DocPutKey(CDoc *doc,I64 ch,I64 sc)
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Dollar/Toggle Underline");
|
||||
else if (sc&SCF_SHIFT)
|
||||
DocPutS(doc,"$$UL,0$$");
|
||||
DocPrint(doc,"$$UL,0$$");
|
||||
else
|
||||
DocPutS(doc,"$$UL,1$$");
|
||||
DocPrint(doc,"$$UL,1$$");
|
||||
break;
|
||||
case CH_CTRLV:
|
||||
if (sc&SCF_KEY_DESC)
|
||||
@@ -1773,9 +1613,9 @@ public U0 DocPutKey(CDoc *doc,I64 ch,I64 sc)
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Dollar/Toggle Word Wrap");
|
||||
else if (sc&SCF_SHIFT)
|
||||
DocPutS(doc,"$$WW,0$$");
|
||||
DocPrint(doc,"$$WW,0$$");
|
||||
else
|
||||
DocPutS(doc,"$$WW,1$$");
|
||||
DocPrint(doc,"$$WW,1$$");
|
||||
break;
|
||||
case CH_CTRLX:
|
||||
if (sc&SCF_KEY_DESC)
|
||||
@@ -1793,9 +1633,9 @@ public U0 DocPutKey(CDoc *doc,I64 ch,I64 sc)
|
||||
if (sc&SCF_KEY_DESC)
|
||||
SetKeyDesc("Dollar/Toggle Inverted Text");
|
||||
else if (sc&SCF_SHIFT)
|
||||
DocPutS(doc,"$$IV,0$$");
|
||||
DocPrint(doc,"$$IV,0$$");
|
||||
else
|
||||
DocPutS(doc,"$$IV,1$$");
|
||||
DocPrint(doc,"$$IV,1$$");
|
||||
break;
|
||||
case '0'...'9':
|
||||
if (!(sc&SCF_ALT)) {
|
||||
@@ -2045,10 +1885,7 @@ public U0 DocPutKey(CDoc *doc,I64 ch,I64 sc)
|
||||
SetKeyDesc("Edit/GoTo Doc End");
|
||||
} else {
|
||||
while (doc_ce!=doc) {
|
||||
if (sc&SCF_SHIFT)
|
||||
doc_ce->type|=DOCET_SELECTED;
|
||||
else
|
||||
doc_ce->type&=~DOCET_SELECTED;
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
doc_ce=doc->cur_entry=doc_ce->next;
|
||||
}
|
||||
doc->cur_data_col=doc_ce->min_col;
|
||||
@@ -2074,10 +1911,7 @@ public U0 DocPutKey(CDoc *doc,I64 ch,I64 sc)
|
||||
} else {
|
||||
if (doc_ce==doc) doc_ce=doc_ce->last;
|
||||
while (doc_ce!=doc) {
|
||||
if (sc&SCF_SHIFT)
|
||||
doc_ce->type|=DOCET_SELECTED;
|
||||
else
|
||||
doc_ce->type&=~DOCET_SELECTED;
|
||||
BEqu(&doc_ce->type,DOCEt_SELECTED,sc&SCF_SHIFT);
|
||||
doc_ce=doc->cur_entry=doc_ce->last;
|
||||
}
|
||||
doc_ce=doc->cur_entry=doc->root.next;
|
||||
@@ -2252,9 +2086,7 @@ public U0 DocPutSPartial(CDoc *doc,U8 *st)
|
||||
doc_ce=doc->cur_entry;
|
||||
doc->recalc_start=doc_ce->last;
|
||||
j=ptr-ptr2;
|
||||
if (doc_ce->type_u8==DOCT_TEXT &&
|
||||
!(doc_ce->flags1&DOCEG1_DONT_EDIT) &&
|
||||
!(doc_ce->flags2&DOCEG2_DONT_EDIT)) {
|
||||
if (IsEditableText(doc_ce)) {
|
||||
dst=b=MAlloc(doc_ce->max_col+j+1,doc->mem_task);
|
||||
src=doc_ce->tag;
|
||||
i=doc->cur_data_col;
|
||||
@@ -2268,14 +2100,12 @@ public U0 DocPutSPartial(CDoc *doc,U8 *st)
|
||||
Free(doc_ce->tag);
|
||||
doc_ce->tag=b;
|
||||
} else {
|
||||
doc_ne=CAlloc(sizeof(CDocEntryBase),doc->mem_task);
|
||||
dst=MAlloc(j+1,doc->mem_task);
|
||||
MemCpy(dst,ptr2,j+1);
|
||||
doc_ne=DocEntryNew(doc,doc_ce,dst);
|
||||
doc_ne->type=DOCT_TEXT | doc->settings_root.dft_text_attr << 8;
|
||||
doc_ne->tag=MAlloc(j+1,doc->mem_task);
|
||||
MemCpy(doc_ne->tag,ptr2,j+1);
|
||||
doc_ne->x=doc_ce->x;
|
||||
doc_ne->y=doc_ce->y;
|
||||
doc_ne->max_col=j;
|
||||
doc_ne->page_line_num=doc_ce->page_line_num;
|
||||
doc_ne->flags1=0;
|
||||
doc_ne->flags2=0;
|
||||
QueIns(doc_ne,doc_ce->last);
|
||||
doc->cur_entry=doc_ne;
|
||||
doc->cur_data_col=StrLen(ptr2);
|
||||
@@ -2394,7 +2224,7 @@ public I64 EdLinkCvt(U8 *link_st,U8 **_filename=NULL,U8 **_pattern=NULL,
|
||||
if (StrLen(st)>3 && st[2]==':') {
|
||||
st[2]=0;
|
||||
filename2=st+3;
|
||||
switch (result=DefineMatch(st,"ST_LINK_TYPES",LEF_IGNORE_CASE)) {
|
||||
switch (result=DefineMatch(st,"ST_LINK_TYPES",LMF_IGNORE_CASE)) {
|
||||
case LK_MAN_PAGE:
|
||||
if (temph=HashFind(filename2,Fs->hash_table,HTG_SRC_SYM)) {
|
||||
if (temph->type&HTT_DEFINE_STR && temph(CHashDefineStr *)->caller) {
|
||||
@@ -2414,7 +2244,7 @@ public I64 EdLinkCvt(U8 *link_st,U8 **_filename=NULL,U8 **_pattern=NULL,
|
||||
i=A2I(ptr+1);
|
||||
} else
|
||||
i=DFT_ADDR_LINK_BIN_SIZE;
|
||||
if (ptr=SrcEdLink(ExePrintF("%s;",filename2),i)) {
|
||||
if (ptr=SrcEdLink(ExePrint("%s;",filename2),i)) {
|
||||
result=EdLinkCvt(ptr,&filename,&pattern,&num,ed_flags);
|
||||
Free(ptr);
|
||||
} else
|
||||
@@ -2437,7 +2267,7 @@ public I64 EdLinkCvt(U8 *link_st,U8 **_filename=NULL,U8 **_pattern=NULL,
|
||||
*ptr=0;
|
||||
pattern=StrNew(ptr+1);
|
||||
}
|
||||
i=DefineMatch(filename2,"ST_BIBLE_BOOKS",LEF_IGNORE_CASE);
|
||||
i=DefineMatch(filename2,"ST_BIBLE_BOOKS",LMF_IGNORE_CASE);
|
||||
if (i<0)
|
||||
result=-1;
|
||||
else {
|
||||
|
||||
@@ -7,7 +7,7 @@ public U0 DocLoad(CDoc *doc,U8 *src2,I64 size)
|
||||
CDocBin *tempb;
|
||||
doc->find_replace->filter_lines=0;
|
||||
if (src2) {
|
||||
DocPutS(doc,src2);
|
||||
DocPutS(doc,src2); //Too big $LK,"DocPrint","MN:DocPrint"$() is wasteful.
|
||||
src=src2+StrLen(src2)+1;
|
||||
i=size-(offset(CDocBin.data)-offset(CDocBin.start));
|
||||
while (src<=src2+i) {
|
||||
@@ -57,7 +57,7 @@ public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
|
||||
I64 i,cnt;
|
||||
U8 *st,*result,*dst,*src,ch;
|
||||
|
||||
if (doc->flags&DOCF_NO_CURSOR)
|
||||
if (doc->flags&DOCF_NO_CURSOR || doc->root.next==doc)
|
||||
cnt=1; //terminator
|
||||
else
|
||||
cnt=2; //cursor + terminator
|
||||
@@ -143,7 +143,7 @@ public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
|
||||
break;
|
||||
default:
|
||||
if (doc_e->type_u8!=DOCT_SOFT_NEW_LINE &&
|
||||
doc_e->type_u8!=DOCT_CURSOR &&
|
||||
doc_e->type_u8!=DOCT_CURSOR && //(Cursor is set by cur_entry)
|
||||
doc_e->type_u8!=DOCT_BPT) {
|
||||
*dst++='$$';
|
||||
st=Doc2PlainText(doc,doc_e);
|
||||
@@ -156,7 +156,14 @@ public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (doc->cur_entry==doc && doc->root.next!=doc && !(doc->flags&DOCF_NO_CURSOR))
|
||||
*dst++=CH_CURSOR;
|
||||
*dst++=0;
|
||||
if (*result==CH_CURSOR) {
|
||||
MemCpy(result,result+1,dst-result-1);
|
||||
cnt--;
|
||||
dst--;
|
||||
}
|
||||
b=doc->bin_root.next;
|
||||
if (b!=&doc->bin_root) {
|
||||
do {
|
||||
@@ -169,7 +176,7 @@ public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
|
||||
b=b->next;
|
||||
} while (b!=&doc->bin_root);
|
||||
} else
|
||||
cnt--;
|
||||
cnt--; //No terminator
|
||||
if (_size) *_size=cnt;
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
@@ -181,7 +188,7 @@ public U0 DocWrite(CDoc *doc,Bool prompt=FALSE)
|
||||
I64 size;
|
||||
U8 *buf=DocSave(doc,&size);
|
||||
if (prompt) {
|
||||
if (DocFormDo(&doc->filename,"CEdFileName"))
|
||||
if (DocFormDo(&doc->filename))
|
||||
FileWrite(doc->filename.name,buf,size,0,doc->file_attr);
|
||||
} else
|
||||
FileWrite(doc->filename.name,buf,size,0,doc->file_attr);
|
||||
@@ -194,29 +201,22 @@ public U0 DocInsDoc(CDoc *doc,CDoc *doc2)
|
||||
U8 *dst;
|
||||
Bool unlock_doc=DocLock(doc),
|
||||
unlock_doc2=DocLock(doc2);
|
||||
CDocEntry *doc_ne,*doc_e=doc2->root.next;
|
||||
CDocEntry *doc_ne,*doc_e=doc2->root.next,*doc_ce;
|
||||
DocRemSoftNewLines(doc,NULL);
|
||||
if (doc->cur_entry->type_u8==DOCT_TEXT &&
|
||||
doc->cur_data_col>doc->cur_entry->min_col) {
|
||||
if (doc->cur_data_col<doc->cur_entry->max_col) {
|
||||
doc_ne=CAlloc(sizeof(CDocEntryBase),doc->mem_task);
|
||||
doc_ne->type=DOCT_TEXT | doc->cur_entry->type & 0xFFFFFF00;
|
||||
doc_ne->flags1=doc->cur_entry->flags1;
|
||||
doc_ne->flags2=doc->cur_entry->flags2;
|
||||
doc_ne->x=doc->cur_entry->x;
|
||||
doc_ne->y=doc->cur_entry->y;
|
||||
doc_ne->page_line_num=doc->cur_entry->page_line_num;
|
||||
dst=doc->cur_entry->tag+doc->cur_data_col;
|
||||
doc_ne->tag=StrNew(dst,doc->mem_task);
|
||||
doc_ne->max_col=StrLen(dst);
|
||||
doc_ce=doc->cur_entry;
|
||||
if (doc_ce->type_u8==DOCT_TEXT && doc->cur_data_col>doc_ce->min_col) {
|
||||
if (doc->cur_data_col<doc_ce->max_col) {
|
||||
dst=doc_ce->tag+doc->cur_data_col;
|
||||
doc_ne=DocEntryNew(doc,doc_ce,StrNew(dst,doc->mem_task));
|
||||
*dst=0;
|
||||
doc->cur_entry->max_col=doc->cur_data_col;
|
||||
QueIns(doc_ne,doc->cur_entry);
|
||||
doc_ne->type=DOCT_TEXT | doc_ce->type & 0xFFFFFF00;
|
||||
doc_ce->max_col=doc->cur_data_col;
|
||||
QueIns(doc_ne,doc_ce);
|
||||
doc->cur_entry=doc_ne;
|
||||
doc->cur_data_col=doc_ne->min_col;
|
||||
} else
|
||||
if (doc->cur_entry!=doc)
|
||||
doc->cur_entry=doc->cur_entry->next;
|
||||
if (doc_ce!=doc)
|
||||
doc->cur_entry=doc_ce->next;
|
||||
}
|
||||
while (doc_e!=doc2) {
|
||||
if (doc_e->type_u8!=DOCT_SOFT_NEW_LINE) {
|
||||
@@ -363,11 +363,11 @@ public U0 StreamDoc(CDoc *doc)
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
if (doc_e->type_u8==DOCT_TEXT)
|
||||
StreamPutS(doc_e->tag);
|
||||
StreamPrint("%s",doc_e->tag);
|
||||
else if (doc_e->type_u8==DOCT_NEW_LINE)
|
||||
StreamPutS("\n");
|
||||
StreamPrint("\n");
|
||||
else if (doc_e->type_u8==DOCT_TAB)
|
||||
StreamPutS("\t");
|
||||
StreamPrint("\t");
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
if (unlock_doc)
|
||||
@@ -383,7 +383,7 @@ Bool DocCaptureUndo(CDoc *doc,Bool force=FALSE)
|
||||
CDocUndo *u;
|
||||
if (doc->flags&DOCF_ALLOW_UNDO) {
|
||||
unlock=DocLock(doc);
|
||||
time_stamp=GetTimeStamp;
|
||||
time_stamp=GetTSC;
|
||||
if (doc->flags&DOCF_UNDO_DIRTY &&
|
||||
time_stamp>doc->undo_root.last->time_stamp+time_stamp_freq<<4 || force) {
|
||||
u=CAlloc(sizeof(CDocUndo),doc->mem_task);
|
||||
@@ -433,18 +433,18 @@ public Bool DocType(CDoc *doc=NULL,U8 *filename,I64 trailing_new_lines=1)
|
||||
CDoc *doc2;
|
||||
if (!doc && !(doc=DocPut) || doc->doc_signature!=DOC_SIGNATURE_VAL)
|
||||
return FALSE;
|
||||
if (FilesFindMatch(FILENAME_MASK_TXT,filename)) {
|
||||
if (FilesFindMatch(filename,FILEMASK_TXT)) {
|
||||
doc2=DocRead(filename);
|
||||
DocInsDoc(doc,doc2);
|
||||
DocDel(doc2);
|
||||
result=TRUE;
|
||||
} else if (FilesFindMatch("*.BMP.Z",filename)) {
|
||||
} else if (FilesFindMatch(filename,"*.BMP.Z")) {
|
||||
DocPutBMPFile(doc,filename,FALSE);
|
||||
result=TRUE;
|
||||
} else if (FilesFindMatch("*.BMP;*.bmp",filename)) {
|
||||
} else if (FilesFindMatch(filename,"*.BMP;*.bmp")) {
|
||||
DocPutBMPFile(doc,filename,TRUE);
|
||||
result=TRUE;
|
||||
} else if (FilesFindMatch("*.GRA*",filename)) {
|
||||
} else if (FilesFindMatch(filename,"*.GRA*")) {
|
||||
DocPutGRAFile(doc,filename);
|
||||
result=TRUE;
|
||||
}
|
||||
|
||||
@@ -137,9 +137,9 @@ public U0 IDE(U8 *filename)
|
||||
"simple stuff, sort-of.\n\n"
|
||||
"I recommend making use of:\n"
|
||||
"$$LK,\"progress1\",\"MN:progress1\"$$-$$LK,\"progress4\",\"MN:progress4\"$$, -- glbl I64 vars shown on wallpaper\n"
|
||||
"$$LK,\"DbgI64\",\"MN:DbgI64\"$$() $$LK,\"DbgStr\",\"MN:DbgStr\"$$() $$LK,\"DbgAdd\",\"MN:DbgAdd\"$$() -- raw text output for a time\n"
|
||||
"$$LK,\"RawI64\",\"MN:RawI64\"$$() $$LK,\"RawStr\",\"MN:RawStr\"$$() $$LK,\"RawAdd\",\"MN:RawAdd\"$$() -- raw text output for a time\n"
|
||||
"$$LK,\"Beep\",\"MN:Beep\"$$() $$LK,\"Snd\",\"MN:Snd\"$$() -- sound\n"
|
||||
"$$LK,\"AdamLog\",\"MN:AdamLog\"$$() $$LK,\"AdamErr\",\"MN:AdamErr\"$$() -- printf to adam task's window\n"
|
||||
"$$LK,\"AdamLog\",\"MN:AdamLog\"$$() $$LK,\"AdamErr\",\"MN:AdamErr\"$$() -- print to adam task's window\n"
|
||||
"$$LK,\"SysDbg\",\"MN:SysDbg\"$$() and $$LK,\"IsSysDbg\",\"MN:IsSysDbg\"$$() -- just a flag\n\n")) {
|
||||
SetWinHorz(1,TEXT_COLS>>1-1);
|
||||
SetWinVert(2,TEXT_ROWS-2);
|
||||
@@ -211,7 +211,7 @@ U0 IDESetStepRange(CDoc *doc)
|
||||
I64 line=doc->cur_entry->y+1;
|
||||
CHashTable *h=Fs->hash_table;
|
||||
CHashFun *tempf;
|
||||
CIDE *tempi=NamedFramePtr("IDEFrame");
|
||||
CIDE *tempi=FramePtr("IDEFrame");
|
||||
CDbgInfo *dbg;
|
||||
while (h) {
|
||||
tempf=h->next_added;
|
||||
@@ -266,7 +266,7 @@ U0 IDEToggleBpt(CDoc *doc)
|
||||
doc->cur_data_col=doc_e->min_col;
|
||||
if (!BptR(a,Fs->parent_task)) {
|
||||
BptS(a,Fs->parent_task);
|
||||
DocPutS(doc,"$$BP$$");
|
||||
DocPrint(doc,"$$BP$$");
|
||||
} else {
|
||||
if (doc_e->type_u8==DOCT_BPT) {
|
||||
doc->cur_entry=doc_e->next;
|
||||
@@ -314,10 +314,10 @@ U0 IDEClearAllBpts(CDoc *doc)
|
||||
U0 IDEGo() //Continue after breakpoint
|
||||
{ //F5
|
||||
CTask *task=Fs->parent_task;
|
||||
CIDE *tempi=NamedFramePtr("IDEFrame");
|
||||
CIDE *tempi=FramePtr("IDEFrame");
|
||||
if (!tempi) {
|
||||
tempi=CAlloc(sizeof(CIDE));
|
||||
NamedFramePtrAdd("IDEFrame",tempi);
|
||||
FramePtrAdd("IDEFrame",tempi);
|
||||
}
|
||||
IDEWaitParent;
|
||||
LBts(&task->task_flags,TASKf_DISABLE_BPTS);
|
||||
@@ -333,10 +333,10 @@ U0 IDEStepOver(CDoc *doc)
|
||||
I64 line;
|
||||
U8 *opcode;
|
||||
|
||||
CIDE *tempi=NamedFramePtr("IDEFrame");
|
||||
CIDE *tempi=FramePtr("IDEFrame");
|
||||
if (!tempi) {
|
||||
tempi=CAlloc(sizeof(CIDE));
|
||||
NamedFramePtrAdd("IDEFrame",tempi);
|
||||
FramePtrAdd("IDEFrame",tempi);
|
||||
}
|
||||
|
||||
IDEWaitParent;
|
||||
@@ -373,10 +373,10 @@ U0 IDEStepInto(CDoc *doc)
|
||||
CTask *task=Fs->parent_task;
|
||||
I64 line;
|
||||
|
||||
CIDE *tempi=NamedFramePtr("IDEFrame");
|
||||
CIDE *tempi=FramePtr("IDEFrame");
|
||||
if (!tempi) {
|
||||
tempi=CAlloc(sizeof(CIDE));
|
||||
NamedFramePtrAdd("IDEFrame",tempi);
|
||||
FramePtrAdd("IDEFrame",tempi);
|
||||
}
|
||||
|
||||
IDEWaitParent;
|
||||
@@ -407,16 +407,16 @@ U0 IDEEdTask(I64)
|
||||
if (rip_filename=SrcFileName(rip)) {
|
||||
ed_task=Spawn(&UserCmdLine,NULL,"Debug",,task);
|
||||
TaskWait(ed_task);
|
||||
st=MSPrintF("Preempt(OFF);Ed(\"%s\");\n",rip_filename);
|
||||
st=MPrint("Preempt(OFF);Ed(\"%s\");\n",rip_filename);
|
||||
XTalkWait(ed_task,st);
|
||||
Free(st);
|
||||
doc=DocPut(ed_task);
|
||||
if (TaskValidate(dbg_task=task->dbg_task)) {
|
||||
SetWinHorz(dbg_task->win_left,dbg_task->win_right, ed_task);
|
||||
SetWinVert(dbg_task->win_top, dbg_task->win_bottom,ed_task);
|
||||
if (tempi=NamedFramePtr("IDEFrame",dbg_task)) {
|
||||
if (tempi=FramePtr("IDEFrame",dbg_task)) {
|
||||
tempi1=MAllocIdentical(tempi,ed_task);
|
||||
NamedFramePtrAdd("IDEFrame",tempi1);
|
||||
FramePtrAdd("IDEFrame",tempi1);
|
||||
}
|
||||
Kill(dbg_task);
|
||||
}
|
||||
@@ -426,7 +426,7 @@ U0 IDEEdTask(I64)
|
||||
if (bpt_filename=SrcFileName(tempb->addr)) {
|
||||
if (!StrCmp(rip_filename,bpt_filename)) {
|
||||
DocLineNumGoTo(doc,SrcLineNum(tempb->addr));
|
||||
DocPutS(doc,"$$BP$$");
|
||||
DocPrint(doc,"$$BP$$");
|
||||
}
|
||||
Free(bpt_filename);
|
||||
}
|
||||
@@ -441,7 +441,7 @@ U0 IDEEdTask(I64)
|
||||
U0 IDEResumeDbg()
|
||||
{
|
||||
CTask *dbg_task=Fs->dbg_task;
|
||||
CIDE *tempi=NamedFramePtr("IDEFrame",dbg_task);
|
||||
CIDE *tempi=FramePtr("IDEFrame",dbg_task);
|
||||
U8 *opcode;
|
||||
if (!tempi) {
|
||||
Spawn(&IDEEdTask,NULL,"Resume Dbg",,Fs);
|
||||
|
||||
@@ -41,10 +41,10 @@ CMacroTemp *Cmd2MT(CSrvCmd *tempc)
|
||||
tempmt->type=MT_CHAR;
|
||||
buf[0]=tempc->aux1;
|
||||
buf[1]=0;
|
||||
SPrintF(tempmt->buf,"%Q",buf);
|
||||
SPrint(tempmt->buf,"%Q",buf);
|
||||
} else {
|
||||
tempmt->type=MT_MSG;
|
||||
SPrintF(tempmt->buf,"Msg(0x%X,0x%X,0x%X);",
|
||||
SPrint(tempmt->buf,"Msg(0x%X,0x%X,0x%X);",
|
||||
tempc->msg_code,tempc->aux1,tempc->aux2);
|
||||
}
|
||||
return tempmt;
|
||||
@@ -149,14 +149,14 @@ I64 PopUpExitRecordPlayStopIns()
|
||||
U8 buf[136];
|
||||
CSrvCmd *tempc;
|
||||
CDoc *doc=DocNew;
|
||||
CDocEntry *doc_e=DocPutS(doc,"$$DA-P,135,\"Name:%s\"$$");
|
||||
CDocEntry *doc_e=DocPrint(doc,"$$DA-P,135,\"Name:%%s\"$$");
|
||||
I64 result=0;
|
||||
doc_e->data=captured_macro_name;
|
||||
DocDataFmt(doc_e);
|
||||
doc_e=DocPutS(doc,"\n$$DA,32,\"Repeat N:%d\"$$");
|
||||
doc_e=DocPrint(doc,"\n$$DA,32,\"Repeat N:%%d\"$$");
|
||||
doc_e->data=&sys_macro_repeat_n;
|
||||
DocDataFmt(doc_e);
|
||||
DocPutS(doc,"\n"
|
||||
DocPrint(doc,"\n"
|
||||
"$$CM+LX,1,3$$$$BT,\"RECORD\",SM_RECORD$$"
|
||||
"$$CM+LX,17,0$$$$BT,\"INSERT\",SM_INS$$"
|
||||
"$$CM+LX,1,3$$$$BT,\"PLAY\",SM_PLAY$$"
|
||||
@@ -165,7 +165,7 @@ I64 PopUpExitRecordPlayStopIns()
|
||||
"$$CM+LX,17,0$$$$BT,\"CANCEL\",SM_CANCEL$$"
|
||||
"\n\n\n$$FG,GREEN$$SHIFT-F2$$FG$$ will play macro.\n");
|
||||
doc->flags|=DOCF_MIN_SIZE | DOCF_FORM;
|
||||
SPrintF(buf,"DocMenuDo(0x%X);",doc);
|
||||
SPrint(buf,"DocMenuDo(0x%X);",doc);
|
||||
sys_macro_util_task=Spawn(&SrvUserCmdLine,NULL,"Macro Popup",,Fs);
|
||||
Fs->popup_task=sys_macro_util_task;
|
||||
LBts(&sys_macro_util_task->display_flags,DISPLAYf_WIN_ON_TOP);
|
||||
@@ -175,7 +175,7 @@ I64 PopUpExitRecordPlayStopIns()
|
||||
Fs->popup_task=NULL;
|
||||
Kill(sys_macro_util_task);
|
||||
sys_macro_util_task=NULL;
|
||||
DocDataGet(doc_e);
|
||||
DocDataScan(doc_e);
|
||||
DocDel(doc);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ ej_doc:
|
||||
EdLite(filename,num);
|
||||
else {
|
||||
cont=TRUE;
|
||||
if (!(ed_flags&EDF_BAIL) && !FilesFindMatch(FILENAME_MASK_TXT,filename) &&
|
||||
if (!(ed_flags&EDF_BAIL) && !FilesFindMatch(filename,FILEMASK_TXT) &&
|
||||
!PopUpCancelOk(ST_WARN_ST "Not Text File\n\n"))
|
||||
cont=FALSE;
|
||||
if (cont)
|
||||
@@ -48,7 +48,7 @@ public Bool Plain(U8 *filename)
|
||||
//so that dollar signs are not special.
|
||||
{
|
||||
Bool result;
|
||||
U8 *st=MSPrintF("PI:%s",filename);
|
||||
U8 *st=MPrint("PI:%s",filename);
|
||||
result=Ed(st);
|
||||
Free(st);
|
||||
return result;
|
||||
@@ -116,46 +116,46 @@ public CDoc *SysBorderDocInit()
|
||||
bdoc->flags|=DOCF_BORDER_DOC;
|
||||
|
||||
if (doc) {
|
||||
DocPutS(bdoc,"$$CM+H+BY+RX+NC,-7,1$$");
|
||||
doc_e=DocPutS(bdoc,"$$TX+H+BD+TC,\" \"$$");
|
||||
DocPrint(bdoc,"$$CM+H+BY+RX+NC,-7,1$$");
|
||||
doc_e=DocPrint(bdoc,"$$TX+H+BD+TC,\" \"$$");
|
||||
doc_e->user_data=doc;
|
||||
doc_e->tag_cb=&EdFilterCB;
|
||||
doc_e=DocPutS(bdoc,"$$TX+H+BD+TC,\" \"$$");
|
||||
doc_e=DocPrint(bdoc,"$$TX+H+BD+TC,\" \"$$");
|
||||
doc_e->user_data=doc;
|
||||
doc_e->tag_cb=&EdOverStrikeCB;
|
||||
doc_e=DocPutS(bdoc,"$$TX+H+BD+TC,\" \"$$");
|
||||
doc_e=DocPrint(bdoc,"$$TX+H+BD+TC,\" \"$$");
|
||||
doc_e->user_data=doc;
|
||||
doc_e->tag_cb=&EdDollarCB;
|
||||
}
|
||||
|
||||
DocPutS(bdoc,"$$CM+H+BY+RX+NC,-4,1$$");
|
||||
doc_e=DocPutS(bdoc,"$$TX+H+BD+TC,\" \"$$");
|
||||
DocPrint(bdoc,"$$CM+H+BY+RX+NC,-4,1$$");
|
||||
doc_e=DocPrint(bdoc,"$$TX+H+BD+TC,\" \"$$");
|
||||
doc_e->tag_cb=&EdQuotesCB;
|
||||
doc_e=DocPutS(bdoc,"$$TX+H+BD+TC,\" \"$$");
|
||||
doc_e=DocPrint(bdoc,"$$TX+H+BD+TC,\" \"$$");
|
||||
doc_e->tag_cb=&EdBracesCB;
|
||||
doc_e=DocPutS(bdoc,"$$TX+H+BD+TC,\" \"$$");
|
||||
doc_e=DocPrint(bdoc,"$$TX+H+BD+TC,\" \"$$");
|
||||
doc_e->tag_cb=&EdSemicolonCB;
|
||||
|
||||
if (doc) {
|
||||
DocPutS(bdoc,"$$CM+H+BY+RX+NC,-18,1$$");
|
||||
doc_e=DocPutS(bdoc,"$$TX+BD+TC,\" \"$$");
|
||||
DocPrint(bdoc,"$$CM+H+BY+RX+NC,-18,1$$");
|
||||
doc_e=DocPrint(bdoc,"$$TX+BD+TC,\" \"$$");
|
||||
doc_e->user_data=doc;
|
||||
doc_e->tag_cb=&EdMoreCB;
|
||||
doc_e=DocPutS(bdoc,"$$TX+H+BD+TC,\" \"$$");
|
||||
doc_e=DocPrint(bdoc,"$$TX+H+BD+TC,\" \"$$");
|
||||
doc_e->user_data=doc;
|
||||
doc_e->tag_cb=&EdDollarTypeCB;
|
||||
}
|
||||
|
||||
if (Fs->user_num)
|
||||
DocPrintF(bdoc,"$$CM+H+TY+LX+NC,5,-1$$$$TX+H+BD,\"#%d\"$$",Fs->user_num);
|
||||
DocPutS(bdoc,"$$CM+H+TY+NC,0,-1$$");
|
||||
doc_e=DocPutS(bdoc,"$$DA+H-T-P+BD+RD+CX+SCX+IV,140,\"%s...\",16$$");
|
||||
DocPrint(bdoc,"$$CM+H+TY+LX+NC,5,-1$$$$TX+H+BD,\"#%d\"$$",Fs->user_num);
|
||||
DocPrint(bdoc,"$$CM+H+TY+NC,0,-1$$");
|
||||
doc_e=DocPrint(bdoc,"$$DA+H-T-P+BD+RD+CX+SCX+IV,140,\"%%s...\",16$$");
|
||||
doc_e->data=&Fs->task_title;
|
||||
DocDataFmt(doc_e);
|
||||
DocPrintF(bdoc,"$$CM+H+NC,1,0$$$$TX+H+BD+IV,\"%X\"$$",Fs);
|
||||
DocPrint(bdoc,"$$CM+H+NC,1,0$$$$TX+H+BD+IV,\"%X\"$$",Fs);
|
||||
if (Bt(&Fs->display_flags,DISPLAYf_HAS_CLOSE_WIN))
|
||||
DocPutS(bdoc,"$$TX+H+RX+BD,\"[X]\"$$");
|
||||
DocPutS(bdoc,"$$BK,1$$$$TX+H+LX+BD,\"MENU\"$$$$BK,0$$");
|
||||
DocPrint(bdoc,"$$TX+H+RX+BD,\"[X]\"$$");
|
||||
DocPrint(bdoc,"$$BK,1$$$$TX+H+LX+BD,\"MENU\"$$$$BK,0$$");
|
||||
return bdoc;
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ public U0 UseTermDoc()
|
||||
}
|
||||
|
||||
#help_index "Doc/Input"
|
||||
public U8 *DocGetLine(CDoc *doc,CDocEntry *doc_e,I64 *cur_col=NULL,CDocEntry **_do_e_end=NULL)
|
||||
public U8 *DocScanLine(CDoc *doc,CDocEntry *doc_e,I64 *cur_col=NULL,CDocEntry **_do_e_end=NULL)
|
||||
{
|
||||
CDocEntry *doc_e2=doc_e;
|
||||
Bool unlock=DocLock(doc);
|
||||
@@ -223,8 +223,8 @@ U0 DocDump(CDoc *doc,I64 uS_delay=0)
|
||||
Bool unlock=DocLock(doc);
|
||||
doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
st=DocGetLine(doc,doc_e,NULL,&doc_e2);
|
||||
"" st;
|
||||
st=DocScanLine(doc,doc_e,NULL,&doc_e2);
|
||||
"%s",st;
|
||||
Free(st);
|
||||
doc_e=doc_e2;
|
||||
if (doc_e->type_u8==DOCT_NEW_LINE) {
|
||||
@@ -255,7 +255,7 @@ public CDocEntry *DocPutLine(CDoc *doc=NULL,CDocEntry *doc_e)
|
||||
else
|
||||
ptr++;
|
||||
*ptr=0;
|
||||
"" ptr2;
|
||||
"%s",ptr2;
|
||||
*ptr=ch;
|
||||
if (ch=='$$') {
|
||||
"$$$$";
|
||||
@@ -318,10 +318,10 @@ public U8 *DocMGetS(I64 flags=0)
|
||||
do doc_e=doc_e->last;
|
||||
while (doc_e!=doc && doc_e->type_u8!=DOCT_PMT);
|
||||
doc_e=doc_e->next;
|
||||
if (result=DocGetLine(doc,doc_e,NULL,&doc_e_end)) {
|
||||
if (result=DocScanLine(doc,doc_e,NULL,&doc_e_end)) {
|
||||
while (doc_e_end!=doc && doc_e_end->type_u8==DOCT_NEW_LINE) {
|
||||
result=StrAdd(result,"\n");
|
||||
if (st=DocGetLine(doc,doc_e_end->next,NULL,&doc_e_end)) {
|
||||
if (st=DocScanLine(doc,doc_e_end->next,NULL,&doc_e_end)) {
|
||||
result=StrAdd(result,st);
|
||||
Free(st);
|
||||
}
|
||||
@@ -338,7 +338,7 @@ public U8 *DocMGetS(I64 flags=0)
|
||||
doc_e->type_u8!=DOCT_PMT);
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
result=DocGetLine(doc,doc_e,NULL);
|
||||
result=DocScanLine(doc,doc_e,NULL);
|
||||
}
|
||||
DocUnlock(doc);
|
||||
mgets_done:
|
||||
@@ -349,20 +349,21 @@ mgets_done:
|
||||
|
||||
#help_index "Char/Input"
|
||||
|
||||
public I64 PmtI64(U8 *msg,I64 dft,I64 lo=MIN_I64,I64 hi=MAX_I64)
|
||||
public I64 PmtI64(U8 *msg=NULL,I64 dft=0,I64 lo=MIN_I64,I64 hi=MAX_I64)
|
||||
{
|
||||
Bool okay;
|
||||
U8 *st;
|
||||
I64 result;
|
||||
while (TRUE) {
|
||||
"" msg,dft;
|
||||
if (msg)
|
||||
"" msg,dft;
|
||||
st=MGetS;
|
||||
if (!*st) {
|
||||
Free(st);
|
||||
return dft;
|
||||
}
|
||||
try {
|
||||
result=ExePrintF3("ToI64(%s);",st);
|
||||
result=ExePrint3("ToI64(%s);",st);
|
||||
okay=TRUE;
|
||||
} catch {
|
||||
Fs->catch_except=TRUE;
|
||||
@@ -374,20 +375,21 @@ public I64 PmtI64(U8 *msg,I64 dft,I64 lo=MIN_I64,I64 hi=MAX_I64)
|
||||
}
|
||||
}
|
||||
|
||||
public F64 PmtF64(U8 *msg,F64 dft,F64 lo=MIN_F64,F64 hi=MAX_F64)
|
||||
public F64 PmtF64(U8 *msg=NULL,F64 dft=0,F64 lo=MIN_F64,F64 hi=MAX_F64)
|
||||
{
|
||||
Bool okay;
|
||||
U8 *st;
|
||||
F64 result;
|
||||
while (TRUE) {
|
||||
"" msg,dft;
|
||||
if (msg)
|
||||
"" msg,dft;
|
||||
st=MGetS;
|
||||
if (!*st) {
|
||||
Free(st);
|
||||
return dft;
|
||||
}
|
||||
try {
|
||||
result=ExePrintF3("ToF64(%s);",st)(F64);
|
||||
result=ExePrint3("ToF64(%s);",st)(F64);
|
||||
okay=TRUE;
|
||||
} catch {
|
||||
Fs->catch_except=TRUE;
|
||||
@@ -402,12 +404,8 @@ public F64 PmtF64(U8 *msg,F64 dft,F64 lo=MIN_F64,F64 hi=MAX_F64)
|
||||
public U8 *PmtStr(U8 *msg=NULL,U8 *dft=NULL)
|
||||
{
|
||||
U8 *st;
|
||||
if (msg) {
|
||||
if (dft)
|
||||
"" msg,dft;
|
||||
else
|
||||
"" msg;
|
||||
}
|
||||
if (msg)
|
||||
"" msg,dft;
|
||||
st=MGetS;
|
||||
if (!*st) {
|
||||
Free(st);
|
||||
@@ -419,12 +417,14 @@ public U8 *PmtStr(U8 *msg=NULL,U8 *dft=NULL)
|
||||
return st;
|
||||
}
|
||||
|
||||
public CDate PmtCDate(U8 *msg,CDate dft,CDate lo=MIN_I64,CDate hi=MAX_I64)
|
||||
public CDate PmtCDate(U8 *msg=NULL,CDate dft=0,CDate lo=MIN_I64,CDate hi=MAX_I64)
|
||||
{
|
||||
U8 *st;
|
||||
CDate result;
|
||||
if (!dft) dft=GetDateTime;
|
||||
while (TRUE) {
|
||||
"" msg,dft,dft;
|
||||
if (msg)
|
||||
"" msg,dft,dft;
|
||||
st=MGetS;
|
||||
if (!*st) {
|
||||
Free(st);
|
||||
@@ -457,8 +457,8 @@ I64 PopUpCancelIncludeDelAuto(U8 *header=NULL,U8 *footer=NULL)
|
||||
{
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
if (header) DocPutS(doc,header);
|
||||
DocPrintF(doc,"\n\n"
|
||||
if (header) DocPrint(doc,"%s",header);
|
||||
DocPrint(doc,"\n\n"
|
||||
"TXT=%s\n"
|
||||
"SRC=%s\n"
|
||||
"AOT=%s\n"
|
||||
@@ -478,12 +478,12 @@ I64 PopUpCancelIncludeDelAuto(U8 *header=NULL,U8 *footer=NULL)
|
||||
"$$CM+LX,26,0$$$$BT,\"PLAIN ED TXT\",RIGHT_PLAIN$$"
|
||||
"$$CM+LX,1,3 $$$$BT,\"CANCEL \",DOCM_CANCEL$$"
|
||||
"$$CM+LX,26,0$$$$BT,\"BINREP BIN\",RIGHT_BINREP$$\n",
|
||||
FILENAME_MASK_TXT,
|
||||
FILENAME_MASK_SRC,
|
||||
FILENAME_MASK_AOT,
|
||||
FILENAME_MASK_JIT,
|
||||
FILENAME_MASK_GRA);
|
||||
if (footer) DocPutS(doc,footer);
|
||||
FILEMASK_TXT,
|
||||
FILEMASK_SRC,
|
||||
FILEMASK_AOT,
|
||||
FILEMASK_JIT,
|
||||
FILEMASK_GRA);
|
||||
if (footer) DocPrint(doc,"%s",footer);
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
return i;
|
||||
@@ -496,7 +496,7 @@ I64 EdLeftClickLink(CDoc *doc,CDocEntry *doc_e)
|
||||
if (st=DocEntryLink(doc,doc_e)) {
|
||||
DocUnlock(doc);
|
||||
if (doc_e->flags1 & DOCEF1_POPUP) {
|
||||
st2=MSPrintF("Ed(\"%Q\");",st);
|
||||
st2=MPrint("Ed(\"%Q\");",st);
|
||||
result=PopUp(st2);
|
||||
Free(st2);
|
||||
} else
|
||||
@@ -519,7 +519,7 @@ I64 TermRightClickLink(CDoc *doc,CDocEntry *doc_e)
|
||||
DocBottom(doc);
|
||||
switch (i) {
|
||||
case RIGHT_INCLUDE:
|
||||
if (FileExtDot(st) && !FilesFindMatch(FILENAME_MASK_JIT,st)) {
|
||||
if (FileExtDot(st) && !FilesFindMatch(st,FILEMASK_JIT)) {
|
||||
if (!PopUpCancelOk(ST_WARN_ST "Not .CPP File\n\n")) {
|
||||
send_new_line=TRUE;
|
||||
break;
|
||||
@@ -545,7 +545,7 @@ I64 TermRightClickLink(CDoc *doc,CDocEntry *doc_e)
|
||||
result=Plain(st);
|
||||
break;
|
||||
case RIGHT_AUTOFILE:
|
||||
if (FileExtDot(st) && !FilesFindMatch("*.AUT*",st)) {
|
||||
if (FileExtDot(st) && !FilesFindMatch(st,"*.AUT*")) {
|
||||
if (!PopUpCancelOk(ST_WARN_ST "Not .AUT File\n\n")) {
|
||||
send_new_line=TRUE;
|
||||
break;
|
||||
@@ -557,7 +557,7 @@ I64 TermRightClickLink(CDoc *doc,CDocEntry *doc_e)
|
||||
result=TRUE;
|
||||
break;
|
||||
case RIGHT_AINCLUDE:
|
||||
if (FileExtDot(st) && !FilesFindMatch(FILENAME_MASK_JIT,st)) {
|
||||
if (FileExtDot(st) && !FilesFindMatch(st,FILEMASK_JIT)) {
|
||||
if (!PopUpCancelOk(ST_WARN_ST "Not .CPP File\n\n")) {
|
||||
send_new_line=TRUE;
|
||||
break;
|
||||
@@ -569,7 +569,7 @@ I64 TermRightClickLink(CDoc *doc,CDocEntry *doc_e)
|
||||
result=TRUE;
|
||||
break;
|
||||
case RIGHT_COMPILE:
|
||||
if (FileExtDot(st) && !FilesFindMatch(FILENAME_MASK_AOT,st)) {
|
||||
if (FileExtDot(st) && !FilesFindMatch(st,FILEMASK_AOT)) {
|
||||
if (!PopUpCancelOk(ST_WARN_ST "Not .PRJ File\n\n")) {
|
||||
send_new_line=TRUE;
|
||||
break;
|
||||
@@ -580,7 +580,7 @@ I64 TermRightClickLink(CDoc *doc,CDocEntry *doc_e)
|
||||
result=!ToBool(Cmp(st));
|
||||
break;
|
||||
case RIGHT_LOAD:
|
||||
if (FileExtDot(st) && !FilesFindMatch("*.BIN*",st)) {
|
||||
if (FileExtDot(st) && !FilesFindMatch(st,"*.BIN*")) {
|
||||
if (!PopUpCancelOk(ST_WARN_ST "Not .BIN File\n\n")) {
|
||||
send_new_line=TRUE;
|
||||
break;
|
||||
@@ -591,7 +591,7 @@ I64 TermRightClickLink(CDoc *doc,CDocEntry *doc_e)
|
||||
result=ToBool(Load(st));
|
||||
break;
|
||||
case RIGHT_BINREP:
|
||||
if (FileExtDot(st) && !FilesFindMatch("*.BIN*",st)) {
|
||||
if (FileExtDot(st) && !FilesFindMatch(st,"*.BIN*")) {
|
||||
if (!PopUpCancelOk(ST_WARN_ST "Not .BIN File\n\n")) {
|
||||
send_new_line=TRUE;
|
||||
break;
|
||||
@@ -603,20 +603,20 @@ I64 TermRightClickLink(CDoc *doc,CDocEntry *doc_e)
|
||||
break;
|
||||
case RIGHT_COPY:
|
||||
StrCpy(fn.name,st);
|
||||
if (DocFormDo(fn.name,"CEdFileName")) {
|
||||
if (DocFormDo(&fn)) {
|
||||
result=ToBool(Copy(st,fn.name));
|
||||
} else
|
||||
send_new_line=TRUE;
|
||||
break;
|
||||
case RIGHT_MOVE:
|
||||
StrCpy(fn.name,st);
|
||||
if (DocFormDo(fn.name,"CEdFileName"))
|
||||
if (DocFormDo(&fn))
|
||||
result=Move(st,fn.name);
|
||||
else
|
||||
send_new_line=TRUE;
|
||||
break;
|
||||
case RIGHT_DEBUG:
|
||||
if (FileExtDot(st) && !FilesFindMatch(FILENAME_MASK_JIT,st)) {
|
||||
if (FileExtDot(st) && !FilesFindMatch(st,FILEMASK_JIT)) {
|
||||
if (!PopUpCancelOk(ST_WARN_ST "Not .CPP File\n\n")) {
|
||||
send_new_line=TRUE;
|
||||
break;
|
||||
@@ -652,7 +652,7 @@ public U0 DocDm(U8 *buf,I64 cnt=0x80)
|
||||
CDocEntry *doc_e;
|
||||
CDoc *doc=DocPut;
|
||||
Bool unlock=DocLock(doc);
|
||||
doc_e=DocPrintF(doc,"$$HX-Z,%d,16$$",cnt);
|
||||
doc_e=DocPrint(doc,"$$HX-Z,%d,16$$",cnt);
|
||||
doc_e->data=buf;
|
||||
doc->cur_entry=doc_e->next;
|
||||
DocRecalc(doc);
|
||||
@@ -668,7 +668,7 @@ public U0 DocD(U8 *buf,I64 cnt=0x80)
|
||||
CDocEntry *doc_e;
|
||||
CDoc *doc=DocPut;
|
||||
Bool unlock=DocLock(doc);
|
||||
doc_e=DocPrintF(doc,"$$HX,%d,16$$",cnt);
|
||||
doc_e=DocPrint(doc,"$$HX,%d,16$$",cnt);
|
||||
doc_e->data=buf;
|
||||
doc->cur_entry=doc_e->next;
|
||||
DocRecalc(doc);
|
||||
|
||||
@@ -10,9 +10,7 @@ U0 DocTablesInit()
|
||||
1<<DOCT_TEXT|
|
||||
1<<DOCT_DATA|
|
||||
1<<DOCT_MENU_VAL|
|
||||
1<<DOCT_HIDE_START |
|
||||
1<<DOCT_TREE|
|
||||
1<<DOCT_HIDE_END|
|
||||
1<<DOCT_MACRO|
|
||||
1<<DOCT_BUTTON|
|
||||
1<<DOCT_CHECK_BOX|
|
||||
@@ -162,7 +160,7 @@ U0 DocBinsValidate(CDoc *doc)
|
||||
doc_e->tag && *doc_e->tag)
|
||||
b->tag=StrNew(doc_e->tag,doc->mem_task);
|
||||
} else {
|
||||
DbgStr("Bin Not Found",3000);
|
||||
RawStr("Bin Not Found",3000);
|
||||
doc_e->type=doc_e->flags2=doc_e->flags1=0;
|
||||
doc_e->type_u8=DOCT_ERROR;
|
||||
}
|
||||
@@ -201,13 +199,36 @@ U0 DocBinDel(CDoc *doc,CDocBin *b)
|
||||
Free(b);
|
||||
}
|
||||
} else
|
||||
DbgStr("DocBinDel",3000);
|
||||
RawStr("DocBinDel",3000);
|
||||
}
|
||||
|
||||
Bool IsEditableText(CDocEntry *doc_e)
|
||||
{
|
||||
if (doc_e->type_u8==DOCT_TEXT&&
|
||||
!(doc_e->flags1&DOCEG1_DONT_EDIT)&&!(doc_e->flags2&DOCEG2_DONT_EDIT))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
CDocEntry *DocEntryNew(CDoc *doc,CDocEntry *doc_ce,U8 *tag)
|
||||
{
|
||||
CDocEntry *result=CAlloc(sizeof(CDocEntryBase),doc->mem_task);
|
||||
result->type=doc_ce->type;
|
||||
result->flags1=doc_ce->flags1;
|
||||
result->flags2=doc_ce->flags2;
|
||||
result->tag=tag;
|
||||
result->max_col=StrLen(tag);
|
||||
result->x=doc_ce->x;
|
||||
result->y=doc_ce->y;
|
||||
result->page_line_num=doc_ce->page_line_num;
|
||||
return result;
|
||||
}
|
||||
|
||||
public U0 DocEntryDel(CDoc *doc,CDocEntry *doc_e)
|
||||
{
|
||||
if (!doc || doc==doc_e)
|
||||
DbgStr("DocEntryDel",3000);
|
||||
RawStr("DocEntryDel",3000);
|
||||
else {
|
||||
if (doc->cur_entry==doc_e)
|
||||
doc->cur_entry=doc_e->next;
|
||||
@@ -596,7 +617,7 @@ U0 DocDataFmt(CDocEntry *doc_e)
|
||||
else
|
||||
d=*ptr(I64 *);
|
||||
if (doc_e->type_u8==DOCT_DATA) {
|
||||
SPrintF(doc_e->tag,doc_e->aux_str,d,doc_e->my_fmt_data);
|
||||
SPrint(doc_e->tag,doc_e->aux_str,d,doc_e->my_fmt_data);
|
||||
if (doc_e->flags1 & DOCEF1_HAS_TERMINATOR) {
|
||||
i=StrLen(doc_e->tag);
|
||||
doc_e->tag[i++]='_';
|
||||
@@ -612,7 +633,7 @@ U0 DocDataFmt(CDocEntry *doc_e)
|
||||
}
|
||||
}
|
||||
|
||||
U0 DocDataGet(CDocEntry *doc_e)
|
||||
U0 DocDataScan(CDocEntry *doc_e)
|
||||
{
|
||||
I64 i,d;
|
||||
U8 *ptr;
|
||||
@@ -628,11 +649,11 @@ U0 DocDataGet(CDocEntry *doc_e)
|
||||
if (i>doc_e->len+doc_e->min_col)
|
||||
doc_e->tag[doc_e->len+doc_e->min_col]=0;
|
||||
if (doc_e->flags1&(DOCEF1_U8|DOCEF1_U16|DOCEF1_U32)) {
|
||||
GetF(doc_e->tag,doc_e->aux_str,&d,doc_e->my_fmt_data);
|
||||
Scan(doc_e->tag,doc_e->aux_str,&d,doc_e->my_fmt_data);
|
||||
if (doc_e->flags1 & DOCEF1_HAS_TERMINATOR)
|
||||
doc_e->tag[i]='_';
|
||||
} else {
|
||||
GetF(doc_e->tag,doc_e->aux_str,ptr,doc_e->my_fmt_data);
|
||||
Scan(doc_e->tag,doc_e->aux_str,ptr,doc_e->my_fmt_data);
|
||||
if (doc_e->flags1 & DOCEF1_HAS_TERMINATOR)
|
||||
doc_e->tag[i]='_';
|
||||
return;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
I64 DocOptEntry(CDoc *,CDocEntry *doc_e)
|
||||
{
|
||||
U8 *st,*st2,**dst;
|
||||
U8 *st,*st2,**_dst;
|
||||
I64 i,result=0;
|
||||
|
||||
if (doc_e->flags1&DOCEF1_LINK) {
|
||||
@@ -16,16 +16,16 @@ I64 DocOptEntry(CDoc *,CDocEntry *doc_e)
|
||||
result++;
|
||||
}
|
||||
if (doc_e->flags1 & DOCEF1_AUX_STR)
|
||||
dst=&doc_e->aux_str;
|
||||
_dst=&doc_e->aux_str;
|
||||
else
|
||||
dst=&doc_e->tag;
|
||||
if (StrStr(*dst,".Z")) {
|
||||
st=DocLinkFile(*dst);
|
||||
_dst=&doc_e->tag;
|
||||
if (StrMatch(".Z",*_dst)) {
|
||||
st=DocLinkFile(*_dst);
|
||||
if (FileFind(st)) {
|
||||
if (IsDotZ(st))
|
||||
st[StrLen(st)-2]=0;
|
||||
i=StrLen(st);
|
||||
if ((st2=StrStr(*dst,st)) && st2[i]=='.' && st2[i+1]=='Z') {
|
||||
if ((st2=StrMatch(st,*_dst)) && st2[i]=='.' && st2[i+1]=='Z') {
|
||||
StrCpy(st2+i,st2+i+2);
|
||||
result++;
|
||||
}
|
||||
@@ -34,13 +34,13 @@ I64 DocOptEntry(CDoc *,CDocEntry *doc_e)
|
||||
}
|
||||
/* !!! Dangerous, but handy !!!
|
||||
if (doc_e->flags1 & DOCEF1_AUX_STR) {
|
||||
if (st=StrStr(doc_e->aux_str,".Z")) {
|
||||
if (st=StrMatch(".Z",doc_e->aux_str)) {
|
||||
StrCpy(st,st+2);
|
||||
result++;
|
||||
}
|
||||
}
|
||||
if (Bt(doc_tag_types,doc_e->type_u8)) {
|
||||
if (st=StrStr(doc_e->tag,".Z")) {
|
||||
if (st=StrMatch(".Z",doc_e->tag)) {
|
||||
StrCpy(st,st+2);
|
||||
result++;
|
||||
}
|
||||
@@ -88,21 +88,21 @@ public I64 DocOptFile(U8 *filename)
|
||||
return result;
|
||||
}
|
||||
|
||||
I64 DocOptLst(CDirEntry *tempm1)
|
||||
I64 DocOptLst(CDirEntry *tempde1)
|
||||
{
|
||||
I64 result=0;
|
||||
CDirEntry *tempm2;
|
||||
while (tempm1) {
|
||||
tempm2=tempm1->next;
|
||||
if (tempm1->attr & _ATTR_DIR) {
|
||||
if (tempm1->sub) {
|
||||
"%S %s\n","ST_SCANNING_DIR",tempm1->full_name;
|
||||
result+=DocOptLst(tempm1->sub);
|
||||
CDirEntry *tempde2;
|
||||
while (tempde1) {
|
||||
tempde2=tempde1->next;
|
||||
if (tempde1->attr & _ATTR_DIR) {
|
||||
if (tempde1->sub) {
|
||||
"%S %s\n","ST_SCANNING_DIR",tempde1->full_name;
|
||||
result+=DocOptLst(tempde1->sub);
|
||||
}
|
||||
} else
|
||||
result+=DocOptFile(tempm1->full_name);
|
||||
CDirEntryDel(tempm1);
|
||||
tempm1=tempm2;
|
||||
result+=DocOptFile(tempde1->full_name);
|
||||
DirEntryDel(tempde1);
|
||||
tempde1=tempde2;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -110,7 +110,7 @@ I64 DocOptLst(CDirEntry *tempm1)
|
||||
public I64 DocOpt(U8 *files_find_mask="*",U8 *fu_flags=NULL)
|
||||
{//Optimize Files
|
||||
I64 f=0;
|
||||
GetFFlags(&f,Define("ST_FILE_UTIL_FLAGS"),"+r+T");
|
||||
GetFFlags(&f,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
ScanFlags(&f,Define("ST_FILE_UTIL_FLAGS"),"+r+T");
|
||||
ScanFlags(&f,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
return DocOptLst(FilesFind(files_find_mask,f));
|
||||
}
|
||||
@@ -5,7 +5,7 @@ U0 PrsDocFlags(CLex *lx,I64 *flags1,I64 *flags2,U32 *type)
|
||||
while (lx->token=='+' || lx->token=='-') {
|
||||
turn_on= lx->token=='+';
|
||||
if (Lex(lx)==TK_IDENT) {
|
||||
i=DefineMatch(lx->ident,"ST_DOC_FLAGS",LEF_EXACT);
|
||||
i=DefineMatch(lx->ident,"ST_DOC_FLAGS",LMF_EXACT);
|
||||
if (i<0)
|
||||
*type=DOCT_ERROR;
|
||||
else if (i<64) {
|
||||
@@ -125,12 +125,6 @@ DOCEF1_ESC | DOCEF1_LEFT_EXP,
|
||||
//DOCT_HEX_ED
|
||||
DOCEF1_DATA_IS_PTR | DOCEF1_ZERO_BASED,
|
||||
|
||||
//DOCT_HIDE_START
|
||||
DOCEF1_CHECKED_COLLAPSED|DOCEF1_CHECK_COLLAPSABLE,
|
||||
|
||||
//DOCT_HIDE_END
|
||||
0,
|
||||
|
||||
//DOCT_TREE
|
||||
DOCEF1_CHECKED_COLLAPSED|DOCEF1_CHECK_COLLAPSABLE|DOCEF1_TREE,
|
||||
|
||||
@@ -273,12 +267,6 @@ I64 doc_dft_flags2[DOCT_NUM_TYPES]={
|
||||
//DOCT_HEX_ED
|
||||
0,
|
||||
|
||||
//DOCT_HIDE_START
|
||||
0,
|
||||
|
||||
//DOCT_HIDE_END
|
||||
0,
|
||||
|
||||
//DOCT_TREE
|
||||
0,
|
||||
|
||||
@@ -421,12 +409,6 @@ DOCET_UNDERLINE,
|
||||
//DOCT_HEX_ED
|
||||
0,
|
||||
|
||||
//DOCT_HIDE_START
|
||||
DOCET_UNDERLINE,
|
||||
|
||||
//DOCT_HIDE_END
|
||||
0,
|
||||
|
||||
//DOCT_TREE
|
||||
DOCET_UNDERLINE,
|
||||
|
||||
@@ -581,17 +563,17 @@ U8 *Doc2PlainText(CDoc *doc,CDocEntry *doc_e)
|
||||
buf2=doc_e->tag+3;
|
||||
else
|
||||
buf2=doc_e->tag;
|
||||
buf2=MSPrintF("%s\"%$$Q\",",buf,buf2);
|
||||
buf2=MPrint("%s\"%$$Q\",",buf,buf2);
|
||||
Free(buf); buf=buf2;
|
||||
break;
|
||||
case DOCT_DATA:
|
||||
buf2=MSPrintF("%s%d,",buf,doc_e->len);
|
||||
buf2=MPrint("%s%d,",buf,doc_e->len);
|
||||
Free(buf); buf=buf2;
|
||||
break;
|
||||
case DOCT_HEX_ED:
|
||||
buf2=MSPrintF("%s%d,",buf,doc_e->len);
|
||||
buf2=MPrint("%s%d,",buf,doc_e->len);
|
||||
Free(buf); buf=buf2;
|
||||
buf2=MSPrintF("%s%d,",buf,doc_e->hex_ed_width);
|
||||
buf2=MPrint("%s%d,",buf,doc_e->hex_ed_width);
|
||||
Free(buf); buf=buf2;
|
||||
break;
|
||||
case DOCT_PAGE_LEN:
|
||||
@@ -614,7 +596,7 @@ U8 *Doc2PlainText(CDoc *doc,CDocEntry *doc_e)
|
||||
case DOCT_SHIFTED_X:
|
||||
case DOCT_SHIFTED_Y:
|
||||
if (doc_e->attr!=DOC_DFT) {
|
||||
buf2=MSPrintF("%s%d,",buf,doc_e->attr);
|
||||
buf2=MPrint("%s%d,",buf,doc_e->attr);
|
||||
Free(buf); buf=buf2;
|
||||
}
|
||||
case DOCT_NUM_TYPES-1: //nobound_switch
|
||||
@@ -629,59 +611,59 @@ U8 *Doc2PlainText(CDoc *doc,CDocEntry *doc_e)
|
||||
Btr(&flags1,j);
|
||||
nobound_switch (j) {
|
||||
case DOCEf1_SCROLLING_X:
|
||||
buf2=MSPrintF("%s%d",buf,doc_e->scroll_len);
|
||||
buf2=MPrint("%s%d",buf,doc_e->scroll_len);
|
||||
Free(buf); buf=buf2;
|
||||
break;
|
||||
case DOCEf1_SHIFTED_X:
|
||||
j=doc_e->type.u16[1]&0x1F;
|
||||
if (j&0x10) j|=0xFFFFFFF0;
|
||||
buf2=MSPrintF("%s%d",buf,j);
|
||||
buf2=MPrint("%s%d",buf,j);
|
||||
Free(buf); buf=buf2;
|
||||
break;
|
||||
case DOCEf1_SHIFTED_Y:
|
||||
j=doc_e->type>>21 &0x1F;
|
||||
if (j&0x10) j|=0xFFFFFFF0;
|
||||
buf2=MSPrintF("%s%d",buf,j);
|
||||
buf2=MPrint("%s%d",buf,j);
|
||||
Free(buf); buf=buf2;
|
||||
break;
|
||||
case DOCEf1_AUX_STR:
|
||||
buf2=MSPrintF("%s\"%$$Q\"",buf,doc_e->aux_str);
|
||||
buf2=MPrint("%s\"%$$Q\"",buf,doc_e->aux_str);
|
||||
Free(buf); buf=buf2;
|
||||
break;
|
||||
case DOCEf1_LEFT_EXP:
|
||||
buf2=MSPrintF("%s%d",buf,doc_e->left_exp);
|
||||
buf2=MPrint("%s%d",buf,doc_e->left_exp);
|
||||
Free(buf); buf=buf2;
|
||||
break;
|
||||
case DOCEf1_LEFT_MACRO:
|
||||
buf2=MSPrintF("%s\"%$$Q\"",buf,doc_e->left_macro);
|
||||
buf2=MPrint("%s\"%$$Q\"",buf,doc_e->left_macro);
|
||||
Free(buf); buf=buf2;
|
||||
break;
|
||||
case DOCEf1_RIGHT_EXP:
|
||||
buf2=MSPrintF("%s%d",buf,doc_e->right_exp);
|
||||
buf2=MPrint("%s%d",buf,doc_e->right_exp);
|
||||
Free(buf); buf=buf2;
|
||||
break;
|
||||
case DOCEf1_RIGHT_MACRO:
|
||||
buf2=MSPrintF("%s\"%$$Q\"",buf,doc_e->right_macro);
|
||||
buf2=MPrint("%s\"%$$Q\"",buf,doc_e->right_macro);
|
||||
Free(buf); buf=buf2;
|
||||
break;
|
||||
case DOCEf1_HAS_BIN:
|
||||
buf2=MSPrintF("%s%d",buf,doc_e->bin_num);
|
||||
buf2=MPrint("%s%d",buf,doc_e->bin_num);
|
||||
Free(buf); buf=buf2;
|
||||
break;
|
||||
case DOCEf1_WIDTH:
|
||||
buf2=MSPrintF("%s%d",buf,doc_e->width);
|
||||
buf2=MPrint("%s%d",buf,doc_e->width);
|
||||
Free(buf); buf=buf2;
|
||||
break;
|
||||
case DOCEf1_HEIGHT:
|
||||
buf2=MSPrintF("%s%d",buf,doc_e->height);
|
||||
buf2=MPrint("%s%d",buf,doc_e->height);
|
||||
Free(buf); buf=buf2;
|
||||
break;
|
||||
case DOCEf1_DEFINE:
|
||||
buf2=MSPrintF("%s\"%$$Q\"",buf,doc_e->define_str);
|
||||
buf2=MPrint("%s\"%$$Q\"",buf,doc_e->define_str);
|
||||
Free(buf); buf=buf2;
|
||||
break;
|
||||
case DOCEf1_HTML_LINK:
|
||||
buf2=MSPrintF("%s\"%$$Q\"",buf,doc_e->html_link);
|
||||
buf2=MPrint("%s\"%$$Q\"",buf,doc_e->html_link);
|
||||
Free(buf); buf=buf2;
|
||||
break;
|
||||
#assert DOCEf1_HTML_LINK==DOCEf1_NUM_FLAGS-1 //nobound_switch
|
||||
@@ -694,7 +676,7 @@ U8 *Doc2PlainText(CDoc *doc,CDocEntry *doc_e)
|
||||
Btr(&flags2,j);
|
||||
nobound_switch (j) {
|
||||
case DOCEf2_BIN_PTR_LINK:
|
||||
buf2=MSPrintF("%s\"%$$Q\"",buf,doc_e->bin_ptr_link);
|
||||
buf2=MPrint("%s\"%$$Q\"",buf,doc_e->bin_ptr_link);
|
||||
Free(buf); buf=buf2;
|
||||
break;
|
||||
#assert DOCEf2_BIN_PTR_LINK==DOCEf2_NUM_FLAGS-1 //nobound_switch
|
||||
@@ -748,11 +730,11 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
if (lx->token==TK_STR) {
|
||||
st2=LexExtStr(lx);
|
||||
if (i==DOCT_CHECK_BOX) {
|
||||
st=MSPrintF("[X] %s",st2);
|
||||
st=MPrint("[X] %s",st2);
|
||||
Free(st2);
|
||||
doc_e->min_col=1;
|
||||
} else if (doc_e->flags1 & DOCEF1_TREE) {
|
||||
st=MSPrintF("+] %s",st2);
|
||||
st=MPrint("+] %s",st2);
|
||||
Free(st2);
|
||||
doc_e->min_col=1;
|
||||
} else
|
||||
@@ -769,22 +751,15 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DOCT_HIDE_START:
|
||||
doc_e->tag=StrNew("<-",doc->mem_task);
|
||||
doc_e->min_col=1;
|
||||
break;
|
||||
case DOCT_HIDE_END:
|
||||
doc_e->tag=StrNew(">",doc->mem_task);
|
||||
break;
|
||||
case DOCT_DATA:
|
||||
doc_e->flags1|=DOCEF1_AUX_STR; //don't allow switched off
|
||||
doc_e->len=Expression(lx);
|
||||
doc_e->len=LexExpression(lx);
|
||||
break;
|
||||
case DOCT_HEX_ED:
|
||||
doc_e->len=Expression(lx);
|
||||
doc_e->len=LexExpression(lx);
|
||||
if (lx->token==',')
|
||||
Lex(lx);
|
||||
doc_e->hex_ed_width=Expression(lx);
|
||||
doc_e->hex_ed_width=LexExpression(lx);
|
||||
break;
|
||||
case DOCT_PAGE_LEN:
|
||||
case DOCT_LEFT_MARGIN:
|
||||
@@ -808,7 +783,7 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
if (!lx->token)
|
||||
doc_e->attr=DOC_DFT;
|
||||
else
|
||||
doc_e->attr=Expression(lx);
|
||||
doc_e->attr=LexExpression(lx);
|
||||
break;
|
||||
case DOCT_ERROR:
|
||||
doc_e->flags1=0;
|
||||
@@ -830,13 +805,13 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
Lex(lx);
|
||||
nobound_switch (j) { //TODO: Might check for expression errors
|
||||
case DOCEf1_SCROLLING_X:
|
||||
doc_e->scroll_len=Expression(lx);
|
||||
doc_e->scroll_len=LexExpression(lx);
|
||||
break;
|
||||
case DOCEf1_SHIFTED_X:
|
||||
doc_e->type|=(Expression(lx) & 0x1F)<<16;
|
||||
doc_e->type|=(LexExpression(lx) & 0x1F)<<16;
|
||||
break;
|
||||
case DOCEf1_SHIFTED_Y:
|
||||
doc_e->type|=(Expression(lx) & 0x1F)<<21;
|
||||
doc_e->type|=(LexExpression(lx) & 0x1F)<<21;
|
||||
break;
|
||||
case DOCEf1_AUX_STR:
|
||||
if (lx->token==TK_STR) {
|
||||
@@ -847,7 +822,7 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
doc_e->tag=StrNew(doc_e->aux_str,doc->mem_task);
|
||||
//$AN,"Anchor","DataTagWidth"$
|
||||
if (i==DOCT_DATA) {
|
||||
if (ptr=StrStr(doc_e->aux_str,":"))
|
||||
if (ptr=StrMatch(":",doc_e->aux_str))
|
||||
doc_e->min_col=ptr-doc_e->aux_str+1;
|
||||
doc_e->tag=MAlloc(doc_e->len+doc_e->min_col+2,doc->mem_task); //+2 because "_\0"
|
||||
}
|
||||
@@ -855,7 +830,7 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
doc_e->type=DOCT_ERROR;
|
||||
break;
|
||||
case DOCEf1_LEFT_EXP:
|
||||
doc_e->left_exp=Expression(lx);
|
||||
doc_e->left_exp=LexExpression(lx);
|
||||
break;
|
||||
case DOCEf1_LEFT_MACRO:
|
||||
if (lx->token==TK_STR) {
|
||||
@@ -868,7 +843,7 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
doc_e->type=DOCT_ERROR;
|
||||
break;
|
||||
case DOCEf1_RIGHT_EXP:
|
||||
doc_e->right_exp=Expression(lx);
|
||||
doc_e->right_exp=LexExpression(lx);
|
||||
break;
|
||||
case DOCEf1_RIGHT_MACRO:
|
||||
if (lx->token==TK_STR) {
|
||||
@@ -884,13 +859,13 @@ CDocEntry *PrsDollarCmd(CDoc *doc,U8 *st)
|
||||
if (!lx->token)
|
||||
doc_e->bin_num=0;
|
||||
else
|
||||
doc_e->bin_num=Expression(lx);
|
||||
doc_e->bin_num=LexExpression(lx);
|
||||
break;
|
||||
case DOCEf1_WIDTH:
|
||||
doc_e->width=Expression(lx);
|
||||
doc_e->width=LexExpression(lx);
|
||||
break;
|
||||
case DOCEf1_HEIGHT:
|
||||
doc_e->height=Expression(lx);
|
||||
doc_e->height=LexExpression(lx);
|
||||
break;
|
||||
case DOCEf1_DEFINE:
|
||||
if (lx->token==TK_STR) {
|
||||
@@ -954,21 +929,14 @@ public U0 DocIns(CDoc *doc,CDocEntry *doc_e)
|
||||
!(doc_ce->flags1&(DOCEF1_TAG_CB|DOCEF1_DEFINE|DOCEF1_HTML_LINK)) &&
|
||||
!(doc_ce->flags2&DOCEF2_BIN_PTR_LINK) &&
|
||||
doc->cur_data_col<doc_ce->max_col) {
|
||||
doc_ne=CAlloc(sizeof(CDocEntryBase),doc->mem_task);
|
||||
doc_ne->type=DOCT_TEXT|doc_ce->type&0xFFFFFF00;
|
||||
doc_ne->x=doc_ce->x;
|
||||
doc_ne->y=doc_ce->y;
|
||||
doc_ne->page_line_num=doc_ce->page_line_num;
|
||||
doc_ne->flags1=doc_ce->flags1;
|
||||
doc_ne->flags2=doc_ce->flags2;
|
||||
dst=doc_ce->tag+doc->cur_data_col;
|
||||
doc_ne->tag=StrNew(dst,doc->mem_task);
|
||||
doc_ne=DocEntryNew(doc,doc_ce,StrNew(dst,doc->mem_task));
|
||||
*dst=0;
|
||||
doc_ne->type=DOCT_TEXT|doc_ce->type&0xFFFFFF00;
|
||||
doc_ce->max_col=doc->cur_data_col;
|
||||
QueIns(doc_ne,doc_ce);
|
||||
doc->cur_data_col=0;
|
||||
doc_ce=doc_ne;
|
||||
doc_ce->max_col=StrLen(doc_ce->tag);
|
||||
}
|
||||
if (doc_ce->type_u8==DOCT_TEXT && doc->cur_data_col>=doc_ce->max_col) {
|
||||
QueIns(doc_e,doc_ce);
|
||||
@@ -985,8 +953,9 @@ public U0 DocIns(CDoc *doc,CDocEntry *doc_e)
|
||||
|
||||
|
||||
#help_index "Doc/Output"
|
||||
public CDocEntry *DocPutS(CDoc *doc,U8 *st)
|
||||
{ //Does not handle partial Doc entries
|
||||
CDocEntry *DocPutS(CDoc *doc,U8 *st)
|
||||
{ //Don't use this. Use $LK,"DocPrint","MN:DocPrint"$().
|
||||
//Does not handle partial Doc entries
|
||||
//Returns last newly created dollar-sign CDocEntry.
|
||||
U8 ch,*ptr=st,*ptr2,*st2,*ptr3,*ptr4,*src,
|
||||
*char_bitmap;
|
||||
@@ -1140,10 +1109,9 @@ public CDocEntry *DocPutS(CDoc *doc,U8 *st)
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public CDocEntry *DocPrintF(CDoc *doc,U8 *src,...)
|
||||
public CDocEntry *DocPrint(CDoc *doc,U8 *fmt,...)
|
||||
{
|
||||
U8 *buf=SPrintFJoin(NULL,src,argc,argv);
|
||||
U8 *buf=SPrintJoin(NULL,fmt,argc,argv);
|
||||
CDocEntry *result=DocPutS(doc,buf);
|
||||
Free(buf);
|
||||
return result;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
public I64 DocEntryRun(CDoc *doc,CDocEntry *doc_e,Bool exited)
|
||||
{ //sometimes returns locked, sometimes unlocked
|
||||
U8 ch=doc->cmd_U8,*st;
|
||||
I64 result=-1;
|
||||
I64 result=DOCM_EXIT;
|
||||
DocLock(doc);
|
||||
if (!exited) {
|
||||
if (doc_e->flags1 & DOCEF1_ESC) {
|
||||
@@ -164,7 +164,7 @@ U8 *EdDollarTypeCB(CDoc *,CDocEntry *doc_e,CTask *mem_task)
|
||||
src="EOF";
|
||||
else if (!src)
|
||||
src="ERR";
|
||||
SPrintF(st,"%-3ts",src);
|
||||
SPrint(st,"%-3ts",src);
|
||||
return st;
|
||||
}
|
||||
|
||||
@@ -218,47 +218,47 @@ public Bool DocDo(CDoc *doc,I64 doc_flags=0)
|
||||
doc->win_task=Fs;
|
||||
bdoc=DocNew;
|
||||
bdoc->flags|=DOCF_BORDER_DOC;
|
||||
DocPutS(bdoc,"$$CM+TY+LX+NC,0,-1$$");
|
||||
DocPrint(bdoc,"$$CM+TY+LX+NC,0,-1$$");
|
||||
if (Bt(&Fs->display_flags,DISPLAYf_HAS_CLOSE_WIN))
|
||||
DocPutS(bdoc,"$$TX+RX+BD,\"[X]\"$$");
|
||||
DocPutS(bdoc,"$$BK,1$$$$TX+LX+BD,\"MENU\"$$$$BK,0$$");
|
||||
DocPrint(bdoc,"$$TX+RX+BD,\"[X]\"$$");
|
||||
DocPrint(bdoc,"$$BK,1$$$$TX+LX+BD,\"MENU\"$$$$BK,0$$");
|
||||
|
||||
old_task_title=StrNew(Fs->task_title);
|
||||
if (Fs->title_src!=TTS_LOCKED_CONST) {
|
||||
Fs->title_src=TTS_ED_FILENAME;
|
||||
MemCpy(Fs->task_title,doc->filename.name,TASK_TITLE_LEN);
|
||||
}
|
||||
doc_e=DocPutS(bdoc,"$$DA-T-P+BD+RD+CX+SCX+IV,140,\"%s...\",16$$");
|
||||
doc_e=DocPrint(bdoc,"$$DA-T-P+BD+RD+CX+SCX+IV,140,\"%%s...\",16$$");
|
||||
doc_e->data=&Fs->task_title;
|
||||
DocDataFmt(doc_e);
|
||||
|
||||
if (doc->flags & DOCF_ALLOW_UNDO) {
|
||||
DocPutS(bdoc,"$$CM+BY+LX+NC,1,1$$");
|
||||
doc_e=DocPutS(bdoc,"$$DA+BD+RD-T,32,\"Undo:%03d\"$$\n");
|
||||
DocPrint(bdoc,"$$CM+BY+LX+NC,1,1$$");
|
||||
doc_e=DocPrint(bdoc,"$$DA+BD+RD-T-U64+U32,32,\"Undo:%%03d\"$$\n");
|
||||
doc_e->data=&doc->undo_cnt;
|
||||
DocDataFmt(doc_e);
|
||||
}
|
||||
|
||||
DocPutS(bdoc,"$$CM+BY+RX+NC,-30,1$$");
|
||||
doc_e=DocPutS(bdoc,"$$TX+BD+TC,\" \"$$");
|
||||
DocPrint(bdoc,"$$CM+BY+RX+NC,-30,1$$");
|
||||
doc_e=DocPrint(bdoc,"$$TX+BD+TC,\" \"$$");
|
||||
doc_e->user_data=doc;
|
||||
doc_e->tag_cb=&EdMoreCB;
|
||||
doc_e=DocPutS(bdoc,"$$TX+BD+TC,\" \"$$");
|
||||
doc_e=DocPrint(bdoc,"$$TX+BD+TC,\" \"$$");
|
||||
doc_e->user_data=doc;
|
||||
doc_e->tag_cb=&EdDollarTypeCB;
|
||||
doc_e=DocPutS(bdoc,"$$TX+BD+TC,\" \"$$");
|
||||
doc_e=DocPrint(bdoc,"$$TX+BD+TC,\" \"$$");
|
||||
doc_e->user_data=doc;
|
||||
doc_e->tag_cb=&EdFilterCB;
|
||||
doc_e=DocPutS(bdoc,"$$TX+BD+TC,\" \"$$");
|
||||
doc_e=DocPrint(bdoc,"$$TX+BD+TC,\" \"$$");
|
||||
doc_e->user_data=doc;
|
||||
doc_e->tag_cb=&EdOverStrikeCB;
|
||||
doc_e=DocPutS(bdoc,"$$TX+BD+TC,\" \"$$");
|
||||
doc_e=DocPrint(bdoc,"$$TX+BD+TC,\" \"$$");
|
||||
doc_e->user_data=doc;
|
||||
doc_e->tag_cb=&EdDollarCB;
|
||||
doc_e=DocPutS(bdoc,"$$DA+BD+RD-T,32,\"Line:%04d \"$$");
|
||||
doc_e=DocPrint(bdoc,"$$DA+BD+RD-T,32,\"Line:%%04d \"$$");
|
||||
doc_e->data=&doc->line;
|
||||
DocDataFmt(doc_e);
|
||||
doc_e=DocPutS(bdoc,"$$DA+BD+RD-T,32,\"Col:%04d\"$$\n");
|
||||
doc_e=DocPrint(bdoc,"$$DA+BD+RD-T,32,\"Col:%%04d\"$$\n");
|
||||
doc_e->data=&doc->col;
|
||||
DocDataFmt(doc_e);
|
||||
|
||||
@@ -291,7 +291,7 @@ public Bool DocDo(CDoc *doc,I64 doc_flags=0)
|
||||
doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
if (doc_e->type_u8==DOCT_DATA || doc_e->type_u8==DOCT_CHECK_BOX)
|
||||
DocDataGet(doc_e);
|
||||
DocDataScan(doc_e);
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
}
|
||||
@@ -317,7 +317,7 @@ public Bool DocDo(CDoc *doc,I64 doc_flags=0)
|
||||
|
||||
|
||||
#help_index "Doc/Input"
|
||||
public Bool DocFormDo(U8 *D,U8 *class_name,
|
||||
public Bool DocFormDo(U8 *_d,U8 *class_name=lastclass,
|
||||
I64 doc_flags=0,U8 *header=NULL,U8 *footer=NULL)
|
||||
//Supply a class name that has fmtstr definitions
|
||||
//and this routine will allow user input.
|
||||
@@ -333,31 +333,32 @@ public Bool DocFormDo(U8 *D,U8 *class_name,
|
||||
return FALSE;
|
||||
doc=DocNew;
|
||||
StrCpy(doc->desc,"Form");
|
||||
if (header) DocPutS(doc,header);
|
||||
if (header) DocPrint(doc,"%s",header);
|
||||
doc->flags|=DOCF_OVERSTRIKE|DOCF_FORM;
|
||||
if (doc_flags&DOF_MIN_SIZE)
|
||||
doc->flags|=DOCF_MIN_SIZE;
|
||||
ml=tempc->member_lst;
|
||||
while (ml) {
|
||||
if (fmtstr=MemberMetaData("fmtstr",ml)) {
|
||||
doc_e=DocPutS(doc,fmtstr);
|
||||
doc_e->data=D+ml->offset;
|
||||
doc_e=DocPrint(doc,"%s",fmtstr);
|
||||
doc_e->data=_d+ml->offset;
|
||||
doc_e->my_fmt_data=MemberMetaData("fmtdata",ml);
|
||||
DocDataFmt(doc_e);
|
||||
}
|
||||
ml=ml->next;
|
||||
}
|
||||
if (footer) DocPutS(doc,footer);
|
||||
if (footer) DocPrint(doc,"%s",footer);
|
||||
if (doc->root.next!=doc) {
|
||||
Fs->border_src=BDS_CONST;
|
||||
DocRecalc(doc);
|
||||
if (DocDo(doc,doc_flags)) {
|
||||
doc_e=doc->cur_entry;
|
||||
result=TRUE;
|
||||
if (doc_e!=doc) {
|
||||
DocEntryRun(doc,doc_e,TRUE);
|
||||
if (DocEntryRun(doc,doc_e,TRUE)==DOCM_CANCEL)
|
||||
result=FALSE;
|
||||
DocUnlock(doc);
|
||||
}
|
||||
result=TRUE;
|
||||
}
|
||||
}
|
||||
DocDel(doc);
|
||||
@@ -431,7 +432,7 @@ public I64 PopUp(U8 *msg,CTask *parent=NULL,CTask **_pu_task=NULL)
|
||||
#help_index "Doc/Output"
|
||||
public CTask *PopUpViewDoc(CDoc *doc,I64 doc_flags=0)
|
||||
{
|
||||
U8 *buf=MSPrintF("if (!IsSysDeterministic) Preempt(ON);DocDo(0x%X,0x%X);",doc,doc_flags);
|
||||
U8 *buf=MPrint("if (!IsSysDeterministic) Preempt(ON);DocDo(0x%X,0x%X);",doc,doc_flags);
|
||||
CTask *task=Spawn(&SrvUserCmdLine,NULL,"View",,Fs);
|
||||
TaskExeStrQue(task,NULL,buf,1<<SVCf_EXIT_ON_COMPLETE|1<<SVCf_FREE_ON_COMPLETE);
|
||||
Free(buf);
|
||||
@@ -440,7 +441,7 @@ public CTask *PopUpViewDoc(CDoc *doc,I64 doc_flags=0)
|
||||
|
||||
U0 PopUpViewStrTaskEndCB()
|
||||
{
|
||||
DocDel(NamedFramePtr("ViewStrFrame"));
|
||||
DocDel(FramePtr("ViewStrFrame"));
|
||||
Exit;
|
||||
}
|
||||
|
||||
@@ -448,9 +449,9 @@ public CTask *PopUpViewStr(U8 *msg)
|
||||
{
|
||||
CTask *task;
|
||||
CDoc *doc=DocNew;
|
||||
DocPrintF(doc,msg);
|
||||
DocPrint(doc,msg);
|
||||
task=PopUpViewDoc(doc);
|
||||
NamedFramePtrAdd("ViewStrFrame",doc,task);
|
||||
FramePtrAdd("ViewStrFrame",doc,task);
|
||||
task->task_end_cb=&PopUpViewStrTaskEndCB;
|
||||
return task;
|
||||
}
|
||||
@@ -462,10 +463,10 @@ public I64 PopUpMenu(CDoc *doc,I64 doc_flags=0)
|
||||
return SrvUser("DocMenuDo(0x%X,0x%X);",doc,doc_flags);
|
||||
}
|
||||
|
||||
public Bool PopUpForm(U8 *D,U8 *class_name,I64 doc_flags=DOF_MIN_SIZE,
|
||||
public Bool PopUpForm(U8 *_d,U8 *class_name=lastclass,I64 doc_flags=DOF_MIN_SIZE,
|
||||
U8 *header=NULL,U8 *footer=NULL)
|
||||
{
|
||||
return SrvUser("DocFormDo(0x%X,0x%X,0x%X,0x%X,0x%X);",D,class_name,
|
||||
return SrvUser("DocFormDo(0x%X,0x%X,0x%X,0x%X,0x%X);",_d,class_name,
|
||||
doc_flags,header,footer);
|
||||
}
|
||||
|
||||
@@ -474,10 +475,10 @@ public U8 *PopUpPickFile(U8 *dir=NULL)
|
||||
{
|
||||
U8 *result,*st,*st2;
|
||||
if (dir)
|
||||
st=MSPrintF("Cd(\"%Q\");FileMgr(FM_PICK_FILE,Fs->parent_task);",dir);
|
||||
st=MPrint("Cd(\"%Q\");FileMgr(FM_PICK_FILE,Fs->parent_task);",dir);
|
||||
else {
|
||||
st2=CurDir;
|
||||
st=MSPrintF("Cd(\"%Q\");FileMgr(FM_PICK_FILE,Fs->parent_task);",st2);
|
||||
st=MPrint("Cd(\"%Q\");FileMgr(FM_PICK_FILE,Fs->parent_task);",st2);
|
||||
Free(st2);
|
||||
}
|
||||
result=PopUp(st,Fs);
|
||||
@@ -489,10 +490,10 @@ public U8 *PopUpPickDir(U8 *dir=NULL)
|
||||
{
|
||||
U8 *result,*st,*st2;
|
||||
if (dir)
|
||||
st=MSPrintF("Cd(\"%Q\");FileMgr(FM_PICK_DIR,Fs->parent_task);",dir);
|
||||
st=MPrint("Cd(\"%Q\");FileMgr(FM_PICK_DIR,Fs->parent_task);",dir);
|
||||
else {
|
||||
st2=CurDir;
|
||||
st=MSPrintF("Cd(\"%Q\");FileMgr(FM_PICK_DIR,Fs->parent_task);",st2);
|
||||
st=MPrint("Cd(\"%Q\");FileMgr(FM_PICK_DIR,Fs->parent_task);",st2);
|
||||
Free(st2);
|
||||
}
|
||||
result=PopUp(st,Fs);
|
||||
@@ -507,7 +508,7 @@ public U8 *FileNameForm(U8 *dft=NULL,I64 doc_flags=0,CTask *mem_task=NULL)
|
||||
StrCpy(fn.name,dft);
|
||||
else
|
||||
*fn.name=0;
|
||||
if (DocFormDo(fn.name,"CEdFileName",doc_flags))
|
||||
if (DocFormDo(&fn,,doc_flags))
|
||||
return StrNew(fn.name,mem_task);
|
||||
else
|
||||
return NULL;
|
||||
@@ -515,7 +516,7 @@ public U8 *FileNameForm(U8 *dft=NULL,I64 doc_flags=0,CTask *mem_task=NULL)
|
||||
|
||||
public U8 *PopUpFileName(U8 *dft=NULL,I64 doc_flags=0)
|
||||
{
|
||||
U8 *st=MSPrintF("FileNameForm(\"%Q\",0x%X,Fs->parent_task);",dft,doc_flags|DOF_MIN_SIZE),
|
||||
U8 *st=MPrint("FileNameForm(\"%Q\",0x%X,Fs->parent_task);",dft,doc_flags|DOF_MIN_SIZE),
|
||||
*result=PopUp(st,Fs);
|
||||
Free(st);
|
||||
return result;
|
||||
@@ -535,21 +536,21 @@ Bool PopUpCd()
|
||||
}
|
||||
|
||||
#help_index "Doc/Input"
|
||||
public U8 *PopUpPickLstEntry(U8 *lst)
|
||||
public U8 *PopUpPickLst(U8 *lst)
|
||||
{
|
||||
I64 i=0;
|
||||
CDoc *doc=DocNew;
|
||||
DocPutS(doc,"$$FG,LTBLUE$$");
|
||||
DocPrint(doc,"$$FG,LTBLUE$$");
|
||||
while (*lst) {
|
||||
if (*lst=='@') { //Check for '@' alias lst entry
|
||||
i--;
|
||||
lst++;
|
||||
}
|
||||
DocPrintF(doc,"$$MU,\"%s\",0x%08X$$\n",
|
||||
DocPrint(doc,"$$MU,\"%s\",0x%08X$$\n",
|
||||
lst,i++);
|
||||
lst+=StrLen(lst)+1;
|
||||
}
|
||||
DocPutS(doc,"\n$$MU,\"CANCEL\",DOCM_CANCEL$$\n");
|
||||
DocPrint(doc,"\n$$MU,\"CANCEL\",DOCM_CANCEL$$\n");
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
return i;
|
||||
@@ -557,16 +558,16 @@ public U8 *PopUpPickLstEntry(U8 *lst)
|
||||
|
||||
public U8 *PopUpPickDefineSub(U8 *st)
|
||||
{
|
||||
return PopUpPickLstEntry(Define(st));
|
||||
return PopUpPickLst(Define(st));
|
||||
}
|
||||
|
||||
public I64 PopUp1(U8 *b1,I64 n1,U8 *header=NULL,U8 *footer=NULL)
|
||||
{
|
||||
I64 i,l1=StrLen(b1);
|
||||
CDoc *doc=DocNew;
|
||||
if (header) DocPutS(doc,header);
|
||||
DocPrintF(doc,"$$CM+CX,%d,4$$$$BT,\"%s\",%d$$\n",-l1/2,b1,n1);
|
||||
if (footer) DocPutS(doc,footer);
|
||||
if (header) DocPrint(doc,"%s",header);
|
||||
DocPrint(doc,"$$CM+CX,%d,4$$$$BT,\"%s\",%d$$\n",-l1/2,b1,n1);
|
||||
if (footer) DocPrint(doc,"%s",footer);
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
return i;
|
||||
@@ -577,15 +578,15 @@ public I64 PopUp2(U8 *b1,I64 n1,U8 *b2,I64 n2,U8 *header=NULL,U8 *footer=NULL)
|
||||
I64 i,l1=StrLen(b1),l2=StrLen(b2),y;
|
||||
CDoc *doc=DocNew;
|
||||
if (header) {
|
||||
DocPutS(doc,header);
|
||||
DocPrint(doc,"%s",header);
|
||||
y=4;
|
||||
} else {
|
||||
DocPrintF(doc,"%*s\n",l1+l2+10,"");
|
||||
DocPrint(doc,"%*s\n",l1+l2+10,"");
|
||||
y=3;
|
||||
}
|
||||
DocPrintF(doc,"$$CM+CX,%d,%d$$$$BT,\"%s\",%d$$",-(l1+l2+3)>>1,y,b1,n1);
|
||||
DocPrintF(doc,"$$CM+CX,%d,0$$$$BT,\"%s\",%d$$\n" ,-(l1+l2+3)>>1+l1+6,b2,n2);
|
||||
if (footer) DocPutS(doc,footer);
|
||||
DocPrint(doc,"$$CM+CX,%d,%d$$$$BT,\"%s\",%d$$",-(l1+l2+3)>>1,y,b1,n1);
|
||||
DocPrint(doc,"$$CM+CX,%d,0$$$$BT,\"%s\",%d$$\n" ,-(l1+l2+3)>>1+l1+6,b2,n2);
|
||||
if (footer) DocPrint(doc,"%s",footer);
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
return i;
|
||||
@@ -615,12 +616,12 @@ public I64 PopUpReplaceSkipAllCancel(U8 *header=NULL,U8 *footer=NULL)
|
||||
{
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
if (header) DocPutS(doc,header);
|
||||
DocPutS(doc,"$$CM+LX,1,4$$$$BT,\"REPLACE\",RSAC_REPLACE$$"
|
||||
if (header) DocPrint(doc,"%s",header);
|
||||
DocPrint(doc,"$$CM+LX,1,4$$$$BT,\"REPLACE\",RSAC_REPLACE$$"
|
||||
"$$CM+LX,17,0$$$$BT,\"SKIP\",RSAC_SKIP$$"
|
||||
"$$CM+LX,1,3$$$$BT,\"ALL\",RSAC_ALL$$"
|
||||
"$$CM+LX,17,0$$$$BT,\"CANCEL\",DOCM_CANCEL$$\n");
|
||||
if (footer) DocPutS(doc,footer);
|
||||
if (footer) DocPrint(doc,"%s",footer);
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
return i;
|
||||
@@ -630,7 +631,7 @@ U8 *DoPopUpMGetS(U8 *header,CTask *mem_task)
|
||||
{
|
||||
U8 *result,*st;
|
||||
if (header)
|
||||
"" header;
|
||||
"%s",header;
|
||||
st=MGetS(GETSF_WITH_NEW_LINE);
|
||||
result=StrNew(st,mem_task);
|
||||
Free(st);
|
||||
@@ -639,23 +640,31 @@ U8 *DoPopUpMGetS(U8 *header,CTask *mem_task)
|
||||
|
||||
public U8 *PopUpMGetS(U8 *header=NULL)
|
||||
{
|
||||
U8 *st=MSPrintF("DoPopUpMGetS(0x%X,0x%X);",header,Fs),
|
||||
U8 *st=MPrint("DoPopUpMGetS(0x%X,0x%X);",header,Fs),
|
||||
*result=PopUp(st,Fs);
|
||||
Free(st);
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 PopUpI64(U8 *msg,I64 dft,I64 lo=MIN_I64,I64 hi=MAX_I64)
|
||||
{
|
||||
U8 *st=MPrint("PmtI64(0x%X,0x%X,0x%X,0x%X);",msg,dft,lo,hi);
|
||||
I64 result=PopUp(st,Fs);
|
||||
Free(st);
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 PopUpRangeI64(I64 lo,I64 hi,I64 step=1,U8 *header=NULL,U8 *footer=NULL)
|
||||
{
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
if (header)
|
||||
DocPutS(doc,header);
|
||||
DocPutS(doc,"$$FG,LTBLUE$$");
|
||||
DocPrint(doc,"%s",header);
|
||||
DocPrint(doc,"$$FG,LTBLUE$$");
|
||||
for (i=lo;i<=hi;i+=step)
|
||||
DocPrintF(doc,"$$MU,\"%d\",%d$$\n",i,i);
|
||||
DocPrint(doc,"$$MU,\"%d\",%d$$\n",i,i);
|
||||
if (footer)
|
||||
DocPutS(doc,footer);
|
||||
DocPrint(doc,"%s",footer);
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
return i;
|
||||
@@ -669,14 +678,14 @@ public F64 PopUpRangeF64(F64 lo,F64 hi,F64 step,
|
||||
U8 buf[136];
|
||||
CDoc *doc=DocNew;
|
||||
if (header)
|
||||
DocPutS(doc,header);
|
||||
DocPutS(doc,"$$FG,LTBLUE$$");
|
||||
DocPrint(doc,"%s",header);
|
||||
DocPrint(doc,"$$FG,LTBLUE$$");
|
||||
for (d=lo;d<=hi;d+=step) {
|
||||
SPrintF(buf,fmt,d);
|
||||
DocPrintF(doc,"$$MU,\"%s\",0x%X$$\n",buf,d);
|
||||
SPrint(buf,fmt,d);
|
||||
DocPrint(doc,"$$MU,\"%s\",0x%X$$\n",buf,d);
|
||||
}
|
||||
if (footer)
|
||||
DocPutS(doc,footer);
|
||||
DocPrint(doc,"%s",footer);
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
return i(F64);
|
||||
@@ -690,14 +699,14 @@ public F64 PopUpRangeF64Exp(F64 lo,F64 hi,F64 factor,
|
||||
U8 buf[136];
|
||||
CDoc *doc=DocNew;
|
||||
if (header)
|
||||
DocPutS(doc,header);
|
||||
DocPutS(doc,"$$FG,LTBLUE$$");
|
||||
DocPrint(doc,"%s",header);
|
||||
DocPrint(doc,"$$FG,LTBLUE$$");
|
||||
for (d=lo;d<=hi;d*=factor) {
|
||||
SPrintF(buf,fmt,d);
|
||||
DocPrintF(doc,"$$MU,\"%s\",0x%X$$\n",buf,d);
|
||||
SPrint(buf,fmt,d);
|
||||
DocPrint(doc,"$$MU,\"%s\",0x%X$$\n",buf,d);
|
||||
}
|
||||
if (footer)
|
||||
DocPutS(doc,footer);
|
||||
DocPrint(doc,"%s",footer);
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
return i(F64);
|
||||
@@ -717,7 +726,7 @@ public I64 AdamFile(U8 *filename,Bool warn_ext=TRUE)
|
||||
*name2=DftExt(name,"CPP.Z");
|
||||
I64 result=0;
|
||||
if (warn_ext &&
|
||||
!FilesFindMatch(FILENAME_MASK_JIT,name2) &&
|
||||
!FilesFindMatch(name2,FILEMASK_JIT) &&
|
||||
!PopUpCancelOk(ST_WARN_ST "Not .CPP File\n\n"))
|
||||
okay=FALSE;
|
||||
if (okay)
|
||||
@@ -735,11 +744,11 @@ public I64 PopUpFile(U8 *filename,Bool warn_ext=TRUE,CTask *parent=NULL,CTask **
|
||||
*name2=DftExt(name,"CPP.Z");
|
||||
I64 result=0;
|
||||
if (warn_ext &&
|
||||
!FilesFindMatch(FILENAME_MASK_JIT,name2) &&
|
||||
!FilesFindMatch(name2,FILEMASK_JIT) &&
|
||||
!PopUpCancelOk(ST_WARN_ST "Not .CPP File\n\n"))
|
||||
okay=FALSE;
|
||||
if (okay) {
|
||||
st=MSPrintF("\"$$$$WW+H,1$$$$\";Auto(\"ExeFile(\\\"%s\\\");\\n\");UserTaskCont;",name2);
|
||||
st=MPrint("\"$$$$WW+H,1$$$$\";Auto(\"ExeFile(\\\"%s\\\");\\n\");UserTaskCont;",name2);
|
||||
result=PopUp(st,parent,_pu_task);
|
||||
Free(st);
|
||||
}
|
||||
@@ -754,13 +763,13 @@ public I64 PopUpColor(U8 *header=NULL,Bool allow_transparent=TRUE,Bool allow_dft
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
if (header)
|
||||
DocPutS(doc,header);
|
||||
DocPrint(doc,"%s",header);
|
||||
if (allow_transparent)
|
||||
DocPutS(doc,"$$MU,\"TRANSPARENT\",COLOR_TRANSPARENT$$\n");
|
||||
DocPrint(doc,"$$MU,\"TRANSPARENT\",COLOR_TRANSPARENT$$\n");
|
||||
for (i=0;i<16;i++)
|
||||
DocPrintF(doc,"$$BG,%d$$$$MU,\"__%-8Z__\",%d$$$$BG$$\n",i,i,"ST_COLORS",i);
|
||||
DocPrint(doc,"$$BG,%d$$$$MU,\"__%-8Z__\",%d$$$$BG$$\n",i,i,"ST_COLORS",i);
|
||||
if (allow_dft)
|
||||
DocPutS(doc,"$$BG,WHITE$$$$MU,\"DEFAULT\",DOC_DFT$$$$BG$$");
|
||||
DocPrint(doc,"$$BG,WHITE$$$$MU,\"DEFAULT\",DOC_DFT$$$$BG$$");
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
return i;
|
||||
@@ -771,23 +780,23 @@ public I64 PopUpColorLighting(U8 *header=NULL)
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
if (header)
|
||||
DocPutS(doc,header);
|
||||
DocPutS(doc,"\nSingle-Sided means both sides same color."
|
||||
DocPrint(doc,"%s",header);
|
||||
DocPrint(doc,"\nSingle-Sided means both sides same color."
|
||||
"\nDouble-Sided means back side darker."
|
||||
"\n"
|
||||
"\nHalf-Range means 0 to [0,7]"
|
||||
"\n [8,15]-8 to [8,15]"
|
||||
"\nFull-Range means 0 to [0,7] to [0,7]+8"
|
||||
"\n");
|
||||
DocPutS(doc,"\n$$FG,LTPURPLE$$Single-Sided Full-Range Double-Sided Full-Range\n$$FG,BLACK$$");
|
||||
DocPrint(doc,"\n$$FG,LTPURPLE$$Single-Sided Full-Range Double-Sided Full-Range\n$$FG,BLACK$$");
|
||||
for (i=0;i<8;i++) {
|
||||
DocPrintF(doc,"$$BG,%d$$$$MU,\"__%-19Z__\",%d$$$$BG$$ ",i,i,"ST_COLORS",i);
|
||||
DocPrintF(doc,"$$BG,%d$$$$MU,\"__%-19Z__\",%d$$$$BG$$\n",i,i,"ST_COLORS",ROPF_TWO_SIDED+i);
|
||||
DocPrint(doc,"$$BG,%d$$$$MU,\"__%-19Z__\",%d$$$$BG$$ ",i,i,"ST_COLORS",i);
|
||||
DocPrint(doc,"$$BG,%d$$$$MU,\"__%-19Z__\",%d$$$$BG$$\n",i,i,"ST_COLORS",ROPF_TWO_SIDED+i);
|
||||
}
|
||||
DocPutS(doc,"\n$$FG,LTPURPLE$$Single-Sided Half-Range Double-Sided Half-Range\n$$FG,BLACK$$");
|
||||
DocPrint(doc,"\n$$FG,LTPURPLE$$Single-Sided Half-Range Double-Sided Half-Range\n$$FG,BLACK$$");
|
||||
for (i=0;i<16;i++) {
|
||||
DocPrintF(doc,"$$BG,%d$$$$MU,\"__%-19Z__\",%d$$$$BG$$ ",i,i,"ST_COLORS",ROPF_HALF_RANGE_COLOR+i);
|
||||
DocPrintF(doc,"$$BG,%d$$$$MU,\"__%-19Z__\",%d$$$$BG$$\n",i,i,"ST_COLORS",ROPF_TWO_SIDED+ROPF_HALF_RANGE_COLOR+i);
|
||||
DocPrint(doc,"$$BG,%d$$$$MU,\"__%-19Z__\",%d$$$$BG$$ ",i,i,"ST_COLORS",ROPF_HALF_RANGE_COLOR+i);
|
||||
DocPrint(doc,"$$BG,%d$$$$MU,\"__%-19Z__\",%d$$$$BG$$\n",i,i,"ST_COLORS",ROPF_TWO_SIDED+ROPF_HALF_RANGE_COLOR+i);
|
||||
}
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
@@ -819,7 +828,7 @@ Bool PopUpTransform(I64 *r)
|
||||
tf->x_offset=0.0;
|
||||
tf->y_offset=0.0;
|
||||
tf->z_offset=0.0;
|
||||
if (PopUpForm(tf,"CTransformForm")) {
|
||||
if (PopUpForm(tf)) {
|
||||
MemSet(r,0,16*sizeof(I64));
|
||||
r[0] =tf->x_scale*gr_scale;
|
||||
r[5] =tf->y_scale*gr_scale;
|
||||
@@ -855,7 +864,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
else
|
||||
i1=COLOR_TRANSPARENT;
|
||||
dc->color=j1+i1<<16+ROPF_DITHER;
|
||||
GrRect(dc,i*PU_SPACING,j*PU_SPACING+NamedFramePtr("DitherDoFrame",task),PU_SPACING,PU_SPACING);
|
||||
GrRect(dc,i*PU_SPACING,j*PU_SPACING+FramePtr("DitherDoFrame",task),PU_SPACING,PU_SPACING);
|
||||
}
|
||||
i=(17*PU_SPACING+FONT_WIDTH-1)/FONT_WIDTH;
|
||||
if (doc->max_x>i) i=doc->max_x;
|
||||
@@ -867,9 +876,9 @@ I64 DitherColorDo(U8 *header=NULL)
|
||||
{
|
||||
I64 msg_code,p1,p2,result=-1,i,j;
|
||||
DocClear;
|
||||
"" header;
|
||||
"%s",header;
|
||||
DocRecalc(DocPut);
|
||||
NamedFramePtrAdd("DitherDoFrame",(DocPut->max_y+1)*FONT_HEIGHT);
|
||||
FramePtrAdd("DitherDoFrame",(DocPut->max_y+1)*FONT_HEIGHT);
|
||||
SettingsPush; //See $LK,"SettingsPush","MN:SettingsPush"$
|
||||
Fs->draw_it=&DrawIt;
|
||||
do {
|
||||
@@ -877,7 +886,7 @@ I64 DitherColorDo(U8 *header=NULL)
|
||||
if (msg_code==MSG_IP_L_DOWN) {
|
||||
msg_code=GetMsg(&p1,&p2,1<<MSG_IP_L_UP);
|
||||
i=p1/PU_SPACING;
|
||||
j=(p2-NamedFramePtr("DitherDoFrame"))/PU_SPACING;
|
||||
j=(p2-FramePtr("DitherDoFrame"))/PU_SPACING;
|
||||
if (p1>=0 && p2>=0 && 0<=j<17 && 0<=i<17) {
|
||||
if (j==16) j=COLOR_TRANSPARENT;
|
||||
if (i==16) i=COLOR_TRANSPARENT;
|
||||
@@ -890,14 +899,14 @@ I64 DitherColorDo(U8 *header=NULL)
|
||||
while (!p1);
|
||||
dcd_done:
|
||||
SettingsPop;
|
||||
NamedFramePtrDel("DitherDoFrame");
|
||||
FramePtrDel("DitherDoFrame");
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 PopUpColorDither(U8 *header=NULL)
|
||||
{
|
||||
U8 buf[136];
|
||||
SPrintF(buf,"DitherColorDo(0x%X);",header);
|
||||
SPrint(buf,"DitherColorDo(0x%X);",header);
|
||||
return PopUp(buf,Fs);
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,6 @@ Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC_ALL)
|
||||
{
|
||||
I64 i,ii,j,k,x,x0,y,y0,D,d2,col,col2,best_col=0,best_d=MAX_I64,xx,yy,zz,
|
||||
num_entries=0,ijif,cur_u8_attr,temp_u32_attr,
|
||||
hide_collapsed[2],
|
||||
cursor_y=MIN_I64,left_margin,right_margin,
|
||||
y_plot_top,y_plot_bottom,
|
||||
top,left,bottom,right,width,height,scroll_x,scroll_y,
|
||||
@@ -195,7 +194,7 @@ Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC_ALL)
|
||||
best_do_e=doc->cur_entry;
|
||||
|
||||
if (!(doc->flags&(DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_WITH_TABS)) &&
|
||||
FilesFindMatch(FILENAME_MASK_SRC,doc->filename.name))
|
||||
FilesFindMatch(doc->filename.name,FILEMASK_SRC))
|
||||
doc->flags|=DOCF_HIGHLIGHT;
|
||||
else
|
||||
doc->flags&=~DOCF_HIGHLIGHT;
|
||||
@@ -356,9 +355,7 @@ word_wrap_start:
|
||||
goto word_wrap_start;
|
||||
}
|
||||
}
|
||||
if (doc_e->type_u8==DOCT_TEXT &&
|
||||
!(doc_e->flags1&DOCEG1_DONT_EDIT) &&
|
||||
!(doc_e->flags2&DOCEG2_DONT_EDIT)) {
|
||||
if (IsEditableText(doc_e)) {
|
||||
if (doc_e->flags1==doc_e2->flags1 && doc_e->flags2==doc_e2->flags2 &&
|
||||
doc_e->type==doc_e2->type) {
|
||||
j=StrLen(doc_e2->tag);
|
||||
@@ -461,9 +458,7 @@ word_wrap2:
|
||||
if (doc->flags & DOCF_WORD_WRAP) {
|
||||
i=right_margin+1-(x+left); //Space left on line
|
||||
ii=x+1-s->left_margin;
|
||||
if (doc_e->type_u8==DOCT_TEXT &&
|
||||
!(doc_e->flags1&DOCEG1_DONT_EDIT) &&
|
||||
!(doc_e->flags2&DOCEG2_DONT_EDIT)) {
|
||||
if (IsEditableText(doc_e)) {
|
||||
if (doc->cur_entry==doc_e->next) {
|
||||
if (doc->cur_data_col==doc_e->next->min_col)
|
||||
i--;
|
||||
@@ -577,10 +572,6 @@ skip_soft_cr:
|
||||
case DOCT_TREE:
|
||||
temp_u32_attr.u8[1]|=DOC_COLOR_TREE;
|
||||
break;
|
||||
case DOCT_HIDE_START:
|
||||
case DOCT_HIDE_END:
|
||||
temp_u32_attr.u8[1]|=DOC_COLOR_HIDDEN;
|
||||
break;
|
||||
default:
|
||||
temp_u32_attr.u8[1]|=cur_u8_attr&15;
|
||||
}
|
||||
@@ -615,7 +606,7 @@ skip_soft_cr:
|
||||
if (doc_e==doc->cur_entry && doc_e->type_u8!=DOCT_TEXT)
|
||||
temp_u32_attr^=0x0F00;
|
||||
if (full_refresh && '0'<=ptr[1]<='9') {
|
||||
SPrintF(buf,"<%d>",doc_e->bin_num);
|
||||
SPrint(buf,"<%d>",doc_e->bin_num);
|
||||
k=StrLen(buf);
|
||||
Free(doc_e->tag);
|
||||
ptr=doc_e->tag=MAlloc(k+1,mem_task);
|
||||
@@ -632,20 +623,7 @@ skip_soft_cr:
|
||||
*ptr++=']';
|
||||
ptr=doc_e->tag;
|
||||
}
|
||||
} else if (doc_e->type_u8==DOCT_HIDE_START) {
|
||||
if (k>=2) {
|
||||
*ptr++='<';
|
||||
if (doc_e->flags1 & DOCEF1_CHECKED_COLLAPSED)
|
||||
*ptr++='+';
|
||||
else
|
||||
*ptr++='-';
|
||||
ptr=doc_e->tag;
|
||||
}
|
||||
} else if (doc_e->type_u8==DOCT_HIDE_END) {
|
||||
if (k>=1)
|
||||
*ptr='>';
|
||||
}
|
||||
|
||||
if (doc_e->flags1 & DOCEF1_SCROLLING_X) {
|
||||
j=StrLen(doc_e->tag);
|
||||
if (j && doc_e->scroll_len) {
|
||||
@@ -741,9 +719,9 @@ skip_soft_cr:
|
||||
k=doc_e->hex_ed_width; //columns
|
||||
for (i=0;i<doc_e->len;i+=k) {
|
||||
if (doc_e->flags1 & DOCEF1_ZERO_BASED)
|
||||
SPrintF(buf,"%08tX ",i);
|
||||
SPrint(buf,"%08tX ",i);
|
||||
else
|
||||
SPrintF(buf,"%08tX ",bptr);
|
||||
SPrint(buf,"%08tX ",bptr);
|
||||
ptr=buf;
|
||||
while (ch=*ptr++) {
|
||||
if (recalc==DOC_RECALC_TO_SCREEN && !(doc_e->flags1&DOCEF1_DONT_DRAW)) {
|
||||
@@ -764,7 +742,7 @@ skip_soft_cr:
|
||||
}
|
||||
if (i+k>doc_e->len) k=doc_e->len-i;
|
||||
for (j=0;j<k;j++) {
|
||||
SPrintF(buf,"%02tX",*bptr++);
|
||||
SPrint(buf,"%02tX",*bptr++);
|
||||
ptr=buf;
|
||||
while (ch=*ptr++) {
|
||||
if (recalc==DOC_RECALC_TO_SCREEN && !(doc_e->flags1&DOCEF1_DONT_DRAW)) {
|
||||
@@ -1240,7 +1218,6 @@ adjust_xy:
|
||||
if (full_refresh) {
|
||||
switch (doc_e->type_u8) {
|
||||
case DOCT_CHECK_BOX:
|
||||
case DOCT_HIDE_START:
|
||||
doc_e->max_col=2;
|
||||
break;
|
||||
case DOCT_TREE:
|
||||
@@ -1248,7 +1225,6 @@ adjust_xy:
|
||||
case DOCT_LINK:
|
||||
case DOCT_MENU_VAL:
|
||||
case DOCT_MACRO:
|
||||
case DOCT_HIDE_END:
|
||||
doc_e->max_col=1;
|
||||
break;
|
||||
default:
|
||||
@@ -1304,35 +1280,6 @@ adjust_xy:
|
||||
} while (doc_e2!=doc && j>i);
|
||||
}
|
||||
}
|
||||
if (doc_e->type_u8 == DOCT_HIDE_START) {
|
||||
if (doc_e->flags1 & DOCEF1_ALIAS)
|
||||
alias=doc_e;
|
||||
else
|
||||
alias=NULL;
|
||||
doc_e2=doc_e->next;
|
||||
LBtr(hide_collapsed,0);
|
||||
j=1;
|
||||
LBEqu(hide_collapsed,j,doc_e->flags1 & DOCEF1_CHECKED_COLLAPSED);
|
||||
while (doc_e2!=doc && j>0) {
|
||||
if (Bt(hide_collapsed,j))
|
||||
doc_e2->flags1|=DOCEF1_SKIP;
|
||||
else
|
||||
doc_e2->flags1&=~DOCEF1_SKIP;
|
||||
if (doc_e2->type_u8==DOCT_HIDE_START) {
|
||||
j++;
|
||||
LBEqu(hide_collapsed,j,doc_e2->flags1 & DOCEF1_CHECKED_COLLAPSED);
|
||||
if (Bt(hide_collapsed,j-1))
|
||||
LBts(hide_collapsed,j);
|
||||
} else if (doc_e2->type_u8==DOCT_HIDE_END) {
|
||||
j--;
|
||||
if (Bt(hide_collapsed,j))
|
||||
doc_e2->flags1|=DOCEF1_SKIP;
|
||||
else
|
||||
doc_e2->flags1&=~DOCEF1_SKIP;
|
||||
}
|
||||
doc_e2=doc_e2->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
doc_e2=doc_e->next;
|
||||
@@ -1563,7 +1510,7 @@ public U0 DocInsSafe(CDoc *doc,U8 *st)
|
||||
unlock=DocLock(doc);
|
||||
old_flags=doc->flags;
|
||||
doc->flags|=DOCF_NO_CURSOR;
|
||||
DocPutS(doc,st);
|
||||
DocPrint(doc,"%s",st);
|
||||
DocRecalc(doc,FALSE,DOC_RECALC_PARTIAL);
|
||||
doc->flags=old_flags;
|
||||
if (unlock)
|
||||
@@ -1612,7 +1559,7 @@ public U0 DocClear(CDoc *doc=NULL)
|
||||
}
|
||||
unlock=DocLock(doc);
|
||||
DocBottom(doc);
|
||||
DocPutS(doc,"$$CL$$");
|
||||
DocPrint(doc,"$$CL$$");
|
||||
DocRecalc(doc);
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
@@ -1650,7 +1597,7 @@ public U0 DocCollapse(Bool collapse=TRUE,CDoc *doc=NULL)
|
||||
unlock=DocLock(doc);
|
||||
doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
if (doc_e->flags1&DOCEF1_TREE || doc_e->type_u8==DOCT_HIDE_START)
|
||||
if (doc_e->flags1&DOCEF1_TREE)
|
||||
BEqu(&doc_e->flags1,DOCEf1_CHECKED_COLLAPSED,collapse);
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
|
||||
@@ -98,8 +98,8 @@ mt_done:
|
||||
while (*st3) {
|
||||
StrFirstRem(st3,"/",st2);
|
||||
if (*st2) {
|
||||
DocPrintF(doc,"$$TR+C,\"%s\"$$\n$$ID,2$$",st2);
|
||||
doc->cur_entry=DocPutS(doc,"$$ID,-2$$");
|
||||
DocPrint(doc,"$$TR+C,\"%s\"$$\n$$ID,2$$",st2);
|
||||
doc->cur_entry=DocPrint(doc,"$$ID,-2$$");
|
||||
doc->cur_data_col=0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,56 +4,68 @@ U0 LoadDocDefines()
|
||||
{
|
||||
//These are used in documents such as $LK-A,"::/TempleOS/Doc/TrivialSolutions.TXT"$
|
||||
//The $LK,"CDoc","MN:CDoc"$ framework will search the sym table for define string
|
||||
//constants if you specify that.
|
||||
//consts if you specify that.
|
||||
CBinFile *bfh=sys_boot_base-sizeof(CBinFile);
|
||||
|
||||
DefinePrintF(
|
||||
DefinePrint(
|
||||
"DD_KERNEL","%08X",bfh);
|
||||
DefinePrintF(
|
||||
DefinePrint(
|
||||
"DD_KERNEL2","%09,X",bfh);
|
||||
bfh(I64)+=bfh->file_size-1;
|
||||
DefinePrintF(
|
||||
DefinePrint(
|
||||
"DD_KERNEL_END","%08X",bfh);
|
||||
DefinePrintF(
|
||||
DefinePrint(
|
||||
"DD_KERNEL_END2","%09,X",bfh);
|
||||
bfh(I64)++;
|
||||
DefinePrint(
|
||||
"DD_COMPILER","%08X",bfh);
|
||||
DefinePrint(
|
||||
"DD_COMPILER2","%09,X",bfh);
|
||||
bfh(I64)+=bfh->file_size-1;
|
||||
DefinePrint(
|
||||
"DD_COMPILER_END","%08X",bfh);
|
||||
DefinePrint(
|
||||
"DD_COMPILER_END2","%09,X",bfh);
|
||||
|
||||
DefinePrintF(
|
||||
//$LK,"DD_BOOT_HIGH_LOC","FF:::/TempleOS/Adam/Boot/BootCD.CPP.Z,DD_BOOT_HIGH_LOC"$
|
||||
|
||||
DefinePrint(
|
||||
"DD_MP_VECT","%08X",MP_VECT_ADDR);
|
||||
DefinePrintF(
|
||||
DefinePrint(
|
||||
"DD_MP_VECT_END","%08X",MP_VECT_ADDR+SYS_MP_INIT_END-SYS_MP_INIT_START-1);
|
||||
|
||||
DefinePrintF(
|
||||
DefinePrint(
|
||||
"DD_OS_NAME_VERSION","TempleOS V%0.2f",os_version);
|
||||
DefinePrintF(
|
||||
"DD_TEMPLEOS_AGE","%h56D",GetCurTimeDate-A2Date("8/1/2003"));
|
||||
DefinePrint(
|
||||
"DD_TEMPLEOS_AGE","%h56D",GetDateTime-A2Date("8/1/2003"));
|
||||
|
||||
//This is cut and replaced when I generate a distro.
|
||||
//See $LK,"DD_TEMPLEOS_LOC","FF:::/TempleOS/Demo/AcctExample/TSDistro.CPP,DD_TEMPLEOS_LOC"$.
|
||||
$TR-C,"LineCnt"$
|
||||
$ID,4$DefinePrintF("DD_TEMPLEOS_LOC","122,808");
|
||||
$ID,4$DefinePrint("DD_TEMPLEOS_LOC","124,033");
|
||||
$ID,-4$
|
||||
DefinePrintF(
|
||||
DefinePrint(
|
||||
"DD_PAGE_TABLE_BASE","%08X",PAGE_TABLE_BASE);
|
||||
DefinePrintF(
|
||||
DefinePrint(
|
||||
"DD_PAGE_TABLE_BASE2","%09,X",PAGE_TABLE_BASE);
|
||||
DefinePrintF(
|
||||
DefinePrint(
|
||||
"DD_PAGE_TABLE_END","%08X",PAGE_TABLE_BASE+PAGE_TABLE_SIZE-1);
|
||||
|
||||
DefinePrintF(
|
||||
DefinePrint(
|
||||
"DD_SYS_HEAP_BASE","%08X",sys_heap_base);
|
||||
DefinePrintF(
|
||||
DefinePrint(
|
||||
"DD_SYS_HEAP_BASE2","%09,X",sys_heap_base);
|
||||
|
||||
DefinePrintF(
|
||||
DefinePrint(
|
||||
"DD_SYS_HEAP_LIMIT","%08X",sys_heap_limit);
|
||||
DefinePrintF(
|
||||
DefinePrint(
|
||||
"DD_SYS_HEAP_LIMIT2","%09,X",sys_heap_limit);
|
||||
|
||||
DefinePrintF(
|
||||
DefinePrint(
|
||||
"DD_MAPPED_MEM_SPACE_GIG","%d Gig",MAPPED_MEM_SPACE/0x40000000);
|
||||
DefinePrintF(
|
||||
DefinePrint(
|
||||
"DD_MAPPED_MEM_SPACE_END","%010X",MAPPED_MEM_SPACE-1);
|
||||
DefinePrintF(
|
||||
DefinePrint(
|
||||
"DD_MAPPED_MEM_SPACE_END2","%014,X",MAPPED_MEM_SPACE-1);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,37 +11,37 @@ Bool ChkDskConfirm(Bool *_fix,Bool *_confirm)
|
||||
return *_fix;
|
||||
}
|
||||
|
||||
I64 RedSeaFSChkDskLst(CDirEntry *tempm1,U8 *bits,U8 *bits2,I64 size,I64 bpc)
|
||||
I64 RedSeaFSChkDskLst(CDirEntry *tempde1,U8 *bits,U8 *bits2,I64 size,I64 bpc)
|
||||
{
|
||||
CDirEntry *tempm2;
|
||||
CDirEntry *tempde2;
|
||||
I64 i,j,errs=0;
|
||||
while (tempm1) {
|
||||
tempm2=tempm1->next;
|
||||
if (tempm1->attr & _ATTR_DIR) {
|
||||
if (tempm1->sub)
|
||||
errs+=RedSeaFSChkDskLst(tempm1->sub,bits,bits2,size,bpc);
|
||||
while (tempde1) {
|
||||
tempde2=tempde1->next;
|
||||
if (tempde1->attr & _ATTR_DIR) {
|
||||
if (tempde1->sub)
|
||||
errs+=RedSeaFSChkDskLst(tempde1->sub,bits,bits2,size,bpc);
|
||||
}
|
||||
j=(tempm1->size+bpc-1)/bpc;
|
||||
j=(tempde1->size+bpc-1)/bpc;
|
||||
for (i=0;i<j;i++) {
|
||||
if (i+tempm1->cluster>size) {
|
||||
PrintFErr("Invalid Cluster:%s Cluster:%X\n",tempm1->full_name,
|
||||
i+tempm1->cluster);
|
||||
if (i+tempde1->cluster>size) {
|
||||
PrintErr("Invalid Cluster:%s Cluster:%X\n",tempde1->full_name,
|
||||
i+tempde1->cluster);
|
||||
errs++;
|
||||
break;
|
||||
}
|
||||
if (LBts(bits,i+tempm1->cluster)) {
|
||||
PrintFErr("Dbl Alloc:%s Cluster:%X\n",tempm1->full_name,
|
||||
i+tempm1->cluster);
|
||||
if (LBts(bits,i+tempde1->cluster)) {
|
||||
PrintErr("Dbl Alloc:%s Cluster:%X\n",tempde1->full_name,
|
||||
i+tempde1->cluster);
|
||||
errs++;
|
||||
}
|
||||
if (!LBtr(bits2,i+tempm1->cluster)) {
|
||||
PrintFErr("UnAlloc:%s Cluster:%X\n",tempm1->full_name,
|
||||
i+tempm1->cluster);
|
||||
if (!LBtr(bits2,i+tempde1->cluster)) {
|
||||
PrintErr("UnAlloc:%s Cluster:%X\n",tempde1->full_name,
|
||||
i+tempde1->cluster);
|
||||
errs++;
|
||||
}
|
||||
}
|
||||
CDirEntryDel(tempm1);
|
||||
tempm1=tempm2;
|
||||
DirEntryDel(tempde1);
|
||||
tempde1=tempde2;
|
||||
}
|
||||
return errs;
|
||||
}
|
||||
@@ -50,7 +50,7 @@ I64 RedSeaFSChkDsk(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=MSPrintF("%c:/*",Prt2Drv(p)),
|
||||
U8 *files_find_mask=MPrint("%c:/*",Prt2Drv(p)),
|
||||
*old_dir=StrNew(Fs->cur_dir),
|
||||
*bits,*bits2;
|
||||
CDirEntry *ptr,*ptr2;
|
||||
@@ -72,16 +72,16 @@ I64 RedSeaFSChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
|
||||
|
||||
for (i=0;i<j;i++) {
|
||||
if (i+p->root_cluster>size) {
|
||||
PrintFErr("Invalid Cluster: RootDir Cluster:%X\n",i+p->root_cluster);
|
||||
PrintErr("Invalid Cluster: RootDir Cluster:%X\n",i+p->root_cluster);
|
||||
errs++;
|
||||
break;
|
||||
}
|
||||
if (LBts(bits,i+p->root_cluster)) {
|
||||
PrintFErr("Dbl Alloc: RootDir Cluster:%X\n",i+p->root_cluster);
|
||||
PrintErr("Dbl Alloc: RootDir Cluster:%X\n",i+p->root_cluster);
|
||||
errs++;
|
||||
}
|
||||
if (!LBtr(bits2,i+p->root_cluster)) {
|
||||
PrintFErr("UnAlloc: RootDir Cluster:%X\n",i+p->root_cluster);
|
||||
PrintErr("UnAlloc: RootDir Cluster:%X\n",i+p->root_cluster);
|
||||
errs++;
|
||||
}
|
||||
}
|
||||
@@ -89,7 +89,7 @@ I64 RedSeaFSChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
|
||||
errs+=RedSeaFSChkDskLst(FilesFind(files_find_mask,FUF_RECURSE),bits,bits2,size,bpc);
|
||||
for (i=1;i<size;i++)
|
||||
if (Bt(bits2,i)) {
|
||||
PrintFWarn("Shouldn't Alloc Cluster:%0X\n",i);
|
||||
PrintWarn("Shouldn't Alloc Cluster:%0X\n",i);
|
||||
errs++;
|
||||
if (ChkDskConfirm(_fix,_confirm))
|
||||
RedSeaFSFreeClusters(p,i,1);
|
||||
@@ -104,49 +104,49 @@ I64 RedSeaFSChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
|
||||
return errs;
|
||||
}
|
||||
|
||||
I64 FAT32ChkDskLst(CPrt *p,CDirEntry *tempm1,U8 *bits,U32 *bits2,I64 size,I64 bpc)
|
||||
I64 FAT32ChkDskLst(CPrt *p,CDirEntry *tempde1,U8 *bits,U32 *bits2,I64 size,I64 bpc)
|
||||
{
|
||||
CDirEntry *tempm2;
|
||||
CDirEntry *tempde2;
|
||||
I64 i,c,errs=0;
|
||||
while (tempm1) {
|
||||
tempm2=tempm1->next;
|
||||
if (tempm1->attr & _ATTR_DIR) {
|
||||
if (tempm1->sub)
|
||||
errs+=FAT32ChkDskLst(p,tempm1->sub,bits,bits2,size,bpc);
|
||||
while (tempde1) {
|
||||
tempde2=tempde1->next;
|
||||
if (tempde1->attr & _ATTR_DIR) {
|
||||
if (tempde1->sub)
|
||||
errs+=FAT32ChkDskLst(p,tempde1->sub,bits,bits2,size,bpc);
|
||||
}
|
||||
i=0;
|
||||
c=tempm1->cluster;
|
||||
c=tempde1->cluster;
|
||||
while (0<c<0x0FFFFFF8) {
|
||||
if (c>size) {
|
||||
PrintFErr("Invalid Cluster:%s Cluster:%X\n",tempm1->full_name,c);
|
||||
PrintErr("Invalid Cluster:%s Cluster:%X\n",tempde1->full_name,c);
|
||||
errs++;
|
||||
break;
|
||||
}
|
||||
if (LBts(bits,c)) {
|
||||
PrintFErr("Dbl Alloc:%s Cluster:%X\n",tempm1->full_name,c);
|
||||
PrintErr("Dbl Alloc:%s Cluster:%X\n",tempde1->full_name,c);
|
||||
errs++;
|
||||
}
|
||||
if (!bits2[c]) {
|
||||
PrintFErr("UnAlloc:%s Cluster:%X\n",tempm1->full_name,c);
|
||||
PrintErr("UnAlloc:%s Cluster:%X\n",tempde1->full_name,c);
|
||||
errs++;
|
||||
} else
|
||||
bits2[c]=0;
|
||||
c=ClusterNumNext(p,c);
|
||||
i++;
|
||||
}
|
||||
if (!(tempm1->attr & _ATTR_DIR)) {
|
||||
if (!(tempde1->attr & _ATTR_DIR)) {
|
||||
i*=bpc;
|
||||
if (tempm1->size>i) {
|
||||
PrintFErr("Allocated File Too Short:%s\n",tempm1->full_name);
|
||||
if (tempde1->size>i) {
|
||||
PrintErr("Allocated File Too Short:%s\n",tempde1->full_name);
|
||||
errs++;
|
||||
}
|
||||
if (i>tempm1->size+bpc-1) {
|
||||
PrintFWarn("Allocated File Too Long:%s\n",tempm1->full_name);
|
||||
if (i>tempde1->size+bpc-1) {
|
||||
PrintWarn("Allocated File Too Long:%s\n",tempde1->full_name);
|
||||
errs++;
|
||||
}
|
||||
}
|
||||
CDirEntryDel(tempm1);
|
||||
tempm1=tempm2;
|
||||
DirEntryDel(tempde1);
|
||||
tempde1=tempde2;
|
||||
}
|
||||
return errs;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ 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=MSPrintF("%c:/*",Prt2Drv(p)),
|
||||
U8 *files_find_mask=MPrint("%c:/*",Prt2Drv(p)),
|
||||
*old_dir=StrNew(Fs->cur_dir),
|
||||
*bits;
|
||||
U32 *bits2;
|
||||
@@ -170,16 +170,16 @@ I64 FAT32ChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
|
||||
c=p->root_cluster;
|
||||
while (0<c<0x0FFFFFF8) {
|
||||
if (c>size) {
|
||||
PrintFErr("Invalid Cluster: RootDir Cluster:%X\n",c);
|
||||
PrintErr("Invalid Cluster: RootDir Cluster:%X\n",c);
|
||||
errs++;
|
||||
break;
|
||||
}
|
||||
if (LBts(bits,c)) {
|
||||
PrintFErr("Dbl Alloc: RootDir Cluster:%X\n",c);
|
||||
PrintErr("Dbl Alloc: RootDir Cluster:%X\n",c);
|
||||
errs++;
|
||||
}
|
||||
if (!bits2[c]) {
|
||||
PrintFErr("UnAlloc: RootDir Cluster:%X\n",c);
|
||||
PrintErr("UnAlloc: RootDir Cluster:%X\n",c);
|
||||
errs++;
|
||||
} else
|
||||
bits2[c]=0;
|
||||
@@ -191,7 +191,7 @@ I64 FAT32ChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
|
||||
bits2[1]=0; //See $LK,"FAT32Fmt","MN:FAT32Fmt"$()
|
||||
for (i=1;i<size;i++)
|
||||
if (bits2[i]) {
|
||||
PrintFWarn("Shouldn't Alloc Cluster:%0X\n",i);
|
||||
PrintWarn("Shouldn't Alloc Cluster:%0X\n",i);
|
||||
errs++;
|
||||
if (ChkDskConfirm(_fix,_confirm))
|
||||
FAT32FreeClusters(p,i);
|
||||
|
||||
+105
-129
@@ -3,7 +3,7 @@
|
||||
public U8 *DBlk(I64 blk,Bool write=FALSE)
|
||||
{//Dump Disk Blk.
|
||||
//If you set write to TRUE, it will be written when you press <ESC>.
|
||||
//See $LK-A,"::/TempleOS/Demo/Dsk/Raw.CPP"$.
|
||||
//See $LK-A,"::/TempleOS/Demo/Dsk/DskRaw.CPP"$.
|
||||
U8 *buf=MAlloc(BLK_SIZE);
|
||||
|
||||
RBlks(Fs->cur_prt,buf,blk,1);
|
||||
@@ -21,7 +21,7 @@ public U8 *DBlk(I64 blk,Bool write=FALSE)
|
||||
public U8 *DCluster(I64 c,Bool write=FALSE,I64 num=0)
|
||||
{//Dump Disk Cluster.
|
||||
//If you set write to TRUE, it will be written when you press <ESC>.
|
||||
//See $LK-A,"::/TempleOS/Demo/Dsk/Raw.CPP"$.
|
||||
//See $LK-A,"::/TempleOS/Demo/Dsk/DskRaw.CPP"$.
|
||||
//Do $LK,"Dir","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);
|
||||
@@ -40,49 +40,48 @@ public U8 *DCluster(I64 c,Bool write=FALSE,I64 num=0)
|
||||
|
||||
#help_index "File/Program Routines"
|
||||
|
||||
U0 OFFlatten(CDirEntry *tempm,CDirEntry **a,I64 *i)
|
||||
U0 FOFlatten(CDirEntry *tempde,CDirEntry **a,I64 *i)
|
||||
{
|
||||
CDirEntry *tempm1;
|
||||
while (tempm) {
|
||||
tempm1=tempm->next;
|
||||
if (tempm->attr&_ATTR_DIR) {
|
||||
OFFlatten(tempm->sub,a,i);
|
||||
CDirEntryDel(tempm);
|
||||
CDirEntry *tempde1;
|
||||
while (tempde) {
|
||||
tempde1=tempde->next;
|
||||
if (tempde->attr&_ATTR_DIR) {
|
||||
FOFlatten(tempde->sub,a,i);
|
||||
DirEntryDel(tempde);
|
||||
} else {
|
||||
a[*i]=tempm;
|
||||
a[*i]=tempde;
|
||||
*i=*i+1;
|
||||
}
|
||||
tempm=tempm1;
|
||||
tempde=tempde1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public I64 CFileCnt(CDirEntry *tempm)
|
||||
public I64 FileCnt(CDirEntry *tempde)
|
||||
{
|
||||
I64 cnt=0;
|
||||
while (tempm) {
|
||||
if (tempm->attr&_ATTR_DIR)
|
||||
cnt+=CFileCnt(tempm->sub);
|
||||
while (tempde) {
|
||||
if (tempde->attr&_ATTR_DIR)
|
||||
cnt+=FileCnt(tempde->sub);
|
||||
else
|
||||
cnt++;
|
||||
tempm=tempm->next;
|
||||
tempde=tempde->next;
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
|
||||
I64 OFCompare(CDirEntry *e1,CDirEntry *e2)
|
||||
I64 FOCompare(CDirEntry *tempde1,CDirEntry *tempde2)
|
||||
{
|
||||
return e1->cluster-e2->cluster;
|
||||
return tempde1->cluster-tempde2->cluster;
|
||||
}
|
||||
|
||||
public CDirEntry **FilesOrder(CDirEntry *tempm,I64 *_cnt=NULL)
|
||||
public CDirEntry **FilesOrder(CDirEntry *tempde,I64 *_cnt=NULL)
|
||||
{ //See $LK-A,"::/TempleOS/Demo/Dsk/OrderedIO.CPP"$.
|
||||
I64 cnt=CFileCnt(tempm),i=0;
|
||||
CDirEntry **a=MAlloc(sizeof(CDirEntry *)*cnt);
|
||||
OFFlatten(tempm,a,&i);
|
||||
QSortI64(a,cnt,&OFCompare);
|
||||
I64 cnt=FileCnt(tempde),i=0;
|
||||
CDirEntry **flst=MAlloc(sizeof(CDirEntry *)*cnt);
|
||||
FOFlatten(tempde,flst,&i);
|
||||
QSortI64(flst,cnt,&FOCompare);
|
||||
if (_cnt) *_cnt=cnt;
|
||||
return a;
|
||||
return flst;
|
||||
}
|
||||
|
||||
|
||||
@@ -92,22 +91,22 @@ public Bool Copy(U8 *src_files_find_mask,U8 *dst_files_find_mask=".")
|
||||
{
|
||||
Bool result=TRUE;
|
||||
CFileAccess *fa;
|
||||
CDirEntry *tempm,*tempm1;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
U8 *st;
|
||||
if (!(tempm=FilesFind(src_files_find_mask)))
|
||||
if (!(tempde=FilesFind(src_files_find_mask)))
|
||||
return FALSE;
|
||||
if (IsDir(dst_files_find_mask)) {
|
||||
if (fa=FileAccessNew(dst_files_find_mask,TRUE)) {
|
||||
while (tempm) {
|
||||
tempm1=tempm->next;
|
||||
if (!(tempm->attr & _ATTR_DIR)) {
|
||||
st=FileNameAbs(tempm->name);
|
||||
if (!CopySingle(tempm->full_name,st))
|
||||
while (tempde) {
|
||||
tempde1=tempde->next;
|
||||
if (!(tempde->attr & _ATTR_DIR)) {
|
||||
st=FileNameAbs(tempde->name);
|
||||
if (!CopySingle(tempde->full_name,st))
|
||||
result=FALSE;
|
||||
Free(st);
|
||||
}
|
||||
CDirEntryDel(tempm);
|
||||
tempm=tempm1;
|
||||
DirEntryDel(tempde);
|
||||
tempde=tempde1;
|
||||
}
|
||||
FileAccessDel(fa);
|
||||
}
|
||||
@@ -125,22 +124,22 @@ public Bool Move(U8 *f1,U8 *f2)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
I64 PutCopyTree(CDirEntry *tempm,I64 src_dir_len,I64 dst_dir_len,U8 *dst_dir)
|
||||
I64 PutCopyTree(CDirEntry *tempde,I64 src_dir_len,I64 dst_dir_len,U8 *dst_dir)
|
||||
{
|
||||
U8 *st;
|
||||
I64 result=1;
|
||||
while (tempm) {
|
||||
st=MAlloc(StrLen(tempm->full_name)+dst_dir_len+2);
|
||||
while (tempde) {
|
||||
st=MAlloc(StrLen(tempde->full_name)+dst_dir_len+2);
|
||||
MemCpy(st,dst_dir,dst_dir_len);
|
||||
StrCpy(st+dst_dir_len,tempm->full_name+src_dir_len);
|
||||
if (tempm->attr & _ATTR_DIR) {
|
||||
StrCpy(st+dst_dir_len,tempde->full_name+src_dir_len);
|
||||
if (tempde->attr & _ATTR_DIR) {
|
||||
MkDir(st);
|
||||
result+=PutCopyTree(tempm->sub,src_dir_len,dst_dir_len,dst_dir);
|
||||
result+=PutCopyTree(tempde->sub,src_dir_len,dst_dir_len,dst_dir);
|
||||
} else
|
||||
if (CopySingle(tempm->full_name,st))
|
||||
if (CopySingle(tempde->full_name,st))
|
||||
result++;
|
||||
Free(st);
|
||||
tempm=tempm->next;
|
||||
tempde=tempde->next;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -148,7 +147,7 @@ I64 PutCopyTree(CDirEntry *tempm,I64 src_dir_len,I64 dst_dir_len,U8 *dst_dir)
|
||||
public I64 CopyTree(U8 *src_files_find_mask,U8 *dst_files_find_mask)
|
||||
{ //returns count of copied files (not dirs)
|
||||
CFileAccess *fa;
|
||||
CDirEntry *tempm=NULL;
|
||||
CDirEntry *tempde=NULL;
|
||||
I64 result=0,i1,i2;
|
||||
U8 *st1,*st2;
|
||||
|
||||
@@ -163,7 +162,7 @@ public I64 CopyTree(U8 *src_files_find_mask,U8 *dst_files_find_mask)
|
||||
Free(st1);
|
||||
Free(st2);
|
||||
if (fa=FileAccessNew(src_files_find_mask,TRUE)) {
|
||||
tempm=SysFilesFind(fa->mask,FUF_RECURSE);
|
||||
tempde=SysFilesFind(fa->mask,FUF_RECURSE);
|
||||
st1=CurDir;
|
||||
FileAccessDel(fa);
|
||||
i1=StrLen(st1);
|
||||
@@ -172,46 +171,46 @@ public I64 CopyTree(U8 *src_files_find_mask,U8 *dst_files_find_mask)
|
||||
st2=CurDir;
|
||||
i2=StrLen(st2);
|
||||
if (i2==3) i2--;
|
||||
result=PutCopyTree(tempm,i1,i2,st2);
|
||||
result=PutCopyTree(tempde,i1,i2,st2);
|
||||
FileAccessDel(fa);
|
||||
Free(st2);
|
||||
}
|
||||
CDirLstDel(tempm);
|
||||
DirLstDel(tempde);
|
||||
Free(st1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
I64 DelTreeDirs(CDirEntry *tempm1)
|
||||
I64 DelTreeDirs(CDirEntry *tempde1)
|
||||
{
|
||||
I64 result=0;
|
||||
CDirEntry *tempm2;
|
||||
while (tempm1) {
|
||||
tempm2=tempm1->next;
|
||||
if (tempm1->attr & _ATTR_DIR) {
|
||||
if (tempm1->sub)
|
||||
result+=DelTreeDirs(tempm1->sub);
|
||||
result+=SysDel(tempm1->full_name,TRUE);
|
||||
CDirEntry *tempde2;
|
||||
while (tempde1) {
|
||||
tempde2=tempde1->next;
|
||||
if (tempde1->attr & _ATTR_DIR) {
|
||||
if (tempde1->sub)
|
||||
result+=DelTreeDirs(tempde1->sub);
|
||||
result+=SysDel(tempde1->full_name,TRUE);
|
||||
}
|
||||
CDirEntryDel(tempm1);
|
||||
tempm1=tempm2;
|
||||
DirEntryDel(tempde1);
|
||||
tempde1=tempde2;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
I64 DelTreeFiles(CDirEntry *tempm1)
|
||||
I64 DelTreeFiles(CDirEntry *tempde1)
|
||||
{
|
||||
I64 result=0;
|
||||
CDirEntry *tempm2;
|
||||
while (tempm1) {
|
||||
tempm2=tempm1->next;
|
||||
if (tempm1->attr & _ATTR_DIR) {
|
||||
if (tempm1->sub)
|
||||
result+=DelTreeFiles(tempm1->sub);
|
||||
CDirEntry *tempde2;
|
||||
while (tempde1) {
|
||||
tempde2=tempde1->next;
|
||||
if (tempde1->attr & _ATTR_DIR) {
|
||||
if (tempde1->sub)
|
||||
result+=DelTreeFiles(tempde1->sub);
|
||||
} else
|
||||
result+=SysDel(tempm1->full_name,FALSE);
|
||||
CDirEntryDel(tempm1);
|
||||
tempm1=tempm2;
|
||||
result+=SysDel(tempde1->full_name,FALSE);
|
||||
DirEntryDel(tempde1);
|
||||
tempde1=tempde2;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -219,8 +218,8 @@ I64 DelTreeFiles(CDirEntry *tempm1)
|
||||
public I64 DelTree(U8 *files_find_mask,U8 *fu_flags=NULL)
|
||||
{
|
||||
I64 result=0,fuf_flags=0;
|
||||
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
|
||||
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
if (IsDir(files_find_mask)) {
|
||||
result=DelTreeDirs(FilesFind(files_find_mask,fuf_flags));
|
||||
result+=SysDel(files_find_mask,TRUE);
|
||||
@@ -230,7 +229,7 @@ public I64 DelTree(U8 *files_find_mask,U8 *fu_flags=NULL)
|
||||
return result;
|
||||
}
|
||||
|
||||
U0 TouchFile(U8 *filename,U8 *attr,CDate cdt=0) //Just one file
|
||||
U0 TouchFile(U8 *filename,U8 *attr,CDate cdt=0)
|
||||
{
|
||||
CPrt *p=Drv2Prt(*filename);
|
||||
CDirEntry de;
|
||||
@@ -239,39 +238,22 @@ U0 TouchFile(U8 *filename,U8 *attr,CDate cdt=0) //Just one file
|
||||
if (FileFind(filename,&de,FUF_JUST_FILES)) {
|
||||
Free(de.full_name);
|
||||
if (!StrCmp(attr,"+?"))
|
||||
"%-48ts %s\n",filename,SPrintFFlags(buf,Define("ST_FILE_ATTRS"),de.attr);
|
||||
"%-48ts %s\n",filename,SPrintFlags(buf,Define("ST_FILE_ATTRS"),de.attr);
|
||||
else {
|
||||
StrFirstRem(cur_dir,":");
|
||||
StrLastRem(cur_dir,"/");
|
||||
if (!*cur_dir)
|
||||
StrCpy(cur_dir,"/");
|
||||
GetFFlags(&de.attr,Define("ST_FILE_ATTRS"),attr);
|
||||
ScanFlags(&de.attr,Define("ST_FILE_ATTRS"),attr);
|
||||
if (cdt)
|
||||
de.datetime=cdt;
|
||||
else
|
||||
de.datetime=GetCurTimeDate;
|
||||
CDirNew(p,cur_dir,&de,FALSE);
|
||||
de.datetime=GetDateTime;
|
||||
DirNew(p,cur_dir,&de,FALSE);
|
||||
}
|
||||
} else PutDefineErr("ST_FILE_NOT_FOUND");
|
||||
}
|
||||
|
||||
U0 TouchLst(CDirEntry *tempm1,U8 *attr,CDate cdt=0)
|
||||
{
|
||||
CDirEntry *tempm2;
|
||||
while (tempm1) {
|
||||
tempm2=tempm1->next;
|
||||
if (tempm1->attr & _ATTR_DIR) {
|
||||
if (tempm1->sub) {
|
||||
"%S%s\n","ST_SCANNING_DIR",tempm1->full_name;
|
||||
TouchLst(tempm1->sub,attr,cdt);
|
||||
}
|
||||
} else
|
||||
TouchFile(tempm1->full_name,attr,cdt);
|
||||
CDirEntryDel(tempm1);
|
||||
tempm1=tempm2;
|
||||
}
|
||||
}
|
||||
|
||||
public U0 Touch(U8 *files_find_mask,U8 *attr="+?",U8 *fu_flags=NULL,CDate cdt=0)
|
||||
{
|
||||
//Attr "+?" =show
|
||||
@@ -279,38 +261,32 @@ public U0 Touch(U8 *files_find_mask,U8 *attr="+?",U8 *fu_flags=NULL,CDate cdt=0)
|
||||
//To Set Date
|
||||
// Touch(filename,"",,datetime);
|
||||
I64 fuf_flags=0;
|
||||
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
TouchLst(FilesFind(files_find_mask,fuf_flags),attr,cdt);
|
||||
}
|
||||
|
||||
I64 FFLst(CDirEntry *tempm1)
|
||||
{
|
||||
I64 cnt=0;
|
||||
CDirEntry *tempm2;
|
||||
|
||||
while (tempm1) {
|
||||
tempm2=tempm1->next;
|
||||
if (tempm1->attr & _ATTR_DIR) {
|
||||
if (tempm1->sub)
|
||||
cnt+=FFLst(tempm1->sub);
|
||||
} else {
|
||||
PutFileLink(tempm1->full_name);
|
||||
NewLine;
|
||||
cnt++;
|
||||
}
|
||||
CDirEntryDel(tempm1);
|
||||
tempm1=tempm2;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+f+F");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
||||
while (tempde) {
|
||||
TouchFile(tempde->full_name,attr,cdt);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
return cnt;
|
||||
DirLstDel(tempde1);
|
||||
}
|
||||
|
||||
public I64 FF(U8 *files_find_mask,U8 *fu_flags=NULL)
|
||||
//Files Find
|
||||
{
|
||||
I64 cnt=0,fuf_flags=0;
|
||||
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
|
||||
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
cnt+=FFLst(FilesFind(files_find_mask,fuf_flags));
|
||||
CDirEntry *tempde,*tempde1;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
||||
while (tempde) {
|
||||
PutFileLink(tempde->full_name);
|
||||
NewLine;
|
||||
cnt++;
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirLstDel(tempde1);
|
||||
return cnt;
|
||||
}
|
||||
|
||||
@@ -386,19 +362,19 @@ public I64 UnusedDrvSpace(U8 drv_let=0)
|
||||
|
||||
#help_index "File/Program Routines"
|
||||
|
||||
I64 TreeSizeFiles(CDirEntry *tempm,I64 round_to)
|
||||
I64 TreeSizeFiles(CDirEntry *tempde,I64 round_to)
|
||||
{
|
||||
I64 result=0,i;
|
||||
while (tempm) {
|
||||
while (tempde) {
|
||||
if (round_to)
|
||||
i=CeilU64(tempm->size,round_to);
|
||||
i=CeilU64(tempde->size,round_to);
|
||||
else
|
||||
i=tempm->size;
|
||||
if (tempm->attr&_ATTR_DIR)
|
||||
i+=TreeSizeFiles(tempm->sub,round_to);
|
||||
tempm->user_data=i;
|
||||
i=tempde->size;
|
||||
if (tempde->attr&_ATTR_DIR)
|
||||
i+=TreeSizeFiles(tempde->sub,round_to);
|
||||
tempde->user_data=i;
|
||||
result+=i;
|
||||
tempm=tempm->next;
|
||||
tempde=tempde->next;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -408,12 +384,12 @@ public I64 TreeSize(U8 *files_find_mask="/TempleOS/*",U8 *fu_flags=NULL,I64 roun
|
||||
//Does not include directory size of base directory, but
|
||||
//does include size of sub directories.
|
||||
I64 fuf_flags=0,result=0;
|
||||
CDirEntry *tempm1=NULL;
|
||||
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
|
||||
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
if (tempm1=FilesFind(files_find_mask,fuf_flags)) {
|
||||
result=TreeSizeFiles(tempm1,round_to);
|
||||
CDirLstDel(tempm1);
|
||||
CDirEntry *tempde1=NULL;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
if (tempde1=FilesFind(files_find_mask,fuf_flags)) {
|
||||
result=TreeSizeFiles(tempde1,round_to);
|
||||
DirLstDel(tempde1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
+29
-29
@@ -1,70 +1,70 @@
|
||||
#help_index "File/Program Routines/Utils"
|
||||
|
||||
I64 CDirTreeFlattenSize(CDirEntry *tempm)
|
||||
I64 DirTreeFlattenSize(CDirEntry *tempde)
|
||||
{
|
||||
I64 result=0;
|
||||
while (tempm) {
|
||||
while (tempde) {
|
||||
result+=CDIR_SIZE+1;
|
||||
if (tempm->attr & _ATTR_DIR)
|
||||
result+=CDirTreeFlattenSize(tempm->sub);
|
||||
tempm=tempm->next;
|
||||
if (tempde->attr & _ATTR_DIR)
|
||||
result+=DirTreeFlattenSize(tempde->sub);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
return result+1;
|
||||
}
|
||||
|
||||
I64 CDirTreeFlattenFill(CDirEntry *tempm,U8 *dst)
|
||||
I64 DirTreeFlattenFill(CDirEntry *tempde,U8 *dst)
|
||||
{
|
||||
I64 result=0,i;
|
||||
while (tempm) {
|
||||
while (tempde) {
|
||||
*dst++=1;
|
||||
result++;
|
||||
i=CDIR_SIZE;
|
||||
MemCpy(dst,&tempm->start,i);
|
||||
MemCpy(dst,&tempde->start,i);
|
||||
dst+=i;
|
||||
result+=i;
|
||||
if (tempm->attr & _ATTR_DIR) {
|
||||
i=CDirTreeFlattenFill(tempm->sub,dst);
|
||||
if (tempde->attr & _ATTR_DIR) {
|
||||
i=DirTreeFlattenFill(tempde->sub,dst);
|
||||
dst+=i;
|
||||
result+=i;
|
||||
}
|
||||
tempm=tempm->next;
|
||||
tempde=tempde->next;
|
||||
}
|
||||
*dst=0;
|
||||
return result+1;
|
||||
}
|
||||
|
||||
public U8 *CDirTreeFlatten(CDirEntry *tempm,I64 *_size=NULL)
|
||||
public U8 *DirTreeFlatten(CDirEntry *tempde,I64 *_size=NULL)
|
||||
{
|
||||
I64 size=CDirTreeFlattenSize(tempm);
|
||||
I64 size=DirTreeFlattenSize(tempde);
|
||||
U8 *buf=MAlloc(size);
|
||||
CDirTreeFlattenFill(tempm,buf);
|
||||
DirTreeFlattenFill(tempde,buf);
|
||||
if (_size) *_size=size;
|
||||
return buf;
|
||||
}
|
||||
|
||||
U8 *CDirTreeDoUnflatten(U8 *src,CDirEntry **tempm)
|
||||
U8 *DirTreeDoUnflatten(U8 *src,CDirEntry **tempde)
|
||||
{
|
||||
I64 i;
|
||||
CDirEntry *tempm1;
|
||||
CDirEntry *tempde1;
|
||||
if (*src++) {
|
||||
tempm1=CAlloc(sizeof(CDirEntry));
|
||||
*tempm=tempm1;
|
||||
tempde1=CAlloc(sizeof(CDirEntry));
|
||||
*tempde=tempde1;
|
||||
i=CDIR_SIZE;
|
||||
MemCpy(&tempm1->start,src,i);
|
||||
MemCpy(&tempde1->start,src,i);
|
||||
src+=i;
|
||||
if (tempm1->attr & _ATTR_DIR)
|
||||
src=CDirTreeDoUnflatten(src,&tempm1->sub);
|
||||
src=CDirTreeDoUnflatten(src,&tempm1->next);
|
||||
if (tempde1->attr & _ATTR_DIR)
|
||||
src=DirTreeDoUnflatten(src,&tempde1->sub);
|
||||
src=DirTreeDoUnflatten(src,&tempde1->next);
|
||||
} else
|
||||
*tempm=NULL;
|
||||
*tempde=NULL;
|
||||
return src;
|
||||
}
|
||||
|
||||
public CDirEntry *CDirTreeUnflatten(U8 *src)
|
||||
public CDirEntry *DirTreeUnflatten(U8 *src)
|
||||
{
|
||||
CDirEntry *tempm=NULL;
|
||||
CDirTreeDoUnflatten(src,&tempm);
|
||||
return tempm;
|
||||
CDirEntry *tempde=NULL;
|
||||
DirTreeDoUnflatten(src,&tempde);
|
||||
return tempde;
|
||||
}
|
||||
|
||||
#help_index "Install;File/Cmd Line (Typically);Cmd Line (Typically)"
|
||||
@@ -386,7 +386,7 @@ public U0 DskView(U8 drv_let=0)
|
||||
v>>1+radius*Sin(sect_end));
|
||||
|
||||
dc->color=j;
|
||||
GrPrintF(dc,0,v-FONT_HEIGHT*j,"%C %-8Z",Prt2Drv(p),
|
||||
GrPrint(dc,0,v-FONT_HEIGHT*j,"%C %-8Z",Prt2Drv(p),
|
||||
p->type.u16[0],"ST_PRT_TYPES");
|
||||
GrFloodFill(dc,
|
||||
h>>1+(radius-4)*Cos((sect_start+sect_end)/2),
|
||||
@@ -407,6 +407,6 @@ public U0 BlkDevRep()
|
||||
I64 i;
|
||||
for (i=0;i<NUM_BLKDEVS;i++)
|
||||
if (sys_blkdevs[i].bd_signature==BD_SIGNATURE_VAL)
|
||||
ClassRep("CBlkDev",&sys_blkdevs[i]);
|
||||
ClassRep(&sys_blkdevs[i]);
|
||||
}
|
||||
#help_index ""
|
||||
+186
-186
@@ -1,24 +1,24 @@
|
||||
#help_index "Doc/Output"
|
||||
U0 CDirFileDoc(CDoc *doc,CDirEntry *tempm)
|
||||
U0 DirFileDoc(CDoc *doc,CDirEntry *tempde)
|
||||
{
|
||||
CDocEntry *doc_e;
|
||||
while (tempm) {
|
||||
if (tempm->attr & _ATTR_DIR) {
|
||||
doc_e=DocPrintF(doc,"$$TR,\"%s\"$$",tempm->name);
|
||||
doc_e->user_data=tempm;
|
||||
tempm->user_data=doc_e;
|
||||
DocPutS(doc,"\n$$ID,+2$$");
|
||||
if (tempm->sub)
|
||||
CDirFileDoc(doc,tempm->sub);
|
||||
DocPutS(doc,"$$ID,-2$$");
|
||||
while (tempde) {
|
||||
if (tempde->attr & _ATTR_DIR) {
|
||||
doc_e=DocPrint(doc,"$$TR,\"%s\"$$",tempde->name);
|
||||
doc_e->user_data=tempde;
|
||||
tempde->user_data=doc_e;
|
||||
DocPrint(doc,"\n$$ID,+2$$");
|
||||
if (tempde->sub)
|
||||
DirFileDoc(doc,tempde->sub);
|
||||
DocPrint(doc,"$$ID,-2$$");
|
||||
} else {
|
||||
doc_e=DocPrintF(doc,"$$MU-LE,\"%s\"$$",
|
||||
tempm->name);
|
||||
doc_e->user_data=tempm;
|
||||
tempm->user_data=doc_e;
|
||||
DocPutS(doc,"\n");
|
||||
doc_e=DocPrint(doc,"$$MU-LE,\"%s\"$$",
|
||||
tempde->name);
|
||||
doc_e->user_data=tempde;
|
||||
tempde->user_data=doc_e;
|
||||
DocPrint(doc,"\n");
|
||||
}
|
||||
tempm=tempm->next;
|
||||
tempde=tempde->next;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,15 +34,15 @@ CFMUncollapsedLst *FMCollectUncollapsedLst(CDoc *doc)
|
||||
{
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
CFMUncollapsedLst *result=NULL,*tempc;
|
||||
CDirEntry *tempm;
|
||||
CDirEntry *tempde;
|
||||
while (doc_e!=doc) {
|
||||
if (doc_e->type_u8==DOCT_TREE) {
|
||||
if (!(doc_e->flags1&DOCEF1_CHECKED_COLLAPSED)) {
|
||||
if (tempm=doc_e->user_data) {
|
||||
if (tempde=doc_e->user_data) {
|
||||
tempc=MAlloc(sizeof(CFMUncollapsedLst));
|
||||
tempc->next=result;
|
||||
result=tempc;
|
||||
tempc->name=StrNew(tempm->full_name);
|
||||
tempc->name=StrNew(tempde->full_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,42 +55,42 @@ U0 FMMarkUncollapsed(CDoc *doc,CFMUncollapsedLst *tempc,U8 *cur_entry,U8 *next_e
|
||||
{
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
CFMUncollapsedLst *tempc1;
|
||||
CDirEntry *tempm;
|
||||
CDirEntry *tempde;
|
||||
while (doc_e!=doc) {
|
||||
if (doc_e->type_u8==DOCT_TREE) {
|
||||
tempm=doc_e->user_data;
|
||||
tempde=doc_e->user_data;
|
||||
tempc1=tempc;
|
||||
while (tempc1) {
|
||||
if (!StrCmp(tempc1->name,tempm->full_name)) {
|
||||
if (!StrCmp(tempc1->name,tempde->full_name)) {
|
||||
doc_e->flags1&=~DOCEF1_CHECKED_COLLAPSED;
|
||||
break;
|
||||
}
|
||||
tempc1=tempc1->next;
|
||||
}
|
||||
if (cur_entry) {
|
||||
if (!StrNCmp(cur_entry,tempm->full_name,StrLen(tempm->full_name))) {
|
||||
if (!StrNCmp(cur_entry,tempde->full_name,StrLen(tempde->full_name))) {
|
||||
doc->cur_entry=doc_e;
|
||||
if (StrLen(tempm->full_name)==StrLen(cur_entry))
|
||||
if (StrLen(tempde->full_name)==StrLen(cur_entry))
|
||||
cur_entry=NULL;
|
||||
} else if (next_entry) {
|
||||
if (!StrNCmp(next_entry,tempm->full_name,StrLen(tempm->full_name))) {
|
||||
if (!StrNCmp(next_entry,tempde->full_name,StrLen(tempde->full_name))) {
|
||||
doc->cur_entry=doc_e;
|
||||
if (StrLen(tempm->full_name)==StrLen(next_entry))
|
||||
if (StrLen(tempde->full_name)==StrLen(next_entry))
|
||||
cur_entry=NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (doc_e->type_u8==DOCT_MENU_VAL) {
|
||||
tempm=doc_e->user_data;
|
||||
tempde=doc_e->user_data;
|
||||
if (cur_entry) {
|
||||
if (!StrNCmp(cur_entry,tempm->full_name,StrLen(tempm->full_name))) {
|
||||
if (!StrNCmp(cur_entry,tempde->full_name,StrLen(tempde->full_name))) {
|
||||
doc->cur_entry=doc_e;
|
||||
if (StrLen(tempm->full_name)==StrLen(cur_entry))
|
||||
if (StrLen(tempde->full_name)==StrLen(cur_entry))
|
||||
cur_entry=NULL;
|
||||
} else if (next_entry) {
|
||||
if (!StrNCmp(next_entry,tempm->full_name,StrLen(tempm->full_name))) {
|
||||
if (!StrNCmp(next_entry,tempde->full_name,StrLen(tempde->full_name))) {
|
||||
doc->cur_entry=doc_e;
|
||||
if (StrLen(tempm->full_name)==StrLen(next_entry))
|
||||
if (StrLen(tempde->full_name)==StrLen(next_entry))
|
||||
cur_entry=NULL;
|
||||
}
|
||||
}
|
||||
@@ -114,33 +114,33 @@ U0 FMDelUncollapsedLst(CFMUncollapsedLst *tempc)
|
||||
CDirEntry *FMRebuildDocDrv(U8 drv_let,CDoc *doc,CDirEntry **_root,Bool init)
|
||||
{
|
||||
CDocEntry *doc_e;
|
||||
CDirEntry *tempm,*tempm1;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
U8 *st;
|
||||
tempm=CAlloc(sizeof(CDirEntry));
|
||||
tempm->full_name=MSPrintF("%C:/",drv_let);
|
||||
tempm->attr=_ATTR_DIR;
|
||||
st=MSPrintF("%c:/*",drv_let);
|
||||
tempde=CAlloc(sizeof(CDirEntry));
|
||||
tempde->full_name=MPrint("%C:/",drv_let);
|
||||
tempde->attr=_ATTR_DIR;
|
||||
st=MPrint("%c:/*",drv_let);
|
||||
if (init)
|
||||
tempm->sub=tempm1=FilesFind(st,FUF_RECURSE);
|
||||
tempde->sub=tempde1=FilesFind(st,FUF_RECURSE);
|
||||
else
|
||||
tempm1=NULL;
|
||||
tempde1=NULL;
|
||||
Free(st);
|
||||
doc_e=DocPrintF(doc,"$$TR,\"%s\"$$",tempm->full_name);
|
||||
doc_e->user_data=tempm;
|
||||
tempm->user_data=doc_e;
|
||||
tempm->next=*_root;
|
||||
*_root=tempm;
|
||||
DocPutS(doc,"\n$$ID,+2$$");
|
||||
doc_e=DocPrint(doc,"$$TR,\"%s\"$$",tempde->full_name);
|
||||
doc_e->user_data=tempde;
|
||||
tempde->user_data=doc_e;
|
||||
tempde->next=*_root;
|
||||
*_root=tempde;
|
||||
DocPrint(doc,"\n$$ID,+2$$");
|
||||
DocBottom(doc);
|
||||
if (init) {
|
||||
CDirFileDoc(doc,tempm1);
|
||||
while (tempm1) {
|
||||
tempm1->parent=tempm;
|
||||
tempm1=tempm1->next;
|
||||
DirFileDoc(doc,tempde1);
|
||||
while (tempde1) {
|
||||
tempde1->parent=tempde;
|
||||
tempde1=tempde1->next;
|
||||
}
|
||||
}
|
||||
DocPutS(doc,"$$ID,-2$$");
|
||||
return tempm;
|
||||
DocPrint(doc,"$$ID,-2$$");
|
||||
return tempde;
|
||||
}
|
||||
|
||||
U0 FMRebuildDoc(CDoc **_doc,CDirEntry **_root,I64 mode)
|
||||
@@ -151,7 +151,7 @@ U0 FMRebuildDoc(CDoc **_doc,CDirEntry **_root,I64 mode)
|
||||
CFMUncollapsedLst *tempc=NULL;
|
||||
U8 *cur_entry=NULL,*next_entry=NULL;
|
||||
CDocEntry *doc_ce;
|
||||
CDirEntry *tempm,*tempm1,*cur_tree_entry;
|
||||
CDirEntry *tempde,*tempde1,*cur_tree_entry;
|
||||
if (!doc)
|
||||
parent_doc=DocPut;
|
||||
else {
|
||||
@@ -166,36 +166,36 @@ U0 FMRebuildDoc(CDoc **_doc,CDirEntry **_root,I64 mode)
|
||||
cur_tree_entry=doc_ce->user_data;
|
||||
if (cur_tree_entry)
|
||||
cur_entry=StrNew(cur_tree_entry->full_name);
|
||||
tempm=NULL;
|
||||
tempde=NULL;
|
||||
if (doc_ce!=doc)
|
||||
doc_ce=doc_ce->next;
|
||||
while (doc_ce!=doc) {
|
||||
if (doc_ce->type_u8==DOCT_TREE || doc_ce->type_u8==DOCT_MENU_VAL)
|
||||
tempm=doc_ce->user_data;
|
||||
tempde=doc_ce->user_data;
|
||||
else
|
||||
tempm=NULL;
|
||||
if (tempm) {
|
||||
tempm1=tempm->parent;
|
||||
while (tempm1) {
|
||||
if (tempm1==cur_tree_entry) {
|
||||
tempm=NULL;
|
||||
tempde=NULL;
|
||||
if (tempde) {
|
||||
tempde1=tempde->parent;
|
||||
while (tempde1) {
|
||||
if (tempde1==cur_tree_entry) {
|
||||
tempde=NULL;
|
||||
break;
|
||||
} else
|
||||
tempm1=tempm1->parent;
|
||||
tempde1=tempde1->parent;
|
||||
}
|
||||
if (tempm)
|
||||
if (tempde)
|
||||
break;
|
||||
}
|
||||
doc_ce=doc_ce->next;
|
||||
}
|
||||
if (tempm)
|
||||
next_entry=StrNew(tempm->full_name);
|
||||
if (tempde)
|
||||
next_entry=StrNew(tempde->full_name);
|
||||
|
||||
tempc=FMCollectUncollapsedLst(doc);
|
||||
DocDel(doc);
|
||||
}
|
||||
if (*_root) {
|
||||
CDirLstDel(*_root);
|
||||
DirLstDel(*_root);
|
||||
*_root=NULL;
|
||||
}
|
||||
doc=DocNew;
|
||||
@@ -204,30 +204,30 @@ U0 FMRebuildDoc(CDoc **_doc,CDirEntry **_root,I64 mode)
|
||||
doc->flags|=DOCF_FORM;
|
||||
switch (mode) {
|
||||
case FM_NORMAL:
|
||||
DocPutS(doc,"$$FG,PURPLE$$File Manager\n\n$$LK,\"Click for Help\",\"FI:::/TempleOS/Doc/FileMgr.TXT\"$$\n\n");
|
||||
DocPrint(doc,"$$FG,PURPLE$$File Manager\n\n$$LK,\"Click for Help\",\"FI:::/TempleOS/Doc/FileMgr.TXT\"$$\n\n");
|
||||
break;
|
||||
case FM_PICK_FILE:
|
||||
DocPutS(doc,"$$FG,PURPLE$$Pick file and press <ESC>\n\n");
|
||||
DocPrint(doc,"$$FG,PURPLE$$Pick file and press <ESC>\n\n");
|
||||
doc->flags|=DOCF_MIN_SIZE;
|
||||
break;
|
||||
case FM_PICK_DIR:
|
||||
DocPutS(doc,"$$FG,PURPLE$$Pick directory and press <ESC>\n\n");
|
||||
DocPrint(doc,"$$FG,PURPLE$$Pick directory and press <ESC>\n\n");
|
||||
doc->flags|=DOCF_MIN_SIZE;
|
||||
break;
|
||||
}
|
||||
DocPutS(doc,"$$FG,LTBLUE$$");
|
||||
DocPrint(doc,"$$FG,LTBLUE$$");
|
||||
for (i=0;i<NUM_PRTS;i++) {
|
||||
p=&sys_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)
|
||||
tempm=FMRebuildDocDrv(Prt2Drv(p),doc,_root,TRUE);
|
||||
tempde=FMRebuildDocDrv(Prt2Drv(p),doc,_root,TRUE);
|
||||
else {
|
||||
tempm=FMRebuildDocDrv(Prt2Drv(p),doc,_root,FALSE);
|
||||
tempm->flags|=DEF_NOT_INITIALIZED;
|
||||
tempde=FMRebuildDocDrv(Prt2Drv(p),doc,_root,FALSE);
|
||||
tempde->flags|=DEF_NOT_INITIALIZED;
|
||||
}
|
||||
tempm->flags|=DEF_REMOVABLE;
|
||||
tempde->flags|=DEF_REMOVABLE;
|
||||
}
|
||||
}
|
||||
DocHome(doc);
|
||||
@@ -246,28 +246,28 @@ U0 FMRename(CDoc *doc)
|
||||
{
|
||||
CEdFileName fn;
|
||||
CDocEntry *doc_e=doc->cur_entry;
|
||||
CDirEntry *tempm=NULL,*parent;
|
||||
CDirEntry *tempde=NULL,*parent;
|
||||
if (doc_e->type_u8==DOCT_MENU_VAL) {
|
||||
tempm=doc_e->user_data;
|
||||
if (parent=tempm->parent) {
|
||||
tempde=doc_e->user_data;
|
||||
if (parent=tempde->parent) {
|
||||
Cd(parent->full_name);
|
||||
StrCpy(fn.name,tempm->name);
|
||||
if (DocFormDo(fn.name,"CEdFileName")) {
|
||||
StrCpy(fn.name,tempde->name);
|
||||
if (DocFormDo(&fn)) {
|
||||
Silent(ON);
|
||||
Move(tempm->name,fn.name);
|
||||
Move(tempde->name,fn.name);
|
||||
Silent(OFF);
|
||||
}
|
||||
}
|
||||
} else if (doc_e->type_u8==DOCT_TREE) {
|
||||
tempm=doc_e->user_data;
|
||||
if (parent=tempm->parent) {
|
||||
tempde=doc_e->user_data;
|
||||
if (parent=tempde->parent) {
|
||||
Cd(parent->full_name);
|
||||
StrCpy(fn.name,tempm->name);
|
||||
if (DocFormDo(fn.name,"CEdFileName")) {
|
||||
if (StrCmp(tempm->name,fn.name)) {
|
||||
StrCpy(fn.name,tempde->name);
|
||||
if (DocFormDo(&fn)) {
|
||||
if (StrCmp(tempde->name,fn.name)) {
|
||||
Silent(ON);
|
||||
if (CopyTree(tempm->name,fn.name))
|
||||
DelTree(tempm->name);
|
||||
if (CopyTree(tempde->name,fn.name))
|
||||
DelTree(tempde->name);
|
||||
Silent(OFF);
|
||||
}
|
||||
}
|
||||
@@ -279,22 +279,22 @@ U0 FMMkDir(CDoc *doc)
|
||||
{
|
||||
CEdFileName fn;
|
||||
CDocEntry *doc_e=doc->cur_entry;
|
||||
CDirEntry *tempm=NULL,*parent;
|
||||
CDirEntry *tempde=NULL,*parent;
|
||||
*fn.name=0;
|
||||
if (doc_e->type_u8==DOCT_MENU_VAL) {
|
||||
tempm=doc_e->user_data;
|
||||
if (parent=tempm->parent) {
|
||||
tempde=doc_e->user_data;
|
||||
if (parent=tempde->parent) {
|
||||
Cd(parent->full_name);
|
||||
if (DocFormDo(fn.name,"CEdFileName")) {
|
||||
if (DocFormDo(&fn)) {
|
||||
Silent(ON);
|
||||
MkDir(fn.name);
|
||||
Silent(OFF);
|
||||
}
|
||||
}
|
||||
} else if (doc_e->type_u8==DOCT_TREE) {
|
||||
tempm=doc_e->user_data;
|
||||
Cd(tempm->full_name);
|
||||
if (DocFormDo(fn.name,"CEdFileName")) {
|
||||
tempde=doc_e->user_data;
|
||||
Cd(tempde->full_name);
|
||||
if (DocFormDo(&fn)) {
|
||||
Silent(ON);
|
||||
MkDir(fn.name);
|
||||
Silent(OFF);
|
||||
@@ -306,21 +306,21 @@ U0 FMDelete(CDoc *doc)
|
||||
{
|
||||
U8 *st;
|
||||
CDocEntry *doc_ce=doc->cur_entry;
|
||||
CDirEntry *tempm;
|
||||
CDirEntry *tempde;
|
||||
if (doc_ce->type_u8==DOCT_MENU_VAL) {
|
||||
tempm=doc_ce->user_data;
|
||||
tempde=doc_ce->user_data;
|
||||
Silent(ON);
|
||||
st=MSPrintF("Delete: %s",tempm->full_name);
|
||||
st=MPrint("Delete: %s",tempde->full_name);
|
||||
if (PopUpCancelOk(st))
|
||||
Del(tempm->full_name);
|
||||
Del(tempde->full_name);
|
||||
Free(st);
|
||||
Silent(OFF);
|
||||
} else if (doc_ce->type_u8==DOCT_TREE) {
|
||||
tempm=doc_ce->user_data;
|
||||
tempde=doc_ce->user_data;
|
||||
Silent(ON);
|
||||
st=MSPrintF("Delete: %s",tempm->full_name);
|
||||
st=MPrint("Delete: %s",tempde->full_name);
|
||||
if (PopUpCancelOk(st))
|
||||
DelTree(tempm->full_name);
|
||||
DelTree(tempde->full_name);
|
||||
Free(st);
|
||||
Silent(OFF);
|
||||
}
|
||||
@@ -329,16 +329,16 @@ U0 FMDelete(CDoc *doc)
|
||||
U0 FMMount(CDoc *doc)
|
||||
{
|
||||
CDocEntry *doc_ce=doc->cur_entry;
|
||||
CDirEntry *tempm;
|
||||
CDirEntry *tempde;
|
||||
if (doc_ce->type_u8==DOCT_TREE || doc_ce->type_u8==DOCT_MENU_VAL)
|
||||
tempm=doc_ce->user_data;
|
||||
tempde=doc_ce->user_data;
|
||||
else
|
||||
tempm=NULL;
|
||||
if (tempm) {
|
||||
while (tempm->parent)
|
||||
tempm=tempm->parent;
|
||||
tempde=NULL;
|
||||
if (tempde) {
|
||||
while (tempde->parent)
|
||||
tempde=tempde->parent;
|
||||
Silent(ON);
|
||||
ChgDsk(*tempm->full_name);
|
||||
ChgDsk(*tempde->full_name);
|
||||
Silent(OFF);
|
||||
}
|
||||
}
|
||||
@@ -346,19 +346,19 @@ U0 FMMount(CDoc *doc)
|
||||
U0 FMFmtDrv(CDoc *doc)
|
||||
{
|
||||
CDocEntry *doc_ce=doc->cur_entry;
|
||||
CDirEntry *tempm;
|
||||
CDirEntry *tempde;
|
||||
U8 *st=NULL;
|
||||
if (doc_ce->type_u8==DOCT_TREE || doc_ce->type_u8==DOCT_MENU_VAL)
|
||||
tempm=doc_ce->user_data;
|
||||
tempde=doc_ce->user_data;
|
||||
else
|
||||
tempm=NULL;
|
||||
if (tempm) {
|
||||
while (tempm->parent)
|
||||
tempm=tempm->parent;
|
||||
st=MSPrintF("Format Drive '%c'?\nAre You Sure?\n",*tempm->full_name);
|
||||
tempde=NULL;
|
||||
if (tempde) {
|
||||
while (tempde->parent)
|
||||
tempde=tempde->parent;
|
||||
st=MPrint("Format Drive '%c'?\nAre You Sure?\n",*tempde->full_name);
|
||||
if (PopUpCancelOk(st)) {
|
||||
Silent(ON);
|
||||
Fmt(*tempm->full_name,TRUE,FALSE);
|
||||
Fmt(*tempde->full_name,TRUE,FALSE);
|
||||
Silent(OFF);
|
||||
}
|
||||
}
|
||||
@@ -368,21 +368,21 @@ U0 FMFmtDrv(CDoc *doc)
|
||||
U0 FMMakeISO(CDoc *doc)
|
||||
{
|
||||
CDocEntry *doc_ce=doc->cur_entry;
|
||||
CDirEntry *tempm;
|
||||
CDirEntry *tempde;
|
||||
U8 *st;
|
||||
if (doc_ce->type_u8==DOCT_TREE || doc_ce->type_u8==DOCT_MENU_VAL)
|
||||
tempm=doc_ce->user_data;
|
||||
tempde=doc_ce->user_data;
|
||||
else
|
||||
tempm=NULL;
|
||||
if (tempm) {
|
||||
tempde=NULL;
|
||||
if (tempde) {
|
||||
if (doc_ce->type_u8==DOCT_MENU_VAL)
|
||||
tempm=tempm->parent;
|
||||
if (tempm && *tempm->full_name) {
|
||||
tempde=tempde->parent;
|
||||
if (tempde && *tempde->full_name) {
|
||||
Silent(ON);
|
||||
if (tempm->full_name[StrLen(tempm->full_name)-1]=='/')
|
||||
st=MSPrintF("%s*",tempm->full_name);
|
||||
if (tempde->full_name[StrLen(tempde->full_name)-1]=='/')
|
||||
st=MPrint("%s*",tempde->full_name);
|
||||
else
|
||||
st=MSPrintF("%s/*",tempm->full_name);
|
||||
st=MPrint("%s/*",tempde->full_name);
|
||||
CDFileCreate(,st);
|
||||
Free(st);
|
||||
Silent(OFF);
|
||||
@@ -393,16 +393,16 @@ U0 FMMakeISO(CDoc *doc)
|
||||
U0 FMBurnISO(CDoc *doc)
|
||||
{
|
||||
CDocEntry *doc_ce=doc->cur_entry;
|
||||
CDirEntry *tempm;
|
||||
CDirEntry *tempde;
|
||||
if (doc_ce->type_u8==DOCT_TREE || doc_ce->type_u8==DOCT_MENU_VAL)
|
||||
tempm=doc_ce->user_data;
|
||||
tempde=doc_ce->user_data;
|
||||
else
|
||||
tempm=NULL;
|
||||
if (tempm) {
|
||||
while (tempm->parent)
|
||||
tempm=tempm->parent;
|
||||
tempde=NULL;
|
||||
if (tempde) {
|
||||
while (tempde->parent)
|
||||
tempde=tempde->parent;
|
||||
Silent(ON);
|
||||
CDImageWrite(*tempm->full_name);
|
||||
CDImageWrite(*tempde->full_name);
|
||||
Silent(OFF);
|
||||
}
|
||||
}
|
||||
@@ -412,37 +412,37 @@ U0 FMCopy(CDoc *doc)
|
||||
CDoc *doc2=sys_clipboard_doc;
|
||||
U8 *st;
|
||||
CDocEntry *doc_ce=doc->cur_entry,*doc_e;
|
||||
CDirEntry *tempm,*tempm1=NULL,*tempm2;
|
||||
CDirEntry *tempde,*tempde1=NULL,*tempde2;
|
||||
Bool unlock_doc2=DocLock(doc2);
|
||||
doc_e=doc2->root.next;
|
||||
|
||||
tempm1=doc_ce->user_data;
|
||||
tempde1=doc_ce->user_data;
|
||||
if (doc_ce->type_u8==DOCT_MENU_VAL)
|
||||
tempm1=tempm1->parent;
|
||||
tempde1=tempde1->parent;
|
||||
else if (doc_ce->type_u8!=DOCT_TREE)
|
||||
tempm1=NULL;
|
||||
if (tempm1) {
|
||||
tempde1=NULL;
|
||||
if (tempde1) {
|
||||
while (doc_e!=doc2) {
|
||||
if (doc_e->type_u8==DOCT_MENU_VAL) {
|
||||
tempm=doc_e->user_data;
|
||||
tempm->flags|=DEF_PROCESSED;
|
||||
tempm2=tempm->parent;
|
||||
if (!tempm2 || !(tempm2->flags&DEF_PROCESSED)) {
|
||||
tempde=doc_e->user_data;
|
||||
tempde->flags|=DEF_PROCESSED;
|
||||
tempde2=tempde->parent;
|
||||
if (!tempde2 || !(tempde2->flags&DEF_PROCESSED)) {
|
||||
Silent(ON);
|
||||
Copy(tempm->full_name,tempm1->full_name);
|
||||
Copy(tempde->full_name,tempde1->full_name);
|
||||
Silent(OFF);
|
||||
}
|
||||
} else if (doc_e->type_u8==DOCT_TREE) {
|
||||
tempm=doc_e->user_data;
|
||||
tempm->flags|=DEF_PROCESSED;
|
||||
tempm2=tempm->parent;
|
||||
if (!tempm2 || !(tempm2->flags&DEF_PROCESSED)) {
|
||||
tempde=doc_e->user_data;
|
||||
tempde->flags|=DEF_PROCESSED;
|
||||
tempde2=tempde->parent;
|
||||
if (!tempde2 || !(tempde2->flags&DEF_PROCESSED)) {
|
||||
Silent(ON);
|
||||
if (*tempm1->name)
|
||||
st=MSPrintF("%s/%s",tempm1->full_name,tempm->name);
|
||||
if (*tempde1->name)
|
||||
st=MPrint("%s/%s",tempde1->full_name,tempde->name);
|
||||
else
|
||||
st=MSPrintF("%s%s",tempm1->full_name,tempm->name);
|
||||
CopyTree(tempm->full_name,st);
|
||||
st=MPrint("%s%s",tempde1->full_name,tempde->name);
|
||||
CopyTree(tempde->full_name,st);
|
||||
Free(st);
|
||||
Silent(OFF);
|
||||
}
|
||||
@@ -471,8 +471,8 @@ I64 PopUpCancelPasteDel(U8 *header=NULL,U8 *footer=NULL)
|
||||
{
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
if (header) DocPutS(doc,header);
|
||||
DocPutS(doc,"$$CM+LX,1,1 $$$$BT,\"INCLUDE \",FMR_INCLUDE$$"
|
||||
if (header) DocPrint(doc,"%s",header);
|
||||
DocPrint(doc,"$$CM+LX,1,1 $$$$BT,\"INCLUDE \",FMR_INCLUDE$$"
|
||||
"$$CM+LX,27,0$$$$BT,\"ADAM INCLUDE \",FMR_ADAM_INCLUDE$$"
|
||||
"$$CM+LX,1,3 $$$$BT,\"DELETE \",FMR_DELETE$$"
|
||||
"$$CM+LX,27,0$$$$BT,\"RENAME \",FMR_RENAME$$"
|
||||
@@ -485,7 +485,7 @@ I64 PopUpCancelPasteDel(U8 *header=NULL,U8 *footer=NULL)
|
||||
"$$CM+LX,27,0$$$$BT,\"BURN ISO (CD-ROM) FILE\",FMR_BURN_ISO$$"
|
||||
"$$CM+LX,1,3 $$$$BT,\"HELP \",FMR_HELP$$"
|
||||
"$$CM+LX,27,0$$$$BT,\"CANCEL \",DOCM_CANCEL$$\n");
|
||||
if (footer) DocPutS(doc,footer);
|
||||
if (footer) DocPrint(doc,"%s",footer);
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
return i;
|
||||
@@ -541,14 +541,14 @@ U0 FMFinalScreenUpdate(CDC *dc)
|
||||
{
|
||||
if (fm_ip_str) {
|
||||
dc->color=LTRED;
|
||||
GrPutS(dc,ipx,ipy,fm_ip_str);
|
||||
GrPrint(dc,ipx,ipy,"%s",fm_ip_str);
|
||||
}
|
||||
(*fp_old_final_screen_update)(dc);
|
||||
}
|
||||
|
||||
public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
|
||||
{
|
||||
CDirEntry *root=NULL,*tempm,*tempm1,*tempm2;
|
||||
CDirEntry *root=NULL,*tempde,*tempde1,*tempde2;
|
||||
I64 sc,ch,p1,p2,msg_code;
|
||||
CDoc *doc=NULL,*old_put_doc=DocPut,*old_display_doc=DocDisplay;
|
||||
U8 *result=NULL,*st,*st2,*old_cur_dir=CurDir;
|
||||
@@ -559,12 +559,12 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
|
||||
fp_old_final_screen_update=fp_final_screen_update;
|
||||
MenuFilePush("::/TempleOS/Doc/FileMgrPullDown.TXT");
|
||||
FMRebuildDoc(&doc,&root,mode);
|
||||
if (tempm1=Cd2DirEntry(root,old_cur_dir))
|
||||
doc->cur_entry=tempm1->user_data;
|
||||
while (tempm1) {
|
||||
if (tempm1->attr&_ATTR_DIR)
|
||||
tempm1->user_data(CDocEntry *)->flags1&=~DOCEF1_CHECKED_COLLAPSED;
|
||||
tempm1=tempm1->parent;
|
||||
if (tempde1=Cd2DirEntry(root,old_cur_dir))
|
||||
doc->cur_entry=tempde1->user_data;
|
||||
while (tempde1) {
|
||||
if (tempde1->attr&_ATTR_DIR)
|
||||
tempde1->user_data(CDocEntry *)->flags1&=~DOCEF1_CHECKED_COLLAPSED;
|
||||
tempde1=tempde1->parent;
|
||||
}
|
||||
do {
|
||||
DocUnlock(doc);
|
||||
@@ -592,40 +592,40 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
|
||||
if (doc_e!=doc_ce) {
|
||||
st2=NULL;
|
||||
if (doc_e->type_u8==DOCT_MENU_VAL) {
|
||||
tempm1=doc_e->user_data;
|
||||
if (tempm1=tempm1->parent)
|
||||
st2=StrNew(tempm1->full_name);
|
||||
tempde1=doc_e->user_data;
|
||||
if (tempde1=tempde1->parent)
|
||||
st2=StrNew(tempde1->full_name);
|
||||
} else if (doc_e->type_u8==DOCT_TREE) {
|
||||
tempm1=doc_e->user_data;
|
||||
st2=StrNew(tempm1->full_name);
|
||||
tempde1=doc_e->user_data;
|
||||
st2=StrNew(tempde1->full_name);
|
||||
}
|
||||
if (st2 && doc_ce->type_u8==DOCT_MENU_VAL) {
|
||||
tempm=doc_ce->user_data;
|
||||
tempde=doc_ce->user_data;
|
||||
Silent(ON);
|
||||
Move(tempm->full_name,st2);
|
||||
Move(tempde->full_name,st2);
|
||||
Silent(OFF);
|
||||
FMRebuildDoc(&doc,&root,mode);
|
||||
} else if (st2 && doc_ce->type_u8==DOCT_TREE) {
|
||||
tempm=doc_ce->user_data;
|
||||
tempde=doc_ce->user_data;
|
||||
okay=TRUE;
|
||||
tempm2=tempm1;
|
||||
while (tempm2) {
|
||||
if (tempm2!=tempm)
|
||||
tempm2=tempm2->parent;
|
||||
tempde2=tempde1;
|
||||
while (tempde2) {
|
||||
if (tempde2!=tempde)
|
||||
tempde2=tempde2->parent;
|
||||
else {
|
||||
okay=FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (okay) {
|
||||
if (*tempm1->name)
|
||||
st=MSPrintF("%s/%s",tempm1->full_name,tempm->name);
|
||||
if (*tempde1->name)
|
||||
st=MPrint("%s/%s",tempde1->full_name,tempde->name);
|
||||
else
|
||||
st=MSPrintF("%s%s",tempm1->full_name,tempm->name);
|
||||
if (StrCmp(tempm->full_name,st)) {
|
||||
st=MPrint("%s%s",tempde1->full_name,tempde->name);
|
||||
if (StrCmp(tempde->full_name,st)) {
|
||||
Silent(ON);
|
||||
CopyTree(tempm->full_name,st);
|
||||
DelTree(tempm->full_name);
|
||||
CopyTree(tempde->full_name,st);
|
||||
DelTree(tempde->full_name);
|
||||
Silent(OFF);
|
||||
FMRebuildDoc(&doc,&root,mode);
|
||||
}
|
||||
@@ -715,14 +715,14 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
|
||||
break;
|
||||
case CH_ESC:
|
||||
doc_ce=doc->cur_entry;
|
||||
tempm=doc_ce->user_data;
|
||||
tempde=doc_ce->user_data;
|
||||
if (mode==FM_PICK_FILE && doc_ce->type_u8==DOCT_MENU_VAL)
|
||||
result=StrNew(tempm->full_name,mem_task);
|
||||
result=StrNew(tempde->full_name,mem_task);
|
||||
else if (mode==FM_PICK_DIR) {
|
||||
if (doc_ce->type_u8==DOCT_TREE)
|
||||
result=StrNew(tempm->full_name,mem_task);
|
||||
else if (doc_ce->type_u8==DOCT_MENU_VAL && (tempm=tempm->parent))
|
||||
result=StrNew(tempm->full_name,mem_task);
|
||||
result=StrNew(tempde->full_name,mem_task);
|
||||
else if (doc_ce->type_u8==DOCT_MENU_VAL && (tempde=tempde->parent))
|
||||
result=StrNew(tempde->full_name,mem_task);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -731,12 +731,12 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
|
||||
FMRebuildDoc(&doc,&root,mode);
|
||||
} else if (sc.u8[0]==SC_F5) {
|
||||
if (doc->cur_entry->type_u8==DOCT_MENU_VAL) {
|
||||
tempm=doc->cur_entry->user_data;
|
||||
tempde=doc->cur_entry->user_data;
|
||||
DocUnlock(doc);
|
||||
if (sc&SCF_SHIFT)
|
||||
AdamFile(tempm->full_name);
|
||||
AdamFile(tempde->full_name);
|
||||
else
|
||||
PopUpFile(tempm->full_name);
|
||||
PopUpFile(tempde->full_name);
|
||||
DocLock(doc);
|
||||
}
|
||||
} else {
|
||||
@@ -754,7 +754,7 @@ regular_key:
|
||||
Fs->display_doc=old_display_doc;
|
||||
SettingsPop;
|
||||
DocDel(doc);
|
||||
CDirLstDel(root);
|
||||
DirLstDel(root);
|
||||
Cd(old_cur_dir);
|
||||
Free(old_cur_dir);
|
||||
if (mode!=FM_NORMAL && !result)
|
||||
|
||||
+42
-48
@@ -1,54 +1,48 @@
|
||||
#help_index "Graphics"
|
||||
U0 GrInit1()
|
||||
{
|
||||
DefineLstLoad("ST_SPRITE_TYPES","End\0 \0Color 8Bit\0 \0Point\0"
|
||||
"Line\0PolyLine\0PolyPoint\0Width\0Shift\0"
|
||||
"BSpline2\0BSpline3\0BSpline2 Closed\0BSpline3 Closed\0"
|
||||
" \0 \0 \0Rect\0Circle\0Flood Fill Not Color\0Flood Fill\0BitMap 8Bit\0"
|
||||
" \0Text\0Ellipse\0Polygon\0Planar Symmetry\0"
|
||||
"Dither Color 8Bit\0Rotated Rect\0Mesh\0Shiftable Mesh\0"
|
||||
"Transform On\0Transform Off\0Arrow\0Text Box\0Text Diamond\0");
|
||||
DefineLstLoad("ST_SPRITE_TYPES",
|
||||
"End\0Color 8Bit\0Dither Color 8Bit\0"
|
||||
"Width\0Planar Symmetry\0Transform On\0Transform Off\0Shift\0"
|
||||
"Point\0PolyPoint\0Line\0PolyLine\0Rect\0Rotated Rect\0"
|
||||
"Circle\0Ellipse\0Polygon\0BSpline2\0BSpline2 Closed\0BSpline3\0BSpline3 Closed\0"
|
||||
"Flood Fill\0Flood Fill Not Color\0BitMap 8Bit\0Mesh\0Shiftable Mesh\0"
|
||||
"Arrow\0Text\0Text Box\0Text Diamond\0");
|
||||
}
|
||||
GrInit1;
|
||||
|
||||
#help_index "Graphics/CSprite"
|
||||
#define GRST_END 0
|
||||
//Unused
|
||||
#define GRST_COLOR8 2
|
||||
//Unused
|
||||
#define GRST_PT 4
|
||||
#define GRST_LINE 5
|
||||
#define GRST_POLYLINE 6
|
||||
#define GRST_POLYPT 7
|
||||
#define GRST_WIDTH 8
|
||||
#define GRST_SHIFT 9
|
||||
#define GRST_BSPLINE2 10
|
||||
#define GRST_BSPLINE3 11
|
||||
#define GRST_BSPLINE2_CLOSED 12
|
||||
#define GRST_BSPLINE3_CLOSED 13
|
||||
//Unused
|
||||
//Unused
|
||||
//Unused
|
||||
#define GRST_RECT 17
|
||||
#define GRST_CIRCLE 18
|
||||
#define GRST_FLOOD_FILL_NOT 19
|
||||
#define GRST_FLOOD_FILL 20
|
||||
#define GRST_BITMAP8 21
|
||||
//Unused
|
||||
#define GRST_TEXT 23
|
||||
#define GRST_ELLIPSE 24
|
||||
#define GRST_POLYGON 25
|
||||
#define GRST_PLANAR_SYMMETRY 26
|
||||
#define GRST_DITHER_COLOR8 27
|
||||
#define GRST_ROTATED_RECT 28
|
||||
#define GRST_MESH 29
|
||||
#define GRST_SHIFTABLE_MESH 30
|
||||
#define GRST_TRANSFORM_ON 31
|
||||
#define GRST_TRANSFORM_OFF 32
|
||||
#define GRST_ARROW 33
|
||||
#define GRST_TEXT_BOX 34
|
||||
#define GRST_TEXT_DIAMOND 35
|
||||
#define GRST_NUM_TYPES 36
|
||||
#define GRST_COLOR8 1
|
||||
#define GRST_DITHER_COLOR8 2
|
||||
#define GRST_WIDTH 3
|
||||
#define GRST_PLANAR_SYMMETRY 4
|
||||
#define GRST_TRANSFORM_ON 5
|
||||
#define GRST_TRANSFORM_OFF 6
|
||||
#define GRST_SHIFT 7
|
||||
#define GRST_PT 8
|
||||
#define GRST_POLYPT 9
|
||||
#define GRST_LINE 10
|
||||
#define GRST_POLYLINE 11
|
||||
#define GRST_RECT 12
|
||||
#define GRST_ROTATED_RECT 13
|
||||
#define GRST_CIRCLE 14
|
||||
#define GRST_ELLIPSE 15
|
||||
#define GRST_POLYGON 16
|
||||
#define GRST_BSPLINE2 17
|
||||
#define GRST_BSPLINE2_CLOSED 18
|
||||
#define GRST_BSPLINE3 19
|
||||
#define GRST_BSPLINE3_CLOSED 20
|
||||
#define GRST_FLOOD_FILL 21
|
||||
#define GRST_FLOOD_FILL_NOT 22
|
||||
#define GRST_BITMAP8 23
|
||||
#define GRST_MESH 24
|
||||
#define GRST_SHIFTABLE_MESH 25
|
||||
#define GRST_ARROW 26
|
||||
#define GRST_TEXT 27
|
||||
#define GRST_TEXT_BOX 28
|
||||
#define GRST_TEXT_DIAMOND 29
|
||||
#define GRST_NUM_TYPES 30
|
||||
|
||||
class CMeshTri
|
||||
{
|
||||
@@ -116,11 +110,11 @@ extern U8 *GrBitMap4ToBitMap8(U8 *dst,U8 *src,I64 src_size,I64 bkcolor);
|
||||
#define GE_EXIT 0
|
||||
#define GE_CONT 1
|
||||
|
||||
#include "CSpriteNew"
|
||||
#include "SpriteNew"
|
||||
#include "GrSpritePlot"
|
||||
#include "CSpriteMesh"
|
||||
#include "CSpriteBitMap"
|
||||
#include "CSpriteEd"
|
||||
#include "CSpriteMain"
|
||||
#include "SpriteMesh"
|
||||
#include "SpriteBitMap"
|
||||
#include "SpriteEd"
|
||||
#include "SpriteMain"
|
||||
#help_index ""
|
||||
|
||||
+22
-22
@@ -12,9 +12,9 @@ _PLOT_SCREEN_U8::
|
||||
ENTER 0
|
||||
MOV RBX,U64 SF_ARG2[RBP]
|
||||
MOV RAX,U64 SF_ARG3[RBP]
|
||||
OR RBX,RBX
|
||||
TEST RBX,RBX
|
||||
JS @@05
|
||||
OR RAX,RAX
|
||||
TEST RAX,RAX
|
||||
JS @@05
|
||||
CMP RBX,TEXT_COLS
|
||||
JGE @@05
|
||||
@@ -44,22 +44,22 @@ _PLOT_WIN_U8::
|
||||
SAR RAX,3
|
||||
ADD RAX,U64 SF_ARG4[RBP]
|
||||
|
||||
OR RBX,RBX
|
||||
TEST RBX,RBX
|
||||
JS @@05
|
||||
ADD RBX,U64 CTask.win_left[RCX]
|
||||
CMP RBX,U64 CTask.win_right[RCX]
|
||||
JG @@05
|
||||
OR RBX,RBX
|
||||
TEST RBX,RBX
|
||||
JS @@05
|
||||
CMP RBX,TEXT_COLS
|
||||
JGE @@05
|
||||
|
||||
OR RAX,RAX
|
||||
TEST RAX,RAX
|
||||
JS @@05
|
||||
ADD RAX,U64 CTask.win_top[RCX]
|
||||
CMP RAX,U64 CTask.win_bottom[RCX]
|
||||
JG @@05
|
||||
OR RAX,RAX
|
||||
TEST RAX,RAX
|
||||
JS @@05
|
||||
CMP RAX,TEXT_ROWS
|
||||
JGE @@05
|
||||
@@ -94,7 +94,7 @@ _PLOT_WIN_STR2::
|
||||
ADD RDI,U64 SF_ARG5[RBP]
|
||||
MOV RCX,U64 SF_ARG3[RBP]
|
||||
|
||||
OR RDI,RDI
|
||||
TEST RDI,RDI
|
||||
JNS @@05
|
||||
ADD RCX,RDI
|
||||
SUB RSI,RDI
|
||||
@@ -109,7 +109,7 @@ _PLOT_WIN_STR2::
|
||||
SUB RAX,U64 CTask.win_right[RBX]
|
||||
SUB RDX,RAX
|
||||
SUB RCX,RAX
|
||||
@@10: OR RDI,RDI
|
||||
@@10: TEST RDI,RDI
|
||||
JNS @@15
|
||||
ADD RCX,RDI
|
||||
SUB RSI,RDI
|
||||
@@ -124,12 +124,12 @@ _PLOT_WIN_STR2::
|
||||
MOV RAX,U64 CTask.win_scroll_y[RBX]
|
||||
SAR RAX,3
|
||||
ADD RAX,U64 SF_ARG6[RBP]
|
||||
OR RAX,RAX
|
||||
TEST RAX,RAX
|
||||
JS @@30
|
||||
ADD RAX,U64 CTask.win_top[RBX]
|
||||
CMP RAX,U64 CTask.win_bottom[RBX]
|
||||
JG @@30
|
||||
OR RAX,RAX
|
||||
TEST RAX,RAX
|
||||
JS @@30
|
||||
CMP RAX,TEXT_ROWS
|
||||
JGE @@30
|
||||
@@ -171,7 +171,7 @@ _PLOT_ATTR_STR2::
|
||||
ADD RDI,U64 SF_ARG4[RBP]
|
||||
MOV RCX,U64 SF_ARG3[RBP]
|
||||
|
||||
OR RDI,RDI
|
||||
TEST RDI,RDI
|
||||
JNS @@05
|
||||
ADD RCX,RDI
|
||||
SHL RDI,2
|
||||
@@ -187,7 +187,7 @@ _PLOT_ATTR_STR2::
|
||||
SUB RAX,U64 CTask.win_right[RBX]
|
||||
SUB RDX,RAX
|
||||
SUB RCX,RAX
|
||||
@@10: OR RDI,RDI
|
||||
@@10: TEST RDI,RDI
|
||||
JNS @@15
|
||||
ADD RCX,RDI
|
||||
SHL RDI,2
|
||||
@@ -203,12 +203,12 @@ _PLOT_ATTR_STR2::
|
||||
MOV RAX,U64 CTask.win_scroll_y[RBX]
|
||||
SAR RAX,3
|
||||
ADD RAX,U64 SF_ARG5[RBP]
|
||||
OR RAX,RAX
|
||||
TEST RAX,RAX
|
||||
JS @@30
|
||||
ADD RAX,U64 CTask.win_top[RBX]
|
||||
CMP RAX,U64 CTask.win_bottom[RBX]
|
||||
JG @@30
|
||||
OR RAX,RAX
|
||||
TEST RAX,RAX
|
||||
JS @@30
|
||||
CMP RAX,TEXT_ROWS
|
||||
JGE @@30
|
||||
@@ -248,7 +248,7 @@ _PLOT_ATTR::
|
||||
ADD RDI,U64 SF_ARG4[RBP]
|
||||
MOV RCX,U64 SF_ARG2[RBP]
|
||||
|
||||
OR RDI,RDI
|
||||
TEST RDI,RDI
|
||||
JNS @@05
|
||||
ADD RCX,RDI
|
||||
XOR RDI,RDI
|
||||
@@ -262,7 +262,7 @@ _PLOT_ATTR::
|
||||
SUB RAX,U64 CTask.win_right[RBX]
|
||||
SUB RDX,RAX
|
||||
SUB RCX,RAX
|
||||
@@10: OR RDI,RDI
|
||||
@@10: TEST RDI,RDI
|
||||
JNS @@15
|
||||
ADD RCX,RDI
|
||||
XOR RDI,RDI
|
||||
@@ -276,12 +276,12 @@ _PLOT_ATTR::
|
||||
MOV RAX,U64 CTask.win_scroll_y[RBX]
|
||||
SAR RAX,3
|
||||
ADD RAX,U64 SF_ARG5[RBP]
|
||||
OR RAX,RAX
|
||||
TEST RAX,RAX
|
||||
JS @@35
|
||||
ADD RAX,U64 CTask.win_top[RBX]
|
||||
CMP RAX,U64 CTask.win_bottom[RBX]
|
||||
JG @@35
|
||||
OR RAX,RAX
|
||||
TEST RAX,RAX
|
||||
JS @@35
|
||||
CMP RAX,TEXT_ROWS
|
||||
JGE @@35
|
||||
@@ -293,7 +293,7 @@ _PLOT_ATTR::
|
||||
MOV RBX,U64 SF_ARG3[RBP]
|
||||
MOV RSI,RDI
|
||||
@@25: LODSD
|
||||
OR AL,AL
|
||||
TEST AL,AL
|
||||
JNZ @@30
|
||||
MOV RAX,RBX
|
||||
STOSD
|
||||
@@ -331,7 +331,7 @@ _PLOT_BORDER_U8::
|
||||
INC RDX
|
||||
CMP RBX,RDX
|
||||
JG @@05
|
||||
OR RBX,RBX
|
||||
TEST RBX,RBX
|
||||
JS @@05
|
||||
CMP RBX,TEXT_COLS
|
||||
JGE @@05
|
||||
@@ -344,7 +344,7 @@ _PLOT_BORDER_U8::
|
||||
INC RDX
|
||||
CMP RAX,RDX
|
||||
JG @@05
|
||||
OR RAX,RAX
|
||||
TEST RAX,RAX
|
||||
JS @@05
|
||||
CMP RAX,TEXT_ROWS
|
||||
JGE @@05
|
||||
@@ -624,7 +624,7 @@ _GR_ROP_EQU_U8_NO_CLIPPING::
|
||||
JNC @@05
|
||||
MOV RBX,0xFF00000000000000
|
||||
OR RAX,RBX
|
||||
@@05: OR RAX,RAX
|
||||
@@05: TEST RAX,RAX
|
||||
JZ I32 @@10
|
||||
|
||||
PUSH RSI
|
||||
|
||||
@@ -831,8 +831,8 @@ public I64 GrPutChar(CDC *dc,I64 x,I64 y,U8 ch)
|
||||
return 0;
|
||||
}
|
||||
|
||||
public I64 GrPutS(CDC *dc,I64 x,I64 y,U8 *_s)
|
||||
{
|
||||
I64 GrPutS(CDC *dc,I64 x,I64 y,U8 *_s)
|
||||
{ //Use $LK,"GrPrint","MN:GrPrint"$()
|
||||
I64 x0,ch,result;
|
||||
if (!_s) return 0;
|
||||
x0=x;
|
||||
@@ -851,8 +851,8 @@ public I64 GrPutS(CDC *dc,I64 x,I64 y,U8 *_s)
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 GrVPutS(CDC *dc,I64 x,I64 y,U8 *_s)
|
||||
{ //Vertical text
|
||||
I64 GrVPutS(CDC *dc,I64 x,I64 y,U8 *_s)
|
||||
{ //Vertical Text. Use $LK,"GrVPrint","MN:GrVPrint"$()
|
||||
I64 y0,result;
|
||||
U8 buf[2];
|
||||
if (!_s) return 0;
|
||||
@@ -874,18 +874,22 @@ public I64 GrVPutS(CDC *dc,I64 x,I64 y,U8 *_s)
|
||||
return result;
|
||||
}
|
||||
|
||||
public U0 GrPrintF(CDC *dc,I64 x,I64 y,U8 *fmt,...)
|
||||
public I64 GrPrint(CDC *dc,I64 x,I64 y,U8 *fmt,...)
|
||||
{
|
||||
U8 *buf=SPrintFJoin(NULL,fmt,argc,argv);
|
||||
GrPutS(dc,x,y,buf);
|
||||
I64 result;
|
||||
U8 *buf=SPrintJoin(NULL,fmt,argc,argv);
|
||||
result=GrPutS(dc,x,y,buf);
|
||||
Free(buf);
|
||||
return result;
|
||||
}
|
||||
|
||||
public U0 GrVPrintF(CDC *dc,I64 x,I64 y,U8 *fmt,...)
|
||||
public I64 GrVPrint(CDC *dc,I64 x,I64 y,U8 *fmt,...)
|
||||
{ //Vertical text
|
||||
U8 *buf=SPrintFJoin(NULL,fmt,argc,argv);
|
||||
GrVPutS(dc,x,y,buf);
|
||||
I64 result;
|
||||
U8 *buf=SPrintJoin(NULL,fmt,argc,argv);
|
||||
result=GrVPutS(dc,x,y,buf);
|
||||
Free(buf);
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "Graphics"
|
||||
@@ -1089,7 +1093,7 @@ public I64 GrRect(CDC *dc,I64 x,I64 y,I64 w,I64 h)
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask^color_mask&~leading_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask|*dst(I64 *)^color_mask&~leading_bit_mask;
|
||||
result+=leading_bits;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
@@ -1100,7 +1104,7 @@ public I64 GrRect(CDC *dc,I64 x,I64 y,I64 w,I64 h)
|
||||
result+=8;
|
||||
}
|
||||
if (trailing_bits && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask^color_mask&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|*dst(I64 *)^color_mask&~trailing_bit_mask;
|
||||
result+=trailing_bits;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
@@ -1122,11 +1126,11 @@ public I64 GrRect(CDC *dc,I64 x,I64 y,I64 w,I64 h)
|
||||
gr_1_to_8_bits[0xAA]&gr_1_to_8_colors[color.c1.color];
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits)
|
||||
*dst(I64 *)++=*dst&leading_bit_mask^color_mask&~leading_bit_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|*dst(I64 *)^color_mask&~leading_bit_mask;
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
*dst(I64 *)^=color_mask;
|
||||
if (trailing_bits)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask^color_mask&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|*dst(I64 *)^color_mask&~trailing_bit_mask;
|
||||
kk1+=dc->width_internal;
|
||||
if (probability_dither) {
|
||||
if (RandU16<dc->dither_probability)
|
||||
@@ -1221,7 +1225,7 @@ public I64 GrRect(CDC *dc,I64 x,I64 y,I64 w,I64 h)
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask^color_mask&~leading_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask|*dst(I64 *)^color_mask&~leading_bit_mask;
|
||||
result+=leading_bits;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
@@ -1232,7 +1236,7 @@ public I64 GrRect(CDC *dc,I64 x,I64 y,I64 w,I64 h)
|
||||
result+=8;
|
||||
}
|
||||
if (trailing_bits && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask^color_mask&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|*dst(I64 *)^color_mask&~trailing_bit_mask;
|
||||
result+=trailing_bits;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
@@ -1245,11 +1249,11 @@ public I64 GrRect(CDC *dc,I64 x,I64 y,I64 w,I64 h)
|
||||
for (j=h2-h1;j;j--) {
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask^color_mask&~leading_bit_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|*dst(I64 *)^color_mask&~leading_bit_mask;
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
*dst(I64 *)^=color_mask;
|
||||
if (trailing_bits)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask^color_mask&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|*dst(I64 *)^color_mask&~trailing_bit_mask;
|
||||
kk1+=dc->width_internal;
|
||||
}
|
||||
result=(h2-h1)*(w2-w1);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
//See $LK,"SYS_BIOS_GR_MODE","FF:D:/TempleOS/Kernel/KStart.CPP,SYS_BIOS_GR_MODE:2"$
|
||||
//See $LK,"SysGrInit","MN:SysGrInit"$()
|
||||
|
||||
//This allows constants to be used
|
||||
//This allows consts to be used
|
||||
//instead of vars.
|
||||
DefinePrintF("BIOS_GR_MODE","%d",bios_gr_mode);
|
||||
DefinePrintF("GR_WIDTH","%d",gr_width);
|
||||
DefinePrintF("GR_HEIGHT","%d",gr_height);
|
||||
DefinePrintF("TEXT_ROWS","%d",text_rows);
|
||||
DefinePrintF("TEXT_COLS","%d",text_cols);
|
||||
DefinePrint("BIOS_GR_MODE","%d",bios_gr_mode);
|
||||
DefinePrint("GR_WIDTH","%d",gr_width);
|
||||
DefinePrint("GR_HEIGHT","%d",gr_height);
|
||||
DefinePrint("TEXT_ROWS","%d",text_rows);
|
||||
DefinePrint("TEXT_COLS","%d",text_cols);
|
||||
@@ -1,4 +1,29 @@
|
||||
#help_index "Graphics"
|
||||
public I64 GrRectB(CDC *dc,I64 x1,I64 y1,I64 x2,I64 y2)
|
||||
{
|
||||
if (x2<x1) SwapU64(&x1,&x2);
|
||||
if (y2<y1) SwapU64(&y1,&y2);
|
||||
return GrRect(dc,x1,y1,x2-x1+1,y2-y1+1);
|
||||
}
|
||||
|
||||
public I64 GrRect3(CDC *dc,I64 x,I64 y,I64 z,I64 w,I64 h)
|
||||
{ //Clipping and transformation
|
||||
CD3I32 poly[4];
|
||||
poly[0].x=x;
|
||||
poly[0].y=y;
|
||||
poly[0].z=z;
|
||||
poly[1].x=x+w;
|
||||
poly[1].y=y;
|
||||
poly[1].z=z;
|
||||
poly[2].x=x+w;
|
||||
poly[2].y=y+h;
|
||||
poly[2].z=z;
|
||||
poly[3].x=x;
|
||||
poly[3].y=y+h;
|
||||
poly[3].z=z;
|
||||
return GrFillPoly3(dc,4,poly);
|
||||
}
|
||||
|
||||
public U0 GrLineRect4(CDC *dc,I64 x1,I64 y1,I64 x2,I64 y2,I64 step=1,I64 start=0)
|
||||
{
|
||||
//Can be used with ROPF_DITHER+WHITE<<16+BLACK
|
||||
@@ -76,7 +101,7 @@ public I64 GrTextBox3(CDC *dc,I64 x1,I64 y1,I64 z1,U8 *s,I64 border=2)
|
||||
w+=FONT_WIDTH;
|
||||
}
|
||||
if (w>w_max) w_max=w;
|
||||
result=GrPutS(dc,x1,y1,s);
|
||||
result=GrPrint(dc,x1,y1,"%s",s);
|
||||
result+=GrLine(dc,x1-border ,y1-border ,x1+w_max+border,y1-border);
|
||||
result+=GrLine(dc,x1-border ,y1+h+border,x1+w_max+border,y1+h+border);
|
||||
result+=GrLine(dc,x1-border ,y1-border ,x1-border,y1+h+border);
|
||||
@@ -120,10 +145,10 @@ public I64 GrTextDiamond3(CDC *dc,I64 x1,I64 y1,I64 z1,U8 *_s,I64 border=2)
|
||||
|
||||
w=(StrLen(st)*FONT_WIDTH)>>1;
|
||||
if (first) {
|
||||
result+=GrPutS(dc,x1-w,y,st);
|
||||
result+=GrPrint(dc,x1-w,y,"%s",st);
|
||||
first=FALSE;
|
||||
} else
|
||||
result+=GrPutS(dc,x1-w,y,st);
|
||||
result+=GrPrint(dc,x1-w,y,"%s",st);
|
||||
if (w) {
|
||||
w+=border;
|
||||
do {
|
||||
|
||||
@@ -41,7 +41,7 @@ public CDC *DCAlias(CDC *dc=NULL,CTask *task=NULL)
|
||||
|
||||
public CDC *DCNew(I64 type,I64 width,I64 height,CTask *task=NULL,Bool null_bitmap=FALSE)
|
||||
{ //This internally only allows widths which are divisible by 8
|
||||
//Don't forget these $MA+A-X+PU,"sizeof(CDC)","Grep(\"sizeof(CDC)\",\"/TempleOS/\"FILENAME_MASK_TXT);View;"$.
|
||||
//Don't forget these $MA+A-X+PU,"sizeof(CDC)","Grep(\"sizeof(CDC)\",\"/TempleOS/*\");View;"$.
|
||||
CDC *result;
|
||||
if (!task) task=Fs;
|
||||
result=CAlloc(sizeof(CDC),task);
|
||||
@@ -136,19 +136,21 @@ public U0 DCMono(CDC *dc,
|
||||
}
|
||||
}
|
||||
|
||||
public U0 DCColorChg(CDC *dc,I64 src_color,I64 dst_color=COLOR_TRANSPARENT)
|
||||
public I64 DCColorChg(CDC *dc,I64 src_color,I64 dst_color=COLOR_TRANSPARENT)
|
||||
{
|
||||
I64 i;
|
||||
I64 i,result=0;
|
||||
U8 *dst;
|
||||
if (dc->type==DCT_COLOR8) {
|
||||
dst=dc->body;
|
||||
i=dc->width_internal*dc->height;
|
||||
while (i--)
|
||||
if (*dst==src_color)
|
||||
if (*dst==src_color) {
|
||||
*dst++=dst_color;
|
||||
else
|
||||
result++;
|
||||
} else
|
||||
dst++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public U8 *DCSave(CDC *dc,I64 *_size=NULL,Bool compressed=TRUE)
|
||||
|
||||
+175
-131
@@ -271,7 +271,7 @@ ff_done:
|
||||
return result;
|
||||
}
|
||||
|
||||
public Bool GrPlot3b(CDC *dc,I64 x,I64 y,I64 z)
|
||||
public Bool GrPlot3B(CDC *dc,I64 x,I64 y,I64 z)
|
||||
{ //Clipping and transformation but no pen_width
|
||||
I64 _x,_y,_z;
|
||||
Bool was_transform=FALSE,was_symmetry=FALSE;
|
||||
@@ -552,43 +552,37 @@ gr_done:
|
||||
|
||||
#help_index "Graphics/Char;Char/Graphics"
|
||||
|
||||
public Bool GrPutChar3(CDC *dc,I64 x1,I64 y1,I64 z1,U8 ch)
|
||||
public Bool GrPutChar3(CDC *dc,I64 x,I64 y,I64 z,U8 ch)
|
||||
{ //transformation
|
||||
//DCF_SYMMETRY is silly.
|
||||
if (dc->flags & DCF_TRANSFORMATION)
|
||||
(*dc->transform)(dc,&x1,&y1,&z1);
|
||||
return GrPutChar(dc,x1,y1,ch);
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
return GrPutChar(dc,x,y,ch);
|
||||
}
|
||||
|
||||
public Bool GrPutS3(CDC *dc,I64 x1,I64 y1,I64 z1,U8 *s)
|
||||
public I64 GrPrint3(CDC *dc,I64 x,I64 y,I64 z,U8 *fmt,...)
|
||||
{ //transformation
|
||||
//DCF_SYMMETRY is silly.
|
||||
U8 *buf=SPrintJoin(NULL,fmt,argc,argv);
|
||||
I64 result;
|
||||
if (dc->flags & DCF_TRANSFORMATION)
|
||||
(*dc->transform)(dc,&x1,&y1,&z1);
|
||||
return GrPutS(dc,x1,y1,s);
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
result=GrPrint(dc,x,y,"%s",buf);
|
||||
Free(buf);
|
||||
return result;
|
||||
}
|
||||
|
||||
public Bool GrVPutS3(CDC *dc,I64 x1,I64 y1,I64 z1,U8 *s)
|
||||
public I64 GrVPrint3(CDC *dc,I64 x,I64 y,I64 z,U8 *fmt,...)
|
||||
{ //Vertical text
|
||||
//transformation
|
||||
//DCF_SYMMETRY is silly.
|
||||
U8 *buf=SPrintJoin(NULL,fmt,argc,argv);
|
||||
I64 result;
|
||||
if (dc->flags & DCF_TRANSFORMATION)
|
||||
(*dc->transform)(dc,&x1,&y1,&z1);
|
||||
return GrVPutS(dc,x1,y1,s);
|
||||
}
|
||||
|
||||
public U0 GrPrintF3(CDC *dc,I64 x,I64 y,I64 z,U8 *fmt,...)
|
||||
{
|
||||
U8 *buf=SPrintFJoin(NULL,fmt,argc,argv);
|
||||
GrPutS3(dc,x,y,z,buf);
|
||||
Free(buf);
|
||||
}
|
||||
|
||||
public U0 GrVPrintF3(CDC *dc,I64 x,I64 y,I64 z,U8 *fmt,...)
|
||||
{ //Vertical text
|
||||
U8 *buf=SPrintFJoin(NULL,fmt,argc,argv);
|
||||
GrVPutS3(dc,x,y,z,buf);
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
result=GrVPrint(dc,x,y,"%s",buf);
|
||||
Free(buf);
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "Graphics"
|
||||
@@ -731,49 +725,6 @@ gr_done:
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 GrRect3(CDC *dc,I64 x,I64 y,I64 z,I64 w,I64 h)
|
||||
{ //Clipping and transformation
|
||||
I64 x2,y2,z2,x3,y3,z3,result=0;
|
||||
CDC *old_brush=dc->brush;
|
||||
if (dc->flags & DCF_TRANSFORMATION) {
|
||||
dc->brush=NULL;
|
||||
x2=x+w; y2=y; z2=z;
|
||||
x3=x; y3=y+h; z3=z;
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
(*dc->transform)(dc,&x2,&y2,&z2);
|
||||
(*dc->transform)(dc,&x3,&y3,&z3);
|
||||
if (!(dc->flags&DCF_JUST_MIRROR) ||
|
||||
!(dc->flags&DCF_SYMMETRY))
|
||||
result=Rect(dc,x,y,z,x2,y2,z2,x3,y3,z3,&GrLinePlot);
|
||||
if (dc->flags & DCF_SYMMETRY) {
|
||||
GrReflect(dc,&x,&y,&z);
|
||||
GrReflect(dc,&x2,&y2,&z2);
|
||||
GrReflect(dc,&x3,&y3,&z3);
|
||||
result+=Rect(dc,x,y,z,x2,y2,z2,x3,y3,z3,&GrLinePlot);
|
||||
}
|
||||
dc->brush=old_brush;
|
||||
} else {
|
||||
if (!(dc->flags&DCF_JUST_MIRROR)||
|
||||
!(dc->flags&DCF_SYMMETRY)) {
|
||||
if (dc->depth_buf)
|
||||
result=Rect(dc,x,y,z,x+w,y,z,x,y+h,z,&GrLinePlot);
|
||||
else
|
||||
result=GrRect(dc,x,y,w,h);
|
||||
}
|
||||
if (dc->flags & DCF_SYMMETRY) {
|
||||
dc->brush=NULL;
|
||||
x2=x+w; y2=y; z2=z;
|
||||
x3=x; y3=y+h; z3=z;
|
||||
GrReflect(dc,&x,&y,&z);
|
||||
GrReflect(dc,&x2,&y2,&z2);
|
||||
GrReflect(dc,&x3,&y3,&z3);
|
||||
result+=Rect(dc,x,y,z,x2,y2,z2,x3,y3,z3,&GrLinePlot);
|
||||
dc->brush=old_brush;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "Graphics;Graphics/DCs"
|
||||
|
||||
public I64 GrBlot3(CDC *dc,I64 x1,I64 y1,I64 z1,CDC *img)
|
||||
@@ -1169,21 +1120,21 @@ gr_done:
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 GrFillTri0(CDC *dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p3)
|
||||
public I64 GrFillTri0(CDC *dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p4)
|
||||
{
|
||||
//This uses $LK,"fixed-point","FI:::/TempleOS/Demo/Lectures/FixedPoint.CPP"$.
|
||||
//Returns cnt of pixels changed
|
||||
I64 x1,x2,y,z1,z2,dx1,dy1,dz1,dx2,dy2,dz2,result=0,i,y_min,y_max;
|
||||
CTask *win_task;
|
||||
//p1 is min x
|
||||
if (p3->x<p2->x)
|
||||
SwapU64(&p3,&p2);
|
||||
if (p4->x<p2->x)
|
||||
SwapU64(&p4,&p2);
|
||||
if (p2->x<p1->x)
|
||||
SwapU64(&p2,&p1);
|
||||
|
||||
//p2 is min y of remainder
|
||||
if (p3->y<p2->y)
|
||||
SwapU64(&p3,&p2);
|
||||
//p2y<=p4y
|
||||
if (p4->y<p2->y)
|
||||
SwapU64(&p4,&p2);
|
||||
|
||||
y_min=0;
|
||||
y_max=dc->height;
|
||||
@@ -1195,16 +1146,47 @@ public I64 GrFillTri0(CDC *dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p3)
|
||||
y_max=win_task->win_pixel_bottom-(win_task->win_scroll_y+win_task->win_pixel_top);
|
||||
}
|
||||
|
||||
if ((dy2=p3->y-p1->y)<0) {
|
||||
if (dy1=p2->y-p1->y) {
|
||||
dx1=(p1->x-p2->x)<<32/dy1;
|
||||
dz1=(p1->z-p2->z)<<32/dy1;
|
||||
} else {
|
||||
dx1=0;
|
||||
dz1=0;
|
||||
}
|
||||
dx2=(p1->x-p3->x)<<32/dy2;
|
||||
dz2=(p1->z-p3->z)<<32/dy2;
|
||||
if ((dy2=p4->y-p1->y)<0) {
|
||||
/*
|
||||
p1x<= {p2x,p4x}
|
||||
|
||||
p2y<=
|
||||
p4y<
|
||||
p1y
|
||||
|
||||
6
|
||||
1
|
||||
|
||||
6
|
||||
1
|
||||
|
||||
24
|
||||
1
|
||||
|
||||
42
|
||||
1
|
||||
|
||||
2
|
||||
4
|
||||
1
|
||||
|
||||
24
|
||||
1
|
||||
|
||||
42
|
||||
1
|
||||
|
||||
2
|
||||
4
|
||||
1
|
||||
|
||||
*/
|
||||
dy1=p2->y-p1->y;
|
||||
dx1=(p1->x-p2->x)<<32/dy1;
|
||||
dz1=(p1->z-p2->z)<<32/dy1;
|
||||
|
||||
dx2=(p1->x-p4->x)<<32/dy2;
|
||||
dz2=(p1->z-p4->z)<<32/dy2;
|
||||
x1=x2=p1->x<<32; y=p1->y; z1=z2=p1->z<<32;
|
||||
if (y+dy2<y_min) {
|
||||
i=y_min-(y+dy2);
|
||||
@@ -1230,9 +1212,9 @@ public I64 GrFillTri0(CDC *dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p3)
|
||||
z1+=dz1;
|
||||
z2+=dz2;
|
||||
}
|
||||
if (dy2=p2->y-p3->y) {
|
||||
dx2=(p3->x-p2->x)<<32/dy2;
|
||||
dz2=(p3->z-p2->z)<<32/dy2;
|
||||
if (dy2=p2->y-p4->y) {
|
||||
dx2=(p4->x-p2->x)<<32/dy2;
|
||||
dz2=(p4->z-p2->z)<<32/dy2;
|
||||
if (y+dy2<y_min) {
|
||||
i=y_min-(y+dy2);
|
||||
if (i>-dy2) goto ft_done;
|
||||
@@ -1258,13 +1240,36 @@ public I64 GrFillTri0(CDC *dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p3)
|
||||
z2+=dz2;
|
||||
}
|
||||
} else if ((dy2=p2->y-p1->y)>0) {
|
||||
if (dy1=p3->y-p1->y) {
|
||||
dx1=(p3->x-p1->x)<<32/dy1;
|
||||
dz1=(p3->z-p1->z)<<32/dy1;
|
||||
} else {
|
||||
dx1=0;
|
||||
dz1=0;
|
||||
}
|
||||
/*
|
||||
p1x<= {p2x,p4x}
|
||||
|
||||
p1y<
|
||||
p2y<=
|
||||
p4y
|
||||
|
||||
1
|
||||
6
|
||||
|
||||
1
|
||||
6
|
||||
|
||||
1
|
||||
2
|
||||
4
|
||||
|
||||
1
|
||||
2
|
||||
4
|
||||
|
||||
1
|
||||
2
|
||||
4
|
||||
|
||||
*/
|
||||
dy1=p4->y-p1->y;
|
||||
dx1=(p4->x-p1->x)<<32/dy1;
|
||||
dz1=(p4->z-p1->z)<<32/dy1;
|
||||
|
||||
dx2=(p2->x-p1->x)<<32/dy2;
|
||||
dz2=(p2->z-p1->z)<<32/dy2;
|
||||
x1=x2=p1->x<<32; y=p1->y; z1=z2=p1->z<<32;
|
||||
@@ -1292,9 +1297,9 @@ public I64 GrFillTri0(CDC *dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p3)
|
||||
z1+=dz1;
|
||||
z2+=dz2;
|
||||
}
|
||||
if (dy2=p3->y-p2->y) {
|
||||
dx2=(p3->x-p2->x)<<32/dy2;
|
||||
dz2=(p3->z-p2->z)<<32/dy2;
|
||||
if (dy2=p4->y-p2->y) {
|
||||
dx2=(p4->x-p2->x)<<32/dy2;
|
||||
dz2=(p4->z-p2->z)<<32/dy2;
|
||||
if (y+dy2>=y_max) {
|
||||
i=y+dy2-y_max+1;
|
||||
if (i>dy2) goto ft_done;
|
||||
@@ -1320,12 +1325,55 @@ public I64 GrFillTri0(CDC *dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p3)
|
||||
z2+=dz2;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
p1x<= {p2x,p4x}
|
||||
|
||||
p2y<=
|
||||
p1y<=
|
||||
p4y
|
||||
|
||||
7
|
||||
|
||||
16
|
||||
|
||||
124
|
||||
|
||||
3
|
||||
4
|
||||
|
||||
2
|
||||
5
|
||||
|
||||
3
|
||||
4
|
||||
|
||||
2
|
||||
1
|
||||
4
|
||||
|
||||
2
|
||||
1
|
||||
4
|
||||
|
||||
|
||||
|
||||
2
|
||||
1
|
||||
4
|
||||
|
||||
|
||||
|
||||
2
|
||||
1
|
||||
4
|
||||
|
||||
*/
|
||||
if (dy1=p2->y-p1->y) {
|
||||
dx1=(p2->x-p1->x)<<32/dy1;
|
||||
dz1=(p2->z-p1->z)<<32/dy1;
|
||||
if (dy2=p2->y-p3->y) {
|
||||
dx2=(p2->x-p3->x)<<32/dy2;
|
||||
dz2=(p2->z-p3->z)<<32/dy2;
|
||||
if (dy2=p2->y-p4->y) {
|
||||
dx2=(p2->x-p4->x)<<32/dy2;
|
||||
dz2=(p2->z-p4->z)<<32/dy2;
|
||||
} else {
|
||||
dx2=0;
|
||||
dz2=0;
|
||||
@@ -1352,17 +1400,17 @@ public I64 GrFillTri0(CDC *dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p3)
|
||||
z2+=dz2;
|
||||
}
|
||||
}
|
||||
if (dy1=p3->y-p1->y) {
|
||||
dx1=(p1->x-p3->x)<<32/dy1;
|
||||
dz1=(p1->z-p3->z)<<32/dy1;
|
||||
if (dy2=p3->y-p2->y) {
|
||||
dx2=(p2->x-p3->x)<<32/dy2;
|
||||
dz2=(p2->z-p3->z)<<32/dy2;
|
||||
if (dy1=p4->y-p1->y) {
|
||||
dx1=(p1->x-p4->x)<<32/dy1;
|
||||
dz1=(p1->z-p4->z)<<32/dy1;
|
||||
if (dy2=p4->y-p2->y) {
|
||||
dx2=(p2->x-p4->x)<<32/dy2;
|
||||
dz2=(p2->z-p4->z)<<32/dy2;
|
||||
} else {
|
||||
dx2=0;
|
||||
dz2=0;
|
||||
}
|
||||
x1=x2=p3->x<<32; y=p3->y; z1=z2=p3->z<<32;
|
||||
x1=x2=p4->x<<32; y=p4->y; z1=z2=p4->z<<32;
|
||||
if (y-dy1<y_min) {
|
||||
i=y_min-(y-dy1);
|
||||
if (i>dy1) goto ft_done;
|
||||
@@ -1396,36 +1444,34 @@ public I64 GrFillPoly3(CDC *dc,I64 n,CD3I32 *poly)
|
||||
{ //Must be convex.
|
||||
//Returns cnt of pixels changed
|
||||
CD3I32 tri[3];
|
||||
I64 i,j,x0,y0,z0,x1,y1,z1,x2,y2,z2,result=0;
|
||||
I64 i,j,x,y,z,result=0;
|
||||
if (n<3) return 0;
|
||||
if (dc->flags & DCF_SYMMETRY) {
|
||||
for (i=1;i<n-1;i++) {
|
||||
j=i-1;
|
||||
if (i==1) {
|
||||
x0=poly[j].x; y0=poly[j].y; z0=poly[j].z;
|
||||
x=poly[j].x; y=poly[j].y; z=poly[j].z;
|
||||
if (dc->flags&DCF_TRANSFORMATION)
|
||||
(*dc->transform)(dc,&x0,&y0,&z0);
|
||||
GrReflect(dc,&x0,&y0,&z0);
|
||||
tri[0].x=x0; tri[0].y=y0; tri[0].z=z0;
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
GrReflect(dc,&x,&y,&z);
|
||||
tri[0].x=x; tri[0].y=y; tri[0].z=z;
|
||||
}
|
||||
|
||||
j++;
|
||||
if (i==1) {
|
||||
x1=poly[j].x; y1=poly[j].y; z1=poly[j].z;
|
||||
x=poly[j].x; y=poly[j].y; z=poly[j].z;
|
||||
if (dc->flags&DCF_TRANSFORMATION)
|
||||
(*dc->transform)(dc,&x1,&y1,&z1);
|
||||
GrReflect(dc,&x1,&y1,&z1);
|
||||
} else {
|
||||
x1=x2; y1=y2; z1=z2;
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
GrReflect(dc,&x,&y,&z);
|
||||
}
|
||||
tri[1].x=x1; tri[1].y=y1; tri[1].z=z1;
|
||||
tri[1].x=x; tri[1].y=y; tri[1].z=z;
|
||||
|
||||
j++;
|
||||
x2=poly[j].x; y2=poly[j].y; z2=poly[j].z;
|
||||
x=poly[j].x; y=poly[j].y; z=poly[j].z;
|
||||
if (dc->flags&DCF_TRANSFORMATION)
|
||||
(*dc->transform)(dc,&x2,&y2,&z2);
|
||||
GrReflect(dc,&x2,&y2,&z2);
|
||||
tri[2].x=x2; tri[2].y=y2; tri[2].z=z2;
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
GrReflect(dc,&x,&y,&z);
|
||||
tri[2].x=x; tri[2].y=y; tri[2].z=z;
|
||||
|
||||
result+=GrFillTri0(dc,&tri[0],&tri[1],&tri[2]);
|
||||
}
|
||||
@@ -1435,27 +1481,25 @@ public I64 GrFillPoly3(CDC *dc,I64 n,CD3I32 *poly)
|
||||
for (i=1;i<n-1;i++) {
|
||||
j=i-1;
|
||||
if (i==1) {
|
||||
x0=poly[j].x; y0=poly[j].y; z0=poly[j].z;
|
||||
x=poly[j].x; y=poly[j].y; z=poly[j].z;
|
||||
if (dc->flags&DCF_TRANSFORMATION)
|
||||
(*dc->transform)(dc,&x0,&y0,&z0);
|
||||
tri[0].x=x0; tri[0].y=y0; tri[0].z=z0;
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
tri[0].x=x; tri[0].y=y; tri[0].z=z;
|
||||
}
|
||||
|
||||
j++;
|
||||
if (i==1) {
|
||||
x1=poly[j].x; y1=poly[j].y; z1=poly[j].z;
|
||||
x=poly[j].x; y=poly[j].y; z=poly[j].z;
|
||||
if (dc->flags&DCF_TRANSFORMATION)
|
||||
(*dc->transform)(dc,&x1,&y1,&z1);
|
||||
} else {
|
||||
x1=x2; y1=y2; z1=z2;
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
}
|
||||
tri[1].x=x1; tri[1].y=y1; tri[1].z=z1;
|
||||
tri[1].x=x; tri[1].y=y; tri[1].z=z;
|
||||
|
||||
j++;
|
||||
x2=poly[j].x; y2=poly[j].y; z2=poly[j].z;
|
||||
x=poly[j].x; y=poly[j].y; z=poly[j].z;
|
||||
if (dc->flags&DCF_TRANSFORMATION)
|
||||
(*dc->transform)(dc,&x2,&y2,&z2);
|
||||
tri[2].x=x2; tri[2].y=y2; tri[2].z=z2;
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
tri[2].x=x; tri[2].y=y; tri[2].z=z;
|
||||
|
||||
result+=GrFillTri0(dc,&tri[0],&tri[1],&tri[2]);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ public U0 DCClear(CDC *dc=NULL)
|
||||
}
|
||||
|
||||
#help_index "Graphics/Screen"
|
||||
public I64 gr_pan_text_x=0,gr_pan_text_y=0; // [-7,7]
|
||||
public U0 (*fp_final_screen_update)(CDC *dc)=NULL;
|
||||
public U0 (*fp_wall_paper)(CTask *task)=NULL;
|
||||
|
||||
@@ -361,9 +362,9 @@ U0 GrInit4()
|
||||
|
||||
gr_text_base=CAlloc(TEXT_ROWS*TEXT_COLS*sizeof(U32));
|
||||
gr_vga_text_cache=MAlloc(TEXT_ROWS*TEXT_COLS*sizeof(U16));
|
||||
gr_win_z_buf=MAlloc(TEXT_ROWS*TEXT_COLS*sizeof(U16));
|
||||
gr_win_uncovered_bitmap=CAlloc(65536/8);
|
||||
gr_highest_uncovered=0;
|
||||
gr_win_z_buf=MAlloc(TEXT_ROWS*TEXT_COLS*sizeof(U16));
|
||||
|
||||
gr_dc2=DCNew(DCT_COLOR8,GR_WIDTH,GR_HEIGHT);
|
||||
gr_dc2->flags|=DCF_SCREEN_BITMAP;
|
||||
@@ -583,25 +584,71 @@ U0 GrZoomInScreen()
|
||||
|
||||
U0 GrUpdateBackgroundOfText()
|
||||
{
|
||||
I64 reg RSI *dst=gr_dc2->body,reg R13 c,row,col,,cur_ch,
|
||||
reg R12 w1=gr_dc2->width_internal,reg R10 w2=-7*w1+8,w3=7*w1,
|
||||
reg *my_1_to_8_colors=gr_1_to_8_colors;
|
||||
U32 reg *src=gr_text_base;
|
||||
$HL,1$ Bool blink_flag=Blink;
|
||||
nounusedwarn w2;
|
||||
for (row=TEXT_ROWS;row--;) {
|
||||
for (col=TEXT_COLS;col--;) {
|
||||
I64 reg RSI *dst=gr_dc2->body,reg R13 c,row,col,
|
||||
num_rows=TEXT_ROWS,num_cols=TEXT_COLS,i,j,cur_ch,
|
||||
reg R12 w1=gr_dc2->width_internal,w2=-7*w1+8,w3=7*w1,w4=0;
|
||||
U32 *src=gr_text_base;
|
||||
Bool blink_flag=Blink;
|
||||
U8 *dst2=dst;
|
||||
|
||||
if (gr_pan_text_x) {
|
||||
gr_pan_text_x=LimitI64(gr_pan_text_x,-7,7);
|
||||
j=AbsI64(gr_pan_text_x)/FONT_WIDTH+1;
|
||||
num_cols-=j;
|
||||
if (gr_pan_text_x<0) {
|
||||
src+=j;
|
||||
i=FONT_WIDTH*j+gr_pan_text_x;
|
||||
} else
|
||||
i=gr_pan_text_x;
|
||||
dst2=dst(U8 *)+i;
|
||||
w4=j;
|
||||
w3+=j*FONT_WIDTH;
|
||||
|
||||
j*=FONT_WIDTH;
|
||||
dst(U8 *)=gr_dc2->body;
|
||||
for (row=num_rows*FONT_HEIGHT;row--;) {
|
||||
for (col=i;col--;)
|
||||
*dst(U8 *)++=0;
|
||||
dst(U8 *)+=w1-i-j;
|
||||
for (col=j;col--;)
|
||||
*dst(U8 *)++=0;
|
||||
}
|
||||
}
|
||||
dst=dst2;
|
||||
|
||||
if (gr_pan_text_y) {
|
||||
gr_pan_text_y=LimitI64(gr_pan_text_y,-7,7);
|
||||
j=AbsI64(gr_pan_text_y)/FONT_HEIGHT+1;
|
||||
num_rows-=j;
|
||||
if (gr_pan_text_y<0) {
|
||||
src+=w1/FONT_WIDTH*j;
|
||||
i=w1*(FONT_HEIGHT*j+gr_pan_text_y);
|
||||
} else
|
||||
i=w1*gr_pan_text_y;
|
||||
dst2=dst(U8 *)+i;
|
||||
|
||||
j*=w1*FONT_HEIGHT;
|
||||
dst(U8 *)=gr_dc2->body;
|
||||
for (row=i;row--;)
|
||||
*dst(U8 *)++=0;
|
||||
dst(U8 *)=gr_dc2->body+TEXT_ROWS*TEXT_COLS*FONT_HEIGHT*FONT_WIDTH-j;
|
||||
for (row=j;row--;)
|
||||
*dst(U8 *)++=0;
|
||||
}
|
||||
dst=dst2;
|
||||
|
||||
for (row=num_rows;row--;) {
|
||||
for (col=num_cols;col--;) {
|
||||
cur_ch=*src++;
|
||||
if (cur_ch & (DOCET_SELECTED | DOCET_INVERT | DOCET_BLINK)) {
|
||||
if (cur_ch & DOCET_SELECTED)
|
||||
cur_ch.u8[1]=cur_ch.u8[1]^0xFF;
|
||||
if (cur_ch & DOCET_INVERT)
|
||||
cur_ch.u8[1]=cur_ch.u8[1]<<4+cur_ch.u8[1]>>4;
|
||||
if (cur_ch & DOCET_BLINK)
|
||||
if (blink_flag)
|
||||
cur_ch.u8[1]= cur_ch.u8[1]<<4+ cur_ch.u8[1]>>4;
|
||||
if (cur_ch & DOCET_BLINK && blink_flag)
|
||||
cur_ch.u8[1]=cur_ch.u8[1]<<4+cur_ch.u8[1]>>4;
|
||||
}
|
||||
c=my_1_to_8_colors[cur_ch.u8[1]>>4];
|
||||
c=gr_1_to_8_colors[cur_ch.u8[1]>>4];
|
||||
asm {
|
||||
MOV U64 [RSI],R13
|
||||
ADD RSI,R12
|
||||
@@ -618,9 +665,10 @@ asm {
|
||||
MOV U64 [RSI],R13
|
||||
ADD RSI,R12
|
||||
MOV U64 [RSI],R13
|
||||
ADD RSI,R10
|
||||
}
|
||||
dst(U8 *)+=w2;
|
||||
}
|
||||
src+=w4;
|
||||
dst(U8 *)+=w3;
|
||||
}
|
||||
}
|
||||
@@ -638,24 +686,46 @@ asm {
|
||||
U0 GrUpdateForegroundOfText()
|
||||
{
|
||||
U32 *src=gr_text_base;
|
||||
I64 i,j,cur_ch,reg *dst=gr_dc2->body,
|
||||
reg w1=gr_dc2->width_internal,w2=7*w1,
|
||||
row,col;
|
||||
I64 i,j,cur_ch,*dst=gr_dc2->body,
|
||||
w1=gr_dc2->width_internal,w2=7*w1,w4=0,
|
||||
num_rows=TEXT_ROWS,num_cols=TEXT_COLS,row,col;
|
||||
U8 *dst_start=gr_dc2->body,*dst_end=dst_start+w1*gr_dc2->height-7*w1-8;
|
||||
Bool blink_flag=Blink;
|
||||
for (row=TEXT_ROWS;row--;) {
|
||||
for (col=TEXT_COLS;col--;) {
|
||||
|
||||
if (gr_pan_text_x) {
|
||||
gr_pan_text_x=LimitI64(gr_pan_text_x,-7,7);
|
||||
j=AbsI64(gr_pan_text_x)/FONT_WIDTH+1;
|
||||
num_cols-=j;
|
||||
if (gr_pan_text_x<0) {
|
||||
src+=j;
|
||||
dst(U8 *)+=FONT_WIDTH*j;
|
||||
}
|
||||
w4=j;
|
||||
w2+=j*FONT_WIDTH;
|
||||
}
|
||||
|
||||
if (gr_pan_text_y) {
|
||||
gr_pan_text_y=LimitI64(gr_pan_text_y,-7,7);
|
||||
j=AbsI64(gr_pan_text_y)/FONT_HEIGHT+1;
|
||||
num_rows-=j;
|
||||
if (gr_pan_text_y<0) {
|
||||
src+=w1/FONT_WIDTH*j;
|
||||
dst(U8 *)+=w1*FONT_HEIGHT*j;
|
||||
}
|
||||
}
|
||||
|
||||
for (row=num_rows;row--;) {
|
||||
for (col=num_cols;col--;) {
|
||||
cur_ch=*src++;
|
||||
if (cur_ch & (DOCET_UNDERLINE | DOCET_SELECTED | DOCET_INVERT | DOCET_BLINK)) {
|
||||
if (cur_ch & DOCET_SELECTED)
|
||||
cur_ch.u8[1]=cur_ch.u8[1]^0xFF;
|
||||
if (cur_ch & DOCET_INVERT)
|
||||
cur_ch.u8[1]=cur_ch.u8[1]<<4+cur_ch.u8[1]>>4;
|
||||
if (cur_ch & DOCET_BLINK)
|
||||
if (blink_flag)
|
||||
cur_ch.u8[1]= cur_ch.u8[1]<<4+cur_ch.u8[1]>>4;
|
||||
if (cur_ch & DOCET_BLINK && blink_flag)
|
||||
cur_ch.u8[1]=cur_ch.u8[1]<<4+cur_ch.u8[1]>>4;
|
||||
}
|
||||
if (i=cur_ch.u16[1]&0x3FF) {
|
||||
if (i=cur_ch.u16[1]&0x3FF+gr_pan_text_x+gr_pan_text_y<<5) {
|
||||
j=i&0x1F;
|
||||
if (j&0x10) j|=~0x1F;
|
||||
i>>=5;
|
||||
@@ -667,6 +737,7 @@ U0 GrUpdateForegroundOfText()
|
||||
GrRopEquU8NoClipping(cur_ch&(DOCET_UNDERLINE+0xFFF),dst,w1);
|
||||
dst(U8 *)+=8;
|
||||
}
|
||||
src+=w4;
|
||||
dst(U8 *)+=w2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ unions are used. It's kind-of a mess using a union.
|
||||
$LK,"SpriteSize","MN:SpriteSize"$() will return the size of a single
|
||||
operation, while $LK,"SpriteSize","MN:SpriteSize"$() with an 's' will
|
||||
return the size of an entire lst. Look at
|
||||
$LK,"gr_sprite_base_size","MN:gr_sprite_base_size"$.
|
||||
$LK,"sprite_base_size","MN:sprite_base_size"$.
|
||||
|
||||
To get familiar, type <CTRL-R> on sprite in
|
||||
a document and select "Display as Text". It
|
||||
@@ -72,7 +72,7 @@ public U0 SpritePlot3(CDC *dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
GrPlot3(dc,tempg->x1+x,tempg->y1+y,z);
|
||||
break;
|
||||
case GRST_TEXT:
|
||||
GrPutS3(dc,tempg->x1+x,tempg->y1+y,z,tempg->st);
|
||||
GrPrint3(dc,tempg->x1+x,tempg->y1+y,z,"%s",tempg->st);
|
||||
break;
|
||||
case GRST_TEXT_BOX:
|
||||
GrTextBox3(dc,tempg->x1+x,tempg->y1+y,z,tempg->st);
|
||||
@@ -289,7 +289,7 @@ public U0 SpritePlot3(CDC *dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
old_flags&(DCF_SYMMETRY|DCF_TRANSFORMATION);
|
||||
}
|
||||
|
||||
public U0 SpritePlot3b(CDC *dc,I64 x,I64 y,I64 z,U8 *elems)
|
||||
public U0 SpritePlot3B(CDC *dc,I64 x,I64 y,I64 z,U8 *elems)
|
||||
{
|
||||
I64 old_x=dc->x,old_y=dc->y,old_z=dc->z,
|
||||
old_flags=dc->flags&DCF_TRANSFORMATION;
|
||||
@@ -300,7 +300,7 @@ public U0 SpritePlot3b(CDC *dc,I64 x,I64 y,I64 z,U8 *elems)
|
||||
dc->flags=dc->flags&~DCF_TRANSFORMATION|old_flags;
|
||||
}
|
||||
|
||||
public U0 SpritePlotRotMat3b(CDC *dc,I64 x,I64 y,I64 z,U8 *elems,I64 *m)
|
||||
public U0 SpritePlotRotMat3B(CDC *dc,I64 x,I64 y,I64 z,U8 *elems,I64 *m)
|
||||
{
|
||||
I64 *old_r=dc->r,old_m[16],
|
||||
old_flags=dc->flags&DCF_TRANSFORMATION;
|
||||
@@ -315,24 +315,24 @@ public U0 SpritePlotRotMat3b(CDC *dc,I64 x,I64 y,I64 z,U8 *elems,I64 *m)
|
||||
dc->flags=dc->flags&~DCF_TRANSFORMATION|old_flags;
|
||||
}
|
||||
|
||||
public U0 SpritePlotRotX3b(CDC *dc,I64 x,I64 y,I64 z,U8 *elems,F64 č=0)
|
||||
public U0 SpritePlotRotX3B(CDC *dc,I64 x,I64 y,I64 z,U8 *elems,F64 č=0)
|
||||
{
|
||||
I64 *r=GrRotX(è);
|
||||
SpritePlotRotMat3b(dc,x,y,z,elems,r);
|
||||
SpritePlotRotMat3B(dc,x,y,z,elems,r);
|
||||
Free(r);
|
||||
}
|
||||
|
||||
public U0 SpritePlotRotY3b(CDC *dc,I64 x,I64 y,I64 z,U8 *elems,F64 ę=0)
|
||||
public U0 SpritePlotRotY3B(CDC *dc,I64 x,I64 y,I64 z,U8 *elems,F64 ę=0)
|
||||
{
|
||||
I64 *r=GrRotY(ê);
|
||||
SpritePlotRotMat3b(dc,x,y,z,elems,r);
|
||||
SpritePlotRotMat3B(dc,x,y,z,elems,r);
|
||||
Free(r);
|
||||
}
|
||||
|
||||
public U0 SpritePlotRotZ3b(CDC *dc,I64 x,I64 y,I64 z,U8 *elems,F64 é=0)
|
||||
public U0 SpritePlotRotZ3B(CDC *dc,I64 x,I64 y,I64 z,U8 *elems,F64 é=0)
|
||||
{
|
||||
I64 *r=GrRotZ(é);
|
||||
SpritePlotRotMat3b(dc,x,y,z,elems,r);
|
||||
SpritePlotRotMat3B(dc,x,y,z,elems,r);
|
||||
Free(r);
|
||||
}
|
||||
|
||||
@@ -498,10 +498,10 @@ public CDocEntry *DocPutSprite(CDoc *doc=NULL,U8 *elems,U8 *txt=NULL)
|
||||
tempb->use_cnt=1;
|
||||
QueIns(tempb,doc->bin_root.last);
|
||||
if (txt)
|
||||
st=MSPrintF(txt,doc->cur_bin_num++);
|
||||
st=MPrint(txt,doc->cur_bin_num++);
|
||||
else
|
||||
st=MSPrintF("$$SP,\"\",%d$$",doc->cur_bin_num++);
|
||||
doc_e=DocPutS(doc,st);
|
||||
st=MPrint("$$SP,\"\",%d$$",doc->cur_bin_num++);
|
||||
doc_e=DocPrint(doc,"%s",st);
|
||||
Free(st);
|
||||
doc_e->bin_data=tempb;
|
||||
if (doc_e && Bt(doc_tag_types,doc_e->type_u8) && doc_e->tag && *doc_e->tag)
|
||||
|
||||
+10
-10
@@ -794,17 +794,17 @@ public I64 RegPoly(U8 *aux_data,
|
||||
}
|
||||
|
||||
#help_index "Graphics/CD3I32;Math/CD3I32"
|
||||
public F64 P3I32Dist(CD3I32 *p1,CD3I32 *p2)
|
||||
public F64 D3I32Dist(CD3I32 *p1,CD3I32 *p2)
|
||||
{
|
||||
return Sqrt(SqrI64(p1->x-p2->x)+SqrI64(p1->y-p2->y)+SqrI64(p1->z-p2->z));
|
||||
}
|
||||
|
||||
public F64 P3I32Norm(CD3I32 *p)
|
||||
public F64 D3I32Norm(CD3I32 *p)
|
||||
{
|
||||
return Sqrt(SqrI64(p->x)+SqrI64(p->y)+SqrI64(p->z));
|
||||
}
|
||||
|
||||
public I64 P3I32SqrNorm(CD3I32 *p)
|
||||
public I64 D3I32SqrNorm(CD3I32 *p)
|
||||
{
|
||||
return SqrI64(p->x)+SqrI64(p->y)+SqrI64(p->z);
|
||||
}
|
||||
@@ -816,9 +816,9 @@ public I64 Bezier2(U8 *aux_data,CD3I32 *ctrl,Bool (*fp_plot)(U8 *aux,I64 x,I64 y
|
||||
F64 x0=ctrl[0].x,y0=ctrl[0].y,z0=ctrl[0].z,
|
||||
x1=ctrl[1].x-x0,y1=ctrl[1].y-y0,z1=ctrl[1].z-z0,
|
||||
x2=ctrl[2].x-x0,y2=ctrl[2].y-y0,z2=ctrl[2].z-z0,
|
||||
t,d=P3I32Dist(&ctrl[0],&ctrl[1])+
|
||||
P3I32Dist(&ctrl[1],&ctrl[2])+
|
||||
P3I32Dist(&ctrl[2],&ctrl[0]),
|
||||
t,d=D3I32Dist(&ctrl[0],&ctrl[1])+
|
||||
D3I32Dist(&ctrl[1],&ctrl[2])+
|
||||
D3I32Dist(&ctrl[2],&ctrl[0]),
|
||||
s=0.5/d,t1,t2;
|
||||
xx=x0; yy=y0; zz=z0;
|
||||
if (first && (*fp_plot)(aux_data,xx,yy,zz))
|
||||
@@ -861,10 +861,10 @@ public I64 Bezier3(U8 *aux_data,CD3I32 *ctrl,Bool (*fp_plot)(U8 *aux,I64 x,I64 y
|
||||
x1=ctrl[1].x-x0,y1=ctrl[1].y-y0,z1=ctrl[1].z-z0,
|
||||
x2=ctrl[2].x-x0,y2=ctrl[2].y-y0,z2=ctrl[2].z-z0,
|
||||
x3=ctrl[3].x-x0,y3=ctrl[3].y-y0,z3=ctrl[3].z-z0,
|
||||
t,d=P3I32Dist(&ctrl[0],&ctrl[1])+
|
||||
P3I32Dist(&ctrl[1],&ctrl[2])+
|
||||
P3I32Dist(&ctrl[2],&ctrl[3])+
|
||||
P3I32Dist(&ctrl[3],&ctrl[0]),
|
||||
t,d=D3I32Dist(&ctrl[0],&ctrl[1])+
|
||||
D3I32Dist(&ctrl[1],&ctrl[2])+
|
||||
D3I32Dist(&ctrl[2],&ctrl[3])+
|
||||
D3I32Dist(&ctrl[3],&ctrl[0]),
|
||||
s=0.5/d,nt,t1,t2,t3;
|
||||
xx=x0; yy=y0; zz=z0;
|
||||
if (first && (*fp_plot)(aux_data,xx,yy,zz))
|
||||
|
||||
@@ -52,7 +52,7 @@ I64 PopUpSpriteBitMap(CColorROPU32 color,I64 width,I64 snap,F64 ip_scaler)
|
||||
st2="";
|
||||
}
|
||||
|
||||
DocPrintF(doc,"$$FG,PURPLE$$$$TX+CX,\"Sprite BitMap Menu\"$$\n"
|
||||
DocPrint(doc,"$$FG,PURPLE$$$$TX+CX,\"Sprite BitMap Menu\"$$\n"
|
||||
"$$LK+PU+CX,\"Click for Help\",\"FI:::/TempleOS/Doc/SpriteBitMap.TXT.Z\"$$\n"
|
||||
"\n$$FG,LTBLUE$$$$MU-UL,\"Color %s\",GEBM_COLOR$$\n"
|
||||
"$$MU-UL,\"Dither Color %s\",GEBM_DITHER_COLOR$$\n"
|
||||
@@ -82,7 +82,7 @@ I64 PopUpSpriteBitMap(CColorROPU32 color,I64 width,I64 snap,F64 ip_scaler)
|
||||
"\n$$FG,PURPLE$$$$MU-UL,\"+] Sprite Main Menu\",GEBM_MAIN_MENU$$$$FG,LTBLUE$$\n"
|
||||
"$$MU-UL,\"Exit Sprite\",GEBM_EXIT$$\n"
|
||||
"$$MU-UL,\"Abort Sprite\",DOCM_CANCEL$$\n",st1,st2,width,snap,ip_scaler);
|
||||
DocPutS(doc,"\nRight-Click to get back to this menu.");
|
||||
DocPrint(doc,"\nRight-Click to get back to this menu.");
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
return i;
|
||||
@@ -410,7 +410,7 @@ bm_menu:
|
||||
case GEBM_TEXT:
|
||||
GrBMEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
dc->color=color;
|
||||
GrPutS(dc,p1,p2,st);
|
||||
GrPrint(dc,p1,p2,"%s",st);
|
||||
break;
|
||||
case GEBM_TEXT_BOX:
|
||||
GrBMEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
@@ -537,7 +537,7 @@ bm_menu:
|
||||
case GEBM_TEXT:
|
||||
GrBMEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
dc->color=color;
|
||||
GrPutS(dc,p1,p2,st);
|
||||
GrPrint(dc,p1,p2,"%s",st);
|
||||
break;
|
||||
case GEBM_TEXT_BOX:
|
||||
GrBMEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
@@ -648,7 +648,7 @@ bm_menu:
|
||||
break;
|
||||
case GEBM_TEXT:
|
||||
img->color=color;
|
||||
GrPutS(img,p1-xx1,p2-yy1,st);
|
||||
GrPrint(img,p1-xx1,p2-yy1,"%s",st);
|
||||
goto bm_menu;
|
||||
case GEBM_TEXT_BOX:
|
||||
img->color=color;
|
||||
@@ -6,7 +6,7 @@ U8 GrSpOffset[9]={0,1,2,3,0,4,5,6,7};
|
||||
|
||||
Bool GrPolyPtPlot(CSprite *root,I64 x,I64 y,I64)
|
||||
{
|
||||
CSprite *tempg=CAlloc(gr_sprite_qued_base_size[GRST_PT]);
|
||||
CSprite *tempg=CAlloc(SpriteQuedBaseSize(GRST_PT));
|
||||
tempg->type=GRST_PT;
|
||||
tempg->x1=x;
|
||||
tempg->y1=y;
|
||||
@@ -60,7 +60,7 @@ I64 SpriteCntQue(CSprite *root)
|
||||
|
||||
U0 GrEdUpdate(CDoc *doc,CDocBin *tempb,CSprite *root)
|
||||
{
|
||||
I64 i,size=gr_sprite_base_size[GRST_END];
|
||||
I64 i,size=sprite_base_size[GRST_END];
|
||||
CSprite *tempg=root->next;
|
||||
U8 *dst;
|
||||
Bool unlock=DocLock(doc);
|
||||
@@ -175,7 +175,7 @@ CSprite *GrTransformCircle(I64 r[4][4],CSprite *tempg)
|
||||
{
|
||||
I64 x,y,z;
|
||||
F64 m1,a1,m2,radius=tempg->x2<<16;
|
||||
CSprite *tempg1=CAlloc(gr_sprite_qued_base_size[GRST_ELLIPSE]);
|
||||
CSprite *tempg1=CAlloc(SpriteQuedBaseSize(GRST_ELLIPSE));
|
||||
tempg1->type=GRST_ELLIPSE;
|
||||
|
||||
x=tempg->x1; y=tempg->y1; z=0;
|
||||
@@ -202,7 +202,7 @@ CSprite *GrTransformEllipse(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;
|
||||
CSprite *tempg1=CAlloc(gr_sprite_qued_base_size[tempg->type]);
|
||||
CSprite *tempg1=CAlloc(SpriteQuedBaseSize(tempg->type));
|
||||
tempg1->type=tempg->type;
|
||||
if (tempg->type==GRST_POLYGON)
|
||||
tempg1->sides=tempg->sides;
|
||||
@@ -243,7 +243,7 @@ CSprite *GrTransformRect(I64 r[4][4],CSprite *tempg,F64
|
||||
F64 m1,a1,m2,a2,s,c,
|
||||
x_radius=(tempg->x2-tempg->x1)<<16,
|
||||
y_radius=(tempg->y2-tempg->y1)<<16;
|
||||
CSprite *tempg1=CAlloc(gr_sprite_qued_base_size[GRST_ROTATED_RECT]);
|
||||
CSprite *tempg1=CAlloc(SpriteQuedBaseSize(GRST_ROTATED_RECT));
|
||||
tempg1->type=GRST_ROTATED_RECT;
|
||||
|
||||
x=tempg->x1; y=tempg->y1; z=0;
|
||||
@@ -490,7 +490,7 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
tempg1=tempg2;
|
||||
}
|
||||
|
||||
tempg3=CAlloc(gr_sprite_qued_base_size[GRST_POLYPT]+
|
||||
tempg3=CAlloc(SpriteQuedBaseSize(GRST_POLYPT)+
|
||||
sizeof(I32)*2+(num*3+7)>>3);
|
||||
ptr=&tempg3->y1;
|
||||
ptr[0]=x2;
|
||||
@@ -596,28 +596,28 @@ U0 PickSpriteDocNew(CDoc *doc,CSprite *root,I64 old_num)
|
||||
I64 cur_num=0;
|
||||
U8 *st;
|
||||
|
||||
DocPutS(doc,"$$FG,PURPLE$$$$TX+CX,\"Sprite SideBar\"$$\n"
|
||||
DocPrint(doc,"$$FG,PURPLE$$$$TX+CX,\"Sprite SideBar\"$$\n"
|
||||
"$$LK+PU+CX,\"Click for Help\",\"FI:::/TempleOS/Doc/SpriteSideBar.TXT.Z\"$$\n\n");
|
||||
|
||||
tempg=root->next;
|
||||
while (tempg!=root) {
|
||||
st=Sprite2Text(tempg);
|
||||
if (cur_num==old_num) {
|
||||
DocPutS(doc,"$$FG,LTRED$$");
|
||||
doc_e=DocPrintF(doc,"$$MU-UL,\"%Q\",%d$$\n",st,cur_num++);
|
||||
DocPrint(doc,"$$FG,LTRED$$");
|
||||
doc_e=DocPrint(doc,"$$MU-UL,\"%Q\",%d$$\n",st,cur_num++);
|
||||
} else {
|
||||
DocPutS(doc,"$$FG,LTBLUE$$");
|
||||
DocPrintF(doc,"$$MU-UL,\"%Q\",%d$$\n",st,cur_num++);
|
||||
DocPrint(doc,"$$FG,LTBLUE$$");
|
||||
DocPrint(doc,"$$MU-UL,\"%Q\",%d$$\n",st,cur_num++);
|
||||
}
|
||||
Free(st);
|
||||
tempg=tempg->next;
|
||||
}
|
||||
if (cur_num==old_num) {
|
||||
DocPutS(doc,"$$FG,LTRED$$");
|
||||
doc_e=DocPrintF(doc,"$$MU-UL,\"END\",%d$$\n",cur_num);
|
||||
DocPrint(doc,"$$FG,LTRED$$");
|
||||
doc_e=DocPrint(doc,"$$MU-UL,\"END\",%d$$\n",cur_num);
|
||||
} else {
|
||||
DocPutS(doc,"$$FG,LTBLUE$$");
|
||||
DocPrintF(doc,"$$MU-UL,\"END\",%d$$\n",cur_num);
|
||||
DocPrint(doc,"$$FG,LTBLUE$$");
|
||||
DocPrint(doc,"$$MU-UL,\"END\",%d$$\n",cur_num);
|
||||
}
|
||||
if (doc_e)
|
||||
doc->cur_entry=doc_e;
|
||||
@@ -658,7 +658,7 @@ U0 SpriteSideBarTask(CTask *parent,CSprite **_root,I64 *_cur_num)
|
||||
|
||||
U8 *SpriteHexDoc2Sprite(CDoc *doc,I64 *_cur_num,CTask *mem_task=NULL)
|
||||
{
|
||||
I64 num=0,size=gr_sprite_base_size[GRST_END];
|
||||
I64 num=0,size=sprite_base_size[GRST_END];
|
||||
U8 *result,*dst;
|
||||
Bool unlock_doc=DocLock(doc);
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
@@ -694,14 +694,14 @@ Bool SpriteTextEd(CSprite **_root,I64 *_cur_num)
|
||||
CSprite *root=*_root,*tempg;
|
||||
CDocEntry *doc_e;
|
||||
doc->flags|=DOCF_FORM;
|
||||
DocPutS(doc,"$$FG,PURPLE$$$$TX+CX,\"Sprite Edit as Text\"$$$$FG$$\n"
|
||||
DocPrint(doc,"$$FG,PURPLE$$$$TX+CX,\"Sprite Edit as Text\"$$$$FG$$\n"
|
||||
"$$LK+PU+CX,\"Click for Help\",\"FI:::/TempleOS/Doc/SpriteEdText.TXT.Z\"$$\n\n");
|
||||
tempg=root->next;
|
||||
while (tempg!=root) {
|
||||
st=Sprite2Text(tempg);
|
||||
DocPrintF(doc,"$$FG,BLUE$$%s$$FG$$\n",st);
|
||||
DocPrint(doc,"$$FG,BLUE$$%s$$FG$$\n",st);
|
||||
Free(st);
|
||||
doc_e=DocPrintF(doc,"$$HX,%d,16$$",SpriteElemSize(tempg));
|
||||
doc_e=DocPrint(doc,"$$HX,%d,16$$",SpriteElemSize(tempg));
|
||||
doc_e->data=&tempg->start;
|
||||
tempg=tempg->next;
|
||||
}
|
||||
@@ -744,7 +744,7 @@ I64 PopUpSpriteEd(CSprite **_root,I64 snap,F64 ip_scaler,I64 *_cur_num)
|
||||
CTask *pu_task;
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
DocPrintF(doc,"$$FG,PURPLE$$$$TX+CX,\"Sprite Edit Menu\"$$\n"
|
||||
DocPrint(doc,"$$FG,PURPLE$$$$TX+CX,\"Sprite Edit Menu\"$$\n"
|
||||
"$$LK+PU+CX,\"Click for Help\",\"FI:::/TempleOS/Doc/SpriteEd.TXT.Z\"$$\n\n"
|
||||
"$$FG,LTBLUE$$$$MU-UL,\"Shift Points\",GED_SHIFT_PTS$$\n"
|
||||
"$$MU-UL,\"Shift Points with Rects\",GED_SHIFT_RECTS$$\n"
|
||||
@@ -760,7 +760,7 @@ I64 PopUpSpriteEd(CSprite **_root,I64 snap,F64 ip_scaler,I64 *_cur_num)
|
||||
"\n$$FG,PURPLE$$$$MU-UL,\"+] Sprite Main Menu\",GED_MAIN_MENU$$$$FG,LTBLUE$$\n"
|
||||
"$$MU-UL,\"Exit Sprite\",GED_EXIT$$\n"
|
||||
"$$MU-UL,\"Abort Sprite\",DOCM_CANCEL$$",snap,ip_scaler);
|
||||
st=MSPrintF("SpriteSideBarTask(0x%X,0x%X,0x%X);",Fs,_root,_cur_num);
|
||||
st=MPrint("SpriteSideBarTask(0x%X,0x%X,0x%X);",Fs,_root,_cur_num);
|
||||
PopUp(st,NULL,&pu_task);
|
||||
Free(st);
|
||||
i=PopUpMenu(doc);
|
||||
@@ -1189,7 +1189,7 @@ I64 SpriteEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y,CSprite **_root,I64 *_cur_nu
|
||||
case GED_SHIFT_SUB_ORIGIN:
|
||||
doc_e->flags1=old_e_flags1;
|
||||
insert_pt=GrNum2Que(*_root,*_cur_num);
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_SHIFT]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_SHIFT));
|
||||
tempg->type=GRST_SHIFT;
|
||||
tempg->x1=0;
|
||||
tempg->y1=0;
|
||||
@@ -13,7 +13,7 @@ I64 PopUpSpriteMain(CSprite **_root,I64 snap,F64 ip_scaler,I64 *_cur_num)
|
||||
CTask *pu_task;
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
DocPrintF(doc,"$$FG,PURPLE$$$$TX+CX,\"Sprite Main Menu\"$$\n"
|
||||
DocPrint(doc,"$$FG,PURPLE$$$$TX+CX,\"Sprite Main Menu\"$$\n"
|
||||
"$$LK+PU+CX,\"Click for Help\",\"FI:::/TempleOS/Doc/SpriteMain.TXT.Z\"$$\n"
|
||||
"\n$$FG,LTBLUE$$$$MU-UL,\"Color (4-bit)\",GRST_COLOR8$$\n"
|
||||
"$$MU-UL,\"Dither Color (4-bit)\",GRST_DITHER_COLOR8$$\n"
|
||||
@@ -49,8 +49,8 @@ I64 PopUpSpriteMain(CSprite **_root,I64 snap,F64 ip_scaler,I64 *_cur_num)
|
||||
"$$FG,PURPLE$$$$MU-UL,\"+] Sprite Edit Menu\",GRST_ED_MENU$$$$FG,LTBLUE$$\n"
|
||||
"$$MU-UL,\"Exit Sprite\",GRST_EXIT$$\n"
|
||||
"$$MU-UL,\"Abort Sprite\",DOCM_CANCEL$$\n",snap,ip_scaler);
|
||||
DocPutS(doc,"\nRight-Click to get back to this menu.");
|
||||
st=MSPrintF("SpriteSideBarTask(0x%X,0x%X,0x%X);",Fs,_root,_cur_num);
|
||||
DocPrint(doc,"\nRight-Click to get back to this menu.");
|
||||
st=MPrint("SpriteSideBarTask(0x%X,0x%X,0x%X);",Fs,_root,_cur_num);
|
||||
PopUp(st,NULL,&pu_task);
|
||||
Free(st);
|
||||
i=PopUpMenu(doc);
|
||||
@@ -67,21 +67,21 @@ Bool PopUpExtents(I64 *_x1,I64 *_x2,I64 *_y1,I64 *_y2)
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
CDocEntry *doc_e;
|
||||
doc_e=DocPutS(doc," $$DA,32,\"x1:%d\"$$\n");
|
||||
doc_e=DocPrint(doc," $$DA,32,\"x1:%%d\"$$\n");
|
||||
doc_e->data=_x1;
|
||||
DocDataFmt(doc_e);
|
||||
doc_e=DocPutS(doc," $$DA,32,\"x2:%d\"$$\n");
|
||||
doc_e=DocPrint(doc," $$DA,32,\"x2:%%d\"$$\n");
|
||||
doc_e->data=_x2;
|
||||
DocDataFmt(doc_e);
|
||||
doc_e=DocPutS(doc," $$DA,32,\"y1:%d\"$$\n");
|
||||
doc_e=DocPrint(doc," $$DA,32,\"y1:%%d\"$$\n");
|
||||
doc_e->data=_y1;
|
||||
DocDataFmt(doc_e);
|
||||
doc_e=DocPutS(doc," $$DA,32,\"y2:%d\"$$\n\n");
|
||||
doc_e=DocPrint(doc," $$DA,32,\"y2:%%d\"$$\n\n");
|
||||
doc_e->data=_y2;
|
||||
DocDataFmt(doc_e);
|
||||
|
||||
DocPutS(doc," $$BT,\"Use These Extents\",TRUE$$");
|
||||
DocPutS(doc,"$$CM,3,0$$$$BT,\"Drag-Out New Extents\",FALSE$$\n\n");
|
||||
DocPrint(doc," $$BT,\"Use These Extents\",TRUE$$");
|
||||
DocPrint(doc,"$$CM,3,0$$$$BT,\"Drag-Out New Extents\",FALSE$$\n\n");
|
||||
do i=PopUpMenu(doc);
|
||||
while (i!=FALSE && i!=TRUE);
|
||||
DocDel(doc);
|
||||
@@ -230,7 +230,7 @@ I64 SpriteMain(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
i=PopUpColor(,,FALSE);
|
||||
if (i>=0) {
|
||||
color=i;
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_COLOR8]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_COLOR8));
|
||||
tempg->type=GRST_COLOR8;
|
||||
tempg->color8=color;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
@@ -245,7 +245,7 @@ I64 SpriteMain(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
i=PopUpColorDither;
|
||||
if (i>=0) {
|
||||
color=i;
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_DITHER_COLOR8]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_DITHER_COLOR8));
|
||||
tempg->type=GRST_DITHER_COLOR8;
|
||||
tempg->dither_color8=color.c0.color|color.c1.color<<8;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
@@ -287,8 +287,8 @@ I64 SpriteMain(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
old_mesh=&tempg1->shiftable_vertex_cnt;
|
||||
} else
|
||||
old_mesh=NULL;
|
||||
if (mesh=CSpriteMesh(old_mesh,&size,TRUE)) {
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_MESH]-sizeof(I32)*2+size);
|
||||
if (mesh=SpriteMesh(old_mesh,&size,TRUE)) {
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_MESH)-sizeof(I32)*2+size);
|
||||
tempg->type=GRST_MESH;
|
||||
MemCpy(&tempg->vertex_cnt,mesh,size);
|
||||
Free(mesh);
|
||||
@@ -369,7 +369,7 @@ I64 SpriteMain(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
i=PopUpRangeI64(1,16,1,"Pen Width\n");
|
||||
if (i>=1) {
|
||||
width=i;
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_WIDTH]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_WIDTH));
|
||||
tempg->type=GRST_WIDTH;
|
||||
tempg->width=width;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
@@ -381,7 +381,7 @@ I64 SpriteMain(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
break;
|
||||
case GRST_TRANSFORM_ON:
|
||||
case GRST_TRANSFORM_OFF:
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_TRANSFORM_ON]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_TRANSFORM_ON));
|
||||
if (eletype==GRST_TRANSFORM_ON)
|
||||
tempg->type=GRST_TRANSFORM_ON;
|
||||
else
|
||||
@@ -414,13 +414,13 @@ I64 SpriteMain(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
x1=0; y1=0;
|
||||
do {
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrPutS3(dc,x1,y1,0,st);
|
||||
GrPrint3(dc,x1,y1,0,"%s",st);
|
||||
msg_code=GetMsg(&p1,&p2,
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
GrScreenInit(dc,x,y);
|
||||
x1=p1; y1=p2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
tempg=CAlloc(gr_sprite_qued_base_size[GRST_TEXT]+StrLen(st)+1);
|
||||
tempg=CAlloc(SpriteQuedBaseSize(GRST_TEXT)+StrLen(st)+1);
|
||||
tempg->type=GRST_TEXT;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
@@ -446,7 +446,7 @@ I64 SpriteMain(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
GrScreenInit(dc,x,y);
|
||||
x1=p1; y1=p2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
tempg=CAlloc(gr_sprite_qued_base_size[GRST_TEXT_BOX]+StrLen(st)+1);
|
||||
tempg=CAlloc(SpriteQuedBaseSize(GRST_TEXT_BOX)+StrLen(st)+1);
|
||||
tempg->type=GRST_TEXT_BOX;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
@@ -472,7 +472,7 @@ I64 SpriteMain(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
GrScreenInit(dc,x,y);
|
||||
x1=p1; y1=p2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
tempg=CAlloc(gr_sprite_qued_base_size[GRST_TEXT_DIAMOND]+StrLen(st)+1);
|
||||
tempg=CAlloc(SpriteQuedBaseSize(GRST_TEXT_DIAMOND)+StrLen(st)+1);
|
||||
tempg->type=GRST_TEXT_DIAMOND;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
@@ -499,7 +499,7 @@ ei_restart:
|
||||
msg_code=GetMsg(&p1,&p2,1<<MSG_KEY_DOWN | 1<<MSG_IP_L_DOWN | 1<<MSG_IP_R_UP);
|
||||
if (msg_code==MSG_IP_R_UP) {
|
||||
if (eletype==GRST_PLANAR_SYMMETRY) {
|
||||
tempg=CAlloc(gr_sprite_qued_base_size[GRST_PLANAR_SYMMETRY]);
|
||||
tempg=CAlloc(SpriteQuedBaseSize(GRST_PLANAR_SYMMETRY));
|
||||
tempg->type=GRST_PLANAR_SYMMETRY;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
GrEdUpdate(doc,tempb,root);
|
||||
@@ -532,7 +532,7 @@ ei_restart:
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_LINE]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_LINE));
|
||||
tempg->type=GRST_LINE;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
@@ -555,7 +555,7 @@ ei_restart:
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrArrow3(dc,x1,y1,0,x2,y2,0);
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_ARROW]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_ARROW));
|
||||
tempg->type=GRST_ARROW;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
@@ -580,7 +580,7 @@ ei_restart:
|
||||
GrScreenInit(dc,x,y);
|
||||
x2=p1; y2=p2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_PLANAR_SYMMETRY]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_PLANAR_SYMMETRY));
|
||||
tempg->type=GRST_PLANAR_SYMMETRY;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
@@ -618,7 +618,7 @@ ei_restart:
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrRect3(dc,xx1,yy1,0,xx2-xx1,yy2-yy1);
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_RECT]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_RECT));
|
||||
tempg->type=GRST_RECT;
|
||||
tempg->x1=xx1-x;
|
||||
tempg->y1=yy1-y;
|
||||
@@ -655,7 +655,7 @@ ei_restart:
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
ei_bitmap:
|
||||
xx2++; yy2++;
|
||||
tempg=CAlloc(gr_sprite_qued_base_size[GRST_BITMAP8]+
|
||||
tempg=CAlloc(SpriteQuedBaseSize(GRST_BITMAP8)+
|
||||
((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
tempg->type=eletype;
|
||||
tempg->width=xx2-xx1;
|
||||
@@ -685,7 +685,7 @@ ei_bitmap:
|
||||
case GE_EXIT:
|
||||
case GE_CONT:
|
||||
Free(tempg);
|
||||
tempg=CAlloc(gr_sprite_qued_base_size[GRST_BITMAP8]+
|
||||
tempg=CAlloc(SpriteQuedBaseSize(GRST_BITMAP8)+
|
||||
((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
tempg->type=eletype;
|
||||
tempg->width=xx2-xx1;
|
||||
@@ -736,7 +736,7 @@ ei_bitmap:
|
||||
}
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
xx2++; yy2++;
|
||||
tempg=CAlloc(gr_sprite_qued_base_size[GRST_BITMAP8]+
|
||||
tempg=CAlloc(SpriteQuedBaseSize(GRST_BITMAP8)+
|
||||
((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
tempg->type=GRST_BITMAP8;
|
||||
tempg->width=xx2-xx1;
|
||||
@@ -777,7 +777,7 @@ ei_bitmap:
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrCircle3(dc,x1,y1,0,Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2)));
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_CIRCLE]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_CIRCLE));
|
||||
tempg->type=GRST_CIRCLE;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
@@ -798,7 +798,7 @@ ei_bitmap:
|
||||
GrScreenInit(dc,x,y);
|
||||
x2=p1; y2=p2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_ELLIPSE]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_ELLIPSE));
|
||||
tempg->type=GRST_ELLIPSE;
|
||||
tempg->x2=(x1+x2)>>1-x;
|
||||
tempg->y2=(y1+y2)>>1-y;
|
||||
@@ -848,7 +848,7 @@ ei_bitmap:
|
||||
GrScreenInit(dc,x,y);
|
||||
x2=p1; y2=p2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_POLYGON]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_POLYGON));
|
||||
tempg->type=GRST_POLYGON;
|
||||
tempg->x2=(x1+x2)>>1-x;
|
||||
tempg->y2=(y1+y2)>>1-y;
|
||||
@@ -890,7 +890,7 @@ ei_bitmap:
|
||||
break;
|
||||
case GRST_PT:
|
||||
x1=p1; y1=p2;
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_PT]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_PT));
|
||||
tempg->type=GRST_PT;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
@@ -901,7 +901,7 @@ ei_bitmap:
|
||||
case GRST_FLOOD_FILL:
|
||||
case GRST_FLOOD_FILL_NOT:
|
||||
x1=p1; y1=p2;
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_FLOOD_FILL]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_FLOOD_FILL));
|
||||
tempg->type=eletype;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
@@ -929,7 +929,7 @@ ei_bitmap:
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
if (msg_code==MSG_IP_L_UP) {
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_PT]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_PT));
|
||||
tempg->type=GRST_PT;
|
||||
tempg->x1=x2-x;
|
||||
tempg->y1=y2-y;
|
||||
@@ -939,7 +939,7 @@ ei_bitmap:
|
||||
}
|
||||
} while (msg_code!=MSG_IP_R_UP);
|
||||
if (num) {
|
||||
tempg2=CAlloc(gr_sprite_qued_base_size[GRST_POLYLINE]+
|
||||
tempg2=CAlloc(SpriteQuedBaseSize(GRST_POLYLINE)+
|
||||
(num+1)<<1*sizeof(I32));
|
||||
ptr=&tempg2->y1;
|
||||
tempg=root2.next;
|
||||
@@ -991,7 +991,7 @@ ei_bitmap:
|
||||
tempg=tempg1;
|
||||
}
|
||||
|
||||
tempg2=CAlloc(gr_sprite_qued_base_size[GRST_POLYPT]+
|
||||
tempg2=CAlloc(SpriteQuedBaseSize(GRST_POLYPT)+
|
||||
sizeof(I32)*2+(num*3+7)>>3);
|
||||
ptr=&tempg2->y1;
|
||||
ptr[0]=x3;
|
||||
@@ -1040,7 +1040,7 @@ ei_bitmap:
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
if (msg_code==MSG_IP_L_UP) {
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_PT]);
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_PT));
|
||||
tempg->type=GRST_PT;
|
||||
tempg->x1=x2-x;
|
||||
tempg->y1=y2-y;
|
||||
@@ -1050,7 +1050,7 @@ ei_bitmap:
|
||||
}
|
||||
} while (msg_code!=MSG_IP_R_UP);
|
||||
if (num) {
|
||||
tempg2=CAlloc(gr_sprite_qued_base_size[GRST_POLYLINE]+
|
||||
tempg2=CAlloc(SpriteQuedBaseSize(GRST_POLYLINE)+
|
||||
(num+1)*sizeof(CD3I32));
|
||||
p=&tempg2->y1;
|
||||
tempg=root2.next;
|
||||
@@ -1104,8 +1104,8 @@ ei_shiftable_mesh:
|
||||
z=0;
|
||||
old_mesh=NULL;
|
||||
}
|
||||
if (mesh=CSpriteMesh(old_mesh,&size,TRUE)) {
|
||||
tempg=MAlloc(gr_sprite_qued_base_size[GRST_SHIFTABLE_MESH]-sizeof(I32)*2+size);
|
||||
if (mesh=SpriteMesh(old_mesh,&size,TRUE)) {
|
||||
tempg=MAlloc(SpriteQuedBaseSize(GRST_SHIFTABLE_MESH)-sizeof(I32)*2+size);
|
||||
tempg->type=GRST_SHIFTABLE_MESH;
|
||||
MemCpy(&tempg->shiftable_vertex_cnt,mesh,size);
|
||||
Free(mesh);
|
||||
@@ -1176,12 +1176,12 @@ U0 EdInsGraphic(CDoc *doc,I64 x,I64 y)
|
||||
unlock=DocLock(doc);
|
||||
tempb=CAlloc(sizeof(CDocBin),doc->mem_task);
|
||||
tempb->type=DOCBT_CSPRITE;
|
||||
tempb->size=gr_sprite_base_size[GRST_END];
|
||||
tempb->size=sprite_base_size[GRST_END];
|
||||
tempb->data=CAlloc(tempb->size,doc->mem_task);
|
||||
tempb->num=doc->cur_bin_num++;
|
||||
tempb->use_cnt=1;
|
||||
QueIns(tempb,doc->bin_root.last);
|
||||
doc_e=DocPutS(doc,st);
|
||||
doc_e=DocPrint(doc,"%s",st);
|
||||
doc_e->bin_data=tempb;
|
||||
Free(st);
|
||||
if (doc_e && Bt(doc_tag_types,doc_e->type_u8) && doc_e->tag && *doc_e->tag)
|
||||
@@ -634,7 +634,7 @@ GrMClipBoardInit;
|
||||
|
||||
U0 DrawIt(CTask *task,CDC *dc)
|
||||
{
|
||||
CGrMFrame *e=NamedFramePtr("CGrMFrame",task);
|
||||
CGrMFrame *e=FramePtr("CGrMFrame",task);
|
||||
CCtrl *c=CtrlFindUnique(task,CTRLT_VIEWING_ANGLES);
|
||||
F64 d;
|
||||
I64 i,x,y,z;
|
||||
@@ -664,7 +664,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
dc->ls.x=x;
|
||||
dc->ls.y=y;
|
||||
dc->ls.z=z;
|
||||
d=1<<16/P3I32Norm(&dc->ls); //Light source normalized to 65536.
|
||||
d=1<<16/D3I32Norm(&dc->ls); //Light source normalized to 65536.
|
||||
dc->ls.x*=d;
|
||||
dc->ls.y*=d;
|
||||
dc->ls.z*=d;
|
||||
@@ -725,7 +725,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
dc->color=ROP_XOR+RED^COLOR_TRANSPARENT;
|
||||
else
|
||||
dc->color=ROP_XOR+COLOR_TRANSPARENT;
|
||||
GrPrintF(dc,0,0,"%6.3f%% (%d,%d,%d)",e->view_scale*100,x,y,z);
|
||||
GrPrint(dc,0,0,"%6.3f%% (%d,%d,%d)",e->view_scale*100,x,y,z);
|
||||
dc->pen_width=1;
|
||||
dc->color&=0xF;
|
||||
if (Blink(10))
|
||||
@@ -871,7 +871,7 @@ U0 GrMUpdateMenu(CGrMFrame *e)
|
||||
tempse->checked=ToBool(e->flip_y);
|
||||
}
|
||||
|
||||
I32 *CSpriteMesh(I32 *root=NULL,I64 *_size=NULL,Bool flip_y=FALSE)
|
||||
I32 *SpriteMesh(I32 *root=NULL,I64 *_size=NULL,Bool flip_y=FALSE)
|
||||
/*$WW,1$
|
||||
|
||||
Fmt for mesh:
|
||||
@@ -985,7 +985,7 @@ $WW,0$*/
|
||||
GrMInit(&e,flip_y);
|
||||
if (root)
|
||||
GrMLoad(&e,root);
|
||||
NamedFramePtrAdd("CGrMFrame",&e);
|
||||
FramePtrAdd("CGrMFrame",&e);
|
||||
Fs->draw_it=&DrawIt;
|
||||
GrMCurSnap(&e);
|
||||
GrMRecalcCxCy(Fs,&e);
|
||||
@@ -1370,7 +1370,7 @@ mesh_done:
|
||||
else
|
||||
root=NULL;
|
||||
GrMCleanUp(&e);
|
||||
NamedFramePtrDel("CGrMFrame");
|
||||
FramePtrDel("CGrMFrame");
|
||||
if (old_s) {
|
||||
MemCpy(c->state,old_s,sizeof(CViewAngles));
|
||||
Free(old_s);
|
||||
@@ -1,90 +1,48 @@
|
||||
#help_index "Graphics/CSprite"
|
||||
#help_file "::/TempleOS/Doc/Sprite"
|
||||
|
||||
I64 gr_sprite_base_size[GRST_NUM_TYPES]=
|
||||
I64 sprite_base_size[GRST_NUM_TYPES]=
|
||||
{
|
||||
offset(CSprite.x1)-offset(CSprite.start), //GRST_END
|
||||
1,
|
||||
1+offset(CSprite.color8)-offset(CSprite.start), //GRST_COLOR8
|
||||
1,
|
||||
offset(CSprite.x2)-offset(CSprite.start), //GRST_PT
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //GRST_LINE
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_POLYLINE
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_POLYPT
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_WIDTH
|
||||
offset(CSprite.x2)-offset(CSprite.start), //GRST_SHIFT
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_BSPLINE2
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_BSPLINE3
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_BSPLINE2_CLOSED
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_BSPLINE3_CLOSED
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //GRST_RECT
|
||||
offset(CSprite.y2)-offset(CSprite.start), //GRST_CIRCLE
|
||||
offset(CSprite.x2)-offset(CSprite.start), //GRST_FLOOD_FILL_NOT
|
||||
offset(CSprite.x2)-offset(CSprite.start), //GRST_FLOOD_FILL
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //GRST_BITMAP8
|
||||
1,
|
||||
offset(CSprite.st)-offset(CSprite.start), //GRST_TEXT
|
||||
offset(CSprite.sides)-offset(CSprite.start), //GRST_ELLIPSE
|
||||
sizeof(CSprite)-offset(CSprite.start), //GRST_POLYGON
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //GRST_PLANAR_SYMMETRY
|
||||
2+offset(CSprite.dither_color8)-offset(CSprite.start), //GRST_DITHER_COLOR8
|
||||
offset(CSprite.sides)-offset(CSprite.start), //GRST_ROTATED_RECT
|
||||
offset(CSprite.x2)-offset(CSprite.start), //GRST_MESH
|
||||
offset(CSprite.shiftable_tri_cnt)+sizeof(I32)-offset(CSprite.start), //GRST_SHIFTABLE_MESH
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_WIDTH
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //GRST_PLANAR_SYMMETRY
|
||||
offset(CSprite.x1)-offset(CSprite.start), //GRST_TRANSFORM_ON
|
||||
offset(CSprite.x1)-offset(CSprite.start), //GRST_TRANSFORM_OFF
|
||||
offset(CSprite.x2)-offset(CSprite.start), //GRST_SHIFT
|
||||
offset(CSprite.x2)-offset(CSprite.start), //GRST_PT
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_POLYPT
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //GRST_LINE
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_POLYLINE
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //GRST_RECT
|
||||
offset(CSprite.sides)-offset(CSprite.start), //GRST_ROTATED_RECT
|
||||
offset(CSprite.y2)-offset(CSprite.start), //GRST_CIRCLE
|
||||
offset(CSprite.sides)-offset(CSprite.start), //GRST_ELLIPSE
|
||||
sizeof(CSprite)-offset(CSprite.start), //GRST_POLYGON
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_BSPLINE2
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_BSPLINE2_CLOSED
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_BSPLINE3
|
||||
offset(CSprite.y1)-offset(CSprite.start), //GRST_BSPLINE3_CLOSED
|
||||
offset(CSprite.x2)-offset(CSprite.start), //GRST_FLOOD_FILL
|
||||
offset(CSprite.x2)-offset(CSprite.start), //GRST_FLOOD_FILL_NOT
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //GRST_BITMAP8
|
||||
offset(CSprite.x2)-offset(CSprite.start), //GRST_MESH
|
||||
offset(CSprite.shiftable_tri_cnt)+sizeof(I32)-offset(CSprite.start), //GRST_SHIFTABLE_MESH
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //GRST_ARROW
|
||||
offset(CSprite.st)-offset(CSprite.start), //GRST_TEXT
|
||||
offset(CSprite.st)-offset(CSprite.start), //GRST_TEXT_BOX
|
||||
offset(CSprite.st)-offset(CSprite.start), //GRST_TEXT_DIAMOND
|
||||
};
|
||||
|
||||
I64 gr_sprite_qued_base_size[GRST_NUM_TYPES]=
|
||||
I64 SpriteQuedBaseSize(I64 type)
|
||||
{
|
||||
offset(CSprite.x1),//GRST_END
|
||||
1,
|
||||
1+offset(CSprite.color8), //GRST_COLOR8
|
||||
1,
|
||||
offset(CSprite.x2), //GRST_PT
|
||||
offset(CSprite.linespeed), //GRST_LINE
|
||||
offset(CSprite.y1), //GRST_POLYLINE
|
||||
offset(CSprite.y1), //GRST_POLYPT
|
||||
offset(CSprite.y1), //GRST_WIDTH
|
||||
offset(CSprite.x2), //GRST_SHIFT
|
||||
offset(CSprite.y1), //GRST_BSPLINE2
|
||||
offset(CSprite.y1), //GRST_BSPLINE3
|
||||
offset(CSprite.y1), //GRST_BSPLINE2_CLOSED
|
||||
offset(CSprite.y1), //GRST_BSPLINE3_CLOSED
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
offset(CSprite.linespeed), //GRST_RECT
|
||||
offset(CSprite.y2), //GRST_CIRCLE
|
||||
offset(CSprite.x2), //GRST_FLOOD_FILL_NOT
|
||||
offset(CSprite.x2), //GRST_FLOOD_FILL
|
||||
offset(CSprite.linespeed), //GRST_BITMAP8
|
||||
1,
|
||||
offset(CSprite.st), //GRST_TEXT
|
||||
offset(CSprite.sides), //GRST_ELLIPSE
|
||||
sizeof(CSprite), //GRST_POLYGON
|
||||
offset(CSprite.linespeed), //GRST_PLANAR_SYMMETRY
|
||||
2+offset(CSprite.dither_color8), //GRST_DITHER_COLOR8
|
||||
offset(CSprite.sides), //GRST_ROTATED_RECT
|
||||
offset(CSprite.x2), //GRST_MESH
|
||||
offset(CSprite.shiftable_tri_cnt)+sizeof(I32), //GRST_SHIFTABLE_MESH
|
||||
offset(CSprite.x1), //GRST_TRANSFORM_ON
|
||||
offset(CSprite.x1), //GRST_TRANSFORM_OFF
|
||||
offset(CSprite.linespeed), //GRST_ARROW
|
||||
offset(CSprite.st), //GRST_TEXT_BOX
|
||||
offset(CSprite.st), //GRST_TEXT_DIAMOND
|
||||
};
|
||||
|
||||
return sprite_base_size[type]+offset(CSprite.start);
|
||||
}
|
||||
|
||||
I64 SpriteElemSize(CSprite *tempg)
|
||||
{
|
||||
I64 i=gr_sprite_base_size[tempg->type];
|
||||
I64 i=sprite_base_size[tempg->type];
|
||||
switch (tempg->type) {
|
||||
case GRST_POLYLINE:
|
||||
i+=tempg->num<<1*sizeof(I32);
|
||||
@@ -121,7 +79,7 @@ public I64 SpriteSize(U8 *elems)
|
||||
CSprite *tempg=elems-offset(CSprite.start),*tempg1=tempg;
|
||||
while (tempg->type)
|
||||
tempg(U8 *)+=SpriteElemSize(tempg);
|
||||
return tempg(U8 *)-tempg1(U8 *)+gr_sprite_base_size[GRST_END];
|
||||
return tempg(U8 *)-tempg1(U8 *)+sprite_base_size[GRST_END];
|
||||
}
|
||||
|
||||
I64 SpriteTypeMask(U8 *elems)
|
||||
@@ -151,9 +109,9 @@ public U8 *DC2Sprite(CDC *tempb)
|
||||
tempb1=tempb;
|
||||
temp_bitmap=FALSE;
|
||||
}
|
||||
tempg=CAlloc(gr_sprite_base_size[GRST_BITMAP8]+
|
||||
tempg=CAlloc(sprite_base_size[GRST_BITMAP8]+
|
||||
tempb1->width_internal*tempb1->height+
|
||||
gr_sprite_base_size[GRST_END])
|
||||
sprite_base_size[GRST_END])
|
||||
(U8 *)-offset(CSprite.start);
|
||||
tempg->type=GRST_BITMAP8;
|
||||
tempg->width=tempb1->width;
|
||||
@@ -171,63 +129,63 @@ public U8 *Sprite2Text(CSprite *tempg)
|
||||
{ //Study $LK-A,"::/TempleOS/Demo/Graphics/SpriteText.CPP"$.
|
||||
U8 buf[256],buf2[256],buf3[136];
|
||||
I32 *ptr;
|
||||
SPrintF(buf,"%Z",tempg->type,"ST_SPRITE_TYPES");
|
||||
SPrint(buf,"%Z",tempg->type,"ST_SPRITE_TYPES");
|
||||
*buf2=0;
|
||||
switch (tempg->type) {
|
||||
case GRST_COLOR8:
|
||||
SPrintF(buf2," %s",Color2Text(buf3,tempg->color8));
|
||||
SPrint(buf2," %s",Color2Text(buf3,tempg->color8));
|
||||
break;
|
||||
case GRST_PT:
|
||||
case GRST_FLOOD_FILL:
|
||||
case GRST_FLOOD_FILL_NOT:
|
||||
case GRST_SHIFT:
|
||||
SPrintF(buf2," %d,%d",tempg->x1,tempg->y1);
|
||||
SPrint(buf2," %d,%d",tempg->x1,tempg->y1);
|
||||
break;
|
||||
case GRST_LINE:
|
||||
case GRST_ARROW:
|
||||
case GRST_PLANAR_SYMMETRY:
|
||||
case GRST_RECT:
|
||||
case GRST_ROTATED_RECT:
|
||||
SPrintF(buf2," (%d,%d)-(%d,%d)",
|
||||
SPrint(buf2," (%d,%d)-(%d,%d)",
|
||||
tempg->x1,tempg->y1,tempg->x2,tempg->y2);
|
||||
break;
|
||||
case GRST_CIRCLE:
|
||||
SPrintF(buf2," %d,%d:%dR",
|
||||
SPrint(buf2," %d,%d:%dR",
|
||||
tempg->x1,tempg->y1,tempg->x2);
|
||||
break;
|
||||
case GRST_WIDTH:
|
||||
SPrintF(buf2," %d",tempg->width);
|
||||
SPrint(buf2," %d",tempg->width);
|
||||
break;
|
||||
case GRST_TEXT:
|
||||
case GRST_TEXT_BOX:
|
||||
case GRST_TEXT_DIAMOND:
|
||||
SPrintF(buf2," %d,%d:%-16tQ",tempg->x1,tempg->y1,tempg->st);
|
||||
SPrint(buf2," %d,%d:%-16tQ",tempg->x1,tempg->y1,tempg->st);
|
||||
break;
|
||||
case GRST_DITHER_COLOR8:
|
||||
SPrintF(buf2," %s",Color2Text(buf3,ROPF_DITHER|tempg->dither_color8.u8[0]|tempg->dither_color8.u8[1]<<COLORROP_BITS));
|
||||
SPrint(buf2," %s",Color2Text(buf3,ROPF_DITHER|tempg->dither_color8.u8[0]|tempg->dither_color8.u8[1]<<COLORROP_BITS));
|
||||
break;
|
||||
case GRST_POLYLINE:
|
||||
case GRST_POLYPT:
|
||||
ptr=&tempg->y1;
|
||||
SPrintF(buf2," %d %d,%d",tempg->num,ptr[0],ptr[1]);
|
||||
SPrint(buf2," %d %d,%d",tempg->num,ptr[0],ptr[1]);
|
||||
break;
|
||||
case GRST_ELLIPSE:
|
||||
case GRST_POLYGON:
|
||||
case GRST_BITMAP8:
|
||||
SPrintF(buf2," %dW,%dH:%d,%d",
|
||||
SPrint(buf2," %dW,%dH:%d,%d",
|
||||
tempg->width,tempg->height,tempg->x2,tempg->y2);
|
||||
break;
|
||||
case GRST_BSPLINE2:
|
||||
case GRST_BSPLINE3:
|
||||
case GRST_BSPLINE2_CLOSED:
|
||||
case GRST_BSPLINE3_CLOSED:
|
||||
SPrintF(buf2," %d",tempg->num);
|
||||
SPrint(buf2," %d",tempg->num);
|
||||
break;
|
||||
case GRST_MESH:
|
||||
SPrintF(buf2," %dV,%dT",tempg->vertex_cnt,tempg->tri_cnt);
|
||||
SPrint(buf2," %dV,%dT",tempg->vertex_cnt,tempg->tri_cnt);
|
||||
break;
|
||||
case GRST_SHIFTABLE_MESH:
|
||||
SPrintF(buf2," %dV,%dT",tempg->shiftable_vertex_cnt,tempg->shiftable_tri_cnt);
|
||||
SPrint(buf2," %dV,%dT",tempg->shiftable_vertex_cnt,tempg->shiftable_tri_cnt);
|
||||
break;
|
||||
}
|
||||
StrCat(buf,buf2);
|
||||
+44
-82
@@ -30,7 +30,7 @@ public I64 HashVal(CHash *temph)
|
||||
case HTt_ASM_KEYWORD:
|
||||
case HTt_MODULE:
|
||||
case HTt_FILE:
|
||||
case HTt_NAMED_FRAME_PTR:
|
||||
case HTt_FRAME_PTR:
|
||||
return temph(CHashGeneric *)->user_data0;
|
||||
|
||||
case -1: //nobound_switch
|
||||
@@ -40,15 +40,15 @@ public I64 HashVal(CHash *temph)
|
||||
}
|
||||
}
|
||||
|
||||
#help_index "Info;Hash/Reports;"
|
||||
class CHashRep
|
||||
#help_index "Info;Hash;Cmd Line (Typically)"
|
||||
class CWho
|
||||
{
|
||||
CHashGeneric *h;
|
||||
U8 *index;
|
||||
};
|
||||
|
||||
|
||||
I64 HashEntriesCompare(CHashRep *h1,CHashRep *h2)
|
||||
I64 HashEntriesCompare(CWho *h1,CWho *h2)
|
||||
{
|
||||
I64 i1,i2;
|
||||
if (i1=StrCmp(h1->h->str,h2->h->str))
|
||||
@@ -58,7 +58,7 @@ I64 HashEntriesCompare(CHashRep *h1,CHashRep *h2)
|
||||
return i1-i2;
|
||||
}
|
||||
|
||||
I64 HashEntriesCompare2(CHashRep *h1,CHashRep *h2)
|
||||
I64 HashEntriesCompare2(CWho *h1,CWho *h2)
|
||||
{
|
||||
CHashFun *tempf1=h1->h,*tempf2=h2->h;
|
||||
I64 i1=HashVal(tempf1),i2=HashVal(tempf2);
|
||||
@@ -111,7 +111,7 @@ U8 *HelpIndexStr(U8 **ptr_,U8 *index)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
I64 HashEntriesCompare3(CHashRep *h1,CHashRep *h2)
|
||||
I64 HashEntriesCompare3(CWho *h1,CWho *h2)
|
||||
{
|
||||
I64 i,i1=0,i2=0;
|
||||
i=StrCmp(h1->index,h2->index);
|
||||
@@ -130,17 +130,16 @@ I64 HashEntriesCompare3(CHashRep *h1,CHashRep *h2)
|
||||
}
|
||||
}
|
||||
|
||||
//Possible choices for first arg, "h" include
|
||||
// "adam_task->hash_table"
|
||||
// "Fs->hash_table"
|
||||
public U0 HashRep(CHashTable *h=NULL,
|
||||
I64 mask=HTG_ALL,U8 *outname=NULL,U8 *flags=NULL,U8 mapfile_drv=0,U8 *index=NULL,
|
||||
CDoc *_doc=NULL)
|
||||
{
|
||||
public U0 Who(U8 *fu_flags=NULL,CHashTable *h=NULL,
|
||||
U8 *outname=NULL,U8 mapfile_drv=0,U8 *index=NULL,CDoc *_doc=NULL)
|
||||
{//Dump Symbol Table
|
||||
// +p for only public symbols
|
||||
// +m to order by number (normally alphabetical)
|
||||
// -r just local hash table
|
||||
CHashTable *tempht;
|
||||
CHashSrcSym *temph;
|
||||
CHashGeneric *ptr;
|
||||
CHashRep *lst;
|
||||
CWho *lst;
|
||||
I64 cnt,i,j,k,size,f=0,dbg_bin_num;
|
||||
U8 buf[512],*buf4,*last_index=StrNew(""),*cur_index;
|
||||
CDoc *doc;
|
||||
@@ -148,8 +147,8 @@ public U0 HashRep(CHashTable *h=NULL,
|
||||
CDocBin *tempb;
|
||||
CDbgInfo *dbg;
|
||||
|
||||
GetFFlags(&f,Define("ST_FILE_UTIL_FLAGS"),"+r+p");
|
||||
GetFFlags(&f,Define("ST_FILE_UTIL_FLAGS"),flags);
|
||||
ScanFlags(&f,Define("ST_FILE_UTIL_FLAGS"),"+r");
|
||||
ScanFlags(&f,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
if (f&~(FUF_RECURSE|FUF_PUBLIC|FUF_MAP))
|
||||
throw(EXCEPT_FUF,2);
|
||||
recurse=Bt(&f,FUf_RECURSE);
|
||||
@@ -173,7 +172,6 @@ public U0 HashRep(CHashTable *h=NULL,
|
||||
temph=tempht->next_added;
|
||||
while (temph!=tempht) {
|
||||
if (!(temph->type & (HTF_IMPORT | HTF_PRIVATE)) &&
|
||||
temph->type & mask &&
|
||||
(temph->type & HTF_PUBLIC || !publics))
|
||||
if (!index)
|
||||
cnt++;
|
||||
@@ -190,14 +188,13 @@ public U0 HashRep(CHashTable *h=NULL,
|
||||
}
|
||||
if (!cnt) goto end_hash;
|
||||
|
||||
lst=CAlloc(cnt*sizeof(CHashRep));
|
||||
lst=CAlloc(cnt*sizeof(CWho));
|
||||
j=0;
|
||||
tempht=h;
|
||||
while (tempht) {
|
||||
temph=tempht->next_added;
|
||||
while (temph!=tempht) {
|
||||
if (!(temph->type & (HTF_IMPORT | HTF_PRIVATE)) &&
|
||||
temph->type & mask &&
|
||||
(temph->type & HTF_PUBLIC || !publics))
|
||||
if (!index)
|
||||
lst[j++].h=temph;
|
||||
@@ -220,11 +217,11 @@ public U0 HashRep(CHashTable *h=NULL,
|
||||
Preempt(old_preempt);
|
||||
|
||||
if (map)
|
||||
QSort(lst,cnt,sizeof(CHashRep),&HashEntriesCompare2);
|
||||
QSort(lst,cnt,sizeof(CWho),&HashEntriesCompare2);
|
||||
else if (index)
|
||||
QSort(lst,cnt,sizeof(CHashRep),&HashEntriesCompare3);
|
||||
QSort(lst,cnt,sizeof(CWho),&HashEntriesCompare3);
|
||||
else
|
||||
QSort(lst,cnt,sizeof(CHashRep),&HashEntriesCompare);
|
||||
QSort(lst,cnt,sizeof(CWho),&HashEntriesCompare);
|
||||
|
||||
for (i=0;i<cnt;i++) {
|
||||
ptr=lst[i].h;
|
||||
@@ -235,7 +232,7 @@ public U0 HashRep(CHashTable *h=NULL,
|
||||
Free(last_index);
|
||||
last_index=StrNew(cur_index);
|
||||
if (doc)
|
||||
DocPrintF(doc,"$$FG,GREEN$$%s$$FG$$\n",cur_index);
|
||||
DocPrint(doc,"$$FG,GREEN$$%s$$FG$$\n",cur_index);
|
||||
else
|
||||
"$$FG,GREEN$$%s$$FG$$\n",cur_index;
|
||||
}
|
||||
@@ -271,61 +268,61 @@ public U0 HashRep(CHashTable *h=NULL,
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dbg) {
|
||||
SPrintF(buf,"$$LK+BI,\"%-26s\",\"%s\",%d$$",
|
||||
if (dbg)
|
||||
DocPrint(doc,"$$LK+BI,\"%-26s\",\"%s\",%d$$",
|
||||
ptr->str,buf4,dbg_bin_num);
|
||||
DocPutS(doc,buf);
|
||||
} else {
|
||||
SPrintF(buf,"$$LK,\"%-26s\",\"%s\"$$",
|
||||
else {
|
||||
SPrint(buf,"$$LK,\"%-26s\",\"%s\"$$",
|
||||
ptr->str,buf4);
|
||||
if (doc)
|
||||
DocPutS(doc,buf);
|
||||
DocPrint(doc,"%s",buf);
|
||||
else
|
||||
"" buf;
|
||||
"%s",buf;
|
||||
}
|
||||
Free(buf4);
|
||||
} else {
|
||||
SPrintF(buf,"%-26ts",ptr->str);
|
||||
SPrint(buf,"%-26ts",ptr->str);
|
||||
if (doc)
|
||||
DocPutS(doc,buf);
|
||||
DocPrint(doc,"%s",buf);
|
||||
else
|
||||
"" buf;
|
||||
"%s",buf;
|
||||
}
|
||||
|
||||
if (!index) {
|
||||
if (ptr->type & HTT_DEFINE_STR) {
|
||||
j=ptr(CHashDefineStr *)->cnt;
|
||||
if (j==-1)
|
||||
SPrintF(buf,"%-10tQ ",ptr(CHashDefineStr *)->data);
|
||||
SPrint(buf,"%-10tQ ",ptr(CHashDefineStr *)->data);
|
||||
else
|
||||
SPrintF(buf,"%-10tQ %02X",ptr(CHashDefineStr *)->data,j);
|
||||
SPrint(buf,"%-10tQ %02X",ptr(CHashDefineStr *)->data,j);
|
||||
} else if (ptr->type & HTT_GLBL_VAR) {
|
||||
if (outname)
|
||||
SPrintF(buf,"%010X ",ptr(CHashGlblVar *)->data_addr_ip);
|
||||
SPrint(buf,"%010X ",ptr(CHashGlblVar *)->data_addr_ip);
|
||||
else
|
||||
SPrintF(buf,"%010X ",ptr(CHashGlblVar *)->data_addr);
|
||||
SPrint(buf,"%010X ",ptr(CHashGlblVar *)->data_addr);
|
||||
} else
|
||||
SPrintF(buf,"%010X ",HashVal(ptr));
|
||||
SPrint(buf,"%010X ",HashVal(ptr));
|
||||
j=HashEntrySize(ptr);
|
||||
if (j==-1)
|
||||
SPrintF(buf+StrLen(buf)," %04X ",ptr->use_cnt);
|
||||
SPrint(buf+StrLen(buf)," %04X ",ptr->use_cnt);
|
||||
else
|
||||
SPrintF(buf+StrLen(buf)," %04X %010X ",ptr->use_cnt,j);
|
||||
SPrint(buf+StrLen(buf)," %04X %010X ",ptr->use_cnt,j);
|
||||
} else
|
||||
*buf=0;
|
||||
|
||||
k=ptr->type;
|
||||
if (publics)
|
||||
k&=~HTF_PUBLIC;
|
||||
|
||||
if (!(k&HTG_TYPE_MASK))
|
||||
SPrint(buf+StrLen(buf),"NULL ");
|
||||
for (j=0;j<32;j++)
|
||||
if (Bt(&k,j))
|
||||
SPrintF(buf+StrLen(buf),"%Z ",j,"ST_HTT_TYPES");
|
||||
SPrint(buf+StrLen(buf),"%Z ",j,"ST_HTT_TYPES");
|
||||
StrCat(buf,"\n");
|
||||
if (doc)
|
||||
DocPutS(doc,buf);
|
||||
DocPrint(doc,"%s",buf);
|
||||
else
|
||||
"" buf;
|
||||
"%s",buf;
|
||||
}
|
||||
Free(lst[i].index);
|
||||
}
|
||||
@@ -340,7 +337,7 @@ public U0 HashRep(CHashTable *h=NULL,
|
||||
DocDel(doc);
|
||||
} else {
|
||||
if (doc->root.next==doc)
|
||||
DocPutS(doc,"No Match");
|
||||
DocPrint(doc,"No Match");
|
||||
else
|
||||
DocRecalc(doc);
|
||||
}
|
||||
@@ -348,41 +345,6 @@ public U0 HashRep(CHashTable *h=NULL,
|
||||
Free(last_index);
|
||||
}
|
||||
|
||||
public U0 HFunsRep(U8 *flags="",U8 *index=NULL)
|
||||
{
|
||||
HashRep(Fs->hash_table,HTT_FUN,NULL,flags,0,index);
|
||||
}
|
||||
|
||||
public U0 HMapRep(U8 *flags="-p+m",U8 *index=NULL)
|
||||
{
|
||||
HashRep(Fs->hash_table,HTT_FUN,NULL,flags,0,index);
|
||||
}
|
||||
|
||||
public U0 HVarsRep(U8 *flags="",U8 *index=NULL)
|
||||
{
|
||||
HashRep(Fs->hash_table,HTT_GLBL_VAR,NULL,flags,0,index);
|
||||
}
|
||||
|
||||
public U0 HClassesRep(U8 *flags="-p",U8 *index=NULL)
|
||||
{
|
||||
HashRep(Fs->hash_table,HTT_CLASS,NULL,flags,0,index);
|
||||
}
|
||||
|
||||
public U0 HDefinesRep(U8 *flags="-p",U8 *index=NULL)
|
||||
{
|
||||
HashRep(Fs->hash_table,HTT_DEFINE_STR,NULL,flags,0,index);
|
||||
}
|
||||
|
||||
public U0 HSymsRep(U8 *flags="-p",U8 *index=NULL)
|
||||
{
|
||||
HashRep(Fs->hash_table,HTT_EXPORT_SYS_SYM,NULL,flags,0,index);
|
||||
}
|
||||
|
||||
public U0 HAllRep(U8 *flags="-p",U8 *index=NULL)
|
||||
{
|
||||
HashRep(Fs->hash_table,HTG_ALL,NULL,flags,0,index);
|
||||
}
|
||||
|
||||
#define HDR_MAX 16
|
||||
public I64 HashDepthRep(CHashTable *tempht=NULL)
|
||||
{
|
||||
@@ -419,13 +381,13 @@ public I64 HashDepthRep(CHashTable *tempht=NULL)
|
||||
|
||||
public U0 DocHelpIndex(CDoc *doc,U8 *index)
|
||||
{
|
||||
HashRep(Fs->hash_table,HTG_ALL,NULL,NULL,0,index,doc);
|
||||
Who("+p",,,,index,doc);
|
||||
}
|
||||
|
||||
public U0 PopUpHelpIndex(U8 *index,CTask *parent=NULL)
|
||||
{
|
||||
U8 *buf;
|
||||
buf=MSPrintF("DocHelpIndex(DocPut,\"%s\");View;",index);
|
||||
buf=MPrint("DocHelpIndex(DocPut,\"%s\");View;",index);
|
||||
PopUp(buf,parent);
|
||||
Free(buf);
|
||||
}
|
||||
|
||||
+25
-25
@@ -1,4 +1,4 @@
|
||||
#help_index "Task/Login"
|
||||
#help_index "Misc/Accts"
|
||||
|
||||
//This is temporary until defined in $LK-A,"HOME/Adam3fSys.CPP"$.
|
||||
U0 UserStartUp()
|
||||
@@ -21,32 +21,32 @@ U0 SrvStartUp()
|
||||
Preempt(ON);
|
||||
}
|
||||
|
||||
U8 *PopUpSysAcctGet()
|
||||
U8 *PopUpSysAcct()
|
||||
{
|
||||
U8 *result,*st;
|
||||
CDoc *doc=DocNew;
|
||||
CDirEntry *tempm1=FilesFind("/TempleOS/Accts/*",FUF_RECURSE|FUF_JUST_DIRS|FUF_FLATTEN_TREE),
|
||||
*tempm=tempm1;
|
||||
DocPutS(doc,"$$CM+CX-LE,8$$");
|
||||
CDirEntry *tempde1=FilesFind("/TempleOS/Accts/*",FUF_RECURSE|FUF_JUST_DIRS|FUF_FLATTEN_TREE),
|
||||
*tempde=tempde1;
|
||||
DocPrint(doc,"$$CM+CX-LE,8$$");
|
||||
DocPutSprite(doc,$IB+BP,"<1>",1,"::/TempleOS/Demo/Graphics/Logo.CPP,1"$,"$$SP+SIF,\"\",%d$$");
|
||||
DocPutS(doc,"$$CM+LX,0,14$$Select Account.\nCursor down and press <SPACE BAR>.\n");
|
||||
while (tempm) {
|
||||
if (*tempm->name!='.') {
|
||||
st=tempm->full_name;
|
||||
DocPrint(doc,"$$CM+LX,0,14$$Select Account.\nCursor down and press <SPACE BAR>.\n");
|
||||
while (tempde) {
|
||||
if (*tempde->name!='.') {
|
||||
st=tempde->full_name;
|
||||
if (!StrNCmp(st+2,"/TempleOS/Accts/",10))
|
||||
st+=12;
|
||||
DocPrintF(doc,"$$CM+LX,2,3$$$$BT,\"%s\",%d$$",st,tempm);
|
||||
DocPrint(doc,"$$CM+LX,2,3$$$$BT,\"%s\",%d$$",st,tempde);
|
||||
}
|
||||
tempm=tempm->next;
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DocPutS(doc,"\n\n\n\nLog-in as USER if you are new and get familiar\n"
|
||||
DocPrint(doc,"\n\n\n\nLog-in as USER if you are new and get familiar\n"
|
||||
"before you try to install.\n");
|
||||
do tempm=PopUpMenu(doc,DOF_WIN_MAX);
|
||||
while (tempm<0);
|
||||
do tempde=PopUpMenu(doc,DOF_WIN_MAX);
|
||||
while (tempde<0);
|
||||
|
||||
DocDel(doc);
|
||||
result=AStrNew(tempm->full_name);
|
||||
CDirLstDel(tempm1);
|
||||
result=AStrNew(tempde->full_name);
|
||||
DirLstDel(tempde1);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ U0 SysLogin()
|
||||
U8 *st;
|
||||
if (!FileFind(sys_acct)||!StrCmp(sys_acct+2,"/TempleOS/Accts")) {
|
||||
st=sys_acct;
|
||||
sys_acct=PopUpSysAcctGet;
|
||||
sys_acct=PopUpSysAcct;
|
||||
Free(st);
|
||||
}
|
||||
}
|
||||
@@ -84,10 +84,10 @@ public Bool AcctRegSetDftEntry(U8 *path,U8 *val,Bool is_adam_entry=FALSE)
|
||||
unlock_doc=DocLock(sys_registry_doc);
|
||||
if (!DocTreeFind(sys_registry_doc,path)) {
|
||||
DocTreeMake(sys_registry_doc,path);
|
||||
DocPutS(sys_registry_doc,val);
|
||||
DocPrint(sys_registry_doc,"%s",val);
|
||||
if (is_adam_entry) {
|
||||
if (Fs==adam_task)
|
||||
ExePutS(val);
|
||||
ExePrint("%s",val);
|
||||
else
|
||||
Adam("%s",val);
|
||||
}
|
||||
@@ -111,13 +111,13 @@ public Bool AcctRegWriteBranch(U8 *path,U8 *fmt,...)
|
||||
{
|
||||
Bool result,unlock_doc;
|
||||
CDocEntry *tree_branch,*start_indent,*end_indent;
|
||||
U8 *buf=SPrintFJoin(NULL,fmt,argc,argv);
|
||||
U8 *buf=SPrintJoin(NULL,fmt,argc,argv);
|
||||
AcctCacheRegistry;
|
||||
unlock_doc=DocLock(sys_registry_doc);
|
||||
if (result=DocTreeFind(sys_registry_doc,path,&tree_branch,&start_indent,&end_indent))
|
||||
DocCut(sys_registry_doc,tree_branch,end_indent);
|
||||
DocTreeMake(sys_registry_doc,path);
|
||||
DocPutS(sys_registry_doc,buf);
|
||||
DocPrint(sys_registry_doc,"%s",buf);
|
||||
if (IsDrvWritable(*sys_acct))
|
||||
DocWrite(sys_registry_doc);
|
||||
if (unlock_doc)
|
||||
@@ -131,9 +131,9 @@ U0 AcctOneTimePopUp(I64 flag_num,U8 *msg)
|
||||
CDoc *doc=DocNew;
|
||||
CDocEntry *doc_e;
|
||||
if (!Bt(sys_msg_flags,flag_num)) {
|
||||
if (msg) DocPutS(doc,msg);
|
||||
doc_e=DocPutS(doc,"\n$$CB+LE,\"Do not show this msg again.\",1$$");
|
||||
DocPutS(doc,"$$CM+CX,0,4$$$$BT,\"OKAY\",1$$\n");
|
||||
if (msg) DocPrint(doc,"%s",msg);
|
||||
doc_e=DocPrint(doc,"\n$$CB+LE,\"Do not show this msg again.\",1$$");
|
||||
DocPrint(doc,"$$CM+CX,0,4$$$$BT,\"OKAY\",1$$\n");
|
||||
if (PopUpMenu(doc)==1 && doc_e->flags1&DOCEF1_CHECKED_COLLAPSED) {
|
||||
LBts(sys_msg_flags,flag_num);
|
||||
AcctRegWriteBranch("Adam/TempleOS/SysMsgFlags",
|
||||
@@ -149,7 +149,7 @@ U0 RegistryInit()
|
||||
U8 buf[136];
|
||||
Bool version_present;
|
||||
AcctRegSetDftEntry("Adam/TempleOS/SysMsgFlags","sys_msg_flags[0]=0;\n",TRUE);
|
||||
SPrintF(buf,"registry_version=%4.3f;\n",os_version);
|
||||
SPrint(buf,"registry_version=%4.3f;\n",os_version);
|
||||
version_present=AcctRegSetDftEntry("Adam/TempleOS/SysRegVer",buf,TRUE);
|
||||
AcctRegExeBranch("Adam");
|
||||
if (registry_version!=os_version) {
|
||||
|
||||
@@ -279,7 +279,7 @@ U0 ODECalcSprings(CMathODE *ode)
|
||||
e2=temps->end2;
|
||||
d=D3Norm(D3Sub(&e2->state->x,&e1->state->x,&p));
|
||||
temps->displacement=d-temps->rest_len;
|
||||
temps->f=temps->displacement*temps->constant;
|
||||
temps->f=temps->displacement*temps->const;
|
||||
if (temps->f>0 && temps->flags&SSF_NO_TENSION)
|
||||
temps->f=0;
|
||||
else if (temps->f<0 && temps->flags&SSF_NO_COMPRESSION)
|
||||
|
||||
@@ -50,15 +50,15 @@ CMenuEntry *MenuNewSub(CLex *lx,CTask *task)
|
||||
tempme->msg_code=MSG_KEY_DOWN_UP;
|
||||
Lex(lx); //Skip (
|
||||
if (lx->token!=',' && lx->token!=')')
|
||||
tempme->msg_code=Expression(lx);
|
||||
tempme->msg_code=LexExpression(lx);
|
||||
if (lx->token==',')
|
||||
Lex(lx);
|
||||
if (lx->token!=',' && lx->token!=')')
|
||||
tempme->p1=Expression(lx);
|
||||
tempme->p1=LexExpression(lx);
|
||||
if (lx->token==',')
|
||||
Lex(lx);
|
||||
if (lx->token!=',' && lx->token!=')')
|
||||
tempme->p2=Expression(lx);
|
||||
tempme->p2=LexExpression(lx);
|
||||
if (lx->token!=')')
|
||||
LexExcept(lx,"ST_MISSING_RIGHT_PAREN");
|
||||
if (Lex(lx)!=';')
|
||||
@@ -103,7 +103,7 @@ public CMenu *MenuNew(U8 *st,I64 flags=0,CTask *task=NULL)
|
||||
public CMenu *MenuFile(U8 *filename,I64 flags=0,CTask *task=NULL)
|
||||
{
|
||||
CMenu *m;
|
||||
U8 *st=MSPrintF("#include \"%s\"",filename);
|
||||
U8 *st=MPrint("#include \"%s\"",filename);
|
||||
m=MenuNew(st,flags,task);
|
||||
Free(st);
|
||||
return m;
|
||||
@@ -199,7 +199,7 @@ U0 DrawMenu(CDC *dc)
|
||||
dc->color=m->attr>>4;
|
||||
} else
|
||||
dc->color=m->attr&15;
|
||||
GrPutS(dc,x0,0,tempme->name);
|
||||
GrPrint(dc,x0,0,"%s",tempme->name);
|
||||
y0=FONT_HEIGHT;
|
||||
tempse=tempme->sub;
|
||||
while (tempse) {
|
||||
@@ -217,26 +217,26 @@ U0 DrawMenu(CDC *dc)
|
||||
dc->color=i&15;
|
||||
GrRect(dc,x0,y0,w,FONT_HEIGHT);
|
||||
dc->color=i>>4;
|
||||
GrPutS(dc,x0,y0,tempse->name);
|
||||
GrPrint(dc,x0,y0,"%s",tempse->name);
|
||||
if (st) {
|
||||
dc->color=i>>4;
|
||||
GrRect(dc,x0+w,y0-FONT_HEIGHT,(StrLen(st)+1)*FONT_WIDTH,FONT_HEIGHT*3);
|
||||
dc->color=i&15;
|
||||
GrPutS(dc,x0+w,y0,st);
|
||||
GrPrint(dc,x0+w,y0,"%s",st);
|
||||
Free(st);
|
||||
}
|
||||
} else {
|
||||
dc->color=i>>4;
|
||||
GrRect(dc,x0,y0,w,FONT_HEIGHT);
|
||||
dc->color=i&15;
|
||||
GrPutS(dc,x0,y0,tempse->name);
|
||||
GrPrint(dc,x0,y0,"%s",tempse->name);
|
||||
}
|
||||
y0+=FONT_HEIGHT;
|
||||
tempse=tempse->next;
|
||||
}
|
||||
} else {
|
||||
dc->color=m->attr&15;
|
||||
GrPutS(dc,x0,0,tempme->name);
|
||||
GrPrint(dc,x0,0,"%s",tempme->name);
|
||||
}
|
||||
x0+=w;
|
||||
tempme=tempme->next;
|
||||
|
||||
@@ -119,7 +119,7 @@ public U0 SndWaveCtrlDel(CSndWaveCtrl *swc)
|
||||
#define WF_NULL 0
|
||||
#define WF_SQUARE 1
|
||||
#define WF_SINE 2
|
||||
#define WF_TRI 3
|
||||
#define WF_TRI 3
|
||||
#define WF_SAWTOOTH 4
|
||||
#define WF_NOISE 5
|
||||
#define WF_NUM_WAVEFORMS 6
|
||||
|
||||
@@ -158,12 +158,8 @@ public U0 Play(U8 *st,U8 *words=NULL)
|
||||
f=Note2Freq(note,music_octave);
|
||||
} else
|
||||
f=0;
|
||||
if (words) {
|
||||
if (word=LstEntryPt(i++,words))
|
||||
if (StrCmp(word," "))
|
||||
"" word;
|
||||
}
|
||||
|
||||
if (words && (word=LstSub(i++,words)) && StrCmp(word," "))
|
||||
"%s",word;
|
||||
d=JIFFY_FREQ*music_note_len/music_tempo;
|
||||
if (tie) {
|
||||
on_jiffies =d;
|
||||
|
||||
@@ -9,7 +9,7 @@ class CSoundEffectFrame
|
||||
|
||||
U0 SoundEffectEndTaskCB()
|
||||
{
|
||||
Free(NamedFramePtr("CSoundEffectFrame"));
|
||||
Free(FramePtr("CSoundEffectFrame"));
|
||||
music_mute--;
|
||||
SndTaskEndCB;
|
||||
}
|
||||
@@ -18,7 +18,7 @@ U0 SoundEffectTask(CSoundEffectFrame *ns)
|
||||
{
|
||||
I64 i;
|
||||
F64 f,t0=tS,t,timeout=t0+ns->duration;
|
||||
NamedFramePtrAdd("CSoundEffectFrame",ns);
|
||||
FramePtrAdd("CSoundEffectFrame",ns);
|
||||
Fs->task_end_cb=&SoundEffectEndTaskCB;
|
||||
switch (ns->type) {
|
||||
case SE_NOISE:
|
||||
|
||||
@@ -13,7 +13,8 @@ class CFileSND
|
||||
};
|
||||
|
||||
//This is a windows media constraint.
|
||||
#define MAX_SND_FILE_DATA 0x7FF00
|
||||
//#define MAX_SND_FILE_DATA 0x0007FF00
|
||||
#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,
|
||||
@@ -107,7 +108,7 @@ public I64 SndFileCreate(U8 *base_filename,F64 normalized_vol=1.0,F64 averaging=
|
||||
i=MAX_SND_FILE_DATA;
|
||||
s->data_size=EndianU32(i*sizeof(I16));
|
||||
MemCpy(s->body,&s->body[file_num*MAX_SND_FILE_DATA],i*sizeof(I16));
|
||||
SPrintF(name2,"%s%03d.SND",name,file_num++);
|
||||
SPrint(name2,"%s%03d.SND",name,file_num++);
|
||||
FileWrite(name2,s,offset(CFileSND.body)+i*sizeof(I16));
|
||||
cnt2-=i;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ U0 Start()
|
||||
{
|
||||
Type("::/TempleOS/Doc/Splash.TXT");
|
||||
SetWinHorz(TEXT_COLS/4-1,3*TEXT_COLS/4);
|
||||
SetWinVert(TEXT_ROWS/4-3,Fs->win_bottom);
|
||||
SetWinVert(6,Fs->win_bottom);
|
||||
LBts(&Fs->display_flags,DISPLAYf_WIN_ON_TOP);
|
||||
"$$FG,GREEN$$Tip of day$$FG$$\n";
|
||||
TipOfDay;
|
||||
|
||||
@@ -152,10 +152,10 @@ U0 KeyMapFamily2(U8 **entries,U8 *family,CTask *task,I64 scf)
|
||||
}
|
||||
if (*key_desc && StrNCmp(key_desc,"Char/",5)) {
|
||||
st=ScanCode2KeyName(p2&~(SCF_CTRL|SCF_ALT|SCF_SHIFT));
|
||||
st2=MSPrintF("%s %s",family,st);
|
||||
st2=MPrint("%s %s",family,st);
|
||||
Free(st);
|
||||
st=SrcEdLink(key_handler,256);
|
||||
entries[i]=MSPrintF("%20s $$LK,\"%s\",\"%s\"$$\n",
|
||||
entries[i]=MPrint("%20s $$LK,\"%s\",\"%s\"$$\n",
|
||||
st2,key_desc,st);
|
||||
Free(st);
|
||||
Free(st2);
|
||||
@@ -168,14 +168,14 @@ U0 KeyMapFamily(U8 *family,CTask *task,I64 scf)
|
||||
{
|
||||
I64 i;
|
||||
U8 **entries=CAlloc(2*256*sizeof(U8 *)),st1[32],st2[32];
|
||||
SPrintF(st1,"%s ",family);
|
||||
SPrintF(st2,"%s SHIFT",family);
|
||||
SPrint(st1,"%s ",family);
|
||||
SPrint(st2,"%s SHIFT",family);
|
||||
KeyMapFamily2(entries ,st1,task,scf);
|
||||
KeyMapFamily2(entries+256,st2,task,scf+SCF_SHIFT);
|
||||
QSortI64(entries,2*256,&KMCompare);
|
||||
for (i=0;i<2*256;i++)
|
||||
if (entries[i]) {
|
||||
"" entries[i];
|
||||
"%s",entries[i];
|
||||
Free(entries[i]);
|
||||
}
|
||||
Free(entries);
|
||||
@@ -234,7 +234,7 @@ public U0 TipOfDay(U8 *tip_file="::/TempleOS/Doc/Tips.TXT")
|
||||
U0 CtrlAltK(I64)
|
||||
{
|
||||
U8 buf[136];
|
||||
SPrintF(buf,"KeyMap(0x%X);View;",
|
||||
SPrint(buf,"KeyMap(0x%X);View;",
|
||||
sys_focus_task);
|
||||
PopUp(buf);
|
||||
}
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
DefineLstLoad("ST_BIN_FILE_TYPES",
|
||||
"END\0 \0"
|
||||
"REL_EXPORT\0"
|
||||
"LIT_EXPORT\0"
|
||||
"IMM_EXPORT\0"
|
||||
"REL_U8\0"
|
||||
"LIT_U8\0"
|
||||
"IMM_U8\0"
|
||||
"REL_U16\0"
|
||||
"LIT_U16\0"
|
||||
"IMM_U16\0"
|
||||
"REL_U32\0"
|
||||
"LIT_U32\0"
|
||||
"IMM_U32\0"
|
||||
"REL_U64\0"
|
||||
"LIT_U64\0"
|
||||
"IMM_U64\0"
|
||||
" \0 \0 \0 \0"
|
||||
"MAIN\0"
|
||||
"MODULE_ALIGN\0MODULE_ORG\0"
|
||||
@@ -57,7 +57,7 @@ public Bool BinRep(U8 *filename)
|
||||
ptr+=StrLen(sptr)+1;
|
||||
"%16Z:$$FG,GREEN$$%s$$FG$$:%X ",etype,"ST_BIN_FILE_TYPES",sptr,i;
|
||||
switch (etype) {
|
||||
case EIE_REL_U8...EIE_LIT_U64:
|
||||
case EIE_REL_U8...EIE_IMM_U64:
|
||||
if (*sptr)
|
||||
saved_hash_ptr=HashFind(sptr,Fs->hash_table,HTG_ALL);
|
||||
if (!saved_hash_ptr)
|
||||
|
||||
@@ -10,7 +10,7 @@ I64 PopUpDiffOptions()
|
||||
{
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
DocPutS(doc,"$$CM+LX,2,4$$$$FG$$$$BT,\"USE FILE1\",DS_USE_FILE1$$"
|
||||
DocPrint(doc,"$$CM+LX,2,4$$$$FG$$$$BT,\"USE FILE1\",DS_USE_FILE1$$"
|
||||
"$$CM+LX,24,0$$$$FG,CYAN$$$$BT,\"USE FILE2\",DS_USE_FILE2$$"
|
||||
"$$CM+LX,2,4$$$$FG$$$$BT,\"REMAINDER ALL FILE1\",DS_REMAINDER_1$$"
|
||||
"$$CM+LX,24,0$$$$FG,CYAN$$$$BT,\"REMAINDER ALL FILE2\",DS_REMAINDER_2$$"
|
||||
@@ -65,7 +65,7 @@ U0 DiffSelect(CDoc *doc,I64 *_df_flags,I64 j1_lo,I64 j1_hi,
|
||||
old_flags=cur_l->flags&DOCF_PLAIN_TEXT;
|
||||
cur_l->flags|=DOCF_PLAIN_TEXT;
|
||||
}
|
||||
"" doc_us1[i++]->tag;
|
||||
"%s",doc_us1[i++]->tag;
|
||||
if (cur_l)
|
||||
cur_l->flags= cur_l->flags&~DOCF_PLAIN_TEXT |old_flags;
|
||||
NewLine;
|
||||
@@ -80,7 +80,7 @@ U0 DiffSelect(CDoc *doc,I64 *_df_flags,I64 j1_lo,I64 j1_hi,
|
||||
old_flags=cur_l->flags&DOCF_PLAIN_TEXT;
|
||||
cur_l->flags|=DOCF_PLAIN_TEXT;
|
||||
}
|
||||
"" doc_us2[i++]->tag;
|
||||
"%s",doc_us2[i++]->tag;
|
||||
if (cur_l)
|
||||
cur_l->flags= cur_l->flags&~DOCF_PLAIN_TEXT |old_flags;
|
||||
NewLine;
|
||||
|
||||
@@ -11,8 +11,8 @@ I64 PopUpReplaceSkipAllCancelEd(U8 *msg)
|
||||
{
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
DocPutS(doc,msg);
|
||||
DocPutS(doc,"$$CM+LX,2,4$$$$BT,\"REPLACE\",GRF_REPLACE$$"
|
||||
DocPrint(doc,"%s",msg);
|
||||
DocPrint(doc,"$$CM+LX,2,4$$$$BT,\"REPLACE\",GRF_REPLACE$$"
|
||||
"$$CM+LX,22,0$$$$BT,\"SKIP\",GRF_SKIP$$"
|
||||
"$$CM+LX,2,4$$$$BT,\"ALL\",GRF_ALL$$"
|
||||
"$$CM+LX,22,0$$$$BT,\"ABORT ALL\",DOCM_CANCEL$$"
|
||||
@@ -35,15 +35,15 @@ I64 GrepFile(U8 *pattern,U8 *name,I64 *_fuf_flags,U8 *replace_text)
|
||||
CDocEntry *doc_e;
|
||||
|
||||
if (Bt(_fuf_flags,FUf_IGNORE))
|
||||
ss_flags=SRF_IGNORE_CASE;
|
||||
ss_flags=SFF_IGNORE_CASE;
|
||||
else
|
||||
ss_flags=0;
|
||||
if (Bt(_fuf_flags,FUf_WHOLE_LABELS))
|
||||
ss_flags|=SRG_WHOLE_LABELS;
|
||||
ss_flags|=SFG_WHOLE_LABELS;
|
||||
if (Bt(_fuf_flags,FUf_WHOLE_LABELS_FRONT))
|
||||
ss_flags|=SRF_WHOLE_LABELS_FRONT;
|
||||
ss_flags|=SFF_WHOLE_LABELS_FRONT;
|
||||
if (Bt(_fuf_flags,FUf_WHOLE_LABELS_BACK))
|
||||
ss_flags|=SRF_WHOLE_LABELS_BACK;
|
||||
ss_flags|=SFF_WHOLE_LABELS_BACK;
|
||||
|
||||
plen=StrLen(pattern);
|
||||
if (replace_text)
|
||||
@@ -54,12 +54,12 @@ I64 GrepFile(U8 *pattern,U8 *name,I64 *_fuf_flags,U8 *replace_text)
|
||||
src=doc_e->tag;
|
||||
first_on_line=TRUE;
|
||||
while (src && cont) {
|
||||
if (src=SearchStr(src,pattern,ss_flags)) {
|
||||
if (src=StrFind(pattern,src,ss_flags)) {
|
||||
cnt++;
|
||||
if (first_on_line || Bt(_fuf_flags,FUf_REPLACE)) {
|
||||
first_on_line=FALSE;
|
||||
PutFileLink(name,doc_e->y+1,TRUE);
|
||||
name_buf=MSPrintF("%s,%d",name,doc_e->y+1);
|
||||
name_buf=MPrint("%s,%d",name,doc_e->y+1);
|
||||
if (cur_l=DocPut) {
|
||||
old_flags=cur_l->flags&DOCF_PLAIN_TEXT;
|
||||
cur_l->flags|=DOCF_PLAIN_TEXT;
|
||||
@@ -143,27 +143,7 @@ I64 GrepFile(U8 *pattern,U8 *name,I64 *_fuf_flags,U8 *replace_text)
|
||||
return cnt;
|
||||
}
|
||||
|
||||
I64 GrepLst(U8 *pattern,CDirEntry *tempm1,I64 *_fuf_flags,U8 *replace_text)
|
||||
{
|
||||
I64 cnt=0;
|
||||
CDirEntry *tempm2;
|
||||
|
||||
while (tempm1 && !Bt(_fuf_flags,FUf_CANCEL)) {
|
||||
tempm2=tempm1->next;
|
||||
if (tempm1->attr & _ATTR_DIR) {
|
||||
if (tempm1->sub) {
|
||||
"%S %s\n","ST_SCANNING_DIR",tempm1->full_name;
|
||||
cnt+=GrepLst(pattern,tempm1->sub,_fuf_flags,replace_text);
|
||||
}
|
||||
} else
|
||||
cnt+=GrepFile(pattern,tempm1->full_name,_fuf_flags,replace_text);
|
||||
CDirEntryDel(tempm1);
|
||||
tempm1=tempm2;
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
|
||||
public I64 Grep(U8 *pattern,U8 *files_find_mask=FILENAME_MASK_TXT,U8 *fu_flags=NULL,U8 *replace_text=NULL)
|
||||
public I64 Grep(U8 *pattern,U8 *files_find_mask="*",U8 *fu_flags=NULL,U8 *replace_text=NULL)
|
||||
/*
|
||||
This does not do regular expressions--my bad.
|
||||
Anyway, it's good for searching and replacing.
|
||||
@@ -183,23 +163,29 @@ Let's say it stands for global replace ;-)
|
||||
|
||||
{
|
||||
I64 cnt=0,fuf_flags=0;
|
||||
CDirEntry *tempm;
|
||||
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+i"); //Set dft flags
|
||||
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
if (fuf_flags&~(FUG_FILES_FIND|FUF_IGNORE|FUF_WHOLE_LABELS|FUF_WHOLE_LABELS_FRONT|FUF_WHOLE_LABELS_BACK))
|
||||
CDirEntry *tempde,*tempde1;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+i+f+F+T");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
if (fuf_flags&~(FUG_FILES_FIND|FUF_IGNORE|FUF_ALL|FUF_WHOLE_LABELS|FUF_WHOLE_LABELS_FRONT|FUF_WHOLE_LABELS_BACK))
|
||||
throw(EXCEPT_FUF,1);
|
||||
LBEqu(&fuf_flags,FUf_REPLACE,replace_text);
|
||||
tempm=FilesFind(files_find_mask,fuf_flags&FUG_FILES_FIND);
|
||||
fuf_flags&=FUF_REPLACE|FUF_IGNORE|FUF_WHOLE_LABELS|FUF_WHOLE_LABELS_FRONT|FUF_WHOLE_LABELS_BACK;
|
||||
cnt+=GrepLst(pattern,tempm,&fuf_flags,replace_text);
|
||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags&FUG_FILES_FIND);
|
||||
fuf_flags&=FUF_ALL|FUF_REPLACE|FUF_IGNORE|FUF_WHOLE_LABELS|FUF_WHOLE_LABELS_FRONT|FUF_WHOLE_LABELS_BACK;
|
||||
while (tempde && !Bt(&fuf_flags,FUf_CANCEL)) {
|
||||
cnt+=GrepFile(pattern,tempde->full_name,&fuf_flags,replace_text);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirLstDel(tempde1);
|
||||
return cnt;
|
||||
}
|
||||
|
||||
public I64 FileOcc(U8 *pattern,U8 *files_find_mask=FILENAME_MASK_TXT,U8 *fu_flags="+r+i+l")
|
||||
public I64 FileOcc(U8 *pattern,U8 *files_find_mask="*",U8 *fu_flags="+r+i+l")
|
||||
{/*
|
||||
"+r"=recurse
|
||||
"+i"=ignore case
|
||||
"+l"=whole labels only.
|
||||
"+lf"=only checks for label chars in front
|
||||
"+lb"=only checks for label chars behind (after).
|
||||
*/
|
||||
I64 cnt=0;
|
||||
Bool old_silent=Silent(TRUE);
|
||||
@@ -226,7 +212,7 @@ I64 GrepWiz()
|
||||
CGrep *g=CAlloc(sizeof(CGrep));
|
||||
I64 result=0;
|
||||
g->recurse=TRUE;
|
||||
StrCpy(g->filemask,FILENAME_MASK_TXT);
|
||||
StrCpy(g->filemask,FILEMASK_TXT);
|
||||
if (doc=DocPut) {
|
||||
StrCpy(g->find_text,doc->find_replace->find_text);
|
||||
StrCpy(g->replace_text,doc->find_replace->replace_text);
|
||||
@@ -234,7 +220,7 @@ I64 GrepWiz()
|
||||
g->match_case=doc->find_replace->match_case;
|
||||
g->whole_labels=doc->find_replace->whole_labels;
|
||||
}
|
||||
if (DocFormDo(g,"CGrep",0,"$$FG,PURPLE$$$$TX+CX,\"Grep\"$$\n$$FG$$")) {
|
||||
if (DocFormDo(g,,0,"$$FG,PURPLE$$$$TX+CX,\"Grep\"$$\n$$FG$$")) {
|
||||
if (doc) {
|
||||
StrCpy(doc->find_replace->find_text,g->find_text);
|
||||
StrCpy(doc->find_replace->replace_text,g->replace_text);
|
||||
@@ -252,9 +238,9 @@ I64 GrepWiz()
|
||||
if (g->whole_labels)
|
||||
StrCat(buf,"+l");
|
||||
if (g->replace)
|
||||
st=MSPrintF("\"$$$$WW+H,1$$$$\";Cd(\"%s\");Grep(\"%Q\",\"%Q\",\"%Q\",\"%Q\");UserTaskCont;",dir,g->find_text,g->filemask,buf,g->replace_text);
|
||||
st=MPrint("\"$$$$WW+H,1$$$$\";Cd(\"%s\");Grep(\"%Q\",\"%Q\",\"%Q\",\"%Q\");UserTaskCont;",dir,g->find_text,g->filemask,buf,g->replace_text);
|
||||
else
|
||||
st=MSPrintF("\"$$$$WW+H,1$$$$\";Cd(\"%s\");Grep(\"%Q\",\"%Q\",\"%Q\");UserTaskCont;",dir,g->find_text,g->filemask,buf);
|
||||
st=MPrint("\"$$$$WW+H,1$$$$\";Cd(\"%s\");Grep(\"%Q\",\"%Q\",\"%Q\");UserTaskCont;",dir,g->find_text,g->filemask,buf);
|
||||
result=PopUp(st);
|
||||
}
|
||||
Free(dir);
|
||||
|
||||
@@ -1,43 +1,37 @@
|
||||
#help_index "Utils;Cmd Line (Typically)"
|
||||
|
||||
I64 LineCntRepFiles(CDirEntry *tempm)
|
||||
I64 LineCntRepFiles(CDirEntry *tempde)
|
||||
{
|
||||
CDoc *doc;
|
||||
I64 result=0,i;
|
||||
while (tempm) {
|
||||
while (tempde) {
|
||||
i=0;
|
||||
if (tempm->attr&_ATTR_DIR)
|
||||
i=LineCntRepFiles(tempm->sub);
|
||||
if (tempde->attr&_ATTR_DIR)
|
||||
i=LineCntRepFiles(tempde->sub);
|
||||
else {
|
||||
if (FilesFindMatch(FILENAME_MASK_SRC,tempm->name)) {
|
||||
doc=DocRead(tempm->full_name);
|
||||
if (doc->root.next!=doc)
|
||||
i=doc->root.last->y+2;
|
||||
DocDel(doc);
|
||||
}
|
||||
doc=DocRead(tempde->full_name);
|
||||
if (doc->root.next!=doc)
|
||||
i=doc->root.last->y+2;
|
||||
DocDel(doc);
|
||||
}
|
||||
tempm->user_data=i;
|
||||
tempde->user_data=i;
|
||||
result+=i;
|
||||
tempm=tempm->next;
|
||||
tempde=tempde->next;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
U0 PutLineCntFiles(CDoc *doc,CDirEntry *tempm)
|
||||
U0 PutLineCntFiles(CDoc *doc,CDirEntry *tempde)
|
||||
{
|
||||
while (tempm) {
|
||||
if (tempm->attr&_ATTR_DIR) {
|
||||
DocPrintF(doc,"%8,d $$TR+C,\"%s\"$$\n$$ID,2$$",tempm->user_data,tempm->name);
|
||||
PutLineCntFiles(doc,tempm->sub);
|
||||
DocPutS(doc,"$$ID,-2$$");
|
||||
} else {
|
||||
if (FilesFindMatch(FILENAME_MASK_SRC,tempm->name)) {
|
||||
DocPrintF(doc,"%8,d ",tempm->user_data);
|
||||
DocPrintF(doc,"$$LK,\"%s\",\"FI:%s\"$$\n",
|
||||
tempm->name,tempm->full_name);
|
||||
}
|
||||
}
|
||||
tempm=tempm->next;
|
||||
while (tempde) {
|
||||
if (tempde->attr&_ATTR_DIR) {
|
||||
DocPrint(doc,"%8,d $$TR+C,\"%s\"$$\n$$ID,2$$",tempde->user_data,tempde->name);
|
||||
PutLineCntFiles(doc,tempde->sub);
|
||||
DocPrint(doc,"$$ID,-2$$");
|
||||
} else
|
||||
DocPrint(doc,"%8,d $$LK,\"%s\",\"FI:%s\"$$\n",
|
||||
tempde->user_data,tempde->name,tempde->full_name);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,49 +39,49 @@ public I64 LineCntRep(U8 *files_find_mask="/TempleOS/*",U8 *fu_flags=NULL)
|
||||
{
|
||||
I64 fuf_flags=0,result=0;
|
||||
CDoc *doc=DocNew;
|
||||
CDirEntry *tempm1=NULL;
|
||||
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
|
||||
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
if (tempm1=FilesFind(files_find_mask,fuf_flags)) {
|
||||
result=LineCntRepFiles(tempm1);
|
||||
DocPrintF(doc,"%8,d $$TR+C,\"%s\"$$\n$$ID,2$$",result,files_find_mask);
|
||||
PutLineCntFiles(doc,tempm1);
|
||||
DocPutS(doc,"$$ID,-2$$");
|
||||
CDirLstDel(tempm1);
|
||||
CDirEntry *tempde1=NULL;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+S");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
if (tempde1=FilesFind(files_find_mask,fuf_flags)) {
|
||||
result=LineCntRepFiles(tempde1);
|
||||
DocPrint(doc,"%8,d $$TR+C,\"%s\"$$\n$$ID,2$$",result,files_find_mask);
|
||||
PutLineCntFiles(doc,tempde1);
|
||||
DocPrint(doc,"$$ID,-2$$");
|
||||
DirLstDel(tempde1);
|
||||
}
|
||||
DocInsDoc(DocPut,doc);
|
||||
DocDel(doc);
|
||||
return result;
|
||||
}
|
||||
|
||||
I64 TreeSizeRepFiles(CDirEntry *tempm)
|
||||
I64 TreeSizeRepFiles(CDirEntry *tempde)
|
||||
{
|
||||
I64 result=0,i;
|
||||
while (tempm) {
|
||||
if (tempm->attr&_ATTR_DIR)
|
||||
i=TreeSizeRepFiles(tempm->sub);
|
||||
while (tempde) {
|
||||
if (tempde->attr&_ATTR_DIR)
|
||||
i=TreeSizeRepFiles(tempde->sub);
|
||||
else
|
||||
i=tempm->size;
|
||||
tempm->user_data=i;
|
||||
i=tempde->size;
|
||||
tempde->user_data=i;
|
||||
result+=i;
|
||||
tempm=tempm->next;
|
||||
tempde=tempde->next;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
U0 PutTreeSizeFiles(CDoc *doc,CDirEntry *tempm)
|
||||
U0 PutTreeSizeFiles(CDoc *doc,CDirEntry *tempde)
|
||||
{
|
||||
while (tempm) {
|
||||
if (tempm->attr&_ATTR_DIR) {
|
||||
DocPrintF(doc,"%10,d $$TR+C,\"%s\"$$\n$$ID,2$$",tempm->user_data,tempm->name);
|
||||
PutTreeSizeFiles(doc,tempm->sub);
|
||||
DocPutS(doc,"$$ID,-2$$");
|
||||
while (tempde) {
|
||||
if (tempde->attr&_ATTR_DIR) {
|
||||
DocPrint(doc,"%10,d $$TR+C,\"%s\"$$\n$$ID,2$$",tempde->user_data,tempde->name);
|
||||
PutTreeSizeFiles(doc,tempde->sub);
|
||||
DocPrint(doc,"$$ID,-2$$");
|
||||
} else {
|
||||
DocPrintF(doc,"%10,d ",tempm->user_data);
|
||||
DocPrintF(doc,"$$LK,\"%s\",\"FI:%s\"$$\n",
|
||||
tempm->name,tempm->full_name);
|
||||
DocPrint(doc,"%10,d ",tempde->user_data);
|
||||
DocPrint(doc,"$$LK,\"%s\",\"FI:%s\"$$\n",
|
||||
tempde->name,tempde->full_name);
|
||||
}
|
||||
tempm=tempm->next;
|
||||
tempde=tempde->next;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,15 +89,15 @@ public I64 TreeSizeRep(U8 *files_find_mask="/TempleOS/*",U8 *fu_flags=NULL)
|
||||
{
|
||||
I64 fuf_flags=0,result=0;
|
||||
CDoc *doc=DocNew;
|
||||
CDirEntry *tempm1=NULL;
|
||||
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
|
||||
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
if (tempm1=FilesFind(files_find_mask,fuf_flags)) {
|
||||
result=TreeSizeRepFiles(tempm1);
|
||||
DocPrintF(doc,"%10,d $$TR+C,\"%s\"$$\n$$ID,2$$",result,files_find_mask);
|
||||
PutTreeSizeFiles(doc,tempm1);
|
||||
DocPutS(doc,"$$ID,-2$$");
|
||||
CDirLstDel(tempm1);
|
||||
CDirEntry *tempde1=NULL;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
if (tempde1=FilesFind(files_find_mask,fuf_flags)) {
|
||||
result=TreeSizeRepFiles(tempde1);
|
||||
DocPrint(doc,"%10,d $$TR+C,\"%s\"$$\n$$ID,2$$",result,files_find_mask);
|
||||
PutTreeSizeFiles(doc,tempde1);
|
||||
DocPrint(doc,"$$ID,-2$$");
|
||||
DirLstDel(tempde1);
|
||||
}
|
||||
DocInsDoc(DocPut,doc);
|
||||
DocDel(doc);
|
||||
|
||||
@@ -44,31 +44,19 @@ I64 LinkChkFile(U8 *filename,I64 *_fuf_flags)
|
||||
return result;
|
||||
}
|
||||
|
||||
I64 LinkChkLst(CDirEntry *tempm1,I64 *_fuf_flags)
|
||||
{
|
||||
CDirEntry *tempm2;
|
||||
I64 result=0;
|
||||
while (tempm1 && !Bt(_fuf_flags,FUf_CANCEL)) {
|
||||
tempm2=tempm1->next;
|
||||
if (tempm1->attr & _ATTR_DIR) {
|
||||
if (tempm1->sub) {
|
||||
"%S %s\n","ST_SCANNING_DIR",tempm1->full_name;
|
||||
result+=LinkChkLst(tempm1->sub,_fuf_flags);
|
||||
}
|
||||
} else
|
||||
result+=LinkChkFile(tempm1->full_name,_fuf_flags);
|
||||
CDirEntryDel(tempm1);
|
||||
tempm1=tempm2;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 LinkChk(U8 *files_find_mask=FILENAME_MASK_TXT,U8 *fu_flags=NULL)
|
||||
public I64 LinkChk(U8 *files_find_mask="/TempleOS/*",U8 *fu_flags=NULL)
|
||||
//Checks for broken file links.
|
||||
{
|
||||
I64 fuf_flags=0;
|
||||
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+T");
|
||||
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
return LinkChkLst(FilesFind(files_find_mask,fuf_flags),&fuf_flags);
|
||||
I64 fuf_flags=0,result=0;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+T+f+F");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
||||
while (tempde && !Bt(&fuf_flags,FUf_CANCEL)) {
|
||||
result+=LinkChkFile(tempde->full_name,&fuf_flags);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirLstDel(tempde1);
|
||||
return result;
|
||||
}
|
||||
#help_index ""
|
||||
@@ -106,7 +106,7 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
|
||||
if (!override_validate && !TaskValidate(task))
|
||||
return FALSE;
|
||||
if (task==Fs)
|
||||
task->rsp=GetStkPtr;
|
||||
task->rsp=GetRSP;
|
||||
st=MStrUtil(task->task_title,SUF_REM_CTRL_CHARS|SUF_SAFE_DOLLAR);
|
||||
"$$FG,GREEN$$Task:%010X$$FG,CYAN$$ %-30ts$$FG$$\n$$ID,2$$",task,st;
|
||||
Free(st);
|
||||
@@ -199,14 +199,17 @@ public U0 MemRep()
|
||||
I64 i;
|
||||
CTask *task;
|
||||
CCPU *c;
|
||||
U32 *u32_ptr;
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
CBinFile *bfh=sys_boot_base-sizeof(CBinFile);
|
||||
bfh(I64)+=bfh->file_size-1;
|
||||
|
||||
"$$FG,BLACK$$Low Memory\t:0000100000$$FG$$\n$$ID,2$$";
|
||||
u32_ptr=SYS_BOOT_BASE;
|
||||
"Kernel\t:%010X-%010X\n",*u32_ptr-sizeof(CBinFile),bfh;
|
||||
"Kernel\t:%010X-%010X\n",sys_boot_base-sizeof(CBinFile),bfh;
|
||||
|
||||
i=++bfh(I64);
|
||||
bfh(I64)+=bfh->file_size-1;
|
||||
"Compiler\t:%010X-%010X\n",i,bfh;
|
||||
|
||||
"VGA\t\t:00000A0000-00000BFFFF\n";
|
||||
"$$ID,-2$$$$FG,BLACK$$High Memory\t:0000100000-%010X$$FG$$\n",
|
||||
sys_heap_limit;
|
||||
|
||||
@@ -10,30 +10,30 @@ CDirEntry MCMatchFind(CDirEntry *pattern,CDirEntry *lst)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
U0 MergeChkLst(CDirEntry *m1,CDirEntry *m2,I64 *_fuf_flags,I64 *_df_flags)
|
||||
U0 MergeChkLst(CDirEntry *tempde1,CDirEntry *tempde2,I64 *_fuf_flags,I64 *_df_flags)
|
||||
{
|
||||
I64 i;
|
||||
CDirEntry *tempm2;
|
||||
while (m1 && !(*_df_flags & DF_ABORT_ALL_FILES)) {
|
||||
tempm2=MCMatchFind(m1,m2);
|
||||
if (!tempm2)
|
||||
"$$FG,BROWN$$Does Not Exist:%s$$FG$$\n",m1->full_name;
|
||||
CDirEntry *tempde;
|
||||
while (tempde1 && !(*_df_flags & DF_ABORT_ALL_FILES)) {
|
||||
tempde=MCMatchFind(tempde1,tempde2);
|
||||
if (!tempde)
|
||||
"$$FG,BROWN$$Does Not Exist:%s$$FG$$\n",tempde1->full_name;
|
||||
else {
|
||||
if (m1->attr & _ATTR_DIR)
|
||||
MergeChkLst(m1->sub,tempm2->sub,_fuf_flags,_df_flags);
|
||||
if (tempde1->attr & _ATTR_DIR)
|
||||
MergeChkLst(tempde1->sub,tempde->sub,_fuf_flags,_df_flags);
|
||||
else {
|
||||
i=m1->datetime-tempm2->datetime;
|
||||
i=tempde1->datetime-tempde->datetime;
|
||||
if (AbsI64(i)>CDATE_FREQ*2) { //Filedates can shift due to conversion
|
||||
"" m1->full_name;
|
||||
"%s",tempde1->full_name;
|
||||
NewLine;
|
||||
if (Bt(_fuf_flags,FUf_DIFF)) {
|
||||
if (FilesFindMatch(FILENAME_MASK_TXT,m1->full_name))
|
||||
Diff(tempm2->full_name,m1->full_name,_df_flags);
|
||||
if (FilesFindMatch(tempde1->full_name,FILEMASK_TXT))
|
||||
Diff(tempde->full_name,tempde1->full_name,_df_flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m1=m1->next;
|
||||
tempde1=tempde1->next;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,48 +44,36 @@ public U0 MergeChk(
|
||||
//"+d"=Do $LK,"Diff","MN:Diff"$() on files
|
||||
{
|
||||
I64 df_flags=0,fuf_flags=0;
|
||||
CDirEntry *tempm1=NULL,*tempm2=NULL;
|
||||
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
|
||||
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
CDirEntry *tempde1=NULL,*tempde2=NULL;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
if (fuf_flags&~(FUG_FILES_FIND|FUF_DIFF))
|
||||
throw(EXCEPT_FUF,3);
|
||||
PrintFWarn("This is based strictly on file dates.\n");
|
||||
tempm1=FilesFind(src_files_find_mask,fuf_flags&FUG_FILES_FIND);
|
||||
tempm2=FilesFind(dst_files_find_mask,fuf_flags&FUG_FILES_FIND);
|
||||
PrintWarn("This is based strictly on file dates.\n");
|
||||
tempde1=FilesFind(src_files_find_mask,fuf_flags&FUG_FILES_FIND);
|
||||
tempde2=FilesFind(dst_files_find_mask,fuf_flags&FUG_FILES_FIND);
|
||||
fuf_flags&=FUF_DIFF;
|
||||
MergeChkLst(tempm1,tempm2,&fuf_flags,&df_flags);
|
||||
CDirLstDel(tempm1);
|
||||
CDirLstDel(tempm2);
|
||||
MergeChkLst(tempde1,tempde2,&fuf_flags,&df_flags);
|
||||
DirLstDel(tempde1);
|
||||
DirLstDel(tempde2);
|
||||
}
|
||||
|
||||
#help_index "Utils;Cmd Line (Typically)"
|
||||
|
||||
U0 LstNewFilesLst(CDirEntry *tempm,CDate cdt)
|
||||
{
|
||||
while (tempm) {
|
||||
if (tempm->datetime>cdt) {
|
||||
"" tempm->full_name;
|
||||
NewLine;
|
||||
}
|
||||
LstNewFilesLst(tempm->sub,cdt);
|
||||
tempm=tempm->next;
|
||||
}
|
||||
}
|
||||
|
||||
public U0 LstNewFiles(U8 *files_find_mask="/TempleOS/*",CDate cdt=0,
|
||||
U8 *fu_flags=NULL)
|
||||
//"+T"=is just text files
|
||||
{
|
||||
public U0 NewFiles(U8 *files_find_mask="/TempleOS/*",CDate cdt=0,U8 *fu_flags=NULL)
|
||||
{//List new files
|
||||
I64 fuf_flags=0;
|
||||
CDirEntry *tempm1=NULL;
|
||||
if (!cdt)
|
||||
cdt=sys_compile_time;
|
||||
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+T");
|
||||
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
if (tempm1=FilesFind(files_find_mask,fuf_flags)) {
|
||||
LstNewFilesLst(tempm1,cdt);
|
||||
CDirLstDel(tempm1);
|
||||
CDirEntry *tempde,*tempde1;
|
||||
if (!cdt) cdt=sys_compile_time;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
||||
while (tempde) {
|
||||
if (tempde->datetime>cdt)
|
||||
"%s\n",tempde->full_name;
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirLstDel(tempde1);
|
||||
}
|
||||
|
||||
#help_index ""
|
||||
@@ -123,7 +123,7 @@ public U0 ProfRep(I64 filter_cnt=1)
|
||||
*last_buf=0;
|
||||
for (i=0;i<pf_size;i++) {
|
||||
ip=pf_low+i*(pf_high-pf_low)/pf_size;
|
||||
SPrintF(buf,"%P",ip);
|
||||
SPrint(buf,"%P",ip);
|
||||
StrCpy(buf3,buf);
|
||||
StrFirstRem(buf3,"+",buf2);
|
||||
if (StrCmp(buf2,last_buf)) {
|
||||
@@ -164,7 +164,7 @@ public U0 ProfRep(I64 filter_cnt=1)
|
||||
i++;
|
||||
if (i>=pf_ptr) break;
|
||||
}
|
||||
SPrintF(buf,"%P",ip);
|
||||
SPrint(buf,"%P",ip);
|
||||
StrCpy(buf3,buf);
|
||||
StrFirstRem(buf3,"+",buf2);
|
||||
if (StrCmp(buf2,last_buf)) {
|
||||
|
||||
+14
-24
@@ -2,7 +2,7 @@
|
||||
|
||||
//$LK,"StrUtil","MN:StrUtil"$() operations on files
|
||||
|
||||
public U0 SUFile(U8 *name,I64 su_flags,F64 indent_scale_factor)
|
||||
U0 SUFile(U8 *name,I64 suf_flags,F64 indent_scale_factor)
|
||||
{//String utility on a single file
|
||||
//See $LK,"SU Flags","MN:SUF_SINGLE_SPACE"$
|
||||
U8 *dst;
|
||||
@@ -12,7 +12,7 @@ public U0 SUFile(U8 *name,I64 su_flags,F64 indent_scale_factor)
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
if (doc_e->type_u8==DOCT_TEXT) {
|
||||
dst=MStrUtil(doc_e->tag,su_flags,indent_scale_factor);
|
||||
dst=MStrUtil(doc_e->tag,suf_flags,indent_scale_factor);
|
||||
if (StrCmp(dst,doc_e->tag)) {
|
||||
reduced+=StrLen(doc_e->tag)-StrLen(dst);
|
||||
chged=TRUE;
|
||||
@@ -31,38 +31,28 @@ public U0 SUFile(U8 *name,I64 su_flags,F64 indent_scale_factor)
|
||||
DocDel(doc);
|
||||
}
|
||||
|
||||
U0 SULst(CDirEntry *tempm1,I64 su_flags,F64 indent_scale_factor)
|
||||
{
|
||||
CDirEntry *tempm2;
|
||||
while (tempm1) {
|
||||
tempm2=tempm1->next;
|
||||
if (tempm1->attr & _ATTR_DIR) {
|
||||
if (tempm1->sub) {
|
||||
"%S%s\n","ST_SCANNING_DIR",tempm1->full_name;
|
||||
SULst(tempm1->sub,su_flags,indent_scale_factor);
|
||||
}
|
||||
} else
|
||||
SUFile(tempm1->full_name,su_flags,indent_scale_factor);
|
||||
CDirEntryDel(tempm1);
|
||||
tempm1=tempm2;
|
||||
}
|
||||
}
|
||||
|
||||
public U0 SU(U8 *files_find_mask,I64 su_flags,U8 *fu_flags=NULL,F64 indent_scale_factor=0)
|
||||
public U0 SU(U8 *files_find_mask,I64 suf_flags,U8 *fu_flags=NULL,F64 indent_scale_factor=0)
|
||||
{//Apply string utilities to files
|
||||
//You can convert spaces to tabs, for example
|
||||
//or removing trailing spaces on lines.
|
||||
//See $LK,"SU Flags","MN:SUF_SINGLE_SPACE"$
|
||||
//See $LK,"SUF Flags","MN:SUF_SINGLE_SPACE"$
|
||||
I64 fuf_flags=0;
|
||||
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
SULst(FilesFind(files_find_mask,fuf_flags),su_flags,indent_scale_factor);
|
||||
CDirEntry *tempde,*tempde1;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+f+F+T");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
||||
while (tempde) {
|
||||
SUFile(tempde->full_name,suf_flags,indent_scale_factor);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirLstDel(tempde1);
|
||||
}
|
||||
|
||||
public U0 S2T(U8 *files_find_mask,U8 *fu_flags=NULL)
|
||||
{
|
||||
//Spaces to tabs.
|
||||
//Use "Hard Space" (SHIFT-SPACE) for spaces
|
||||
//in string constants in your code.
|
||||
//in string consts in your code.
|
||||
SU(files_find_mask,SUF_S2T|SUF_REM_TRAILING,fu_flags);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ U0 HtmlPutS(CDoc *doc,I64 c,I64 *_old_c,U8 *st,I64 *_col,U8 *style_bitmap=NULL)
|
||||
U8 *ch;
|
||||
if (c!=*_old_c) {
|
||||
if (*_old_c!=-1)
|
||||
DocPutS(doc,"</span>");
|
||||
DocPrintF(doc,"<span class=c%02X>",c);
|
||||
DocPrint(doc,"</span>");
|
||||
DocPrint(doc,"<span class=c%02X>",c);
|
||||
*_old_c=c;
|
||||
if (style_bitmap)
|
||||
LBts(style_bitmap,c);
|
||||
@@ -22,54 +22,54 @@ U0 HtmlPutS(CDoc *doc,I64 c,I64 *_old_c,U8 *st,I64 *_col,U8 *style_bitmap=NULL)
|
||||
} while (*_col&7);
|
||||
break;
|
||||
case '&':
|
||||
DocPutS(doc,"&");
|
||||
DocPrint(doc,"&");
|
||||
*_col=*_col+1;
|
||||
break;
|
||||
case '<':
|
||||
DocPutS(doc,"<");
|
||||
DocPrint(doc,"<");
|
||||
*_col=*_col+1;
|
||||
break;
|
||||
case '>':
|
||||
DocPutS(doc,">");
|
||||
DocPrint(doc,">");
|
||||
*_col=*_col+1;
|
||||
break;
|
||||
case '"':
|
||||
DocPutS(doc,""");
|
||||
DocPrint(doc,""");
|
||||
*_col=*_col+1;
|
||||
break;
|
||||
case 'ã':
|
||||
DocPutS(doc,"pi");
|
||||
DocPrint(doc,"pi");
|
||||
*_col=*_col+1;
|
||||
break;
|
||||
case 'é':
|
||||
DocPutS(doc,"theta");
|
||||
DocPrint(doc,"theta");
|
||||
*_col=*_col+1;
|
||||
break;
|
||||
case 'è':
|
||||
DocPutS(doc,"phi");
|
||||
DocPrint(doc,"phi");
|
||||
*_col=*_col+1;
|
||||
break;
|
||||
case 'ê':
|
||||
DocPutS(doc,"omega");
|
||||
DocPrint(doc,"omega");
|
||||
*_col=*_col+1;
|
||||
break;
|
||||
case 'ì':
|
||||
DocPutS(doc,"inf");
|
||||
DocPrint(doc,"inf");
|
||||
*_col=*_col+1;
|
||||
break;
|
||||
case 'æ':
|
||||
DocPutS(doc,"u");
|
||||
DocPrint(doc,"u");
|
||||
*_col=*_col+1;
|
||||
break;
|
||||
case CH_SHIFT_SPACE:
|
||||
DocPutS(doc," ");
|
||||
DocPrint(doc," ");
|
||||
*_col=*_col+1;
|
||||
break;
|
||||
default:
|
||||
if (CH_SPACE<=ch<0x7F || ch=='\n')
|
||||
DocPutKey(doc,ch,0);
|
||||
else
|
||||
DocPutS(doc,".");
|
||||
DocPrint(doc,".");
|
||||
*_col=*_col+1;
|
||||
}
|
||||
}
|
||||
@@ -82,7 +82,7 @@ U8 *TSLinkCvt2(U8 *filename,I64 line_num)
|
||||
if (filename) {
|
||||
st=ChgExt(filename,"html");
|
||||
if (st && StrLen(st)>12 && !StrNCmp(st+1,":/TempleOS/",11))
|
||||
result=MSPrintF("http://www.templeos.org/Wb/%s#l%d",st+12,line_num);
|
||||
result=MPrint("http://www.templeos.org/Wb/%s#l%d",st+12,line_num);
|
||||
Free(st);
|
||||
}
|
||||
return result;
|
||||
@@ -152,7 +152,7 @@ public CDoc *Doc2Html(CDoc *doc_in,
|
||||
if (!html_header) html_header="";
|
||||
if (!body_header) body_header="";
|
||||
if (!body_footer) body_footer="";
|
||||
DocPrintF(doc_out,
|
||||
DocPrint(doc_out,
|
||||
"<!DOCTYPE HTML>\n"
|
||||
"<html>\n"
|
||||
"<head>\n"
|
||||
@@ -161,12 +161,12 @@ public CDoc *Doc2Html(CDoc *doc_in,
|
||||
"<meta name=\"generator\" content=\"TempleOS V%4.2f\">\n"
|
||||
"<style type=\"text/css\">\n",html_header,os_version);
|
||||
style=doc_out->cur_entry->last;
|
||||
DocPutS(doc_out,
|
||||
DocPrint(doc_out,
|
||||
"</style>\n"
|
||||
"</head>\n"
|
||||
"<body>\n"
|
||||
"<pre style=\"font-family:courier;font-size:10pt\">\n");
|
||||
DocPutS(doc_out,body_header);
|
||||
DocPrint(doc_out,"%s",body_header);
|
||||
|
||||
doc_e=doc_in->root.next;
|
||||
s=DocSettingsLast(doc_e);
|
||||
@@ -176,14 +176,14 @@ public CDoc *Doc2Html(CDoc *doc_in,
|
||||
while (doc_e!=doc_in) {
|
||||
if (!(doc_e->flags1&(DOCEF1_SKIP|DOCEF1_HARD_SKIP))) {
|
||||
if (line_anchors && y!=old_y) {
|
||||
DocPrintF(doc_out,"<a name=\"l%d\"></a>",y+1);
|
||||
DocPrint(doc_out,"<a name=\"l%d\"></a>",y+1);
|
||||
old_y=y;
|
||||
}
|
||||
while (y<doc_e->y) {
|
||||
HtmlPutS(doc_out,cur_u8_attr,&old_c,"\n",&col,style_bitmap);
|
||||
y++;
|
||||
if (line_anchors && y!=old_y) {
|
||||
DocPrintF(doc_out,"<a name=\"l%d\"></a>",y+1);
|
||||
DocPrint(doc_out,"<a name=\"l%d\"></a>",y+1);
|
||||
old_y=y;
|
||||
}
|
||||
col=0;
|
||||
@@ -212,10 +212,10 @@ public CDoc *Doc2Html(CDoc *doc_in,
|
||||
|
||||
if (link_st) {
|
||||
if (old_c!=-1) {
|
||||
DocPutS(doc_out,"</span>");
|
||||
DocPrint(doc_out,"</span>");
|
||||
old_c=-1;
|
||||
}
|
||||
DocPrintF(doc_out,"<a href=\"%s\">",link_st);
|
||||
DocPrint(doc_out,"<a href=\"%s\">",link_st);
|
||||
}
|
||||
|
||||
if (doc_e->settings)
|
||||
@@ -239,17 +239,17 @@ public CDoc *Doc2Html(CDoc *doc_in,
|
||||
break;
|
||||
case DOCT_HTML_IMG:
|
||||
if (old_c!=-1) {
|
||||
DocPutS(doc_out,"</span>");
|
||||
DocPrint(doc_out,"</span>");
|
||||
old_c=-1;
|
||||
}
|
||||
DocPrintF(doc_out,"<img src=\"%s\" width=\"640\" height=\"480\" alt=\"\">\n",doc_e->tag);
|
||||
DocPrint(doc_out,"<img src=\"%s\" width=\"640\" height=\"480\" alt=\"\">\n",doc_e->tag);
|
||||
break;
|
||||
case DOCT_HTML_VIDEO:
|
||||
if (old_c!=-1) {
|
||||
DocPutS(doc_out,"</span>");
|
||||
DocPrint(doc_out,"</span>");
|
||||
old_c=-1;
|
||||
}
|
||||
DocPrintF(doc_out,
|
||||
DocPrint(doc_out,
|
||||
"<!--begin exclude-->\n"
|
||||
"<object classid=\"clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95\" "
|
||||
"codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab\" "
|
||||
@@ -270,10 +270,10 @@ public CDoc *Doc2Html(CDoc *doc_in,
|
||||
break;
|
||||
case DOCT_HTML_CODE:
|
||||
if (old_c!=-1) {
|
||||
DocPutS(doc_out,"</span>");
|
||||
DocPrint(doc_out,"</span>");
|
||||
old_c=-1;
|
||||
}
|
||||
DocPutS(doc_out,doc_e->tag);
|
||||
DocPrint(doc_out,"%s",doc_e->tag);
|
||||
break;
|
||||
case DOCT_SPRITE:
|
||||
HtmlPutS(doc_out,cur_u8_attr,&old_c,doc_e->tag,&col,style_bitmap);
|
||||
@@ -285,10 +285,10 @@ public CDoc *Doc2Html(CDoc *doc_in,
|
||||
}
|
||||
if (link_st) {
|
||||
if (old_c!=-1) {
|
||||
DocPutS(doc_out,"</span>");
|
||||
DocPrint(doc_out,"</span>");
|
||||
old_c=-1;
|
||||
}
|
||||
DocPutS(doc_out,"</a>");
|
||||
DocPrint(doc_out,"</a>");
|
||||
Free(link_st);
|
||||
}
|
||||
}
|
||||
@@ -300,16 +300,16 @@ public CDoc *Doc2Html(CDoc *doc_in,
|
||||
col=0;
|
||||
}
|
||||
if (old_c!=-1) {
|
||||
DocPutS(doc_out,"</span>");
|
||||
DocPrint(doc_out,"</span>");
|
||||
old_c=-1;
|
||||
}
|
||||
DocPutS(doc_out,body_footer);
|
||||
DocPutS(doc_out,"</pre></body>\n</html>\n");
|
||||
DocPrint(doc_out,"%s",body_footer);
|
||||
DocPrint(doc_out,"</pre></body>\n</html>\n");
|
||||
|
||||
doc_out->cur_entry=style->next;
|
||||
for (i=0;i<256;i++)
|
||||
if (Bt(style_bitmap,i))
|
||||
DocPrintF(doc_out,".c%02X{color:#%02x%02x%02x;background-color:#%02x%02x%02x;}\n",i,p[i&15].r,p[i&15].g,p[i&15].b,p[i/16].r,p[i/16].g,p[i/16].b);
|
||||
DocPrint(doc_out,".c%02X{color:#%02x%02x%02x;background-color:#%02x%02x%02x;}\n",i,p[i&15].r,p[i&15].g,p[i&15].b,p[i/16].r,p[i/16].g,p[i/16].b);
|
||||
doc_out->cur_entry=&doc_out->root;
|
||||
DocRecalc(doc_out);
|
||||
|
||||
|
||||
@@ -12,38 +12,38 @@ U0 TXTPutS(CDoc *doc,U8 *st,I64 *_col)
|
||||
} while (*_col&7);
|
||||
break;
|
||||
case 'ă':
|
||||
DocPutS(doc,"pi");
|
||||
DocPrint(doc,"pi");
|
||||
*_col=*_col+1;
|
||||
break;
|
||||
case 'é':
|
||||
DocPutS(doc,"theta");
|
||||
DocPrint(doc,"theta");
|
||||
*_col=*_col+1;
|
||||
break;
|
||||
case 'č':
|
||||
DocPutS(doc,"phi");
|
||||
DocPrint(doc,"phi");
|
||||
*_col=*_col+1;
|
||||
break;
|
||||
case 'ę':
|
||||
DocPutS(doc,"omega");
|
||||
DocPrint(doc,"omega");
|
||||
*_col=*_col+1;
|
||||
break;
|
||||
case 'ě':
|
||||
DocPutS(doc,"inf");
|
||||
DocPrint(doc,"inf");
|
||||
*_col=*_col+1;
|
||||
break;
|
||||
case 'ć':
|
||||
DocPutS(doc,"u");
|
||||
DocPrint(doc,"u");
|
||||
*_col=*_col+1;
|
||||
break;
|
||||
case CH_SHIFT_SPACE:
|
||||
DocPutS(doc," ");
|
||||
DocPrint(doc," ");
|
||||
*_col=*_col+1;
|
||||
break;
|
||||
default:
|
||||
if (CH_SPACE<=ch<0x7F || ch=='\n')
|
||||
DocPutKey(doc,ch,0);
|
||||
else
|
||||
DocPutS(doc,".");
|
||||
DocPrint(doc,".");
|
||||
*_col=*_col+1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,8 +408,8 @@ public Bool HeapWalk(CTask *task=NULL)
|
||||
U0 TaskRepTask(CTask *task,I64 indent)
|
||||
{
|
||||
CTask *task1;
|
||||
U8 *st,*desc=MSPrintF("%q",task->task_title);
|
||||
st=MSPrintF("$$MA+A,\"%08X\",\"Kill(0x%X);\n\",$$",task,task,task);
|
||||
U8 *st,*desc=MPrint("%q",task->task_title);
|
||||
st=MPrint("$$MA+A,\"%08X\",\"Kill(0x%X);\n\",$$",task,task,task);
|
||||
Spaces(indent);
|
||||
"%s $$TX+SCX,\"%Q...\",16$$ Mem:%08X\n",
|
||||
st,desc,TaskAllocatedMem(task);
|
||||
|
||||
Binary file not shown.
+17
-17
@@ -78,10 +78,10 @@ U0 DrawProgressBars(CDC *dc)
|
||||
if (*sys_progresses[i].desc)
|
||||
st=StrNew(sys_progresses[i].desc);
|
||||
else
|
||||
st=MSPrintF("%d/%d",n,m);
|
||||
GrPutS(dc,(GR_WIDTH-FONT_WIDTH*StrLen(st))/2,
|
||||
st=MPrint("%d/%d",n,m);
|
||||
GrPrint(dc,(GR_WIDTH-FONT_WIDTH*StrLen(st))/2,
|
||||
(GR_HEIGHT-FONT_HEIGHT-
|
||||
(NUM_PROGRESS_BARS*2-2-i*4)*PROGRESS_BAR_HEIGHT)/2,st);
|
||||
(NUM_PROGRESS_BARS*2-2-i*4)*PROGRESS_BAR_HEIGHT)/2,"%s",st);
|
||||
Free(st);
|
||||
}
|
||||
}
|
||||
@@ -126,21 +126,21 @@ U0 ExtendedASCII()
|
||||
{
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
DocPutS(doc,"Select Char and Press <ESC>\n$$FG,LTBLUE$$");
|
||||
DocPrint(doc,"Select Char and Press <ESC>\n$$FG,LTBLUE$$");
|
||||
for (i=0;i<256;i++) {
|
||||
if (i>=CH_SHIFT_SPACE && i!=127) {
|
||||
if (i==CH_SHIFT_SPACE)
|
||||
DocPrintF(doc,"$$MU-X-UL,\"\\37\",%d$$",i);
|
||||
DocPrint(doc,"$$MU-X-UL,\"\\37\",%d$$",i);
|
||||
else if (i=='$$')
|
||||
DocPrintF(doc,"$$MU-X-UL,\"\\44\",%d$$",i);
|
||||
DocPrint(doc,"$$MU-X-UL,\"\\44\",%d$$",i);
|
||||
else if (i=='\"'||i=='\\')
|
||||
DocPrintF(doc,"$$MU-X-UL,\"\\%c\",%d$$",i,i);
|
||||
DocPrint(doc,"$$MU-X-UL,\"\\%c\",%d$$",i,i);
|
||||
else
|
||||
DocPrintF(doc,"$$MU-X-UL,\"%c\",%d$$",i,i);
|
||||
DocPrint(doc,"$$MU-X-UL,\"%c\",%d$$",i,i);
|
||||
} else
|
||||
DocPutS(doc," ");
|
||||
DocPrint(doc," ");
|
||||
if (i&15==15)
|
||||
DocPutS(doc,"\n");
|
||||
DocPrint(doc,"\n");
|
||||
}
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
@@ -1061,7 +1061,7 @@ U0 WinMgrTask(I64)
|
||||
CDocEntry *doc_e;
|
||||
I64 x,y,z,msg_code,
|
||||
my_ipz=0,left,top,
|
||||
old_flags=GetFlags;
|
||||
old_flags=GetRFlags;
|
||||
Bool has_border;
|
||||
CCtrl *c;
|
||||
TaskInitExt;
|
||||
@@ -1087,13 +1087,13 @@ wmt_start:
|
||||
while (TRUE) {
|
||||
Cli;
|
||||
if (!TaskValidate(task)) {
|
||||
SetFlags(old_flags);
|
||||
SetRFlags(old_flags);
|
||||
goto wmt_start;
|
||||
}
|
||||
WinChkMoveSize(task);
|
||||
TaskDerivedValsUpdate(task,FALSE);
|
||||
task=task->last_task;
|
||||
SetFlags(old_flags);
|
||||
SetRFlags(old_flags);
|
||||
if (task==Fs)
|
||||
break;
|
||||
}
|
||||
@@ -1103,21 +1103,21 @@ wmt_start:
|
||||
while (TRUE) {
|
||||
Cli;
|
||||
if (!TaskValidate(task)) {
|
||||
SetFlags(old_flags);
|
||||
SetRFlags(old_flags);
|
||||
goto wmt_start;
|
||||
}
|
||||
if (Bt(&task->display_flags,DISPLAYf_SHOW) &&
|
||||
task->win_border_pixel_left<=ipx<=task->win_border_pixel_right &&
|
||||
task->win_border_pixel_top<=ipy<=task->win_border_pixel_bottom) {
|
||||
SetFlags(old_flags);
|
||||
SetRFlags(old_flags);
|
||||
break;
|
||||
}
|
||||
if (task==Fs) { //Shouldn't happen
|
||||
SetFlags(old_flags);
|
||||
SetRFlags(old_flags);
|
||||
goto wmt_start;
|
||||
}
|
||||
task=task->last_task;
|
||||
SetFlags(old_flags);
|
||||
SetRFlags(old_flags);
|
||||
}
|
||||
|
||||
if (Bt(&task->display_flags,DISPLAYf_NO_BORDER))
|
||||
|
||||
@@ -188,9 +188,9 @@ U0 WSDDictWordsAdd(CDoc *doc,U8 *st=NULL)
|
||||
if (*ptr++!=WSD_WORD_CHAR)
|
||||
break;
|
||||
if (i)
|
||||
DocPutS(doc,"\n");
|
||||
DocPrint(doc,"\n");
|
||||
wsd_fillins[i]=ptr-1;
|
||||
DocPrintF(doc," '%d' %s",i,ptr);
|
||||
DocPrint(doc," '%d' %s",i,ptr);
|
||||
ptr+=StrLen(ptr)+3;
|
||||
}
|
||||
wsd_num_fillins=i;
|
||||
@@ -218,7 +218,7 @@ public U0 WSDDisplayDefs(CDoc *doc,U8 *st,I64 num=-1)
|
||||
if (!st) return;
|
||||
if (*st==WSD_WORD_CHAR)
|
||||
st++;
|
||||
DocPrintF(doc,"$$WW,1$$$$FG,RED$$%s:$$FG$$\n\n",st);
|
||||
DocPrint(doc,"$$WW,1$$$$FG,RED$$%s:$$FG$$\n\n",st);
|
||||
if (num<0) {
|
||||
if (st3=WSDGetWord(st)) {
|
||||
st2=st3;
|
||||
@@ -227,17 +227,17 @@ public U0 WSDDisplayDefs(CDoc *doc,U8 *st,I64 num=-1)
|
||||
case WSD_WORD_CHAR:
|
||||
break;
|
||||
case WSD_DEF_CHAR:
|
||||
DocPrintF(doc,"$$FG,GREEN$$(%d)$$FG$$ %s\n",
|
||||
DocPrint(doc,"$$FG,GREEN$$(%d)$$FG$$ %s\n",
|
||||
++i,st2);
|
||||
break;
|
||||
case WSD_PRONUNCIATION_CHAR:
|
||||
DocPrintF(doc,"$$FG,LTGREEN$$%s$$FG$$\n",st2);
|
||||
DocPrint(doc,"$$FG,LTGREEN$$%s$$FG$$\n",st2);
|
||||
break;
|
||||
case WSD_POS_CHAR:
|
||||
DocPrintF(doc,"$$FG,BLACK$$%s$$FG$$\n",st2);
|
||||
DocPrint(doc,"$$FG,BLACK$$%s$$FG$$\n",st2);
|
||||
break;
|
||||
case WSD_EXTRA_CHAR:
|
||||
DocPrintF(doc,"$$FG,LTBLUE$$%s$$FG$$\n",st2);
|
||||
DocPrint(doc,"$$FG,LTBLUE$$%s$$FG$$\n",st2);
|
||||
break;
|
||||
}
|
||||
st2+=StrLen(st2)+1;
|
||||
@@ -247,7 +247,7 @@ public U0 WSDDisplayDefs(CDoc *doc,U8 *st,I64 num=-1)
|
||||
} else {
|
||||
while (st2=WSDGetDef(st,++i)) {
|
||||
if (i==num)
|
||||
DocPrintF(doc,"$$FG,GREEN$$(%d)$$FG$$ %s\n",
|
||||
DocPrint(doc,"$$FG,GREEN$$(%d)$$FG$$ %s\n",
|
||||
i,st2);
|
||||
Free(st2);
|
||||
}
|
||||
@@ -257,7 +257,7 @@ public U0 WSDDisplayDefs(CDoc *doc,U8 *st,I64 num=-1)
|
||||
U0 WSDPopUpDef(U8 *st,I64 num=-1,CTask *parent=NULL)
|
||||
{
|
||||
U8 *buf;
|
||||
buf=MSPrintF("WSDDisplayDefs(DocPut,\"%s\",%d);View;",st,num);
|
||||
buf=MPrint("WSDDisplayDefs(DocPut,\"%s\",%d);View;",st,num);
|
||||
PopUp(buf,parent);
|
||||
Free(buf);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ I64 WSDNextCmd(U8 **_ptr)
|
||||
if (!(ch=*ptr2++)) goto ncmd_done;
|
||||
} while (ch!='>');
|
||||
*--ptr2=0;
|
||||
result=LstEntryMatch(ptr,"h1\0/h1\0def\0/def\0hw\0/hw\0tt\0/tt\0"
|
||||
result=LstMatch(ptr,"h1\0/h1\0def\0/def\0hw\0/hw\0tt\0/tt\0"
|
||||
"ety\0@fld\0@cd\0@blockquote\0@wordforms\0@note\0@altname\0@chform\0@cref\0@syn\0"
|
||||
"/ety\0@/fld\0@/cd\0@/blockquote\0@/wordforms\0@/note\0@/altname\0@/chform\0@/cref\0@/syn\0");
|
||||
*ptr2++='>';
|
||||
|
||||
@@ -415,7 +415,7 @@ U0 WSMan(I64 n,CTask *parent_task=NULL)
|
||||
if (tempw=ws_sorted_words[ws_fillin_matches[n]]) {
|
||||
if (temph=HashFind(tempw->str,Fs->hash_table,HTG_SRC_SYM)) {
|
||||
if (temph->src_link) {
|
||||
buf=MSPrintF("Ed(\"%s\");",temph->src_link);
|
||||
buf=MPrint("Ed(\"%s\");",temph->src_link);
|
||||
Preempt(old_preempt);
|
||||
PopUp(buf,parent_task);
|
||||
Free(buf);
|
||||
@@ -460,7 +460,7 @@ U0 WSPutChoices(CDoc *focus_l,CDocEntry *doc_e,CTask *focus_task)
|
||||
CHashSrcSym *temph;
|
||||
CDoc *doc=DocPut;
|
||||
|
||||
src=DocGetLine(focus_l,doc_e,&data_col);
|
||||
src=DocScanLine(focus_l,doc_e,&data_col);
|
||||
DocUnlock(focus_l);
|
||||
i=StrLen(src);
|
||||
buf =MAlloc(MaxI64(i+1,256));
|
||||
@@ -504,7 +504,7 @@ pc_done:
|
||||
Fs->text_attr=LTBLUE<<4+WHITE;
|
||||
Fs->border_src =BDS_CONST;
|
||||
Fs->border_attr=LTBLUE<<4+BLACK;
|
||||
DocPrintF(doc,"Word:%s\n",ws_cur_word);
|
||||
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;
|
||||
@@ -514,7 +514,7 @@ pc_done:
|
||||
temph->type&HTT_DEFINE_STR && temph(CHashDefineStr *)->caller)
|
||||
ch='*';
|
||||
}
|
||||
DocPrintF(doc,"%cF%02d %s\n",ch,i+1,st);
|
||||
DocPrint(doc,"%cF%02d %s\n",ch,i+1,st);
|
||||
}
|
||||
WSDDictWordsAdd(doc);
|
||||
|
||||
@@ -534,7 +534,7 @@ U0 WSTask(I64)
|
||||
CDocEntry *doc_e;
|
||||
TaskInitExt;
|
||||
UseTermDoc;
|
||||
SetWinHorz(50,Fs->win_right);
|
||||
SetWinHorz(51,Fs->win_right);
|
||||
LBts(&Fs->display_flags,DISPLAYf_WIN_ON_TOP);
|
||||
do {
|
||||
Sleep(333);
|
||||
@@ -572,13 +572,13 @@ U0 WSMainFileLstTraverse(U8 *files_find_mask,I64 pass)
|
||||
U8 *buf;
|
||||
try {
|
||||
flst=FilesOrder(FilesFind(files_find_mask,
|
||||
FUF_RECURSE|FUF_JUST_TXT_FILES|FUF_JUST_FILES|FUF_FLATTEN_TREE),&cnt);
|
||||
FUF_RECURSE|FUF_JUST_TXT|FUF_JUST_FILES),&cnt);
|
||||
for (i=0;i<cnt;i++) {
|
||||
"%s\n",flst[i]->full_name;
|
||||
buf=TextFileRead(flst[i]->full_name);
|
||||
WSSingleFileAdd(buf,pass);
|
||||
Free(buf);
|
||||
CDirEntryDel(flst[i]);
|
||||
DirEntryDel(flst[i]);
|
||||
}
|
||||
} catch
|
||||
Fs->catch_except=TRUE;
|
||||
|
||||
Reference in new issue
Block a user