TempleOSCDV4.02.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:46:54 +02:00
1 parent fedf66361e
commit 1541d7328d
171 files changed
+5326 -5237

No files matched your search

-158
View File
@@ -58,39 +58,6 @@ public U8 *Dump(U8 *filename,Bool write=FALSE)
return buf;
}
#help_index "File/Program Routines"
U0 FOFlatten(CDirEntry *tempde,CDirEntry **a,I64 *i)
{
CDirEntry *tempde1;
while (tempde) {
tempde1=tempde->next;
if (tempde->attr&RS_ATTR_DIR) {
FOFlatten(tempde->sub,a,i);
DirEntryDel(tempde);
} else {
a[*i]=tempde;
*i=*i+1;
}
tempde=tempde1;
}
}
public I64 FileCnt(CDirEntry *tempde)
{//Cnt of files in $LK,"CDirEntry",A="MN:CDirEntry"$ tree.
I64 cnt=0;
while (tempde) {
if (tempde->attr&RS_ATTR_DIR)
cnt+=FileCnt(tempde->sub);
else
cnt++;
tempde=tempde->next;
}
return cnt;
}
#help_index "File/Cmd Line (Typically);Cmd Line (Typically)"
public Bool Copy(U8 *src_files_find_mask,U8 *dst_files_find_mask=".")
{//Copy files.
//If the name ends in ".Z", it will
@@ -281,128 +248,3 @@ Touch(filename,"",,datetime);
}
DirTreeDel(tempde1);
}
public I64 FF(U8 *files_find_mask,U8 *fu_flags=NULL)
{//Files find. List files matching mask.
I64 cnt=0,fuf_flags=0;
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);
'\n';
cnt++;
tempde=tempde->next;
}
DirTreeDel(tempde1);
return cnt;
}
public U0 DrvTextAttrSet(U8 drv_let,U8 attr)
{//Set color of the window border text
//for when this drive is the current drive.
CDrv *dv;
try {
dv=Let2Drv(drv_let);
dv->text_attr=attr;
} catch
Fs->catch_except=TRUE;
}
I64 RedSeaUnusedDrvSpace(U8 drv_let=0)
{
CDrv *dv=Let2Drv(drv_let);
I64 result=0,i,l;
U8 *bitmap;
try {
l=(dv->size+dv->spc-1)/dv->spc;
i=((l+7)>>3+BLK_SIZE-1)>>BLK_SIZE_BITS;
bitmap=MAlloc(i<<BLK_SIZE_BITS);
RBlks(dv,bitmap,dv->fat1,i);
for (i=0;i<l;i++)
if (!Bt(bitmap,i))
result++;
Free(bitmap);
} catch
DrvUnlock(dv);
return result*BLK_SIZE*dv->spc;
}
I64 FAT32UnusedDrvSpace(U8 drv_let=0)
{
CDrv *dv=Let2Drv(drv_let);
I64 result=0,i,l;
U32 *bitmap;
try {
l=(dv->size+dv->spc-1)/dv->spc;
i=(l*4+BLK_SIZE-1)>>BLK_SIZE_BITS;
bitmap=MAlloc(i<<BLK_SIZE_BITS);
RBlks(dv,bitmap,dv->fat1,i);
for (i=0;i<l;i++)
if (!bitmap[i])
result++;
Free(bitmap);
} catch
DrvUnlock(dv);
return result*BLK_SIZE*dv->spc;
}
public I64 UnusedDrvSpace(U8 drv_let=0)
{//Returns unused size in bytes.
CDrv *dv=Let2Drv(drv_let),*old_dv=Fs->cur_dv;
U8 *old_dir=StrNew(Fs->cur_dir);
I64 result=0;
Drv(drv_let);
switch (dv->type) {
case DVT_REDSEA:
result=RedSeaUnusedDrvSpace(drv_let);
break;
case DVT_FAT32:
result=FAT32UnusedDrvSpace(drv_let);
break;
default:
PrintErr("File System Not Supported\n");
}
Drv(Drv2Let(old_dv));
Cd(old_dir);
Free(old_dir);
return result;
}
#help_index "File/Program Routines"
I64 Size1(CDirEntry *tempde,I64 *_fuf_flags,I64 round_to)
{
U8 buf[BLK_SIZE];
I64 result=0,i;
CDrv *dv;
while (tempde) {
if ((i=tempde->size) && Bt(_fuf_flags,FUf_EXPAND) &&
!(tempde->attr&RS_ATTR_DIR) &&
FileAttr(tempde->name)&RS_ATTR_COMPRESSED) {
dv=Let2Drv(*tempde->full_name);
RBlks(dv,buf,Cluster2Blk(dv,tempde->cluster),1);
i=(&buf)(CArcCompress *)->expanded_size;
}
if (round_to)
i=CeilU64(tempde->size,round_to);
if (tempde->attr&RS_ATTR_DIR)
i+=Size1(tempde->sub,_fuf_flags,round_to);
tempde->user_data=i;
result+=i;
tempde=tempde->next;
}
return result;
}
public I64 Size(U8 *files_find_mask="/*",U8 *fu_flags=NULL,I64 round_to=0)
{//Total size of files in mask. "+x" for expanded size.
//Does not include directory size of base directory, but
//does include size of sub directories.
I64 fuf_flags=0,result=0;
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&FUG_FILES_FIND)) {
fuf_flags&=FUF_EXPAND;
result=Size1(tempde1,&fuf_flags,round_to);
DirTreeDel(tempde1);
}
return result;
}
+73 -317
View File
@@ -60,336 +60,92 @@ public CDirEntry *DirTreeUnserialize(U8 *src)
return tempde;
}
#help_index "Install;File/Cmd Line (Typically);Cmd Line (Typically)"
#define ROUND_DRV_TO (63*255)
#define DRV_HEADER 63
class CPlannedDrv
#help_index "File/Program Routines"
U0 FOFlatten(CDirEntry *tempde,CDirEntry **a,I64 *i)
{
CPlannedDrv *next,*last;
I64 size;
Bool pri;
};
//Available to assist in writing scripts.
I64 drv_dsk_dsk_size;
public U0 PrtDsk(U8 drv_let=0)
{//Partition the disk containing partition drv_let.
//drv_let=0 means add new drive that
//is not already mounted.
CBlkDev *bd;
CPlannedDrv root,*temppp;
CMasterBoot mbr;
Bool pri=TRUE;
I64 ext_base,drv_let2,pri_cnt=0,
i,start_offset,offset,remaining;
"This command does not play well\n"
"with other operating systems.\n"
"You really should use another\n"
"operating system's partitioner.\n"
"If you use this, it may, in fact,\n"
"make your hard drive impossible\n"
"to repartition with other operating\n"
"until you set block zero to zero\n"
"with $$LK,\"MasterBootZero\",\"MN:MasterBootZero\"$$()\n\n\n"
"Continue";
if (!YorN) return;
if (drv_let)
try
Let2BlkDev(drv_let);
catch {
drv_let=0;
Fs->catch_except=TRUE;
CDirEntry *tempde1;
while (tempde) {
tempde1=tempde->next;
if (tempde->attr&RS_ATTR_DIR) {
FOFlatten(tempde->sub,a,i);
DirEntryDel(tempde);
} else {
a[*i]=tempde;
*i=*i+1;
}
if (!drv_let) {
Mount(TRUE);
return;
}
bd=Let2BlkDev(drv_let);
if (!bd || bd->type!=BDT_ATA)
return;
drv_dsk_dsk_size=bd->max_blk+1;
QueInit(&root);
drv_let2=bd->first_drv_let;
remaining=FloorU64(bd->max_blk+1,ROUND_DRV_TO);
while (FloorU64(remaining,ROUND_DRV_TO)>=ROUND_DRV_TO) {
temppp=MAlloc(sizeof(CPlannedDrv));
do {
"$$RED$$Partition %C$$FG$$\n",drv_let2;
temppp->pri=FALSE;
if (pri) {
"Primary Partition";
if (YorN) {
pri_cnt++;
temppp->pri=TRUE;
if (pri_cnt==3)
pri=FALSE;
} else
pri=FALSE;
}
"Blocks Remaining:%d (0x%X)\n",
remaining-DRV_HEADER,remaining-DRV_HEADER;
temppp->size=CeilU64(GetI64("Size in Blocks :",
remaining-DRV_HEADER)+DRV_HEADER,ROUND_DRV_TO);
} while (!(ROUND_DRV_TO<=temppp->size<=FloorU64(remaining,ROUND_DRV_TO)));
QueIns(temppp,root.last);
remaining-=temppp->size;
drv_let2++;
}
"\n\n!!! Repartition Drive !!!\n\n";
temppp=root.next;
drv_let2=bd->first_drv_let;
while (temppp!=&root) {
"Drive %C:%08X ",drv_let2,temppp->size;
if (temppp->pri)
"Primary\n";
else
"Logical\n";
temppp=temppp->next;
drv_let2++;
}
if (!AreYouSure)
goto pd_done;
remaining=FloorU64(bd->max_blk+1,ROUND_DRV_TO)-ROUND_DRV_TO;
temppp=root.next;
MemSet(&mbr,0,BLK_SIZE);
mbr.signature=0xAA55;
offset=0;
for (i=0;i<pri_cnt;i++) {
mbr.p[i].active=0x80;
mbr.p[i].start_head=0;
mbr.p[i].start_cyl=0x101;
mbr.p[i].type=1; //Will get set different.
mbr.p[i].end_head=0xFE;
mbr.p[i].end_cyl=0xFFFF;
mbr.p[i].offset=DRV_HEADER+offset;
mbr.p[i].size=temppp->size-DRV_HEADER;
offset+=temppp->size;
remaining-=temppp->size;
temppp=temppp->next;
}
if (!i) i++;
if (temppp!=&root) {
mbr.p[i].active=0x80;
mbr.p[i].start_head=0;
mbr.p[i].start_cyl=0x101;
mbr.p[i].type=0xF;
mbr.p[i].end_head=0xFE;
mbr.p[i].end_cyl=0xFFFF;
mbr.p[i].offset=offset;
mbr.p[i].size=remaining;
ext_base=offset;
}
ATAWriteBlks(bd,&mbr,0,1);
while (temppp!=&root) {
start_offset=offset;
MemSet(&mbr,0,BLK_SIZE);
mbr.signature=0xAA55;
mbr.p[0].active=0x80;
mbr.p[0].start_head=1;
mbr.p[0].start_cyl=0x101;
mbr.p[0].type=1; //Will get set different.
mbr.p[0].end_head=0xFE;
mbr.p[0].end_cyl=0xFFFF;
mbr.p[0].offset=DRV_HEADER;
mbr.p[0].size=temppp->size-DRV_HEADER;
offset+=temppp->size;
temppp=temppp->next;
if (temppp!=&root) {
mbr.p[1].active=0x80;
mbr.p[1].start_head=0;
mbr.p[1].start_cyl=0x101;
mbr.p[1].type=5;
mbr.p[1].end_head=0xFE;
mbr.p[1].end_cyl=0xFFFF;
mbr.p[1].offset=offset-ext_base;
mbr.p[1].size=temppp->size;
}
ATAWriteBlks(bd,&mbr,start_offset,1);
}
bd->flags&=~(BDF_INITIALIZED | BDF_INIT_IN_PROGRESS);
BlkDevAdd(bd,FALSE,TRUE);
for (i=bd->first_drv_let;i<drv_let2;i++)
Fmt(i,,FALSE);
pd_done:
while (root.next!=&root) {
temppp=root.next;
QueRem(temppp);
Free(temppp);
tempde=tempde1;
}
}
#help_index "Info;File/Cmd Line (Typically);Cmd Line (Typically)"
U0 RedSeaDrvView(U8 drv_let=0)
I64 Size1(CDirEntry *tempde,I64 *_fuf_flags,I64 round_to)
{
CDrv *dv=Let2Drv(drv_let);
I64 lohi,c1,i,x,y,l,s;
U8 *bitmap;
CDC *dc=DCAlias;
l=(GR_HEIGHT-3*FONT_HEIGHT)*(GR_WIDTH-FONT_WIDTH<<1),
s=(dv->size+dv->spc-1)/dv->spc;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
WinMax;
DocCursor;
DocClear;
DCFill;
try {
i=((s+7)>>3+BLK_SIZE-1)>>BLK_SIZE_BITS;
bitmap=MAlloc(i<<BLK_SIZE_BITS);
RBlks(dv,bitmap,dv->fat1,i);
i=0;
for (y=0;y<GR_HEIGHT-3*FONT_HEIGHT;y++) {
if (ScanKey)
break;
for (x=0;x<GR_WIDTH-FONT_WIDTH<<1;x++) {
lohi=i*s;
c1=lohi/l;
if (Bt(bitmap,c1))
dc->color=ROP_XOR+BLUE^TRANSPARENT;
else
dc->color=ROP_XOR+WHITE^TRANSPARENT;
GrPlot(dc,x,y);
i++;
}
}
Free(bitmap);
} catch
DrvUnlock(dv);
GetChar;
SettingsPop;
DCFill;
DCDel(dc);
}
U0 FAT32DrvView(U8 drv_let=0)
{
CDrv *dv=Let2Drv(drv_let);
I64 lohi,c1,i,x,y,l,s;
U32 *bitmap;
CDC *dc=DCAlias;
l=(GR_HEIGHT-3*FONT_HEIGHT)*(GR_WIDTH-FONT_WIDTH<<1),
s=(dv->size+dv->spc-1)/dv->spc;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
WinMax;
DocCursor;
DocClear;
DCFill;
try {
i=(s*4+BLK_SIZE-1)>>BLK_SIZE_BITS;
bitmap=MAlloc(i<<BLK_SIZE_BITS);
RBlks(dv,bitmap,dv->fat1,i);
i=0;
for (y=0;y<GR_HEIGHT-3*FONT_HEIGHT;y++) {
if (ScanKey)
break;
for (x=0;x<GR_WIDTH-FONT_WIDTH<<1;x++) {
lohi=i*s;
c1=lohi/l;
if (bitmap[c1])
dc->color=ROP_XOR+BLUE^TRANSPARENT;
else
dc->color=ROP_XOR+WHITE^TRANSPARENT;
GrPlot(dc,x,y);
i++;
}
}
Free(bitmap);
} catch
DrvUnlock(dv);
GetChar;
SettingsPop;
DCFill;
DCDel(dc);
}
public U0 DrvView(U8 drv_let=0)
{//Drive view. Graph the allocation map's fragmentation.
CDrv *dv=Let2Drv(drv_let),*old_dv=Fs->cur_dv;
Drv(drv_let);
switch (dv->type) {
case DVT_REDSEA:
RedSeaDrvView(drv_let);
break;
case DVT_FAT32:
FAT32DrvView(drv_let);
break;
default:
PrintErr("File System Not Supported\n");
}
Drv(Drv2Let(old_dv));
}
public U0 DskView(U8 drv_let=0)
{//Disk view. Pie chart of partition sizes.
I64 i,j,
h=Fs->pix_width,
v=Fs->pix_height,
radius;
U8 buf[BLK_SIZE];
I64 result=0,i;
CDrv *dv;
CBlkDev *bd=Let2BlkDev(drv_let);
CDC *dc=DCAlias;
F64 sect_start,sect_end;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
DocCursor;
DocClear;
DCFill;
if (h<v)
radius=0.4*h;
else
radius=0.4*v;
dc->color=BLACK;
GrCircle(dc,h>>1,v>>1,radius);
j=1;
for (i=0;i<NUM_DRVS;i++) {
dv=&blkdev.drvs[i];
if (bd==dv->bd && dv->type) {
sect_start=-(dv->base_offset*2*ã/(bd->max_blk+1));
sect_end =-((dv->base_offset+dv->size)*2*ã/(bd->max_blk+1));
dc->color=BLACK;
GrLine(dc,h>>1,v>>1,
h>>1+radius*Cos(sect_start),
v>>1+radius*Sin(sect_start));
GrLine(dc,h>>1,v>>1,
h>>1+radius*Cos(sect_end),
v>>1+radius*Sin(sect_end));
dc->color=j;
GrPrint(dc,0,v-FONT_HEIGHT*j,"%C %-8Z",Drv2Let(dv),
dv->type.u16[0],"ST_DRV_TYPES");
GrFloodFill(dc,
h>>1+(radius-4)*Cos((sect_start+sect_end)/2),
v>>1+(radius-4)*Sin((sect_start+sect_end)/2),FALSE);
j++;
while (tempde) {
if ((i=tempde->size) && Bt(_fuf_flags,FUf_EXPAND) &&
!(tempde->attr&RS_ATTR_DIR) &&
FileAttr(tempde->name)&RS_ATTR_COMPRESSED) {
dv=Let2Drv(*tempde->full_name);
RBlks(dv,buf,Cluster2Blk(dv,tempde->cluster),1);
i=(&buf)(CArcCompress *)->expanded_size;
}
if (round_to)
i=CeilU64(tempde->size,round_to);
if (tempde->attr&RS_ATTR_DIR)
i+=Size1(tempde->sub,_fuf_flags,round_to);
tempde->user_data=i;
result+=i;
tempde=tempde->next;
}
return result;
}
public I64 Size(U8 *files_find_mask="/*",U8 *fu_flags=NULL,I64 round_to=0)
{//Total size of files in mask. "+x" for expanded size.
//Does not include directory size of base directory, but
//does include size of sub directories.
I64 fuf_flags=0,result=0;
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&FUG_FILES_FIND)) {
fuf_flags&=FUF_EXPAND;
result=Size1(tempde1,&fuf_flags,round_to);
DirTreeDel(tempde1);
}
return result;
}
GetChar(,FALSE);
SettingsPop;
DCFill;
DCDel(dc);
public I64 FileCnt(CDirEntry *tempde)
{//Cnt of files in $LK,"CDirEntry",A="MN:CDirEntry"$ tree.
I64 cnt=0;
while (tempde) {
if (tempde->attr&RS_ATTR_DIR)
cnt+=FileCnt(tempde->sub);
else
cnt++;
tempde=tempde->next;
}
return cnt;
}
#help_index "File/Cmd Line (Typically);Cmd Line (Typically)"
public I64 FF(U8 *files_find_mask,U8 *fu_flags=NULL)
{//Files find. List files matching mask.
I64 cnt=0,fuf_flags=0;
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);
'\n';
cnt++;
tempde=tempde->next;
}
DirTreeDel(tempde1);
return cnt;
}
public I64 Zip(U8 *files_find_mask="*",U8 *fu_flags=NULL)
{//Compress files by moving to .Z filename.
+218 -3
View File
@@ -209,11 +209,11 @@ public I64 ChkDsk(U8 drv_let=0,Bool fix=FALSE,Bool confirm=TRUE)
//You probably want to reformat and reinstall.
I64 errs=0;
CDrv *dv=Let2Drv(drv_let);
switch (dv->type) {
case DVT_REDSEA:
switch (dv->fs_type) {
case FSt_REDSEA:
errs=RedSeaChkDsk(drv_let,&fix,&confirm);
break;
case DVT_FAT32:
case FSt_FAT32:
errs=FAT32ChkDsk(drv_let,&fix,&confirm);
break;
default:
@@ -228,3 +228,218 @@ public I64 ChkDsk(U8 drv_let=0,Bool fix=FALSE,Bool confirm=TRUE)
}
return errs;
}
U0 RedSeaDrvView(U8 drv_let=0)
{
CDrv *dv=Let2Drv(drv_let);
I64 lohi,c1,i,x,y,l,s;
U8 *bitmap;
CDC *dc=DCAlias;
l=(GR_HEIGHT-3*FONT_HEIGHT)*(GR_WIDTH-FONT_WIDTH<<1),
s=(dv->size+dv->spc-1)/dv->spc;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
WinMax;
DocCursor;
DocClear;
DCFill;
try {
i=((s+7)>>3+BLK_SIZE-1)>>BLK_SIZE_BITS;
bitmap=MAlloc(i<<BLK_SIZE_BITS);
RBlks(dv,bitmap,dv->fat1,i);
i=0;
for (y=0;y<GR_HEIGHT-3*FONT_HEIGHT;y++) {
if (ScanKey)
break;
for (x=0;x<GR_WIDTH-FONT_WIDTH<<1;x++) {
lohi=i*s;
c1=lohi/l;
if (Bt(bitmap,c1))
dc->color=ROP_XOR+BLUE^TRANSPARENT;
else
dc->color=ROP_XOR+WHITE^TRANSPARENT;
GrPlot(dc,x,y);
i++;
}
}
Free(bitmap);
} catch
DrvUnlock(dv);
GetChar;
SettingsPop;
DCFill;
DCDel(dc);
}
U0 FAT32DrvView(U8 drv_let=0)
{
CDrv *dv=Let2Drv(drv_let);
I64 lohi,c1,i,x,y,l,s;
U32 *bitmap;
CDC *dc=DCAlias;
l=(GR_HEIGHT-3*FONT_HEIGHT)*(GR_WIDTH-FONT_WIDTH<<1),
s=(dv->size+dv->spc-1)/dv->spc;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
WinMax;
DocCursor;
DocClear;
DCFill;
try {
i=(s*4+BLK_SIZE-1)>>BLK_SIZE_BITS;
bitmap=MAlloc(i<<BLK_SIZE_BITS);
RBlks(dv,bitmap,dv->fat1,i);
i=0;
for (y=0;y<GR_HEIGHT-3*FONT_HEIGHT;y++) {
if (ScanKey)
break;
for (x=0;x<GR_WIDTH-FONT_WIDTH<<1;x++) {
lohi=i*s;
c1=lohi/l;
if (bitmap[c1])
dc->color=ROP_XOR+BLUE^TRANSPARENT;
else
dc->color=ROP_XOR+WHITE^TRANSPARENT;
GrPlot(dc,x,y);
i++;
}
}
Free(bitmap);
} catch
DrvUnlock(dv);
GetChar;
SettingsPop;
DCFill;
DCDel(dc);
}
public U0 DrvView(U8 drv_let=0)
{//Drive view. Graph the allocation map's fragmentation.
CDrv *dv=Let2Drv(drv_let),*old_dv=Fs->cur_dv;
Drv(drv_let);
switch (dv->fs_type) {
case FSt_REDSEA:
RedSeaDrvView(drv_let);
break;
case FSt_FAT32:
FAT32DrvView(drv_let);
break;
default:
PrintErr("File System Not Supported\n");
}
Drv(Drv2Let(old_dv));
}
public U0 DskView(U8 drv_let=0)
{//Disk view. Pie chart of partition sizes.
I64 i,j,attr,
h=Fs->pix_width,
v=Fs->pix_height,
radius;
CDrv *dv;
CBlkDev *bd=Let2BlkDev(drv_let);
CDC *dc=DCAlias;
F64 sect_start,sect_end;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
DocCursor;
DocClear;
DCFill;
if (h<v)
radius=0.4*h;
else
radius=0.4*v;
dc->color=BLACK;
GrCircle(dc,h>>1,v>>1,radius);
j=1;
for (i=0;i<NUM_DRVS;i++) {
dv=&blkdev.drvs[i];
if (bd==dv->bd && dv->fs_type) {
sect_start=-(dv->base_offset*2*ã/(bd->max_blk+1));
sect_end =-((dv->base_offset+dv->size)*2*ã/(bd->max_blk+1));
dc->color=BLACK;
GrLine(dc,h>>1,v>>1,
h>>1+radius*Cos(sect_start),
v>>1+radius*Sin(sect_start));
GrLine(dc,h>>1,v>>1,
h>>1+radius*Cos(sect_end),
v>>1+radius*Sin(sect_end));
attr=DrvTextAttrGet(Drv2Let(dv));
dc->color=attr&15;
GrPrint(dc,0,v-FONT_HEIGHT*j,"%C %-8Z",Drv2Let(dv),
dv->fs_type,"ST_DRV_TYPES");
dc->color.c1=attr>>4;
dc->color|=ROPF_DITHER;
GrFloodFill(dc,
h>>1+(radius-4)*Cos((sect_start+sect_end)/2),
v>>1+(radius-4)*Sin((sect_start+sect_end)/2),FALSE);
j++;
}
}
GetChar(,FALSE);
SettingsPop;
DCFill;
DCDel(dc);
}
I64 RedSeaUnusedDrvSpace(U8 drv_let=0)
{
CDrv *dv=Let2Drv(drv_let);
I64 result=0,i,l;
U8 *bitmap;
try {
l=(dv->size+dv->spc-1)/dv->spc;
i=((l+7)>>3+BLK_SIZE-1)>>BLK_SIZE_BITS;
bitmap=MAlloc(i<<BLK_SIZE_BITS);
RBlks(dv,bitmap,dv->fat1,i);
for (i=0;i<l;i++)
if (!Bt(bitmap,i))
result++;
Free(bitmap);
} catch
DrvUnlock(dv);
return result*BLK_SIZE*dv->spc;
}
I64 FAT32UnusedDrvSpace(U8 drv_let=0)
{
CDrv *dv=Let2Drv(drv_let);
I64 result=0,i,l;
U32 *bitmap;
try {
l=(dv->size+dv->spc-1)/dv->spc;
i=(l*4+BLK_SIZE-1)>>BLK_SIZE_BITS;
bitmap=MAlloc(i<<BLK_SIZE_BITS);
RBlks(dv,bitmap,dv->fat1,i);
for (i=0;i<l;i++)
if (!bitmap[i])
result++;
Free(bitmap);
} catch
DrvUnlock(dv);
return result*BLK_SIZE*dv->spc;
}
public I64 UnusedDrvSpace(U8 drv_let=0)
{//Returns unused size in bytes.
CDrv *dv=Let2Drv(drv_let),*old_dv=Fs->cur_dv;
U8 *old_dir=StrNew(Fs->cur_dir);
I64 result=0;
Drv(drv_let);
switch (dv->fs_type) {
case FSt_REDSEA:
result=RedSeaUnusedDrvSpace(drv_let);
break;
case FSt_FAT32:
result=FAT32UnusedDrvSpace(drv_let);
break;
default:
PrintErr("File System Not Supported\n");
}
Drv(Drv2Let(old_dv));
Cd(old_dir);
Free(old_dir);
return result;
}
+2 -2
View File
@@ -217,9 +217,9 @@ U0 FMRebuildDoc(CDoc **_doc,CDirEntry **_root,I64 mode)
DocPrint(doc,"$$LTBLUE$$");
for (i=0;i<NUM_DRVS;i++) {
dv=&blkdev.drvs[i];
if (dv->type==DVT_REDSEA||dv->type==DVT_FAT32)
if (dv->fs_type==FSt_REDSEA||dv->fs_type==FSt_FAT32)
FMRebuildDocDrv(Drv2Let(dv),doc,_root,TRUE);
else if (dv->type==DVT_ISO9660) {
else if (dv->fs_type==FSt_ISO9660) {
if (dv->bd->flags&BDF_INITIALIZED)
tempde=FMRebuildDocDrv(Drv2Let(dv),doc,_root,TRUE);
else {
+2 -1
View File
@@ -1,7 +1,8 @@
Cd(__DIR__);;
#include "ADskA"
#include "Mount"
#include "ADskB"
#include "PrtDsk"
#include "Mount"
#include "ChkDsk"
#include "FileMgr"
Cd("..");;
+103 -91
View File
@@ -1,102 +1,114 @@
#help_index "Install;File/Cmd Line (Typically);Cmd Line (Typically);"
CDoc *BlkDevPmt(U8 boot_drv_let=0,Bool make_free=FALSE,Bool repartition=FALSE)
{
I64 num_hints,drv_let,type,unit;
I64 Mount2(U8 boot_drv_let,CDoc *_doc,Bool repartition)
{//If _doc, called by $LK,"::/Kernel/KCfg.CPP"$ else called by $LK,"Mount",A="MN:Mount"$().
I64 cnt,result=0,num_hints,drv_let,type,unit;
U8 blks_buf[STR_LEN],addr_buf[STR_LEN],base0_buf[STR_LEN],base1_buf[STR_LEN];
CATARep *root=NULL,*tempha;
Bool one_drv,make_free;
CDoc *doc;
"\n****** Mount Drives ******\n"
"$$GREEN$$A$$FG$$-$$GREEN$$B$$FG$$ are RAM drives.\n"
"$$GREEN$$C$$FG$$-$$GREEN$$S$$FG$$ are hard drives.\n"
"$$GREEN$$T$$FG$$-$$GREEN$$Z$$FG$$ are CD/DVD drives.\n"
"\nDrive Letter ($$PURPLE$$<ENTER>$$FG$$ to exit):";
drv_let=ToUpper(GetChar);
'\n';
if ('A'<=drv_let<='Z') {
doc=DocNew;
unit=0;
if ('A'<=drv_let<='B') {
type=BDT_RAM;
"Addr of RAM disk ($$PURPLE$$<ENTER>$$FG$$ to MAlloc):";
GetS(addr_buf,STR_LEN);
"Blks of 512 bytes:";
GetS(blks_buf,STR_LEN);
} else {
num_hints=ATARep(,,&root);
if ('C'<=drv_let<='S')
type=BDT_ATA;
else
type=BDT_ATAPI;
if (type==BDT_ATAPI && boot_drv_let)
"<ENTER> to use booted CD/DVD\n";
do {
if (num_hints)
"Enter dev number or\nport with $$PURPLE$$0x$$FG$$ prefix.\n"
"I/O Port Base0:\n";
else
"Include $$PURPLE$$0x$$FG$$ prefix.\nI/O Port Base0:\n";
GetS(base0_buf,STR_LEN);
} while (!Str2I64(base0_buf) && (type!=BDT_ATAPI || !boot_drv_let));
if (1<=Str2I64(base0_buf)<=num_hints) {
tempha=ATARepFind(root,Str2I64(base0_buf));
StrPrint(base0_buf,"0x%X",tempha->base0);
StrPrint(base1_buf,"0x%X",tempha->base1);
unit=tempha->unit;
} else if (type!=BDT_ATAPI || *base0_buf) {
if (type==BDT_ATAPI)
StrCpy(base1_buf,"0");
else
boot_drv_let=ToUpper(boot_drv_let);
do {
cnt=0;
if (!_doc)
DrvRep;
"\n****** Mount Drives ******\n"
"$$GREEN$$A$$FG$$-$$GREEN$$B$$FG$$ are RAM drives.\n"
"$$GREEN$$C$$FG$$-$$GREEN$$S$$FG$$ are ATA hard drives.\n"
"$$GREEN$$T$$FG$$-$$GREEN$$Z$$FG$$ are ATAPI CD/DVD drives.\n"
"\nDrive Letter ($$PURPLE$$<ENTER>$$FG$$ to exit):";
drv_let=ToUpper(GetChar);
'\n';
if (type=Let2BlkDevType(drv_let)) {
one_drv=FALSE;
if (_doc) { //Called by $LK,"::/Kernel/KCfg.CPP"$
doc=_doc;
make_free=FALSE;
} else { //Called by $LK,"Mount",A="MN:Mount"$()
doc=DocNew;
DocPrint(doc,"CBlkDev *bd;\n");
make_free=TRUE;
}
unit=0;
switch (type) {
case BDT_RAM:
type=BDT_RAM;
"Addr of RAM disk ($$PURPLE$$<ENTER>$$FG$$ to MAlloc):";
GetS(addr_buf,STR_LEN);
"Blks of 512 bytes:";
GetS(blks_buf,STR_LEN);
break;
case BDT_ATA:
case BDT_ATAPI:
num_hints=ATARep(,,&root);
if (type==BDT_ATAPI && boot_drv_let)
"<ENTER> to use booted CD/DVD\n"; //Only $LK,"::/Kernel/KCfg.CPP"$
do {
"I/O Port Base1:\n";
GetS(base1_buf,STR_LEN);
} while (!Str2I64(base1_buf));
do {
"\t$$PURPLE$$0$$FG$$=Master\n\t$$PURPLE$$1$$FG$$=Slave\nUnit:";
unit=GetChar-'0';
} while (!(0<=unit<=1));
'\n';
if (num_hints)
"Enter dev number or\nport with $$PURPLE$$0x$$FG$$ prefix.\n"
"I/O Port Base0:\n";
else
"Include $$PURPLE$$0x$$FG$$ prefix.\nI/O Port Base0:\n";
GetS(base0_buf,STR_LEN);
} while (!Str2I64(base0_buf) && (type!=BDT_ATAPI || !boot_drv_let));
if (1<=Str2I64(base0_buf)<=num_hints) {
tempha=ATARepFind(root,Str2I64(base0_buf));
StrPrint(base0_buf,"0x%X",tempha->base0);
StrPrint(base1_buf,"0x%X",tempha->base1);
unit=tempha->unit;
} else if (type!=BDT_ATAPI || *base0_buf) {
if (type==BDT_ATAPI)
StrCpy(base1_buf,"0");
else
do {
"I/O Port Base1:\n";
GetS(base1_buf,STR_LEN);
} while (!Str2I64(base1_buf));
do {
"\t$$PURPLE$$0$$FG$$=Master\n\t$$PURPLE$$1$$FG$$=Slave\nUnit:";
unit=GetChar-'0';
} while (!(0<=unit<=1));
'\n';
}
LinkedLstDel(root);
break;
}
LinkedLstDel(root);
}
DocPrint(doc,"bd=BlkDevNextFree(%d,%d);bd->unit=%d;\n",drv_let,type,unit);
if (type==BDT_RAM) {
if (!*addr_buf) StrCpy(addr_buf,"0");
DocPrint(doc,"bd->RAM_dsk=%s;bd->max_blk=(%s)-1;\n",addr_buf,blks_buf);
}
if (type==BDT_ATA || type==BDT_ATAPI) {
if (type==BDT_ATAPI && !*base0_buf) {
DocPrint(doc,"GetBaseUnit(bd);\n");
if (drv_let==boot_drv_let)
make_free=TRUE;
} else
DocPrint(doc,"bd->base0=%s;bd->base1=%s;\n",
base0_buf,base1_buf);
}
if (type==BDT_ATA && repartition) {
"\nReformat WHOLE drive!";
if (YorN) {
DocPrint(doc,"if (!BlkDevAdd(bd,TRUE,TRUE))"
"\"\n\n$$BK,1$$$$RED$$Operation Failed$$BK,0$$$$FG$$\n\n\";"
"else PrtDsk(bd->first_drv_let);\n");
return doc;
DocPrint(doc,"bd=BlkDevNextFree(\'%C\',%d);bd->unit=%d;\n",
drv_let,type,unit);
switch (type) {
case BDT_RAM:
if (!*addr_buf) StrCpy(addr_buf,"0");
DocPrint(doc,"bd->RAM_dsk=%s;bd->max_blk=(%s)-1;\n",
addr_buf,blks_buf);
break;
case BDT_ATA:
case BDT_ATAPI:
if (type==BDT_ATAPI && !*base0_buf) {
DocPrint(doc,"GetBaseUnit(bd);\n"); //Only $LK,"::/Kernel/KCfg.CPP"$
if (drv_let==boot_drv_let)
make_free=TRUE;
} else
DocPrint(doc,"bd->base0=%s;bd->base1=%s;\n",base0_buf,base1_buf);
if (type==BDT_ATA && repartition) {
"\nReformat WHOLE drive!";
one_drv=YorN;
}
break;
}
DocPrint(doc,"BlkDevAdd(bd,%d,%d);\n",one_drv,make_free);
if (_doc) //Called by $LK,"::/Kernel/KCfg.CPP"$
cnt++;
else { //Called by $LK,"Mount",A="MN:Mount"$()
if ((cnt=ExeDoc(doc)) && one_drv)
PrtDsk(drv_let);
DocDel(doc);
}
}
DocPrint(doc,"if (!BlkDevAdd(bd,FALSE,%d))"
"\"\n\n$$BK,1$$$$RED$$Operation Failed$$BK,0$$$$FG$$\n\n\";\n",make_free);
return doc;
} else
return NULL;
result+=cnt;
} while (cnt || !result && _doc); //At least 1 if Called by $LK,"::/Kernel/KCfg.CPP"$
return result;
}
public U0 Mount(Bool repartition=FALSE)
{//Mount a drive.
CDoc *doc;
ExePrint("CBlkDev *bd;"); //Leaks
do {
DrvRep;
if (doc=BlkDevPmt(,TRUE,repartition)) {
ExeDoc(doc);
DocDel(doc);
}
} while (doc);
public I64 Mount(Bool repartition=FALSE)
{//Mount drives.
return Mount2(0,NULL,repartition);
}
+163
View File
@@ -0,0 +1,163 @@
#help_index "Install;File/Cmd Line (Typically);Cmd Line (Typically)"
#define ROUND_DRV_TO (63*255)
#define DRV_HEADER 63
class CPlannedDrv
{
CPlannedDrv *next,*last;
I64 size;
Bool pri;
};
//Available to assist in writing scripts.
I64 drv_dsk_dsk_size=0;
public I64 PrtDsk(U8 drv_let=0)
{//Partition the disk containing partition drv_let.
//drv_let=0 means add new drive that
//is not already mounted.
CBlkDev *bd;
CPlannedDrv root,*temppp;
CMasterBoot mbr;
Bool pri=TRUE;
I64 ext_base,drv_let2,pri_cnt=0,
i,start_offset,offset,remaining;
drv_dsk_dsk_size=0;
"This command does not play well\n"
"with other operating systems.\n"
"You really should use another\n"
"operating system's partitioner.\n"
"If you use this, it may, in fact,\n"
"make your hard drive impossible\n"
"to repartition with other operating\n"
"until you set block zero to zero\n"
"with $$LK,\"MasterBootZero\",\"MN:MasterBootZero\"$$()\n\n\n"
"Continue";
if (!YorN) return 0;
if (drv_let && !Let2BlkDev(drv_let,FALSE))
drv_let=0;
if (!drv_let) {
Mount(TRUE);
return 0;
}
if (!(bd=Let2BlkDev(drv_let,FALSE)) || bd->type!=BDT_ATA)
return 0;
drv_dsk_dsk_size=bd->max_blk+1;
QueInit(&root);
drv_let2=bd->first_drv_let;
remaining=FloorU64(bd->max_blk+1,ROUND_DRV_TO);
while (FloorU64(remaining,ROUND_DRV_TO)>=ROUND_DRV_TO) {
temppp=MAlloc(sizeof(CPlannedDrv));
do {
"$$RED$$Partition %C$$FG$$\n",drv_let2;
temppp->pri=FALSE;
if (pri) {
"Primary Partition";
if (YorN) {
pri_cnt++;
temppp->pri=TRUE;
if (pri_cnt==3)
pri=FALSE;
} else
pri=FALSE;
}
"Blocks Remaining:%d (0x%X)\n",
remaining-DRV_HEADER,remaining-DRV_HEADER;
temppp->size=CeilU64(GetI64("Size in Blocks :",
remaining-DRV_HEADER)+DRV_HEADER,ROUND_DRV_TO);
} while (!(ROUND_DRV_TO<=temppp->size<=FloorU64(remaining,ROUND_DRV_TO)));
QueIns(temppp,root.last);
remaining-=temppp->size;
drv_let2++;
}
"\n\n!!! Repartition Drive !!!\n\n";
temppp=root.next;
drv_let2=bd->first_drv_let;
while (temppp!=&root) {
"Drive %C:%08X ",drv_let2,temppp->size;
if (temppp->pri)
"Primary\n";
else
"Logical\n";
temppp=temppp->next;
drv_let2++;
}
if (!AreYouSure)
goto pd_done;
remaining=FloorU64(bd->max_blk+1,ROUND_DRV_TO)-ROUND_DRV_TO;
temppp=root.next;
MemSet(&mbr,0,BLK_SIZE);
mbr.signature=0xAA55;
offset=0;
for (i=0;i<pri_cnt;i++) {
mbr.p[i].active=0x80;
mbr.p[i].start_head=0;
mbr.p[i].start_cyl=0x101;
mbr.p[i].type=1; //Will get set different.
mbr.p[i].end_head=0xFE;
mbr.p[i].end_cyl=0xFFFF;
mbr.p[i].offset=DRV_HEADER+offset;
mbr.p[i].size=temppp->size-DRV_HEADER;
offset+=temppp->size;
remaining-=temppp->size;
temppp=temppp->next;
}
if (!i) i++;
if (temppp!=&root) {
mbr.p[i].active=0x80;
mbr.p[i].start_head=0;
mbr.p[i].start_cyl=0x101;
mbr.p[i].type=0xF;
mbr.p[i].end_head=0xFE;
mbr.p[i].end_cyl=0xFFFF;
mbr.p[i].offset=offset;
mbr.p[i].size=remaining;
ext_base=offset;
}
ATAWriteBlks(bd,&mbr,0,1);
while (temppp!=&root) {
start_offset=offset;
MemSet(&mbr,0,BLK_SIZE);
mbr.signature=0xAA55;
mbr.p[0].active=0x80;
mbr.p[0].start_head=1;
mbr.p[0].start_cyl=0x101;
mbr.p[0].type=1; //Will get set different.
mbr.p[0].end_head=0xFE;
mbr.p[0].end_cyl=0xFFFF;
mbr.p[0].offset=DRV_HEADER;
mbr.p[0].size=temppp->size-DRV_HEADER;
offset+=temppp->size;
temppp=temppp->next;
if (temppp!=&root) {
mbr.p[1].active=0x80;
mbr.p[1].start_head=0;
mbr.p[1].start_cyl=0x101;
mbr.p[1].type=5;
mbr.p[1].end_head=0xFE;
mbr.p[1].end_cyl=0xFFFF;
mbr.p[1].offset=offset-ext_base;
mbr.p[1].size=temppp->size;
}
ATAWriteBlks(bd,&mbr,start_offset,1);
}
bd->flags&=~(BDF_INITIALIZED | BDF_INIT_IN_PROGRESS);
BlkDevAdd(bd,FALSE,TRUE);
for (i=bd->first_drv_let;i<drv_let2;i++)
Fmt(i,,FALSE);
pd_done:
while (root.next!=&root) {
temppp=root.next;
QueRem(temppp);
Free(temppp);
}
return drv_dsk_dsk_size;
}
+2 -2
View File
@@ -11,8 +11,8 @@ U0 LoadDocDefines()
//This is cut and replaced when I generate a distro.
//See $LK,"DD_TEMPLEOS_LOC",A="FF:::/Demo/AcctExample/TOSDistro.CPP,DD_TEMPLEOS_LOC"$.
$TR-C,"LineRep"$
$ID,4$DefinePrint("DD_TEMPLEOS_LOC","118,914");
DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","80,867");
$ID,4$DefinePrint("DD_TEMPLEOS_LOC","118,999");
DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","80,991");
$ID,-4$
DefinePrint("DD_KERNEL","%08X",bfh);
bfh(I64)+=bfh->file_size-1;
+2 -1
View File
@@ -2,8 +2,8 @@ extern U0 ACDDef(I64 n,CTask *parent=NULL);
extern U0 ACDDefsPut(CDoc *doc,U8 *st,I64 num=-1);
extern U0 ACDFillin(I64 n);
extern U0 ACFillIn(I64 n);
extern U0 ACFindMisspelled(CDoc *doc);
extern U0 ACMan(I64 n,CTask *parent=NULL);
extern U0 ACMisspelledFind(CDoc *doc);
extern I64 AdamFile(U8 *filename,Bool warn_ext=TRUE);
extern Bool AutoComplete(Bool val=OFF);
extern I64 BMPWrite(U8 *filename,CDC *dc,I64 bits=4);
@@ -56,6 +56,7 @@ extern CMenuEntry *MenuEntryFind(CMenu *m,U8 *full_name);
extern CMenu *MenuFilePush(U8 *filename);
extern U0 MenuPop();
extern CMenu *MenuPush(U8 *st);
extern I64 Mount(Bool repartition=FALSE);
extern CTask *Noise(I64 mS,I64 min_freq,I64 max_freq);
extern Bool Plain(U8 *filename,I64 edf_dof_flags=0);
extern Bool PopUpCancelOk(U8 *header=NULL,U8 *footer=NULL);
+1 -1
View File
@@ -19,7 +19,7 @@ $$ --> $$$$
U8 *src,*dst;
CDoc *doc;
CDocEntry *doc_e;
if (doc=DocRead(in_name,DOCF_PLAIN_TEXT_WITH_TABS|DOCF_DBL_DOLLARS)) {
if (doc=DocRead(in_name,DOCF_PLAIN_TEXT_TABS|DOCF_DBL_DOLLARS)) {
doc_e=doc->root.next;
while (doc_e!=doc) {
if (doc_e->type_u8==DOCT_TEXT) {
+1 -1
View File
@@ -204,7 +204,7 @@ U0 ACDDef(I64 n,CTask *parent=NULL)
ACDPopUpDef(acd.fillins[n],-1,parent);
}
U0 ACFindMisspelled(CDoc *doc)
U0 ACMisspelledFind(CDoc *doc)
{
Bool unlock=DocLock(doc);
CDocEntry *doc_e=doc->cur_entry;
+1 -2
View File
@@ -129,10 +129,9 @@ public U0 ACInit(U8 *mask=NULL)
Bool start_flag;
CBlkDev *bd=Let2BlkDev;
AutoComplete;
while (LBts(&ac.flags,ACf_INIT_IN_PROGRESS))
Yield;
AutoComplete;
if (DrvIsWritable && FileFind(ACD_DEF_FILENAME_Z) &&
!FileFind(ACD_DEF_FILENAME)) {
if (bd->type!=BDT_RAM) {
+4 -3
View File
@@ -23,7 +23,8 @@ U0 ACDocRst(I64 left,I64 top)
DocRst(doc,TRUE);
doc->flags|=DOCF_MIN_SIZE;
Fs->border_src=BDS_CONST;
Fs->text_attr =Fs->border_attr=LTGRAY<<4+BLUE;
Fs->border_attr=LTGRAY<<4+DrvTextAttrGet(':')&15;
Fs->text_attr =LTGRAY<<4+BLUE;
LBtr(&Fs->display_flags,DISPLAYf_SHOW);
WinHorz(left,Fs->win_right);
WinVert(top,Fs->win_bottom);
@@ -259,9 +260,9 @@ U0 ACTask(I64)
public Bool AutoComplete(Bool val=OFF)
{//Turn AutoComplete OFF or ON.
Bool old_autocomplete=FALSE;
while (Bt(&ac.flags,ACf_INIT_IN_PROGRESS))
Sleep(10);
if (val) {
while (Bt(&ac.flags,ACf_INIT_IN_PROGRESS))
Sleep(10);
if (TaskValidate(ac.task))
old_autocomplete=TRUE;
else {
+3 -2
View File
@@ -13,7 +13,8 @@
public U0 PCIDevFileGen()
{
Bool first=TRUE,del=FALSE,del2=FALSE,cont=FALSE;
CDoc *doc=DocRead(PCI_DEV_FILE,DOCF_PLAIN_TEXT|DOCF_DBL_DOLLARS);
CDoc *doc=DocRead(PCI_DEV_FILE,
DOCF_PLAIN_TEXT|DOCF_DBL_DOLLARS|DOCF_NO_CURSOR);
CDocEntry *doc_e=doc->root.next,*doc_e2;
while (doc_e!=doc) {
doc_e2=doc_e->next;
@@ -121,7 +122,7 @@ U0 PCILookUpDevs()
CDoc *doc;
if (dev.pci_root.next!=&dev.pci_root)
return;
doc=DocRead(PCI_DEV_FILE,DOCF_PLAIN_TEXT);
doc=DocRead(PCI_DEV_FILE,DOCF_PLAIN_TEXT|DOCF_NO_CURSOR);
for (b=0;b<sys_pci_busses;b++)
for (d=0;d<32;d++)
for (f=0;f<8;f++) {
+1 -1
View File
@@ -462,7 +462,7 @@ U0 EdInsChar(I64 ch,I64 sc,CDoc *doc)
} else
goto ic_done;
}
if (ch=='$$' && !(doc->flags & (DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_WITH_TABS))) {
if (ch=='$$' && !(doc->flags & (DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_TABS))) {
doc->flags|=DOCF_IN_DOLLAR;
doc->dollar_buf_ptr=0;
doc->dollar_buf[doc->dollar_buf_ptr++]=ch;
+20 -27
View File
@@ -25,7 +25,7 @@ public U0 DocLoad(CDoc *doc,U8 *src2,I64 size)
doc->cur_bin_num=tempb->num+1;
}
}
if (!(doc->flags & (DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_WITH_TABS)))
if (!(doc->flags & (DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_TABS)))
DocBinsValidate(doc);
DocTop(doc); //DOCT_CURSOR will set it in recalc
DocRecalc(doc);
@@ -59,14 +59,13 @@ public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
I64 ch,i,cnt;
U8 *st,*result,*dst,*src;
if (!(doc->flags & (DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_TABS)))
DocBinsValidate(doc);
DocRecalc(doc);
if (doc->flags&DOCF_NO_CURSOR || doc->root.next==doc)
cnt=1; //terminator
else
cnt=2; //cursor + terminator
if (!(doc->flags & (DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_WITH_TABS)))
DocBinsValidate(doc);
DocRecalc(doc);
for (doc_e=doc->root.next;doc_e!=doc;doc_e=doc_e->next) {
if (!Bt(doldoc.type_flags_data,doc_e->type_u8)) {
switch (doc_e->type_u8) {
@@ -80,27 +79,22 @@ public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
else
cnt++;
break;
case DOCT_SOFT_NEW_LINE:
break;
case DOCT_TEXT://$BK,1$Update $LK,"DOCT_TEXT",A="FF:D:/Compiler/Lex.CPP,DOCT_TEXT"$$BK,0$
if (!(doc_e->de_flags & ~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|
DOCEF_HIGHLIGHT|DOCEF_SKIP|DOCEF_FILTER_SKIP))&&
!(doc_e->type&DOCG_BL_IV_UL)) {
cnt+=StrLen(doc_e->tag);
if (!(doc->flags & (DOCF_PLAIN_TEXT | DOCF_PLAIN_TEXT_WITH_TABS)) ||
if (!(doc->flags & (DOCF_PLAIN_TEXT | DOCF_PLAIN_TEXT_TABS)) ||
doc->flags&DOCF_DBL_DOLLARS)
cnt+=StrOcc(doc_e->tag,'$$');
} else {
st=Doc2PlainText(doc,doc_e);
cnt+=StrLen(st)+2;
Free(st);
break;
}
break;
default:
if (doc_e->type_u8!=DOCT_SOFT_NEW_LINE &&
doc_e->type_u8!=DOCT_CURSOR) {
st=Doc2PlainText(doc,doc_e);
cnt+=StrLen(st)+2;
Free(st);
}
st=Doc2PlainText(doc,doc_e);
cnt+=StrLen(st)+2;
Free(st);
}
}
}
@@ -125,7 +119,7 @@ public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
*dst++=CH_CURSOR;
*dst++=ch;
if (ch=='$$') {
if (!(doc->flags & (DOCF_PLAIN_TEXT | DOCF_PLAIN_TEXT_WITH_TABS)) ||
if (!(doc->flags & (DOCF_PLAIN_TEXT | DOCF_PLAIN_TEXT_TABS)) ||
doc->flags&DOCF_DBL_DOLLARS)
*dst++=ch;
}
@@ -148,16 +142,15 @@ public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
*dst++='\r';
*dst++='\n';
break;
case DOCT_SOFT_NEW_LINE:
break;
default:
if (doc_e->type_u8!=DOCT_SOFT_NEW_LINE &&
doc_e->type_u8!=DOCT_CURSOR) {//(Cursor is set by cur_entry)
*dst++='$$';
st=Doc2PlainText(doc,doc_e);
StrCpy(dst,st);
dst+=StrLen(st);
*dst++='$$';
Free(st);
}
*dst++='$$';
st=Doc2PlainText(doc,doc_e);
StrCpy(dst,st);
dst+=StrLen(st);
*dst++='$$';
Free(st);
}
}
}
+1 -1
View File
@@ -17,7 +17,7 @@ U0 DocInit()
"PRY\0MRX\0WR\0L\0X\0Q\0FST\0B\0S\0BD\0C\0CA\0RD\0UD\0P\0TRM\0Z\0H\0"
"TR\0LS\0SK\0PU\0SIF\0FS\0NC\0DD\0");
DefineLstLoad("ST_LINK_TYPES",
"FI\0FA\0FF\0FL\0MN\0PI\0PF\0PL\0BF\0DF\0HI\0AD\0AI\0AA\0AF\0AL\0");
"FI\0FA\0FF\0FL\0MN\0PI\0PF\0PL\0BF\0DN\0HI\0AD\0AI\0AA\0AF\0AL\0");
doldoc.hash=HashTableNew(512);
HashDefineLstAdd("ST_DOC_CMDS",DHT_DOC_CMD,doldoc.hash);
+7 -7
View File
@@ -13,8 +13,8 @@
"PF:haystack_filename,needle_str:occurnum"
"PL:filename,linenum"
"BF:haystack_bible_book,needle_str"
"DF:word"
"DF:word,defnum"
"DN:word"
"DN:word,defnum"
"HI:index"
"AD:code_address_number"
@@ -67,7 +67,7 @@ Bool DocFileEd(I64 _type,U8 *filename,
try {
switch (type) {
case LK_PLAIN:
flags=DOCF_PLAIN_TEXT;
flags=DOCF_PLAIN_TEXT|DOCF_NO_CURSOR;
case LK_DOC:
type=LK_FILE;
break;
@@ -75,17 +75,17 @@ Bool DocFileEd(I64 _type,U8 *filename,
type=LK_FILE_ANCHOR;
break;
case LK_PLAIN_FIND:
flags=DOCF_PLAIN_TEXT;
flags=DOCF_PLAIN_TEXT|DOCF_NO_CURSOR;
case LK_DOC_FIND:
type=LK_FILE_FIND;
break;
case LK_PLAIN_LINE:
flags=DOCF_PLAIN_TEXT;
flags=DOCF_PLAIN_TEXT|DOCF_NO_CURSOR;
case LK_DOC_LINE:
type=LK_FILE_LINE;
break;
case LK_BIBLE_FIND:
flags=DOCF_PLAIN_TEXT;
flags=DOCF_PLAIN_TEXT|DOCF_NO_CURSOR;
break;
}
@@ -309,7 +309,7 @@ public Bool DocLinkChk(U8 *link_st)
result=TRUE;
Free(st);
break;
default://TODO: Need to validate HI: and DF:
default://TODO: Need to validate HI: and DN:
if (Ed(link_st,EDF_BAIL))
result=TRUE;
}
+9 -11
View File
@@ -12,11 +12,9 @@ U0 SysMacroStripKey(CSrvCmd *macro_root,I64 a1,I64 a2)
while (tempc!=macro_root) {
tempc1=tempc->next;
if (tempc->cmd_code==SVCT_MSG &&
(tempc->msg_code==MSG_KEY_DOWN ||
tempc->msg_code==MSG_KEY_UP ||
(tempc->msg_code==MSG_KEY_DOWN || tempc->msg_code==MSG_KEY_UP ||
tempc->msg_code==MSG_KEY_DOWN_UP) &&
a1 && tempc->aux1==a1 ||
!a1 && tempc->aux2==a2) {
a1 && tempc->aux1==a1 || !a1 && tempc->aux2==a2) {
QueRem(tempc);
SrvCmdDel(tempc);
}
@@ -161,15 +159,15 @@ I64 PopUpMacroMenu()
"\n\n\n$$GREEN$$SHIFT-F2$$FG$$ will play macro.\n");
doc->flags|=DOCF_MIN_SIZE | DOCF_FORM;
StrPrint(buf,"DocMenu(%d);",doc);
sys_macro_util_task=Spawn(&SrvCmdLine,NULL,"Macro Popup",,Fs);
Fs->popup_task=sys_macro_util_task;
LBts(&sys_macro_util_task->display_flags,DISPLAYf_WIN_ON_TOP);
tempc=TaskExe(sys_macro_util_task,Fs,buf,
sys_macro_task=Spawn(&SrvCmdLine,NULL,"Macro Popup",,Fs);
Fs->popup_task=sys_macro_task;
LBts(&sys_macro_task->display_flags,DISPLAYf_WIN_ON_TOP);
tempc=TaskExe(sys_macro_task,Fs,buf,
1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
JobResultScan(tempc,&result);
Fs->popup_task=NULL;
Kill(sys_macro_util_task);
sys_macro_util_task=NULL;
Kill(sys_macro_task);
sys_macro_task=NULL;
DocDataScan(doc,doc_e);
DocDel(doc);
return result;
@@ -208,6 +206,6 @@ U0 MacroTask(I64)
U0 EdMacroUtil()
{
if (!sys_macro_util_task)
if (!sys_macro_task)
Spawn(&MacroTask,NULL,"Macro");
}
+4 -3
View File
@@ -497,7 +497,7 @@ U0 DocEntryToggle(CDoc *doc)
U8 ch,*st,*st2;
I64 i,j,k;
if (doc_ce!=doc &&
!(doc->flags&(DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_WITH_TABS))) {
!(doc->flags&(DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_TABS))) {
if (doc_ce->type_u8==DOCT_TEXT && !(doc_ce->de_flags &
~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|DOCEF_HIGHLIGHT|
DOCEF_SKIP|DOCEF_FILTER_SKIP)) &&
@@ -593,7 +593,7 @@ U0 DocFlagsToggle(CDoc *doc,I64 tog_flags)
U8 *st;
CDocUndo *u_next,*u_last;
doc->flags|=DOCF_COLOR_NAMES;
doc->flags=doc->flags&~DOCF_NO_CURSOR|DOCF_COLOR_NAMES;
st=DocSave(doc,&size);
u_next=doc->undo_root.next;
@@ -604,8 +604,9 @@ U0 DocFlagsToggle(CDoc *doc,I64 tog_flags)
doc->undo_root.next=u_next;
doc->undo_root.last=u_last;
DocUndoCntSet(doc);
doc->flags=flags & ~(DOCG_BL_IV_UL|DOCF_WORD_WRAP);
doc->flags=flags&~(DOCF_NO_CURSOR|DOCG_BL_IV_UL|DOCF_WORD_WRAP);
DocLoad(doc,st,size);
doc->flags|=flags&DOCF_NO_CURSOR;
DocCenter(doc);
if (unlock)
DocUnlock(doc);
+1 -1
View File
@@ -15,7 +15,7 @@ U0 PopUpViewPrintEndCB()
}
public CTask *PopUpViewPrint(U8 *fmt,...)
{//View Print statement in PopUp win task.
{//View Print stmt in PopUp win task.
CTask *task;
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
CDoc *doc=DocNew;
+5 -5
View File
@@ -253,8 +253,8 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
} else {
DocUnlock(doc);
if (sc&SCF_SHIFT) {
if (TaskValidate(sys_macro_util_task))
PostMsgWait(sys_macro_util_task,
if (TaskValidate(sys_macro_task))
PostMsgWait(sys_macro_task,
MSG_KEY_DOWN_UP,CH_SHIFT_ESC,0);
SysMacroStripKey(&sys_macro_root,ch,sc);
PlaySysMacro;
@@ -557,7 +557,7 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
if (sc&SCF_KEY_DESC)
KeyDescSet("Cmd /Sprite Graphic Resource");
else {
if (!(doc->flags&(DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_WITH_TABS))) {
if (!(doc->flags&(DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_TABS))) {
DocUnlock(doc);
if (doc_ce->type_u8==DOCT_SPRITE)
EdSpriteEd(doc,
@@ -577,7 +577,7 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
if (sc&SCF_KEY_DESC)
KeyDescSet("Edit/Find Misspelled");
else
ACFindMisspelled(doc);
ACMisspelledFind(doc);
} else {
if (sc&SCF_KEY_DESC)
KeyDescSet("Edit/Save");
@@ -596,7 +596,7 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
KeyDescSet("Edit/Toggle Plain Text Display");
else
if (!(doc->flags&DOCF_FORM) ||
doc->flags&(DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_WITH_TABS))
doc->flags&(DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_TABS))
DocFlagsToggle(doc,DOCF_PLAIN_TEXT);
}
break;
+1 -1
View File
@@ -12,7 +12,7 @@ CDocEntry *DocPutS(CDoc *doc,U8 *st)
if (!st || !doc && !(doc=DocPut) || doc->doc_signature!=DOC_SIGNATURE_VAL)
return NULL;
unlock=DocLock(doc);
if (doc->flags & DOCF_PLAIN_TEXT_WITH_TABS)
if (doc->flags & DOCF_PLAIN_TEXT_TABS)
char_bitmap=chars_bmp_zero_cr_nl_cursor;
else if (doc->flags & DOCF_PLAIN_TEXT)
char_bitmap=chars_bmp_zero_tab_ff_cr_nl_cursor;
+1 -1
View File
@@ -329,7 +329,7 @@ public Bool DocRecalc(CDoc *doc,Bool has_cursor=FALSE,I64 recalc=DOC_RECALC)
}
best_doc_e=doc->cur_entry;
if (!(doc->flags&(DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_WITH_TABS)) &&
if (!(doc->flags&(DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_TABS)) &&
FilesFindMatch(doc->filename.name,FILEMASK_SRC))
doc->flags|=DOCF_HIGHLIGHT;
else
+3 -15
View File
@@ -182,27 +182,15 @@ public I64 DocMax(I64 i=MAX_I64)
#help_index "DolDoc/Task;StdOut/Task"
U0 DocUpdateTaskDocs(CTask *task)
{//This is called from $LK,"GrUpdateTaskWin",A="MN:GrUpdateTaskWin"$() by the winmgr at 30fps.
CDrv *dv;
CDoc *doc;
CD3I64 saved_scroll;
I64 border_attr;
if (task->border_src==BDS_CUR_DRV && task->cur_dv) {
border_attr=task->cur_dv->text_attr;
if (border_attr&15!=border_attr>>4)
task->border_attr=border_attr;
}
if (task->border_src==BDS_CUR_DRV && task->cur_dv)
task->border_attr=DrvTextAttrGet(Drv2Let(task->cur_dv));
if (task->title_src==TTS_TASK_NAME)
StrCpy(task->task_title,task->task_name);
if ((doc=DocDisplay(task)) && !(doc->flags&DOCF_DONT_SHOW)) {
if (task->border_src==BDS_ED_FILENAME_DRV)
try {
if (dv=Let2Drv(*doc->filename.name)) {
border_attr=dv->text_attr;
if (border_attr&15!=border_attr>>4)
task->border_attr=border_attr;
}
} catch
Fs->catch_except=TRUE;
task->border_attr=DrvTextAttrGet(*doc->filename.name);
if (task->title_src==TTS_ED_FILENAME)
MemCpy(task->task_title,doc->filename.name,TASK_TITLE_LEN);
DocRecalc(doc,TRUE,DOC_RECALC_TO_SCREEN);
+24 -17
View File
@@ -296,9 +296,9 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
else
*_tag=StrNew(e->tag);
if (e->num<0)
*_link=MStrPrint("DF:%s",e->aux);
*_link=MStrPrint("DN:%s",e->aux);
else
*_link=MStrPrint("DF:%s,%d",e->aux,e->num);
*_link=MStrPrint("DN:%s,%d",e->aux,e->num);
}
break;
@@ -906,7 +906,7 @@ U0 EdInsHexEd()
Free(e);
}
class CEdBinary
class CEdBin
{
U8 tag[512] fmtstr "$$DA-P,511,A=\"Tag Text :%s\"$$\n";
I64 bin_num fmtstr "$$DA,512,A=\"Bin Num:%d\"$$\n";
@@ -915,9 +915,9 @@ class CEdBinary
U8 bin_ptr_link_tag[512] fmtstr "$$DA-P,511,A=\"File Bin Tag:%s\"$$\n";
};
U0 EdInsBinary(I64 bin_num,I64 type)
U0 EdInsBin(I64 bin_num,I64 type)
{
CEdBinary *e=CAlloc(sizeof(CEdBinary));
CEdBin *e=CAlloc(sizeof(CEdBin));
StrPrint(e->tag,"<%d>",bin_num);
e->bin_num=bin_num;
e->bin_ptr_link_bin_num=1;
@@ -1036,15 +1036,22 @@ I64 PopUpSpriteType()
I64 i;
CDoc *doc=DocNew;
DocPrint(doc,"$$PURPLE$$$$TX+CX,\"Graphic Sprite Resource Menu\"$$\n"
"$$LK+PU+CX,\"Click for Help\",A=\"FI:::/Doc/Resource.TXT.Z\"$$\n"
"\n$$LTBLUE$$$$MU,\"Make Sprite\",LE=EST_SPRITE$$\n"
"$$MU,\"Pointer to Sprite\",LE=EST_SPRITE_PTR$$\n"
"$$MU,\"Duplicate Sprite\",LE=EST_DUP_SPRITE$$\n"
"$$MU,\"Sprite Size (not really needed)\",LE=EST_SPRITE_SIZE$$\n"
"$$MU,\"Sprite Macro (Icon)\",LE=EST_SPRITE_MACRO$$\n"
"$$MU,\"Sprite Menu Item\",LE=EST_SPRITE_MENU$$\n"
"$$MU,\"Sprite Link\",LE=EST_SPRITE_LINK$$\n"
"\n$$MU,\"Abort\",LE=DOCM_CANCEL$$\n\n");
"$$LK+PU+CX,\"Click for Help\",A=\"FI:::/Doc/Resource.TXT.Z\"$$\n\n"
"$$LTBLUE$$$$MU,\"Make Sprite\",LE=EST_SPRITE$$$$FG$$\t "
"Start by making a sprite.\n"
"$$LTBLUE$$$$MU,\"Ptr to Sprite\",LE=EST_SPRITE_PTR$$$$FG$$\t "
"Insert pointer into src code.\n"
"$$LTBLUE$$$$MU,\"Duplicate Sprite\",LE=EST_DUP_SPRITE$$$$FG$$ "
"Make dup image for in a doc.\n"
"$$LTBLUE$$$$MU,\"Sprite Size\",LE=EST_SPRITE_SIZE$$$$FG$$\t "
"Insert size of a sprite into src code.\n"
"$$LTBLUE$$$$MU,\"Sprite Macro\",LE=EST_SPRITE_MACRO$$$$FG$$\t "
"Create icon with auto-text payload.\n"
"$$LTBLUE$$$$MU,\"Sprite Menu Item\",LE=EST_SPRITE_MENU$$$$FG$$ "
"Create icon with numeric payload.\n"
"$$LTBLUE$$$$MU,\"Sprite Link\",LE=EST_SPRITE_LINK$$$$FG$$\t "
"Create icon with link payload.\n\n"
"$$LTBLUE$$$$MU,\"Abort\",LE=DOCM_CANCEL$$\n\n");
i=PopUpMenu(doc);
DocDel(doc);
return i;
@@ -1123,13 +1130,13 @@ U8 *EdSprite(I64 bin_num)
CatPrint(buf,"+PU");
break;
case EST_SPRITE_PTR:
EdInsBinary(--bin_num,DOCT_INS_BINARY);
EdInsBin(--bin_num,DOCT_INS_BIN);
break;
case EST_SPRITE_SIZE:
EdInsBinary(--bin_num,DOCT_INS_BINARY_SIZE);
EdInsBin(--bin_num,DOCT_INS_BIN_SIZE);
break;
case EST_DUP_SPRITE:
EdInsBinary(--bin_num,DOCT_SPRITE);
EdInsBin(--bin_num,DOCT_SPRITE);
break;
}
if (st1) {
+3 -3
View File
@@ -157,7 +157,7 @@ public U8 *BibleLine2Verse(I64 line,I64 separate_ch=CH_SPACE)
ptr+=StrLen(ptr)+1;
}
if (0<=--i<cnt) {
doc=DocRead(BIBLE_FILENAME,DOCF_PLAIN_TEXT);
doc=DocRead(BIBLE_FILENAME,DOCF_PLAIN_TEXT|DOCF_NO_CURSOR);
DocLineNumGoTo(doc,line); //one based
doc_e=doc->cur_entry;
while (doc_e!=doc && (doc_e->type_u8!=DOCT_TEXT || !*doc_e->tag))
@@ -214,7 +214,7 @@ public U0 BibleLines(CDoc *doc_out=NULL,I64 start,I64 lines)
CDocEntry *doc_e;
if (!doc_out) doc_out=DocPut;
if (doc_out && FileFind(BIBLE_FILENAME)) {
doc_in=DocRead(BIBLE_FILENAME,DOCF_PLAIN_TEXT);
doc_in=DocRead(BIBLE_FILENAME,DOCF_PLAIN_TEXT|DOCF_NO_CURSOR);
DocLineNumGoTo(doc_in,start); //one based
doc_e=doc_in->cur_entry;
while (lines>0 && doc_e!=doc_in) {
@@ -247,7 +247,7 @@ public U0 BibleVerse(CDoc *doc_out=NULL,U8 *verse,I64 lines)
i=DefineMatch(st,"ST_BIBLE_BOOKS",LMF_IGNORE_CASE);
if (i>=0) {
i=Str2I64(DefineSub(i,"ST_BIBLE_BOOK_LINES"));
doc_in=DocRead(BIBLE_FILENAME,DOCF_PLAIN_TEXT);
doc_in=DocRead(BIBLE_FILENAME,DOCF_PLAIN_TEXT|DOCF_NO_CURSOR);
DocLineNumGoTo(doc_in,i); //one based
if (*st2) {
StrCpy(doc_in->find_replace->find_text,st2);
+3 -2
View File
@@ -8,7 +8,7 @@ There's something obviously different about people in the Bible compared to peop
You can't tell if God's talking unless you have a context of conversation, but, more importantly, you are commanded to do an offering of love, like communion preparation. $LK,"1 Corinthians,11:27",A="BF:1 Corinthians,11:27"$ When you pick a greeting card for someone, that is love effort. If you expect God to put effort toward you, you must put effort toward Him. God said, "honest measures" applies between your offering of love and His response, like a fair barter. You get out of prayer what you put into it. God wants praise, hymns, or whatever you think He might want. Try and see, like Cain and Abel. $LK,"Genesis,4:1",A="BF:Genesis,4:1"$, $LK,"Ephesians,5:10",A="BF:Ephesians,5:10"$ God told Cain his offering was not good and told him to try again. Cain really loved God! Can you imagine being so heart-broken?
Do a text search for "new song" in the Bible. It's mentioned nine times. When I hear a NEW awesome rock song, it is ecstasy for the first five times I hear it. Soon, it brings little-to-no pleasure. I did $MA-X+PU,"hymns",HTML="http://www.templeos.org/Wb/Home/Wb2/HymnVideos.html",LM="#include \"::/Apps/Psalmody/Load\";JukeBox(\"::/Apps/Psalmody/Examples\");"$ for God. I also did Moses $MA-X+PU,"comics",HTML="http://www.templeos.org/Wb/Home/Wb2/Files/Comics/",LM="Dir(\"::/Apps/AfterEgypt/Comics\");View;\n"$ for God. When you get to the gates of Heaven, St. Peter will ask how many times you gave blood. That shows you loved neighbor. You better also be able to count the ways you loved God with all heart mind and soul. I praised God for sand castles, popcorn, snowmen, bubbles... You try putting effort into praise! $LK,"Matthew,11:25",A="BF:Matthew,11:25"$, $LK,"Matthew,6:29",A="BF:Matthew,6:29"$
Do a text search for "new song" in the Bible. It's mentioned nine times. When I hear a NEW awesome rock song, it is ecstasy for the first five times I hear it. Soon, it brings little-to-no pleasure. I did $MA-X+PU,"hymns",HTML="http://www.templeos.org/Wb/Home/Web/HymnVideos.html",LM="#include \"::/Apps/Psalmody/Load\";JukeBox(\"::/Apps/Psalmody/Examples\");"$ for God. I also did Moses $MA-X+PU,"comics",HTML="http://www.templeos.org/Wb/Home/Downloads/Comics/",LM="Dir(\"::/Apps/AfterEgypt/Comics\");View;\n"$ for God. When you get to the gates of Heaven, St. Peter will ask how many times you gave blood. That shows you loved neighbor. You better also be able to count the ways you loved God with all heart mind and soul. I praised God for sand castles, popcorn, snowmen, bubbles... You try putting effort into praise! $LK,"Matthew,11:25",A="BF:Matthew,11:25"$, $LK,"Matthew,6:29",A="BF:Matthew,6:29"$
This is funny -- $LK,"Acts,2:1",A="BF:Acts,2:1"$ -- they didn't bother to record anything the Holy Spirit said. The Holy Spirit is supposed to be a really good gift. $LK,"Luke,11:13",A="BF:Luke,11:13"$ Just remember, "Boys are made of snakes and snails and puppy-dog tails."
@@ -135,10 +135,11 @@ Chess? $FG,4$"... will winter with you."$FG$
If You could teach one class? $FG,4$Health$FG$
Favorite video game? $FG,4$Donkey Kong$FG$
Favorite National Park? $FG,4$$TX,"Whitman Mission",HTML="http://www.nps.gov/whmi/index.htm"$$FG$
Favorite National Anthem? $FG,4$$TX,"Latvia's National Anthem",HTML="http://www.youtube.com/watch?v=qKITbBjO4nE"$$FG$
Favorite actor? $FG,4$Hugh Grant$FG$
Favorite vocalist? $FG,4$Mick Jagger$FG$
Favorite guitarist? $FG,4$"$TX,"Simmons Destroyer",HTML="http://www.youtube.com/watch?v=nNADrrjTysk&t=3m55s"$"$FG$
Favorite National Anthem? $FG,4$$TX,"Latvia's National Anthem",HTML="http://www.youtube.com/watch?v=qKITbBjO4nE"$$FG$
America the Beautiful? $FG,4$Hates it. Poet was too in love with own beauty.$FG$
Model for new $TX,"Sistine Chapel",HTML="http://en.wikipedia.org/wiki/Sistine_chapel"$? $FG,4$Ben Franklin$FG$
Voice if God wanted to sing? $FG,4$$TX,"Stabbing Westward's singer",HTML="https://www.youtube.com/watch?v=5NZsCYOM4j0"$$FG$
Stonehenge? $FG,4$Landmark for boundaries.$FG$
+2 -4
View File
@@ -240,7 +240,7 @@ public I64 GrFloodFill(CDC *dc=gr.dc,I64 x,I64 y,
Bool not_color=FALSE,I64 z=0,I32 *db=NULL)
{//2D. Ignore z and db.
//not_color=TRUE means fill up to everything which is not the current color.
//not_color=FALSE means fill all parts equal to the color under the point.
//not_color=FALSE means fill all parts equ to the color under the point.
//Returns cnt of pixs changed
I64 result=0,j,old_flags=dc->flags;
CColorROPU32 old_color2=dc->color2;
@@ -711,7 +711,7 @@ public Bool GrRegPoly3(CDC *dc=gr.dc,
public I64 GrFloodFill3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,Bool not_color=FALSE)
{//3D. Transformation.
//not_color=TRUE means fill up to everything which is not the current color.
//not_color=FALSE means fill all parts equal to the color under the point.
//not_color=FALSE means fill all parts equ to the color under the point.
//Returns cnt of pixs changed
I64 result,old_flags=dc->flags,
_x,_y,_z;
@@ -1364,13 +1364,11 @@ p4y
1
4
2
1
4
2
1
4
+3 -2
View File
@@ -15,7 +15,8 @@ making CSprite by hand. It uses $LK,"SPT_MESH",A="MN:SPT_MESH"$,
one of the most complicated.
*/
public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,
Bool just_one_elem=FALSE)
{//Plot a sprite into a CDC.
CSprite *tempg=elems-offset(CSprite.start);
I64 i,j,k,x1,y1,z1,x2,y2,
@@ -252,7 +253,7 @@ public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
dc->nearest_sprite_elem_num=cur_sprite_elem_num;
}
cur_sprite_elem_num++;
if (just_one) break;
if (just_one_elem) break;
tempg(U8 *)+=SpriteElemSize(tempg);
}
MemCpy(&dc->sym,&old_sym,sizeof(CGrSym));
+1 -1
View File
@@ -1153,7 +1153,7 @@ U0 EdSpriteIns(CDoc *doc,I64 x,I64 y)
DocUnlock(doc);
}
}
if (!(doc->flags & (DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_WITH_TABS)))
if (!(doc->flags & (DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_TABS)))
DocBinsValidate(doc);
}
+1 -1
View File
@@ -385,7 +385,7 @@ U0 MPDrawIt(CMeshFrame *e)
CMeshEdTri *tempt=e->tri_root.next;
I64 i,*old_r=dc->r;
//$LK,"DCAlias",A="MN:DCAlias"$() alllocs a new identity rotation matrix.
//$LK,"DCAlias",A="MN:DCAlias"$() allocs a new identity rotation matrix.
//We want e->dc's rotation matrix.
dc->r=e->dc->r;
+13 -21
View File
@@ -42,16 +42,15 @@ public Bool MakeOSDrvBootInstall(U8 src_drv=0,U8 dst_drv=0)
I64 i,type;
try {
if (!src_drv) src_drv=Drv2Let(Fs->cur_dv);
src_drv=ToUpper(src_drv);
if (!dst_drv) dst_drv=src_drv;
dst_drv=ToUpper(dst_drv);
if (!Drv(src_drv))
throw;
MakeAll;
try {
bd=Let2BlkDev(dst_drv);
dv=Let2Drv(dst_drv);
if ((bd=Let2BlkDev(dst_drv,FALSE)) && (dv=Let2Drv(dst_drv,FALSE)))
type=bd->type;
} catch {
Fs->catch_except=TRUE;
else {
type=BDT_ATAPI;
PrintWarn("Defaulting to CD/DVD dst.\n");
}
@@ -100,8 +99,8 @@ public U0 MasterBootOldRead(U8 src_drv,U8 dst_drv)
CMasterBoot mbr;
Drv(dst_drv);
dv=Fs->cur_dv;
if (dv->type!=DVT_REDSEA && dv->type!=DVT_FAT32)
PrintErr("Not RedSea Drv\n");
if (dv->fs_type!=FSt_REDSEA && dv->fs_type!=FSt_FAT32)
PrintErr("File System Not Supported\n");
else {
//Bypass partition bounds-checking
BlkDevLock(bd);
@@ -146,7 +145,7 @@ public U0 MasterBootZero(U8 dst_drv)
BlkDevUnlock(bd);
}
public Bool MasterBootIntall(U8 drv_let,U8 *drv_lst=NULL)
public Bool MasterBootInstall(U8 drv_let,U8 *drv_lst=NULL)
{//Create new MBR on the disk that has drv_let as a partition.
//Puts stage 2 in BOOT_DIR of drv_let.
CBlkDev *bd,*bd1;
@@ -158,9 +157,10 @@ public Bool MasterBootIntall(U8 drv_let,U8 *drv_lst=NULL)
Bool result=FALSE;
try {
if (drv_lst)
if (drv_lst) {
StrCpy(buf,drv_lst);
else {
StrUtil(buf,SUF_TO_UPPER);
} else {
j=0;
for (i='A';i<='Z';i++)
buf[j++]=i;
@@ -169,8 +169,8 @@ public Bool MasterBootIntall(U8 drv_let,U8 *drv_lst=NULL)
Drv(drv_let);
dv=Fs->cur_dv;
if (dv->type!=DVT_REDSEA && dv->type!=DVT_FAT32)
PrintErr("Not RedSea Drv\n");
if (dv->fs_type!=FSt_REDSEA && dv->fs_type!=FSt_FAT32)
PrintErr("File System Not Supported\n");
else {
bd=Let2BlkDev(drv_let);
if (!FileFind(BOOT_DIR_OLDMBR_BIN_C,,FUF_JUST_FILES))
@@ -190,15 +190,7 @@ public Bool MasterBootIntall(U8 drv_let,U8 *drv_lst=NULL)
ptr=buf;
while (ch=*ptr++) {
try {
p1 =Let2Drv(ch);
bd1=Let2BlkDev(ch);
} catch {
Fs->catch_except=TRUE;
p1 =NULL;
bd1=NULL;
}
if (p1 && bd1==bd) {
if ((p1=Let2Drv(ch,FALSE)) && (bd1=Let2BlkDev(ch,FALSE)) && bd1==bd) {
*_q=p1->base_offset;
"Drive %C:%16X\n",Drv2Let(p1),*_q;
CatPrint(menu_ptr,"%d. Drive %C\n\r",j++,Drv2Let(p1));
+2 -2
View File
@@ -237,8 +237,8 @@ Bool DiffBins(CDoc *doc1,CDoc *doc2)
public Bool Diff(U8 *dst_file,U8 *src_file,I64 *_df_flags=NULL)
{//Report differences between two files and merge differences
//from src_file to dst_file. Don't use _df_flags arg. (Used by $LK,"Merge",A="MN:Merge"$().)
CDoc *doc1=DocRead(dst_file,DOCF_PLAIN_TEXT_WITH_TABS|DOCF_NO_CURSOR),
*doc2=DocRead(src_file,DOCF_PLAIN_TEXT_WITH_TABS|DOCF_NO_CURSOR);
CDoc *doc1=DocRead(dst_file,DOCF_PLAIN_TEXT_TABS|DOCF_NO_CURSOR),
*doc2=DocRead(src_file,DOCF_PLAIN_TEXT_TABS|DOCF_NO_CURSOR);
CDocEntry *doc_e,**doc_sorted1,**doc_sorted2,**doc_unsorted1,**doc_unsorted2;
I64 i,cnt1=0,cnt2=0,df_flags;
Bool result=FALSE;
+2 -2
View File
@@ -30,7 +30,7 @@ I64 FindFile(U8 *needle_str,U8 *haystack_filename,
U8 *src,*dst,*dst2,*name_buf=NULL;
I64 i,j,plen,rlen,dlen,cnt=0,old_flags,ss_flags;
CDoc *cur_l,*doc=DocRead(haystack_filename,
DOCF_PLAIN_TEXT_WITH_TABS|DOCF_NO_CURSOR);
DOCF_PLAIN_TEXT_TABS|DOCF_NO_CURSOR);
CDocEntry *doc_e;
if (Bt(_fuf_flags,FUf_IGNORE))
@@ -118,7 +118,7 @@ I64 FindFile(U8 *needle_str,U8 *haystack_filename,
DocDel(doc);
"Wrote:%s\n",name_buf;
Ed(name_buf);
doc=DocRead(name_buf, DOCF_PLAIN_TEXT_WITH_TABS);
doc=DocRead(name_buf, DOCF_PLAIN_TEXT_TABS);
doc_e=doc->cur_entry;
if (doc_e->last!=doc) doc_e=doc_e->last;
src=NULL;
+74 -3
View File
@@ -7,7 +7,11 @@
class CHeapLog
{
CHeapLog *next,*last;
U8 *addr;
union {
U8 *addr;
I64 size;
}
I64 cnt;
U8 *caller[HL_CALLER_DEPTH];
};
@@ -67,7 +71,7 @@ U0 HeapLogFree(U8 *addr)
}
public Bool HeapLog(Bool val=ON,CTask *task=NULL)
{//Turn on. Collect data. Call $LK,"HeapLogRep",A="MN:HeapLogRep"$().
{//Turn on. Collect data. Call $LK,"HeapLogAddrRep",A="MN:HeapLogAddrRep"$() or $LK,"HeapLogSizeRep",A="MN:HeapLogSizeRep"$().
I64 i;
if (val) {
if (Bt(&sys_semas[SYS_SEMA_HEAPLOG_ACTIVE],0)) {
@@ -108,7 +112,7 @@ public Bool HeapLog(Bool val=ON,CTask *task=NULL)
}
}
public U0 HeapLogRep(Bool leave_it=OFF)
public U0 HeapLogAddrRep(Bool leave_it=OFF)
{//Call $LK,"HeapLog",A="MN:HeapLog"$() first and collect data.
I64 i,j,total=0;
CHeapLog *temphl,hl;
@@ -138,3 +142,70 @@ public U0 HeapLogRep(Bool leave_it=OFF)
if (!leave_it)
HeapLog(OFF);
}
public U0 HeapLogSizeRep(Bool leave_it=OFF)
{//Call $LK,"HeapLog",A="MN:HeapLog"$() first and collect data.
I64 i,j,k,total=0;
CHeapLog *temphla,hla,*temphls,*temphls1;
CHeapLogHash *size_root;
if (!LBtr(&sys_semas[SYS_SEMA_HEAPLOG_ACTIVE],0)) {
"HeapLog Not Active\n";
return;
}
size_root=MAlloc(sizeof(CHeapLogHash)*HL_HASH_SIZE,heaplog_hc);
for (i=0;i<HL_HASH_SIZE;i++)
QueInit(&size_root[i]);
"$$WW,0$$";
while (LBts(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0))
PAUSE
for (i=0;i<HL_HASH_SIZE;i++) {
temphla=heaplog_root[i].next;
while (temphla!=&heaplog_root[i]) {
//Take snapshot in case modified. (while we work)
MemCpy(&hla,temphla,sizeof(CHeapLog));
k=(MSize(hla.addr)>>3+hla.caller[0])&(HL_HASH_SIZE-1);
temphls=size_root[k].next;
while (temphls!=&size_root[k]) {
if (MSize(hla.addr)==temphls->size) {
for (j=0;j<HL_CALLER_DEPTH;j++)
if (hla.caller[j]!=temphls->caller[j])
goto hl_next;
temphls->cnt++;
goto hl_found;
}
hl_next:
temphls=temphls->next;
}
temphls=MAlloc(sizeof(CHeapLog),heaplog_hc);
MemCpy(temphls,&hla,sizeof(CHeapLog));
temphls->cnt=1;
temphls->size=MSize(hla.addr);
QueIns(temphls,size_root[k].last);
hl_found:
temphla=hla.next;
}
}
LBtr(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0);
for (i=0;i<HL_HASH_SIZE;i++) {
temphls=size_root[i].next;
while (temphls!=&size_root[i]) {
temphls1=temphls->next;
"%08X*%08X=%08X",temphls->size,temphls->cnt,temphls->size*temphls->cnt;
for (j=0;j<HL_CALLER_DEPTH;j++)
" %P",temphls->caller[j];
'\n';
total+=temphls->size*temphls->cnt;
Free(temphls);
temphls=temphls1;
}
}
Free(size_root);
"\n$$LTRED$$Total:%08X$$FG$$\n",total;
LBts(&sys_semas[SYS_SEMA_HEAPLOG_ACTIVE],0);
if (!leave_it)
HeapLog(OFF);
}
+2 -2
View File
@@ -20,7 +20,7 @@ public I64 Sort(U8 *_in_name,U8 *_out_name=NULL,
else
out_name=StrNew(in_name);
doc=DocRead(in_name,DOCF_PLAIN_TEXT_WITH_TABS|DOCF_NO_CURSOR);
doc=DocRead(in_name,DOCF_PLAIN_TEXT_TABS|DOCF_NO_CURSOR);
doc_e=doc->root.next;
while (doc_e!=doc) {
if (doc_e->type_u8==DOCT_TEXT)
@@ -159,7 +159,7 @@ U0 SUFile(U8 *filename,I64 suf_flags,F64 indent_scale_factor)
U8 *dst;
Bool chged=FALSE;
I64 reduced=0;
CDoc *doc=DocRead(filename,DOCF_PLAIN_TEXT_WITH_TABS | DOCF_NO_CURSOR);
CDoc *doc=DocRead(filename,DOCF_PLAIN_TEXT_TABS|DOCF_NO_CURSOR);
CDocEntry *doc_e=doc->root.next;
while (doc_e!=doc) {
if (doc_e->type_u8==DOCT_TEXT) {
+5 -5
View File
@@ -300,7 +300,7 @@ public CDoc *Doc2Html(CDoc *doc_in,
public U0 ToHtml(U8 *_in_name,U8 *_out_name=NULL,U8 *html_header=NULL,
U8 *body_header=NULL,U8 *body_footer=NULL,I64 width=80,
Bool line_anchors=TRUE,U8 (*link_cvt)(U8 *link_st)=&TOSLinkCvt1)
{//Convert $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.TXT"$ file to HTML.
{//Convert $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.TXT"$file to HTML.
//Supply your own link_cvt routine.
U8 *in_name,*out_name;
CDoc *doc_in,*doc_out;
@@ -308,11 +308,11 @@ public U0 ToHtml(U8 *_in_name,U8 *_out_name=NULL,U8 *html_header=NULL,
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
WinHorz(0,width-1); //Sets doc width for word wrap.
in_name=DftExt(_in_name,"CPP.Z"),
if (_out_name)
out_name=DftExt(_out_name,"html");
in_name=DftExt(_in_name,"CPP.Z");
if (_out_name)
out_name=DftExt(_out_name,"html");
else
out_name=ChgExt(_in_name,"html");
out_name=ChgExt(_in_name,"html");
doc_in=DocRead(in_name);
doc_out=Doc2Html(doc_in,html_header,body_header,
+5 -5
View File
@@ -103,18 +103,18 @@ public CDoc *Doc2TXT(CDoc *doc_in)
#help_index "Cmd Line (Typically);DolDoc/Conversion;DolDoc/Cmd Line (Typically)"
public U0 ToTXT(U8 *_in_name,U8 *_out_name=NULL,I64 width=70)
{//Convert $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.TXT"$ file to plain text.
{//Convert $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.TXT"$file to plain text.
U8 *in_name,*out_name;
CDoc *doc_in,*doc_out;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
WinHorz(0,width-1); //Sets doc width for word wrap.
in_name=DftExt(_in_name,"TXT.Z"),
if (_out_name)
out_name=DftExt(_out_name,"TXT");
in_name=DftExt(_in_name,"TXT.Z");
if (_out_name)
out_name=DftExt(_out_name,"TXT");
else
out_name=ChgExt(_in_name,"TXT");
out_name=ChgExt(_in_name,"TXT");
doc_in=DocRead(in_name);
doc_out=Doc2TXT(doc_in);