LTCD_070816.ISO
This commit is contained in:
1 parent
d14bbc24f9
commit
0e9364ff4c
506 files changed
+157705
-41812
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,473 @@
|
||||
#help_index "Install"
|
||||
|
||||
#define BOOT_BIC "Boot.BIC"
|
||||
#define BOOT_DIR "/0000Boot"
|
||||
#define BOOT1_BIC "/0000Boot/Boot.BIC"
|
||||
#define BOOT_LOADER_BIC "/0000Boot/BootLoader.BIC"
|
||||
#define OLD_BOOT_BIC "/0000Boot/OldMBR.BIC"
|
||||
#define CD_BOOT "/0000Boot/CDBoot.BIZ"
|
||||
|
||||
if (DriveIsWritable) {
|
||||
CompileFile("BootHD");
|
||||
CompileFile("BootMHD");
|
||||
CompileFile("BootMHD2");
|
||||
CompileFile("BootFD");
|
||||
CompileFile("BootCD");
|
||||
}
|
||||
|
||||
Load("BootHD",TRUE);
|
||||
Load("BootMHD",TRUE);
|
||||
Load("BootMHD2",TRUE);
|
||||
Load("BootFD",TRUE);
|
||||
Load("BootCD",TRUE);
|
||||
|
||||
#help_index "Install;File/Install Related;File/CD DVD"
|
||||
public BoolU8 CreateCdBootFile()
|
||||
{
|
||||
U1 *br;
|
||||
U8 d,size;
|
||||
U2 *ww;
|
||||
|
||||
LTFile *f=FOpen(BOOT1_BIC,"r");
|
||||
size=FSize(f);
|
||||
FClose(f);
|
||||
|
||||
br=MAllocZ(CD_BLK_SIZE);
|
||||
|
||||
ww=BCD_BLK_CNT+1;
|
||||
*ww=1+(size+CD_BLK_SIZE-1)/CD_BLK_SIZE;
|
||||
|
||||
d=CD_FILE_OFFSET+4<<1;
|
||||
ww=BCD_BLK_LO+1;
|
||||
*ww=d/(CD_BLK_SIZE>>BLK_SIZE_BITS);
|
||||
ww=BCD_BLK_HI+1;
|
||||
*ww=(d/(CD_BLK_SIZE>>BLK_SIZE_BITS))>>16;
|
||||
|
||||
ww=BCD_JMP_START;
|
||||
*ww=(d%(CD_BLK_SIZE>>BLK_SIZE_BITS))<<BLK_SIZE_BITS;
|
||||
MemCpy(br,BCD_START,BCD_END-BCD_START);
|
||||
|
||||
WriteFile(CD_BOOT,br,CD_BLK_SIZE);
|
||||
Free(br);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (DriveIsWritable)
|
||||
CreateCdBootFile;
|
||||
|
||||
#help_index "Boot"
|
||||
|
||||
public void Boot(I1 *filename)
|
||||
//Warm Reboot (no hardware reset)
|
||||
//Specify the OSMain binary file you
|
||||
//wish to boot.
|
||||
{
|
||||
U8 size;
|
||||
OsMainStruct *hi_image=ReadFile(filename,&size),
|
||||
*lo_image=sys_boot_base-sizeof(BinFileHeaderStruct),
|
||||
*shutdown=MAlloc(SYS_SHUTDOWN_CPU_END-SYS_SHUTDOWN_CPU);
|
||||
hi_image->boot_base=lo_image+sizeof(BinFileHeaderStruct);
|
||||
hi_image->header_base=lo_image+hi_image->h.header_offset;
|
||||
hi_image->boot_code=BOOT_CODE_RAM;
|
||||
hi_image->sys_memblks=lo_image->sys_memblks;
|
||||
|
||||
Cli;
|
||||
if (mp_cnt>1) {
|
||||
MPHalt;
|
||||
BusyWait(10000);
|
||||
}
|
||||
|
||||
MemCpy(shutdown,SYS_SHUTDOWN_CPU,SYS_SHUTDOWN_CPU_END-SYS_SHUTDOWN_CPU);
|
||||
MemCpy(&hi_image->gdttab,&lo_image->gdttab,sizeof(GdtTabStruct)*MAXGDT);
|
||||
MemCpy(lo_image,hi_image,size);
|
||||
HiCall(shutdown);
|
||||
}
|
||||
|
||||
#help_index "Boot"
|
||||
#help_file "::/LT/Doc/Boot.TXZ"
|
||||
|
||||
public void BootLT(I1 drive=0)
|
||||
{ //Compile OSMain and boot. You might
|
||||
//want to precede with $LK,"Auto","MN:Auto"$() to
|
||||
//specifing answers to the prompted
|
||||
//config questions.
|
||||
I1 *buf;
|
||||
|
||||
if (!drive)
|
||||
drive=Fs->cur_partition->drive;
|
||||
|
||||
//This passes a config parameter for
|
||||
//compilation of OSMain which is accessed
|
||||
//within a #exe {} statement.
|
||||
//See $LK,"insboot_dst_drive","FF:::/LT/OSMain/Disk/DiskAddDev.CPZ,insboot_dst_drive"$
|
||||
|
||||
buf=MSPrintF("I1 insboot_dst_drive=\'%C\';",drive);
|
||||
ExecuteStr(buf);
|
||||
Free(buf);
|
||||
|
||||
Cd("/LT/OSMain");
|
||||
if (!CompileFile("OS","OS",NULL,':'))
|
||||
Boot("OS.BIZ");
|
||||
}
|
||||
|
||||
#help_index "Install"
|
||||
void InstallLTDir(I1 src,I1 dst)
|
||||
{
|
||||
I1 buf_s[64],buf_d[64];
|
||||
if (src==dst) return;
|
||||
SPrintF(buf_s,"%c:/LT",src);
|
||||
SPrintF(buf_d,"%c:/LT",dst);
|
||||
DelTree(buf_d);
|
||||
CopyTree(buf_s,buf_d);
|
||||
}
|
||||
|
||||
I1 CheckWritable(I1 drive=0)
|
||||
{
|
||||
BoolU4 cont=TRUE;
|
||||
I1 writable_drive=drive;
|
||||
LTPartition *p;
|
||||
LTBlkDev *bdev;
|
||||
if (!DriveIsWritable(drive)) {
|
||||
coutln drive,": Drive is read-only.";
|
||||
while (cont) {
|
||||
cout "Enter RAM drive (usually 'B') for temporary files:";
|
||||
writable_drive=ToUpper(GetChar);
|
||||
CrLf;
|
||||
p=DriveToPartition(writable_drive);
|
||||
bdev=p->bdev;
|
||||
if (bdev->type!=LTBDT_RAM ||
|
||||
!DriveIsWritable(writable_drive))
|
||||
coutln "Not A RAM Drive";
|
||||
else
|
||||
cont=FALSE;
|
||||
}
|
||||
Format(writable_drive,FALSE,FALSE);
|
||||
InstallLTDir(drive,writable_drive);
|
||||
}
|
||||
return writable_drive;
|
||||
}
|
||||
|
||||
|
||||
#help_index "Install"
|
||||
BoolU8 CreateBootImage(I1 src_drive,I1 dst_drive,U8 *out_size,I1 *filename)
|
||||
{
|
||||
LTPartition *p;
|
||||
I8 my_CompileFile(I1 *filename,I1 *map_name=NULL,I1 *out_name=NULL,I1 mapfile_drive=0);
|
||||
U1 *buf;
|
||||
|
||||
my_CompileFile=FindExtern("CompileFile5"); //In case a offline compiler is present
|
||||
if (!my_CompileFile)
|
||||
my_CompileFile=FindExtern("CompileFile"); //In case a offline compiler is present
|
||||
|
||||
Drive(src_drive);
|
||||
|
||||
Cd("/LT/Adam/GrAsm");
|
||||
if (my_CompileFile("GrAsm","GrAsm",NULL,':'))
|
||||
return FALSE;
|
||||
|
||||
Cd("/LT/Compiler");
|
||||
if (my_CompileFile("Compiler","Compiler",NULL,':'))
|
||||
return FALSE;
|
||||
|
||||
Cd("/LT/OSMain");
|
||||
if (my_CompileFile("OS","OS",NULL,':'))
|
||||
return FALSE;
|
||||
|
||||
buf=ReadFile("OS.BIZ",out_size);
|
||||
|
||||
filename[StrLen(filename)-1]='C';
|
||||
coutln "Creating ",filename," from OS.BIZ";
|
||||
Drive(dst_drive);
|
||||
Cd("/");
|
||||
p=Fs->cur_partition;
|
||||
|
||||
PrintF("Size: %08X\r\n",*out_size);
|
||||
WriteFile(filename,buf,*out_size,0,LT_ATTR_FIXED,FALSE);
|
||||
Free(buf);
|
||||
Drive(src_drive);
|
||||
Del("/LT/OSMain/OS.BIZ");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public BoolU8 InstallBoot(I1 src_drive,I1 dst_drive=0)
|
||||
{ //See $LK,"Install Documentation","FI:::/LT/Doc/Install.TXZ"$
|
||||
BoolU4 result=FALSE;
|
||||
LTBlkDev *bd;
|
||||
LTPartition *p;
|
||||
LTBootStruct br;
|
||||
LTDirEntry de;
|
||||
U4 *dd;
|
||||
U8 i,size;
|
||||
U1 *bb;
|
||||
U2 *ww;
|
||||
I1 *buf;
|
||||
|
||||
if (!dst_drive) dst_drive=src_drive;
|
||||
|
||||
//This passes a config parameter for
|
||||
//compilation of OSMain which is accessed
|
||||
//within a #exe {} statement.
|
||||
//See $LK,"insboot_dst_drive","FF:::/LT/OSMain/Disk/DiskAddDev.CPZ,insboot_dst_drive"$
|
||||
buf=MSPrintF("I1 insboot_dst_drive=\'%C\';",dst_drive);
|
||||
ExecuteStr(buf);
|
||||
Free(buf);
|
||||
|
||||
bd=DriveToBlkDev(dst_drive);
|
||||
switch (bd->type) {
|
||||
case LTBDT_ATAPI:
|
||||
if (!CreateBootImage(src_drive,src_drive,&size,BOOT1_BIC))
|
||||
return FALSE;
|
||||
Drive(src_drive);
|
||||
CreateCdBootFile;
|
||||
return TRUE;
|
||||
case LTBDT_RAM: //TODO
|
||||
case LTBDT_FDC:
|
||||
break;
|
||||
case LTBDT_ATA:
|
||||
case LTBDT_NON_LT_FILE:
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Drive(dst_drive);
|
||||
p=Fs->cur_partition;
|
||||
if (p->type!=PT_LT)
|
||||
PutSysTextErr("ST_NOT_LT");
|
||||
else {
|
||||
src_drive=CheckWritable(src_drive);
|
||||
if (!CreateBootImage(src_drive,dst_drive,&size,BOOT_BIC))
|
||||
return FALSE;
|
||||
Drive(dst_drive);
|
||||
RBlks(Fs->cur_partition,&br,p->offset,1,TRUE);
|
||||
if (!FindFile(BOOT_BIC,&de,FALSE,TRUE))
|
||||
coutln "No image";
|
||||
else {
|
||||
coutln "Modifying partition boot record.";
|
||||
br.jump_and_nop[0]=0xEB;
|
||||
br.jump_and_nop[1]=30;
|
||||
br.jump_and_nop[2]=0x90;
|
||||
switch (bd->type) {
|
||||
case LTBDT_ATA:
|
||||
case LTBDT_NON_LT_FILE:
|
||||
ww=BHD_BASE0;
|
||||
*ww=PmtI8("Boot Drive Base0 (0x%X):",0x1F0);
|
||||
ww=BHD_BASE1;
|
||||
*ww=PmtI8("Boot Drive Base1 (0x%X):",0x3F6);
|
||||
bb=BHD_UNIT;
|
||||
*bb=0xE0+(PmtI8("Boot Drive Unit (0=Master,1=Slave):",0)<<4);
|
||||
|
||||
ww=BHD_RESTART+1;
|
||||
*ww=(size+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
dd=BHD_BLK;
|
||||
*dd=p->data+de.cluster*p->spc;
|
||||
bb=BHD_CODE;
|
||||
for (i=0;i<(BHD_END-BHD_CODE);i++)
|
||||
br.code[i]=bb[i];
|
||||
break;
|
||||
case LTBDT_RAM: //TODO
|
||||
case LTBDT_FDC:
|
||||
ww=BFD_RESTART+1;
|
||||
*ww=(size+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
ww=BFD_RESTART+4;
|
||||
*ww=p->data+de.cluster*p->spc;
|
||||
bb=BFD_CODE;
|
||||
for (i=0;i<(BFD_END-BFD_CODE);i++)
|
||||
br.code[i]=bb[i];
|
||||
break;
|
||||
}
|
||||
for (;i<478;i++)
|
||||
br.code[i]=0;
|
||||
WBlks(Fs->cur_partition,&br,p->offset,1,TRUE);
|
||||
result=TRUE;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public void ReadOldMasterBoot(I1 src_drive,I1 dst_drive)
|
||||
{
|
||||
LTBlkDev *bd;
|
||||
LTPartition *p,*p2;
|
||||
MasterBootStruct mbr;
|
||||
|
||||
bd=DriveToBlkDev(src_drive);
|
||||
try {
|
||||
while (bd->non_lt_drive) {
|
||||
p2=DriveToPartition(bd->non_lt_drive);
|
||||
bd=DriveToBlkDev(p2->drive);
|
||||
}
|
||||
} catch
|
||||
Fs->catch_except=TRUE;
|
||||
Drive(dst_drive);
|
||||
p=Fs->cur_partition;
|
||||
if (p->type!=PT_LT)
|
||||
PutSysTextErr("ST_NOT_LT");
|
||||
else {
|
||||
ATAReadBlks(bd,&mbr,0,1);
|
||||
Drive(dst_drive);
|
||||
MkDir(BOOT_DIR);
|
||||
WriteFile(OLD_BOOT_BIC,&mbr,BLK_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
public void WriteOldMasterBoot(I1 src_drive,I1 dst_drive)
|
||||
{
|
||||
LTBlkDev *bd;
|
||||
MasterBootStruct *mbr;
|
||||
LTPartition *p2;
|
||||
bd=DriveToBlkDev(dst_drive);
|
||||
try {
|
||||
while (bd->non_lt_drive) {
|
||||
p2=DriveToPartition(bd->non_lt_drive);
|
||||
bd=DriveToBlkDev(p2->drive);
|
||||
}
|
||||
} catch
|
||||
Fs->catch_except=TRUE;
|
||||
Drive(src_drive);
|
||||
mbr=ReadFile(OLD_BOOT_BIC);
|
||||
if (mbr)
|
||||
ATAWriteBlks(bd,mbr,0,1);
|
||||
Free(mbr);
|
||||
}
|
||||
|
||||
void ZeroMasterBoot(I1 dst_drive)
|
||||
{ //This is dangerous!!
|
||||
LTBlkDev *bd;
|
||||
MasterBootStruct mbr;
|
||||
LTPartition *p2;
|
||||
bd=DriveToBlkDev(dst_drive);
|
||||
try {
|
||||
while (bd->non_lt_drive) {
|
||||
p2=DriveToPartition(bd->non_lt_drive);
|
||||
bd=DriveToBlkDev(p2->drive);
|
||||
}
|
||||
} catch
|
||||
Fs->catch_except=TRUE;
|
||||
MemSet(mbr,0,BLK_SIZE);
|
||||
ATAWriteBlks(bd,&mbr,0,1);
|
||||
}
|
||||
|
||||
public BoolU8 InstallMasterBoot(I1 drive,I1 *drive_list=NULL)
|
||||
{
|
||||
BoolU4 result=FALSE;
|
||||
LTBlkDev *bd,*bd1;
|
||||
LTPartition *p,*p1,*p2;
|
||||
MasterBootStruct mbr;
|
||||
LTDirEntry de;
|
||||
U8 i,j,size;
|
||||
U4 *dd;
|
||||
U1 *bb;
|
||||
U2 *ww;
|
||||
I1 *menu_ptr,*ptr,ch,buf[128],buf2[128];
|
||||
|
||||
if (drive_list)
|
||||
StrCpy(buf2,drive_list);
|
||||
else {
|
||||
j=0;
|
||||
for (i='A';i<='Z';i++)
|
||||
buf2[j++]=i;
|
||||
buf2[j++]=0;
|
||||
}
|
||||
|
||||
Drive(drive);
|
||||
p=Fs->cur_partition;
|
||||
if (p->type!=PT_LT)
|
||||
PutSysTextErr("ST_NOT_LT");
|
||||
else {
|
||||
bd=DriveToBlkDev(drive);
|
||||
try {
|
||||
while (bd->non_lt_drive) {
|
||||
p2=DriveToPartition(bd->non_lt_drive);
|
||||
bd=DriveToBlkDev(p2->drive);
|
||||
}
|
||||
} catch
|
||||
Fs->catch_except=TRUE;
|
||||
if (!FindFile(OLD_BOOT_BIC,&de,FALSE,TRUE))
|
||||
ReadOldMasterBoot(drive,drive);
|
||||
|
||||
while (!(i=PmtI8("Base0:",0)));
|
||||
ww=BMHD_BASE0;
|
||||
*ww=i;
|
||||
ww=BMHD2_BASE0;
|
||||
*ww=i;
|
||||
|
||||
while (!(i=PmtI8("Base1:",0)));
|
||||
ww=BMHD_BASE1;
|
||||
*ww=i;
|
||||
ww=BMHD2_BASE1;
|
||||
*ww=i;
|
||||
|
||||
i=0xE0+(PmtI8("Unit (0=Master,1=Slave):",0)<<4);
|
||||
bb=BMHD_UNIT;
|
||||
*bb=i;
|
||||
bb=BMHD2_UNIT;
|
||||
*bb=i;
|
||||
|
||||
dd=BMHD2_BLK_ARRAY;
|
||||
MemSet(dd,0,sizeof(U4)*8);
|
||||
menu_ptr=BMHD2_BOOT_MSG;
|
||||
SPrintF(menu_ptr,"\r\n\r\nLoseThos 3.05 Boot Loader\r\n\r\n");
|
||||
j=0;
|
||||
if (FindFile(OLD_BOOT_BIC,&de,FALSE,TRUE)) {
|
||||
*dd=p->data+de.cluster*p->spc;
|
||||
StrCat(menu_ptr,"0. Old Boot Record\r\n");
|
||||
j++;
|
||||
dd+=sizeof(U4);
|
||||
}
|
||||
|
||||
ptr=buf2;
|
||||
while (ch=*ptr++) {
|
||||
try
|
||||
p1=DriveToPartition(ch);
|
||||
catch {
|
||||
Fs->catch_except=TRUE;
|
||||
p1=NULL;
|
||||
}
|
||||
if (p1) {
|
||||
bd1=p1->bdev;
|
||||
try {
|
||||
while (bd1->non_lt_drive) {
|
||||
p2=DriveToPartition(bd1->non_lt_drive);
|
||||
bd1=DriveToBlkDev(p2->drive);
|
||||
}
|
||||
} catch
|
||||
Fs->catch_except=TRUE;
|
||||
if (bd1==bd) {
|
||||
*dd=p1->offset;
|
||||
PrintF("Drive %c:%16X\r\n",p1->drive,*dd);
|
||||
SPrintF(buf,"%d. Drive %c\r\n",j++,p1->drive);
|
||||
StrCat(menu_ptr,buf);
|
||||
dd+=sizeof(U4);
|
||||
}
|
||||
}
|
||||
}
|
||||
StrCat(menu_ptr,"\r\nSelection:");
|
||||
|
||||
size=BMHD2_END-BMHD2_START;
|
||||
WriteFile(BOOT_LOADER_BIC,BMHD2_START,size);
|
||||
|
||||
if (!FindFile(BOOT_LOADER_BIC,&de,FALSE,TRUE))
|
||||
coutln "No Boot Loader Image";
|
||||
else {
|
||||
ww=BMHD_RESTART+1;
|
||||
*ww=(size+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
dd=BMHD_BLK;
|
||||
*dd=p->data+de.cluster*p->spc;
|
||||
bb=BMHD_CODE;
|
||||
ATAReadBlks(bd,&mbr,0,1);
|
||||
for (i=0;i<(BMHD_END-BMHD_CODE);i++)
|
||||
mbr.boot_code[i]=bb[i];
|
||||
for (;i<446;i++)
|
||||
mbr.boot_code[i]=0;
|
||||
mbr.signature=0xAA55;
|
||||
|
||||
ATAWriteBlks(bd,&mbr,0,1);
|
||||
result=TRUE;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index ""
|
||||
@@ -0,0 +1,241 @@
|
||||
#help_index "Utils"
|
||||
|
||||
I8 PopUpDiffOptions()
|
||||
{
|
||||
I8 i;
|
||||
Ltf *l=LtfNew;
|
||||
LtfPutSExt(l,"$$CM +LX, 2,4$$$$FG$$$$BT, \"USE FILE1\",0$$");
|
||||
LtfPutSExt(l,"$$CM +LX, 24,0$$$$FG CYAN$$$$BT, \"USE FILE2\",1$$");
|
||||
LtfPutSExt(l,"$$CM +LX, 2,4$$$$FG$$$$BT, \"REMAINDER ALL FILE1\",2$$");
|
||||
LtfPutSExt(l,"$$CM +LX, 24,0$$$$FG CYAN$$$$BT, \"REMAINDER ALL FILE2\",3$$");
|
||||
LtfPutSExt(l,"$$CM +LX, 2,4$$$$FG$$$$BT, \"ABORT FILE\",4$$");
|
||||
LtfPutSExt(l,"$$CM +LX, 24,0$$$$FG$$$$BT, \"ABORT ALL FILES\",5$$");
|
||||
i=PopUpMenu(l);
|
||||
LtfDel(l);
|
||||
return i;
|
||||
}
|
||||
|
||||
I8 CompareDiffEntries(LtfEntry **ll1,LtfEntry **ll2)
|
||||
{
|
||||
LtfEntry *cl1=*ll1,*cl2=*ll2;
|
||||
return StrCmp(cl1->display,cl2->display);
|
||||
}
|
||||
|
||||
#define DF_MODIFIED 1
|
||||
#define DF_DONT_MODIFIED 2
|
||||
#define DF_REMAINDER_ALL_FILE1 4
|
||||
#define DF_REMAINDER_ALL_FILE2 8
|
||||
#define DF_ABORT_FILE 16
|
||||
#define DF_ABORT_ALL_FILES 32
|
||||
#define DF_NO_MORE_PROMPTS_THIS_FILE 64
|
||||
|
||||
void DiffSelect(Ltf *l,U8 *flags,I8 j1_lo,I8 j1_hi,
|
||||
I8 j2_lo,I8 j2_hi,LtfEntry **usl1,LtfEntry **usl2)
|
||||
{
|
||||
I8 i;
|
||||
LtfEntry *cl,*cl1,*cl2;
|
||||
BoolU4 use_file1;
|
||||
U8 old_flags;
|
||||
Ltf *cur_l;
|
||||
if (!(*flags & (DF_ABORT_FILE|DF_ABORT_ALL_FILES))) {
|
||||
PrintF("$$FG,RED$$%d,%d---------------------$$FG$$\r\n",j1_lo,j2_lo);
|
||||
i=(j1_lo<=0) ? 0:j1_lo-1;
|
||||
while (i<j1_hi) {
|
||||
if (cur_l=Fs->cur_ltf) {
|
||||
old_flags=cur_l->flags<FF_PLAIN_TEXT;
|
||||
cur_l->flags|=LTFF_PLAIN_TEXT;
|
||||
}
|
||||
PutS(usl1[i++]->display);
|
||||
if (cur_l)
|
||||
cur_l->flags=(cur_l->flags & ~LTFF_PLAIN_TEXT)|old_flags;
|
||||
CrLf;
|
||||
}
|
||||
PutS("$$FG CYAN$$");
|
||||
i=(j2_lo<=0) ? 0:j2_lo-1;
|
||||
while (i<j2_hi) {
|
||||
if (cur_l=Fs->cur_ltf) {
|
||||
old_flags=cur_l->flags<FF_PLAIN_TEXT;
|
||||
cur_l->flags|=LTFF_PLAIN_TEXT;
|
||||
}
|
||||
PutS(usl2[i++]->display);
|
||||
if (cur_l)
|
||||
cur_l->flags=(cur_l->flags & ~LTFF_PLAIN_TEXT)|old_flags;
|
||||
CrLf;
|
||||
}
|
||||
PutS("$$FG$$");
|
||||
|
||||
use_file1=TRUE;
|
||||
if (!(*flags & DF_NO_MORE_PROMPTS_THIS_FILE)) {
|
||||
switch (PopUpDiffOptions) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
use_file1=FALSE;
|
||||
break;
|
||||
case 2:
|
||||
*flags|=DF_REMAINDER_ALL_FILE1|DF_NO_MORE_PROMPTS_THIS_FILE;
|
||||
break;
|
||||
case 3:
|
||||
*flags|=DF_REMAINDER_ALL_FILE2|DF_NO_MORE_PROMPTS_THIS_FILE;
|
||||
break;
|
||||
case 4:
|
||||
*flags|=DF_DONT_MODIFIED|DF_ABORT_FILE|DF_NO_MORE_PROMPTS_THIS_FILE;
|
||||
break;
|
||||
default:
|
||||
*flags|=DF_DONT_MODIFIED|DF_ABORT_ALL_FILES|DF_NO_MORE_PROMPTS_THIS_FILE;
|
||||
}
|
||||
}
|
||||
if (*flags & DF_REMAINDER_ALL_FILE2)
|
||||
use_file1=FALSE;
|
||||
if (!use_file1) {
|
||||
*flags|=DF_MODIFIED;
|
||||
cl1=usl1[j1_lo]->last;
|
||||
if (j1_lo<j1_hi) {
|
||||
cl=usl1[j1_lo];
|
||||
while (cl!=usl1[j1_hi]) {
|
||||
cl2=cl->next;
|
||||
LtfDelEntry(l,cl);
|
||||
cl=cl2;
|
||||
}
|
||||
}
|
||||
if (j2_lo<j2_hi) {
|
||||
cl=usl2[j2_lo];
|
||||
while (cl!=usl2[j2_hi]) {
|
||||
cl2=LtfCopyEntry(l,cl);
|
||||
InsQue(cl2,cl1);
|
||||
cl1=cl2;
|
||||
cl=cl->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DiffSub(Ltf *l,U8 *flags,I8 j1_lo,I8 j1_hi,I8 j2_lo,I8 j2_hi,
|
||||
I8 cnt1,I8 cnt2,LtfEntry **sl1,LtfEntry **sl2,LtfEntry **usl1,LtfEntry **usl2)
|
||||
{
|
||||
I8 i,i1=0,i2=0,i2b,j1,j2,n;
|
||||
I8 best_j1,best_j2,best_score=0,score;
|
||||
|
||||
if (j1_lo>=j1_hi || j2_lo>=j2_hi) {
|
||||
if (j1_lo<j1_hi || j2_lo<j2_hi)
|
||||
DiffSelect(l,flags,j1_lo,j1_hi,j2_lo,j2_hi,usl1,usl2);
|
||||
return;
|
||||
}
|
||||
|
||||
//Locate longest matching str in intervals
|
||||
while (i1<cnt1 && i2<cnt2) {
|
||||
if (sl1[i1]->y<j1_lo || sl1[i1]->y>=j1_hi)
|
||||
i1++;
|
||||
else if (sl2[i2]->y<j2_lo || sl2[i2]->y>=j2_hi)
|
||||
i2++;
|
||||
else {
|
||||
i=StrCmp(sl1[i1]->display,sl2[i2]->display);
|
||||
if (i>0)
|
||||
i2++;
|
||||
else if (i<0)
|
||||
i1++;
|
||||
else {
|
||||
i2b=i2;
|
||||
while (!StrCmp(sl1[i1]->display,sl2[i2]->display)) {
|
||||
if (sl2[i2]->y>=j2_lo && sl2[i2]->y<j2_hi) {
|
||||
score=0;
|
||||
j1=sl1[i1]->y;
|
||||
j2=sl2[i2]->y;
|
||||
n=j1_hi-j1;
|
||||
if (j2_hi-j2<n)
|
||||
n=j2_hi-j2;
|
||||
while (score<n) {
|
||||
if (!StrCmp(usl1[j1+score]->display,usl2[j2+score]->display))
|
||||
score++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (score>best_score) {
|
||||
best_score=score;
|
||||
best_j1=j1;
|
||||
best_j2=j2;
|
||||
}
|
||||
}
|
||||
i2++;
|
||||
if (i2>=cnt2)
|
||||
break;
|
||||
}
|
||||
i2=i2b;
|
||||
i1++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (best_score==0)
|
||||
DiffSelect(l,flags,j1_lo,j1_hi,j2_lo,j2_hi,usl1,usl2);
|
||||
else {
|
||||
DiffSub(l,flags,j1_lo,best_j1,j2_lo,best_j2,cnt1,cnt2,sl1,sl2,usl1,usl2);
|
||||
DiffSub(l,flags,best_j1+best_score,j1_hi,best_j2+best_score,j2_hi,cnt1,cnt2,
|
||||
sl1,sl2,usl1,usl2);
|
||||
}
|
||||
}
|
||||
|
||||
public U8 Diff(I1 *dst_file,I1 *src_file,U8 flags=0)
|
||||
{
|
||||
Ltf *l1=LtfRead(dst_file, LTFF_PLAIN_TEXT_WITH_TABS | LTFF_NO_CURSOR);
|
||||
Ltf *l2=LtfRead(src_file, LTFF_PLAIN_TEXT_WITH_TABS | LTFF_NO_CURSOR);
|
||||
LtfEntry *cl,**sl1,**sl2,**usl1,**usl2;
|
||||
I8 i,cnt1=0,cnt2=0;
|
||||
|
||||
flags&=DF_ABORT_ALL_FILES;
|
||||
|
||||
cl=l1->dummy.next;
|
||||
while (cl!=l1) {
|
||||
if (cl->btype==LTFT_TEXT)
|
||||
cl->y=cnt1++;
|
||||
cl=cl->next;
|
||||
}
|
||||
|
||||
cl=l2->dummy.next;
|
||||
while (cl!=l2) {
|
||||
if (cl->btype==LTFT_TEXT)
|
||||
cl->y=cnt2++;
|
||||
cl=cl->next;
|
||||
}
|
||||
|
||||
sl1=MAlloc(cnt1*sizeof(LtfEntry *));
|
||||
usl1=MAlloc((cnt1+1)*sizeof(LtfEntry *));
|
||||
i=0;
|
||||
cl=l1->dummy.next;
|
||||
while (cl!=l1) {
|
||||
if (cl->btype==LTFT_TEXT) {
|
||||
sl1[i]=cl;
|
||||
usl1[i++]=cl;
|
||||
}
|
||||
cl=cl->next;
|
||||
}
|
||||
usl1[i]=l1;
|
||||
QSort(sl1,cnt1,sizeof(LtfEntry *),&CompareDiffEntries);
|
||||
|
||||
sl2=MAlloc(cnt2*sizeof(LtfEntry *));
|
||||
usl2=MAlloc((cnt2+1)*sizeof(LtfEntry *));
|
||||
i=0;
|
||||
cl=l2->dummy.next;
|
||||
while (cl!=l2) {
|
||||
if (cl->btype==LTFT_TEXT) {
|
||||
sl2[i]=cl;
|
||||
usl2[i++]=cl;
|
||||
}
|
||||
cl=cl->next;
|
||||
}
|
||||
usl2[i]=l2;
|
||||
QSort(sl2,cnt2,sizeof(LtfEntry *),&CompareDiffEntries);
|
||||
|
||||
DiffSub(l1,&flags,0,cnt1,0,cnt2,cnt1,cnt2,sl1,sl2,usl1,usl2);
|
||||
if (flags&DF_MODIFIED && !(flags&DF_DONT_MODIFIED))
|
||||
LtfWrite(l1);
|
||||
|
||||
LtfDel(l1);
|
||||
LtfDel(l2);
|
||||
Free(sl1);
|
||||
Free(sl2);
|
||||
Free(usl1);
|
||||
Free(usl2);
|
||||
return flags;
|
||||
}
|
||||
#help_index ""
|
||||
@@ -0,0 +1,469 @@
|
||||
#help_index "File/Program Routines/Utils"
|
||||
|
||||
U8 SizeFlattenLTDirTree(LTDirEntry *tempm)
|
||||
{
|
||||
U8 result=0;
|
||||
while (tempm) {
|
||||
result+=LT_DIR_ENTRY_SIZE+1;
|
||||
if (tempm->attr & LT_ATTR_DIR)
|
||||
result+=SizeFlattenLTDirTree(tempm->sub);
|
||||
tempm=tempm->next;
|
||||
}
|
||||
return result+1;
|
||||
}
|
||||
|
||||
U8 FillFlattenLTDirTree(LTDirEntry *tempm,U1 *dst)
|
||||
{
|
||||
U8 result=0,i;
|
||||
while (tempm) {
|
||||
*dst++=1;
|
||||
result++;
|
||||
i=LT_DIR_ENTRY_SIZE;
|
||||
MemCpy(dst,&tempm->start,i);
|
||||
dst+=i;
|
||||
result+=i;
|
||||
if (tempm->attr & LT_ATTR_DIR) {
|
||||
i=FillFlattenLTDirTree(tempm->sub,dst);
|
||||
dst+=i;
|
||||
result+=i;
|
||||
}
|
||||
tempm=tempm->next;
|
||||
}
|
||||
*dst=0;
|
||||
return result+1;
|
||||
}
|
||||
|
||||
public U1 *FlattenLTDirTree(LTDirEntry *tempm,U8 *size=NULL)
|
||||
{
|
||||
U8 i=SizeFlattenLTDirTree(tempm);
|
||||
U1 *buf=MAlloc(i);
|
||||
FillFlattenLTDirTree(tempm,buf);
|
||||
if (size) *size=i;
|
||||
return buf;
|
||||
}
|
||||
|
||||
U1 *DoUnflattenLTDirTree(U1 *src,LTDirEntry **tempm)
|
||||
{
|
||||
U8 i;
|
||||
LTDirEntry *tempm1;
|
||||
if (*src++) {
|
||||
tempm1=MAllocZ(sizeof(LTDirEntry));
|
||||
*tempm=tempm1;
|
||||
i=LT_DIR_ENTRY_SIZE;
|
||||
MemCpy(&tempm1->start,src,i);
|
||||
src+=i;
|
||||
if (tempm1->attr & LT_ATTR_DIR)
|
||||
src=DoUnflattenLTDirTree(src,&tempm1->sub);
|
||||
src=DoUnflattenLTDirTree(src,&tempm1->next);
|
||||
} else
|
||||
*tempm=NULL;
|
||||
return src;
|
||||
}
|
||||
|
||||
public LTDirEntry *UnflattenLTDirTree(U1 *src)
|
||||
{
|
||||
LTDirEntry *tempm=NULL;
|
||||
DoUnflattenLTDirTree(src,&tempm);
|
||||
return tempm;
|
||||
}
|
||||
|
||||
#help_index "Install;File/Install Related"
|
||||
#help_file "::/LT/Doc/Install.TXZ"
|
||||
|
||||
|
||||
public void PartitionDrive(I1 drive=0)
|
||||
|
||||
//drive=0 means add new device
|
||||
|
||||
{
|
||||
LTBlkDev *bd;
|
||||
MasterBootStruct mbr;
|
||||
I8 ext_base=0,size,
|
||||
i=0,start_offset,offset=0,remaining,
|
||||
num_partition;
|
||||
if (!drive) {
|
||||
AddDrives(TRUE);
|
||||
return;
|
||||
}
|
||||
bd=DriveToBlkDev(drive);
|
||||
remaining=bd->max_blk,
|
||||
num_partition=bd->partition_base;
|
||||
if (!bd || bd->type!=LTBDT_ATA)
|
||||
return;
|
||||
coutln "\r\n\r\n!!! Repartition Drive !!!\r\n";
|
||||
while (remaining>0) {
|
||||
start_offset=offset;
|
||||
MemSet(&mbr,0,BLK_SIZE);
|
||||
mbr.signature=0xAA55;
|
||||
do {
|
||||
PrintF( "Partition %c :\r\n",num_partition);
|
||||
PrintF( "Blocks Remaining:%d (0x%X)\r\n",remaining,remaining);
|
||||
size=PmtI8("Size in Blocks :",remaining);
|
||||
} while (size<=0 || size>remaining);
|
||||
mbr.p[0].active=0x80;
|
||||
mbr.p[0].size=size;
|
||||
mbr.p[0].type=1;
|
||||
mbr.p[0].offset=1;
|
||||
offset+=1+size;
|
||||
remaining-=1+size;
|
||||
if (remaining>0) {
|
||||
mbr.p[1].active=0x80;
|
||||
mbr.p[1].size=remaining;
|
||||
mbr.p[1].type=0xF;
|
||||
mbr.p[1].offset=offset-ext_base;
|
||||
if (!ext_base)
|
||||
ext_base=offset;
|
||||
}
|
||||
ATAWriteBlks(bd,&mbr,start_offset,1);
|
||||
num_partition++;
|
||||
}
|
||||
bd->flags&=~(LTBDF_INITIALIZED | LTBDF_INIT_IN_PROGRESS|LTBDF_HAS_BEEN_RESET);
|
||||
AddBlkDev(bd,FALSE);
|
||||
for (i=bd->partition_base;i<num_partition;i++)
|
||||
Format(i,TRUE,FALSE);
|
||||
}
|
||||
|
||||
#help_index "File/Cmd Line (Typically)"
|
||||
void DrawIt(TssStruct *tss)
|
||||
{
|
||||
ClearWinText(tss);
|
||||
}
|
||||
|
||||
public void ViewDrive(I1 drive=0)
|
||||
{
|
||||
LTPartition *p=DriveToPartition(drive);
|
||||
void *old_update=Fs->update_win;
|
||||
Ltf *old_ltf=Fs->cur_ltf;
|
||||
U8 lohi,c1,i,x,y,
|
||||
l=(GR_HEIGHT-3*FONT_HEIGHT)*(GR_WIDTH-FONT_WIDTH<<1),
|
||||
s=(p->size+p->spc-1)/p->spc;
|
||||
U8 ch=0;
|
||||
U1 *bitmap;
|
||||
GrBitMap *base=GrAlias(Gs->grbase,Fs);
|
||||
if (p->type!=PT_LT) {
|
||||
GrDel(base);
|
||||
return;
|
||||
}
|
||||
|
||||
WinMax;
|
||||
Fs->update_win=&DrawIt;
|
||||
Fs->cur_ltf=NULL;
|
||||
GrClear;
|
||||
try {
|
||||
i=((s+7)>>3+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
bitmap=MAlloc(i<<BLK_SIZE_BITS);
|
||||
RBlks(p,bitmap,p->MAP1,i,TRUE);
|
||||
i=0;
|
||||
for (y=0;y<(GR_HEIGHT-3*FONT_HEIGHT);y++) {
|
||||
if (ScanKey(&ch))
|
||||
break;
|
||||
for (x=0;x<(GR_WIDTH-FONT_WIDTH<<1);x++) {
|
||||
lohi=i*s;
|
||||
c1=lohi/l;
|
||||
if (Bt(bitmap,c1))
|
||||
base->color=ROP_XOR+(BLUE^WHITE);
|
||||
else
|
||||
base->color=ROP_XOR+(WHITE^WHITE);
|
||||
GrPlot(base,x,y);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
Free(bitmap);
|
||||
} catch
|
||||
UnlockPartition(p);
|
||||
while (ch!=CH_ESC && ch!=CH_CTRLQ)
|
||||
ch=GetChar;
|
||||
|
||||
Fs->update_win=old_update;
|
||||
GrClear;
|
||||
Fs->cur_ltf=old_ltf;
|
||||
GrDel(base);
|
||||
}
|
||||
|
||||
void DrawIt(TssStruct *tss)
|
||||
{
|
||||
ClearWinText(tss);
|
||||
}
|
||||
|
||||
public void ViewDisk(I1 drive=0)
|
||||
{
|
||||
I8 i,j,
|
||||
h=Fs->win_pixel_right-Fs->win_pixel_left,
|
||||
v=Fs->win_pixel_bottom-Fs->win_pixel_top,
|
||||
radius;
|
||||
LTPartition *p;
|
||||
LTBlkDev *bdev=DriveToBlkDev(drive);
|
||||
void *old_update=Fs->update_win;
|
||||
Ltf *old_ltf=Fs->cur_ltf;
|
||||
GrBitMap *base=GrAlias(Gs->grbase,Fs);
|
||||
double sector_start,sector_end;
|
||||
I1 buf[32];
|
||||
|
||||
Fs->update_win=&DrawIt;
|
||||
Fs->cur_ltf=NULL;
|
||||
GrClear;
|
||||
if (h<v)
|
||||
radius=0.4*h;
|
||||
else
|
||||
radius=0.4*v;
|
||||
base->color=ROP_OR+BLACK^WHITE;
|
||||
GrCircle(base,h>>1,v>>1,radius);
|
||||
|
||||
j=1;
|
||||
for (i=0;i<32;i++) {
|
||||
p=&local_partitions[i];
|
||||
if (bdev==p->bdev && p->type) {
|
||||
sector_start=-(p->offset*pi2/bdev->max_blk);
|
||||
sector_end =-((p->offset+p->size-1)*pi2/bdev->max_blk);
|
||||
base->color=ROP_OR+BLACK^WHITE;
|
||||
GrLine(base,h>>1,v>>1,
|
||||
h>>1+radius*Cos(sector_start),
|
||||
v>>1+radius*Sin(sector_start));
|
||||
GrLine(base,h>>1,v>>1,
|
||||
h>>1+radius*Cos(sector_end),
|
||||
v>>1+radius*Sin(sector_end));
|
||||
|
||||
base->color=ROP_XOR+j^WHITE;
|
||||
base->bkcolor=BLACK;
|
||||
SPrintF(buf,"%C ",PartitionToDrive(p));
|
||||
if (p->type==PT_LT)
|
||||
StrCat(buf,"LT ");
|
||||
else if (p->type==PT_FAT12)
|
||||
StrCat(buf,"FAT12 ");
|
||||
else if (p->type==PT_FAT32)
|
||||
StrCat(buf,"FAT32 ");
|
||||
else if (p->type==PT_ISO9660)
|
||||
StrCat(buf,"ISO9660");
|
||||
else
|
||||
StrCat(buf,"-------");
|
||||
GrText(base,0,v-FONT_HEIGHT*j,buf);
|
||||
GrFloodFill(base,
|
||||
h>>1+(radius-4)*Cos((sector_start+sector_end)/2),
|
||||
v>>1+(radius-4)*Sin((sector_start+sector_end)/2),FALSE);
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
GetChar(NULL,FALSE);
|
||||
Fs->update_win=old_update;
|
||||
GrClear;
|
||||
Fs->cur_ltf=old_ltf;
|
||||
GrDel(base);
|
||||
}
|
||||
|
||||
|
||||
void ChkDskList(LTDirEntry *tempm1,U1 *bits,U1 *bits2,U8 size,U8 bpc)
|
||||
{
|
||||
LTDirEntry *tempm2;
|
||||
U8 i,j;
|
||||
while (tempm1) {
|
||||
tempm2=tempm1->next;
|
||||
if (tempm1->attr & LT_ATTR_DIR) {
|
||||
if (tempm1->sub) {
|
||||
coutln SysText("ST_SCANNING_DIRECTORY"),tempm1->full_name;
|
||||
ChkDskList(tempm1->sub,bits,bits2,size,bpc);
|
||||
}
|
||||
}
|
||||
j=(tempm1->size+bpc-1)/bpc;
|
||||
for (i=0;i<j;i++) {
|
||||
if (i+tempm1->cluster>size) {
|
||||
PrintFErr("Invalid Cluster:%s Cluster:%X\r\n",tempm1->full_name,
|
||||
i+tempm1->cluster);
|
||||
break;
|
||||
}
|
||||
if (Bts(bits,i+tempm1->cluster))
|
||||
PrintFErr("Double Alloc:%s Cluster:%X\r\n",tempm1->full_name,
|
||||
i+tempm1->cluster);
|
||||
if (!Btr(bits2,i+tempm1->cluster))
|
||||
PrintFErr("UnAlloc:%s Cluster:%X\r\n",tempm1->full_name,
|
||||
i+tempm1->cluster);
|
||||
}
|
||||
DelLTDirEntry(tempm1);
|
||||
tempm1=tempm2;
|
||||
}
|
||||
}
|
||||
|
||||
public void ChkDsk(I1 drive=0)
|
||||
{
|
||||
U8 i,j,bpc,size;
|
||||
LTPartition *p=DriveToPartition(drive);
|
||||
I1 *mask=MSPrintF("%c:/*",PartitionToDrive(p));
|
||||
U1 *bits,*bits2;
|
||||
|
||||
if (p->type!=PT_LT) {
|
||||
PutSysTextErr("ST_NOT_LT");
|
||||
return;
|
||||
}
|
||||
size=(p->size-(p->data-p->offset))/p->spc;
|
||||
bpc=p->spc<<BLK_SIZE_BITS;
|
||||
bits=MAllocZ((size+7)>>3);
|
||||
bits2=MAllocZ((size+7)>>3+BLK_SIZE);
|
||||
RBlks(p,bits2,p->MAP1,((size+7)>>3+BLK_SIZE-1)>>BLK_SIZE_BITS,TRUE);
|
||||
|
||||
j=1; //TODO: get rootdir size
|
||||
for (i=0;i<j;i++) {
|
||||
if (i+p->root_cluster>size) {
|
||||
PrintFErr("Invalid Cluster: RootDir Cluster:%X\r\n",i+p->root_cluster);
|
||||
break;
|
||||
}
|
||||
if (Bts(bits,i+p->root_cluster))
|
||||
PrintFErr("Double Alloc: RootDir Cluster:%X\r\n",i+p->root_cluster);
|
||||
if (!Btr(bits2,i+p->root_cluster))
|
||||
PrintFErr("UnAlloc: RootDir Cluster:%X\r\n",i+p->root_cluster);
|
||||
}
|
||||
|
||||
ChkDskList(FindFiles(mask,1<<FUf_RECURSE),bits,bits2,size,bpc);
|
||||
for (i=1;i<size;i++)
|
||||
if (Bt(bits2,i))
|
||||
coutln "Shouldn't Alloc Cluster:",i;
|
||||
|
||||
Free(mask);
|
||||
Free(bits);
|
||||
Free(bits2);
|
||||
}
|
||||
|
||||
#help_index "Install;File/Install Related"
|
||||
#define SC_BLK_CNT 2048
|
||||
public U8 ScanNonLT(I8 drive,U4 signature)
|
||||
{
|
||||
// See $LK,"::/LT/Doc/LTZ.TXZ","FI:::/LT/Doc/LTZ.TXZ"$
|
||||
U1 *buf=MAllocZ(BLK_SIZE*SC_BLK_CNT),*b;
|
||||
U4 *d;
|
||||
U8 *dd;
|
||||
LTBlkDev *bd=DriveToBlkDev(drive);
|
||||
LTPartition *p=DriveToPartition(drive);
|
||||
I8 blk=p->offset;
|
||||
U8 result=0,start=0,i,j,n,to_go,size,
|
||||
contiguous=0,new_drive_letter;
|
||||
BoolU4 good,proceed=FALSE;
|
||||
try {
|
||||
while (!result) {
|
||||
cout "-";
|
||||
n=p->size+p->offset-blk;
|
||||
if (n>SC_BLK_CNT)
|
||||
n=SC_BLK_CNT;
|
||||
if (!n)
|
||||
break;
|
||||
RBlks(p,buf,blk,1,TRUE);
|
||||
d=buf;
|
||||
dd=d;
|
||||
if (d[127]==signature) {
|
||||
b=d;
|
||||
good=TRUE;
|
||||
for (j=16;j<BLK_SIZE-4;j++)
|
||||
if (b[j]!=j.u1[0]) {
|
||||
good=FALSE;
|
||||
break;
|
||||
}
|
||||
if (good) {
|
||||
result=blk;
|
||||
break;
|
||||
}
|
||||
}
|
||||
blk+=n;
|
||||
}
|
||||
if (result) {
|
||||
blk=result-(SC_BLK_CNT-1);
|
||||
if (blk<0) blk=0;
|
||||
result=0;
|
||||
n=p->size+p->offset-blk;
|
||||
if (n>SC_BLK_CNT)
|
||||
n=SC_BLK_CNT;
|
||||
RBlks(p,buf,blk,n,TRUE);
|
||||
for (i=0;i<n;i++) {
|
||||
d=buf+BLK_SIZE*i;
|
||||
dd=d;
|
||||
if (d[127]==signature && !dd[0]) {
|
||||
b=d;
|
||||
good=TRUE;
|
||||
for (j=16;j<BLK_SIZE-4;j++)
|
||||
if (b[j]!=j.u1[0]) {
|
||||
good=FALSE;
|
||||
break;
|
||||
}
|
||||
if (good) {
|
||||
result=blk+i;
|
||||
size=dd[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result) {
|
||||
start=result;
|
||||
CrLf;
|
||||
coutln "Start :0x",result," Size:0x",size;
|
||||
to_go=size;
|
||||
blk=result;
|
||||
while (to_go && result) {
|
||||
cout "+";
|
||||
n=to_go;
|
||||
if (n>SC_BLK_CNT)
|
||||
n=SC_BLK_CNT;
|
||||
RBlks(p,buf,blk,n,TRUE);
|
||||
for (i=0;i<n;i++) {
|
||||
d=buf+BLK_SIZE*i;
|
||||
dd=d;
|
||||
if (d[127]==signature && dd[0]==blk-result+i &&
|
||||
dd[1]==size) {
|
||||
b=d;
|
||||
for (j=16;j<BLK_SIZE-4;j++)
|
||||
if (b[j]!=j.u1[0]) {
|
||||
result=0;
|
||||
break;
|
||||
}
|
||||
if (result)
|
||||
contiguous++;
|
||||
else
|
||||
break;
|
||||
} else {
|
||||
result=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
to_go-=n;
|
||||
blk+=n;
|
||||
}
|
||||
}
|
||||
coutln "Start: 0x",result;
|
||||
if (result) {
|
||||
CrLf;
|
||||
coutln "Success";
|
||||
proceed=TRUE;
|
||||
} else {
|
||||
CrLf;
|
||||
coutln "Failed, but found ",contiguous," contiguous.";
|
||||
if (contiguous) {
|
||||
cout "Proceed Anyway ";
|
||||
proceed=YorN;
|
||||
}
|
||||
}
|
||||
} catch
|
||||
Fs->catch_except=TRUE;
|
||||
|
||||
Cd("HOME");
|
||||
Free(buf);
|
||||
|
||||
if (proceed) {
|
||||
cout "New Drive Letter:";
|
||||
new_drive_letter=ToUpper(GetChar);
|
||||
CrLf;
|
||||
bd=local_blkdevs+sizeof(LTBlkDev)*(num_blkdevs++);
|
||||
bd->partition_base=new_drive_letter;
|
||||
bd->blk_size=BLK_SIZE;
|
||||
bd->min_blk=start;
|
||||
bd->max_blk=start+contiguous-1;
|
||||
bd->non_lt_drive=drive;
|
||||
bd->non_lt_offset=start;
|
||||
bd->type=LTBDT_NON_LT_FILE;
|
||||
bd->flags=LTBDF_FORMAT;
|
||||
if (!AddBlkDev(bd,FALSE))
|
||||
PutSysText("ST_FAILED");
|
||||
Drive(new_drive_letter);
|
||||
coutln "File Blk: 0x",start;
|
||||
result=start;
|
||||
} else
|
||||
result=0;
|
||||
return result;
|
||||
}
|
||||
#help_index ""
|
||||
@@ -0,0 +1,49 @@
|
||||
#help_index "Utils"
|
||||
|
||||
void DollarFile(LTDirEntry *m1)
|
||||
{
|
||||
BoolU4 changed;
|
||||
I1 *buf,*ptr,ch;
|
||||
while (m1) {
|
||||
if (m1->attr & LT_ATTR_DIR)
|
||||
DollarFile(m1->sub);
|
||||
else {
|
||||
coutln m1->full_name;
|
||||
Sleep(1000);
|
||||
if (buf=ReadTextFile(m1->full_name)) {
|
||||
ptr=buf;
|
||||
changed=FALSE;
|
||||
while (ch=*ptr++) {
|
||||
if (ch=='$$') {
|
||||
ptr--;
|
||||
*ptr++='.';
|
||||
changed=TRUE;
|
||||
}
|
||||
}
|
||||
if (changed) {
|
||||
WriteTextFile(m1->full_name,buf);
|
||||
coutln "Updated";
|
||||
}
|
||||
Free(buf);
|
||||
}
|
||||
}
|
||||
m1=m1->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Dollar(I1 *src_mask,I1 *flags=NULL)
|
||||
//This is for importing non-"LT" text files.
|
||||
//$BK,1$WARNING:$BK,0$Do not use on files with dollar commands
|
||||
// or on binary files.
|
||||
//r=recurse
|
||||
{
|
||||
LTDirEntry *tempm1=NULL;
|
||||
U8 f=0;
|
||||
GetFFlags(&f,SysText("ST_FILE_UTIL_FLAGS"),"+r");
|
||||
GetFFlags(&f,SysText("ST_FILE_UTIL_FLAGS"),flags);
|
||||
tempm1=FindFiles(src_mask,f);
|
||||
DollarFile(tempm1);
|
||||
DelLTDirList(tempm1);
|
||||
}
|
||||
#help_index ""
|
||||
Binary file not shown.
@@ -0,0 +1,129 @@
|
||||
#help_index "Debugging"
|
||||
|
||||
class HeapLogStruct
|
||||
{
|
||||
HeapLogStruct *next,*last;
|
||||
U1 *add;
|
||||
U1 *caller1;
|
||||
U1 *caller2;
|
||||
U1 *caller3;
|
||||
U1 *caller4;
|
||||
};
|
||||
|
||||
class HeapLogHashStruct
|
||||
{
|
||||
HeapLogStruct *next,*last;
|
||||
};
|
||||
|
||||
#define HEAPLOG_HASH_SIZE 0x1000
|
||||
|
||||
TssStruct *heaplog_tss=NULL,heaplog_test_tss;
|
||||
HeapLogHashStruct *heaplog_root;
|
||||
|
||||
|
||||
void HeapLogTsk()
|
||||
{
|
||||
while (TRUE)
|
||||
SwapInNext;
|
||||
}
|
||||
|
||||
void HeapLogMAlloc(U1 *add)
|
||||
{
|
||||
HeapLogStruct *temph;
|
||||
U8 i,old_flags;
|
||||
BoolU4 old_val;
|
||||
if (Fs==heaplog_test_tss) {
|
||||
old_val=LBtr(&sys_semas[SYS_SEMA_HEAPLOG],0);
|
||||
temph=MAlloc(sizeof(HeapLogStruct),heaplog_tss);
|
||||
LAssignBit(&sys_semas[SYS_SEMA_HEAPLOG],0,old_val);
|
||||
temph->add=add;
|
||||
temph->caller1=Caller(2);
|
||||
temph->caller2=Caller(3);
|
||||
temph->caller3=Caller(4);
|
||||
temph->caller4=Caller(5);
|
||||
i=(add>>2)&(HEAPLOG_HASH_SIZE-1);
|
||||
old_flags=GetFlags;
|
||||
Cli;
|
||||
InsQue(temph,heaplog_root[i].last);
|
||||
SetFlags(old_flags);
|
||||
}
|
||||
}
|
||||
|
||||
void HeapLogFree(U1 *add)
|
||||
{
|
||||
U8 i,old_flags;
|
||||
HeapLogStruct *temph;
|
||||
BoolU4 old_val;
|
||||
if (!add) return;
|
||||
if (Fs==heaplog_test_tss) {
|
||||
i=(add>>2)&(HEAPLOG_HASH_SIZE-1);
|
||||
old_flags=GetFlags;
|
||||
Cli;
|
||||
temph=heaplog_root[i].next;
|
||||
while (temph!=&heaplog_root[i]) {
|
||||
if (add==temph->add) {
|
||||
RemQue(temph);
|
||||
SetFlags(old_flags);
|
||||
old_val=LBtr(&sys_semas[SYS_SEMA_HEAPLOG],0);
|
||||
Free(temph,heaplog_tss);
|
||||
LAssignBit(&sys_semas[SYS_SEMA_HEAPLOG],0,old_val);
|
||||
return;
|
||||
}
|
||||
temph=temph->next;
|
||||
}
|
||||
SetFlags(old_flags);
|
||||
}
|
||||
}
|
||||
|
||||
public void HeapLogRep()
|
||||
{
|
||||
U8 i,total=0;
|
||||
HeapLogStruct *temph;
|
||||
BoolU4 old_val=LBtr(&sys_semas[SYS_SEMA_HEAPLOG],0);
|
||||
for (i=0;i<HEAPLOG_HASH_SIZE;i++) {
|
||||
temph=heaplog_root[i].next;
|
||||
while (temph!=&heaplog_root[i]) {
|
||||
PrintF("$$FG,RED$$%08X$$FG$$ %P %P %P %P\r\n",MSize(temph->add),
|
||||
temph->caller1,temph->caller2,temph->caller3,
|
||||
temph->caller4);
|
||||
total+=MSize(temph->add);
|
||||
temph=temph->next;
|
||||
}
|
||||
}
|
||||
LAssignBit(&sys_semas[SYS_SEMA_HEAPLOG],0,old_val);
|
||||
PrintF("\r\n$$FG,LTRED$$Total:%08X$$FG$$\r\n",total);
|
||||
}
|
||||
|
||||
public void HeapLog(BoolU4 val=TRUE,TssStruct *tss=NULL)
|
||||
{
|
||||
U8 i;
|
||||
if (val) {
|
||||
if (Bt(&sys_semas[SYS_SEMA_HEAPLOG],0))
|
||||
coutln "HeapLog Already Active";
|
||||
else {
|
||||
if (!tss) tss=Fs;
|
||||
heaplog_test_tss=tss;
|
||||
heaplog_tss=Spawn(&HeapLogTsk);
|
||||
ext[EXT_HEAPLOG_MALLOC]=&HeapLogMAlloc;
|
||||
ext[EXT_HEAPLOG_FREE]=&HeapLogFree;
|
||||
heaplog_root=MAlloc(sizeof(HeapLogHashStruct)*HEAPLOG_HASH_SIZE);
|
||||
for (i=0;i<HEAPLOG_HASH_SIZE;i++) {
|
||||
heaplog_root[i].next=&heaplog_root[i];
|
||||
heaplog_root[i].last=&heaplog_root[i];
|
||||
}
|
||||
LBts(&sys_semas[SYS_SEMA_HEAPLOG],0);
|
||||
}
|
||||
} else {
|
||||
if (!LBtr(&sys_semas[SYS_SEMA_HEAPLOG],0))
|
||||
coutln "HeapLog Not Active";
|
||||
else {
|
||||
Kill(heaplog_tss);
|
||||
heaplog_tss=NULL;
|
||||
Free(heaplog_root);
|
||||
ext[EXT_HEAPLOG_MALLOC]=NULL;
|
||||
ext[EXT_HEAPLOG_FREE]=NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#help_index ""
|
||||
@@ -0,0 +1,364 @@
|
||||
#help_index "Debugging"
|
||||
|
||||
ClassStruct *DbgFindFun(Ltf *l,I8 line_offset=0)
|
||||
{
|
||||
I1 st[256],*filename=l->filename.name;
|
||||
I8 line=l->cur_entry->y+1+line_offset;
|
||||
U8 i;
|
||||
SysHashEntry *temph;
|
||||
SysHashTable *h=Fs->hash_table;
|
||||
ClassStruct *tempc;
|
||||
DbgInfo *tempd;
|
||||
while (h) {
|
||||
for (i=0;i<=h->mask;i++) {
|
||||
temph=h->body[i];
|
||||
while (temph) {
|
||||
if (temph->type&HTT_FUNCTION) {
|
||||
tempc=temph;
|
||||
if (tempd=tempc->debug) {
|
||||
StrCpy(st,tempc->source_link);
|
||||
RemoveFirstSeg(st,":");
|
||||
RemoveLastSeg(st,",");
|
||||
if (!StrCmp(st,filename)) {
|
||||
if (line>=tempd->min_line && line<=tempd->max_line)
|
||||
return tempc;
|
||||
}
|
||||
}
|
||||
}
|
||||
temph=temph->next;
|
||||
}
|
||||
}
|
||||
h=h->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void WatchLocals()
|
||||
{
|
||||
BoolU4 old_preempt=Preempt(OFF);
|
||||
TssStruct *tss=Fs->parent_tss,*dbg_tss=tss->dbg_tss;
|
||||
Ltf *swap,*l;
|
||||
ClassStruct *tempc,*tempc1;
|
||||
U8 j,sc,ch;
|
||||
void **rbp,**ptr;
|
||||
I8 offset,ip;
|
||||
|
||||
Fs->double_buf_cur_ltf=LtfNew;
|
||||
while (TRUE) {
|
||||
if (!(dbg_tss=tss->dbg_tss))
|
||||
Exit;
|
||||
if (ScanKey(&ch,&sc,TRUE)) {
|
||||
j=Jiffies+JIFFY_FREQ*5;
|
||||
LtfDel(Fs->double_buf_cur_ltf);
|
||||
Fs->double_buf_cur_ltf=NULL;
|
||||
do {
|
||||
if (ch==CH_CTRLQ || ch==CH_ESC)
|
||||
Exit;
|
||||
if (ScanKey(&ch,&sc,TRUE))
|
||||
j=Jiffies+JIFFY_FREQ*5;
|
||||
WinSync;
|
||||
} while (Jiffies<j);
|
||||
Fs->double_buf_cur_ltf=LtfNew;
|
||||
} else {
|
||||
LtfDel(Fs->cur_ltf);
|
||||
Fs->cur_ltf=LtfNew;
|
||||
if (l=dbg_tss->cur_ltf) {
|
||||
if (tempc=DbgFindFun(l,0)) {
|
||||
PutS("$$WW,1$$");
|
||||
rbp=tss->rbp;
|
||||
ip=tss->rip;
|
||||
do {
|
||||
tempc1=FindPSect(ip,&offset);
|
||||
break; //TODO: load reg variables for higher level subroutines
|
||||
if (tempc==tempc1)
|
||||
break;
|
||||
else {
|
||||
if (rbp>=*rbp)
|
||||
break;
|
||||
ptr=rbp+8;
|
||||
rbp=*rbp;
|
||||
ip=*ptr;
|
||||
if (!CheckOnStk(rbp,tss))
|
||||
break;
|
||||
}
|
||||
} while (TRUE);
|
||||
if (tempc==tempc1)
|
||||
FunRep(tempc->str,rbp,2,tss);
|
||||
}
|
||||
}
|
||||
swap=Fs->double_buf_cur_ltf;
|
||||
Fs->double_buf_cur_ltf=Fs->cur_ltf;
|
||||
Fs->cur_ltf=swap;
|
||||
WinSync;
|
||||
}
|
||||
}
|
||||
LtfDel(Fs->double_buf_cur_ltf);
|
||||
Fs->double_buf_cur_ltf=NULL;
|
||||
Preempt(old_preempt);
|
||||
}
|
||||
|
||||
|
||||
public void IDE(I1 *filename)
|
||||
//Spawns a child process which has
|
||||
//access to parents symbols. Can be used
|
||||
//to debug parent.
|
||||
{
|
||||
TssStruct *tss;
|
||||
I1 *fn1=DefaultExtension(filename,"CPZ"),
|
||||
*fn2=AbsoluteFileName(fn1);
|
||||
|
||||
if (PopUpCancelOk("$$BK,1$$$$FG,RED$$LoseThos IDE Debugger$$FG$$$$BK,0$$\r\n"
|
||||
"Do not use this on files that run when included.\r\n"
|
||||
"\r\nTo use:\r\n"
|
||||
" 1) Set a break-point in the editor window.\r\n"
|
||||
" 2) Run program from command line.\r\n\r\n"
|
||||
"$$FG,GREEN$$F5$$FG$$\t\tGo\r\n"
|
||||
"$$FG,GREEN$$SHIFT-F5$$FG$$\tStep\r\n"
|
||||
"$$FG,GREEN$$F9$$FG$$\t\tToggle Break Point\r\n"
|
||||
"$$FG,GREEN$$SHIFT-F9$$FG$$\tClear All Break Points\r\n"
|
||||
)) {
|
||||
if (!Fs->dbg_tss) {
|
||||
Fs->win_top=2;
|
||||
Fs->win_bottom=TEXT_ROWS-2;
|
||||
Fs->win_left=1;
|
||||
Fs->win_right=TEXT_COLS>>1-1;
|
||||
|
||||
tss=Spawn(&UserCmdLine,"Debug Task",Fs);
|
||||
WaitTskIdle(tss);
|
||||
tss->win_top=12;
|
||||
tss->win_bottom=TEXT_ROWS-2;
|
||||
tss->win_left=TEXT_COLS>>1+1;
|
||||
tss->win_right=TEXT_COLS-2;
|
||||
XTalk(tss,"Edit(\"%s\");\r",fn2);
|
||||
|
||||
Fs->dbg_tss=tss;
|
||||
|
||||
tss=Spawn(&UserCmdLine,"Watch Task",Fs);
|
||||
WaitTskIdle(tss);
|
||||
tss->win_top=2;
|
||||
tss->win_bottom=10;
|
||||
tss->win_left=TEXT_COLS>>1+1;
|
||||
tss->win_right=TEXT_COLS-2;
|
||||
XTalk(tss,"WatchLocals;\r");
|
||||
|
||||
ExecuteFile(fn2);
|
||||
}
|
||||
Free(fn1);
|
||||
Free(fn2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#help_index "Debugging/Breakpoints"
|
||||
I8 IDELineAdd(DbgInfo *tempd,I8 line)
|
||||
{
|
||||
I8 max=tempd->max_line-tempd->min_line;
|
||||
line-=tempd->min_line;
|
||||
if (line<0)
|
||||
return IDELineAdd(tempd,tempd->min_line);
|
||||
while (!tempd->body[line] && line<max)
|
||||
line++;
|
||||
return tempd->body[line];
|
||||
}
|
||||
|
||||
I8 IDERIPLineNum(Ltf *l,void *rip)
|
||||
{
|
||||
I1 st[256],*filename=l->filename.name;
|
||||
I8 line;
|
||||
SysHashEntry *temph;
|
||||
SysHashTable *h=Fs->hash_table;
|
||||
ClassStruct *tempc;
|
||||
I8 i;
|
||||
DbgInfo *tempd;
|
||||
while (h) {
|
||||
for (i=0;i<=h->mask;i++) {
|
||||
temph=h->body[i];
|
||||
while (temph) {
|
||||
if (temph->type&HTT_FUNCTION) {
|
||||
tempc=temph;
|
||||
if (tempd=tempc->debug) {
|
||||
StrCpy(st,tempc->source_link);
|
||||
RemoveFirstSeg(st,":");
|
||||
RemoveLastSeg(st,",");
|
||||
if (!StrCmp(st,filename)) {
|
||||
for (line=tempd->min_line;line<=tempd->max_line;line++)
|
||||
if (rip>=IDELineAdd(tempd,line) &&
|
||||
rip<IDELineAdd(tempd,line+1))
|
||||
return line;
|
||||
}
|
||||
}
|
||||
}
|
||||
temph=temph->next;
|
||||
}
|
||||
}
|
||||
h=h->next;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void IDESetStepRange(Ltf *l)
|
||||
{
|
||||
I1 st[256],*filename=l->filename.name;
|
||||
I8 line=l->cur_entry->y+1;
|
||||
SysHashEntry *temph;
|
||||
SysHashTable *h=Fs->hash_table;
|
||||
ClassStruct *tempc;
|
||||
I8 i;
|
||||
DbgInfo *tempd;
|
||||
while (h) {
|
||||
for (i=0;i<=h->mask;i++) {
|
||||
temph=h->body[i];
|
||||
while (temph) {
|
||||
if (temph->type&HTT_FUNCTION) {
|
||||
tempc=temph;
|
||||
if (tempd=tempc->debug) {
|
||||
StrCpy(st,tempc->source_link);
|
||||
RemoveFirstSeg(st,":");
|
||||
RemoveLastSeg(st,",");
|
||||
if (!StrCmp(st,filename)) {
|
||||
if (line>=tempd->min_line && line<=tempd->max_line) {
|
||||
Fs->user_data0=IDELineAdd(tempd,line);
|
||||
Fs->user_data1=IDELineAdd(tempd,line+1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
temph=temph->next;
|
||||
}
|
||||
}
|
||||
h=h->next;
|
||||
}
|
||||
}
|
||||
|
||||
void IDEToggleBpt(Ltf *l)
|
||||
{ //F9
|
||||
I1 st[256],*filename=l->filename.name;
|
||||
I8 line=l->cur_entry->y+1;
|
||||
SysHashEntry *temph;
|
||||
SysHashTable *h=Fs->hash_table;
|
||||
ClassStruct *tempc;
|
||||
I8 i,a;
|
||||
DbgInfo *tempd;
|
||||
LtfEntry *ll;
|
||||
while (h) {
|
||||
for (i=0;i<=h->mask;i++) {
|
||||
temph=h->body[i];
|
||||
while (temph) {
|
||||
if (temph->type&HTT_FUNCTION) {
|
||||
tempc=temph;
|
||||
if (tempd=tempc->debug) {
|
||||
StrCpy(st,tempc->source_link);
|
||||
RemoveFirstSeg(st,":");
|
||||
RemoveLastSeg(st,",");
|
||||
if (!StrCmp(st,filename)) {
|
||||
if (line>=tempd->min_line && line<=tempd->max_line) {
|
||||
a=IDELineAdd(tempd,line);
|
||||
ll=l->cur_entry;
|
||||
while (ll->last->btype!=LTFT_CR &&
|
||||
ll->last->btype!=LTFT_SOFT_CR &&
|
||||
ll->last!=l)
|
||||
ll=ll->last;
|
||||
l->cur_entry=ll;
|
||||
l->cur_data_col=ll->min_col;
|
||||
if (!RBpt(Fs->parent_tss,a)) {
|
||||
SBpt(Fs->parent_tss,a,SBPTF_BPT);
|
||||
Auto("$$BP$$");
|
||||
} else {
|
||||
if (ll->btype==LTFT_BPT) {
|
||||
l->cur_entry=ll->next;
|
||||
l->cur_data_col=l->cur_entry->min_col;
|
||||
LtfDelEntry(l,ll);
|
||||
}
|
||||
}
|
||||
LtfGotoLineNum(l,line);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
temph=temph->next;
|
||||
}
|
||||
}
|
||||
h=h->next;
|
||||
}
|
||||
}
|
||||
|
||||
void IDEClearAllBpts(Ltf *l)
|
||||
{ //SHIFT-F9
|
||||
LtfEntry *ll,*ll2;
|
||||
CBpt(Fs->parent_tss);
|
||||
ll=l->dummy.next;
|
||||
while (ll!=l) {
|
||||
ll2=ll->next;
|
||||
if (ll->btype==LTFT_BPT) {
|
||||
if (l->cur_entry==ll) {
|
||||
l->cur_entry=ll->next;
|
||||
l->cur_data_col=l->cur_entry->min_col;
|
||||
}
|
||||
LtfDelEntry(l,ll);
|
||||
}
|
||||
ll=ll2;
|
||||
}
|
||||
}
|
||||
|
||||
void IDEGo() //Continue after breakpoint
|
||||
{ //F5
|
||||
TssStruct *tss=Fs->parent_tss;
|
||||
void *rip=&tss->rip;
|
||||
if (!Btr(&tss->task_flags,TSSf_DISABLE_BPTS)) {
|
||||
*rip-=1;
|
||||
if (!DBpt(tss,*rip))
|
||||
*rip+=1;
|
||||
}
|
||||
Fs->user_data0=0;
|
||||
Fs->user_data1=0;
|
||||
Btr(&tss->rflags,8);
|
||||
Btr(&tss->task_flags,TSSf_SUSPENDED);
|
||||
}
|
||||
|
||||
void IDEStep(Ltf *l) //Single step
|
||||
{ //SHIFT-F5
|
||||
TssStruct *tss=Fs->parent_tss;
|
||||
void *rip=&tss->rip;
|
||||
I8 line=IDERIPLineNum(l,*rip);
|
||||
if (!Bts(&tss->task_flags,TSSf_DISABLE_BPTS)) {
|
||||
*rip-=1;
|
||||
if (!DBpt(tss,*rip))
|
||||
*rip+=1;
|
||||
}
|
||||
if (line>0) {
|
||||
LtfGotoLineNum(l,line);
|
||||
IDESetStepRange(l);
|
||||
} else {
|
||||
Fs->user_data0=0;
|
||||
Fs->user_data1=0;
|
||||
}
|
||||
Bts(&tss->rflags,8);
|
||||
Btr(&tss->task_flags,TSSf_SUSPENDED);
|
||||
}
|
||||
|
||||
void IDESetLineNum(Ltf *l)
|
||||
{ //SHIFT-F8
|
||||
TssStruct *tss=Fs->parent_tss;
|
||||
I8 line=IDERIPLineNum(l,tss->rip);
|
||||
if (line>0)
|
||||
LtfGotoLineNum(l,line);
|
||||
}
|
||||
|
||||
void IDEResumeDbg()
|
||||
{
|
||||
TssStruct *dbg=Fs->dbg_tss;
|
||||
I8 u0=dbg->user_data0,u1=dbg->user_data1;
|
||||
if (!u0 || (Fs->rip<u0 || Fs->rip>u1) ||
|
||||
Fs->rip==u1 && u1!=u0) {
|
||||
WinToTop(dbg);
|
||||
QueueMsg(dbg,NULL,MSG_KEY_DOWN,0,SCF_SHIFT+SC_F8,0);
|
||||
} else
|
||||
Btr(&Fs->task_flags,TSSf_SUSPENDED);
|
||||
}
|
||||
|
||||
ext[EXT_RESUME_DBG]=&IDEResumeDbg;
|
||||
|
||||
#help_index ""
|
||||
| ||||