Nightly update (ISO SHA-1 29c437f)

This commit is contained in:
TempleOS-bot committed 2017-01-25 23:27:30 -05:00
1 parent 0315c180e3
commit b650d335ae
95 files changed
+1969 -1195

No files matched your search

Binary file not shown.
+14 -14
View File
@@ -6,34 +6,34 @@ public U8 *DBlk(I64 blk,Bool write=FALSE)
//See $LK,"::/Demo/Dsk/DskRaw.HC"$.
U8 *buf=MAlloc(BLK_SIZE);
RBlks(Fs->cur_dv,buf,blk,1);
BlkRead(Fs->cur_dv,buf,blk,1);
DocD(buf,BLK_SIZE);
if (write) {
"Edit and press <ESC> to write or <SHIFT-ESC>\n";
if (View) {
"Write\n";
WBlks(Fs->cur_dv,buf,blk,1);
BlkWrite(Fs->cur_dv,buf,blk,1);
}
}
return buf;
}
public U8 *DCluster(I64 c,Bool write=FALSE,I64 num=0)
{//Dump disk cluster. Optionally, write.
//If you set write to TRUE, the cluster will
public U8 *DClus(I64 c,Bool write=FALSE,I64 num=0)
{//Dump disk clus. Optionally, write.
//If you set write to TRUE, the clus will
//be written when you press <ESC>.
//See $LK,"::/Demo/Dsk/DskRaw.HC"$.
//Do $LK,"Dir",A="MN:Dir"$("*",TRUE); to get cluster numbers of files.
//Do $LK,"Dir",A="MN:Dir"$("*",TRUE); to get clus numbers of files.
U8 *buf=MAlloc(Fs->cur_dv->spc<<BLK_SIZE_BITS);
c=ClusterNumNext(Fs->cur_dv,c,num);
RClusters(Fs->cur_dv,buf,c,1);
"Cluster:%X\n",c;
c=ClusNumNext(Fs->cur_dv,c,num);
ClusRead(Fs->cur_dv,buf,c,1);
"Clus:%X\n",c;
DocD(buf,Fs->cur_dv->spc<<BLK_SIZE_BITS);
if (write) {
"Edit and press <ESC> to write or <SHIFT-ESC>\n";
if (View) {
"Write\n";
WClusters(Fs->cur_dv,buf,c,1);
ClusWrite(Fs->cur_dv,buf,c,1);
}
}
return buf;
@@ -67,7 +67,7 @@ public Bool Copy(U8 *src_files_find_mask,U8 *dst_files_find_mask=".")
CDirContext *dirc;
CDirEntry *tmpde,*tmpde1;
U8 *st;
if (!(tmpde1=FilesFind(src_files_find_mask,FUF_CLUSTER_ORDER)))
if (!(tmpde1=FilesFind(src_files_find_mask,FUF_CLUS_ORDER)))
return FALSE;
if (IsDir(dst_files_find_mask)) {
if (dirc=DirContextNew(dst_files_find_mask,TRUE)) {
@@ -109,7 +109,7 @@ I64 CopyTree2(CDirEntry *tmpde,I64 src_dir_len,I64 dst_dir_len,U8 *dst_dir)
MemCpy(st,dst_dir,dst_dir_len);
StrCpy(st+dst_dir_len,tmpde->full_name+src_dir_len);
if (tmpde->attr & RS_ATTR_DIR) {
MkDir(st,LinkedLstCnt(tmpde->sub));
DirMk(st,LinkedLstCnt(tmpde->sub));
res+=CopyTree2(tmpde->sub,src_dir_len,dst_dir_len,dst_dir);
} else
if (CopySingle(tmpde->full_name,st))
@@ -140,12 +140,12 @@ public I64 CopyTree(U8 *src_files_find_mask,U8 *dst_files_find_mask,
Free(st2);
if (dirc=DirContextNew(src_files_find_mask,TRUE,,no_mask)) {
tmpde=FilesFind(dirc->mask,FUF_RECURSE);
st1=CurDir;
st1=DirCur;
DirContextDel(dirc);
i1=StrLen(st1);
if (i1==3) i1--;
if (dirc=DirContextNew(dst_files_find_mask,TRUE,TRUE)) {
st2=CurDir;
st2=DirCur;
i2=StrLen(st2);
if (i2==3) i2--;
res=CopyTree2(tmpde,i1,i2,st2);
+1 -1
View File
@@ -87,7 +87,7 @@ I64 Size1(CDirEntry *tmpde,I64 *_fuf_flags,I64 round_to)
!(tmpde->attr&RS_ATTR_DIR) &&
FileAttr(tmpde->name)&RS_ATTR_COMPRESSED) {
dv=Let2Drv(*tmpde->full_name);
RBlks(dv,buf,Cluster2Blk(dv,tmpde->cluster),1);
BlkRead(dv,buf,Clus2Blk(dv,tmpde->clus),1);
i=(&buf)(CArcCompress *)->expanded_size;
}
if (round_to)
+444
View File
@@ -0,0 +1,444 @@
#help_index "Info;File/Cmd Line (Typically);Cmd Line (Typically)"
Bool ChkDskConfirm(Bool *_fix,Bool *_confirm)
{
if (*_fix && *_confirm) {
"Fix ";
if (!YorN)
*_fix=FALSE;
*_confirm=FALSE;
}
return *_fix;
}
I64 RedSeaChkDskLst(CDrv *dv,CDirEntry *tmpde1,
U8 *bits,U8 *bits2,I64 size,I64 bpc)
{
CDirEntry *tmpde2;
I64 i,j,errs=0;
while (tmpde1) {
tmpde2=tmpde1->next;
if (tmpde1->attr & RS_ATTR_DIR && tmpde1->sub)
errs+=RedSeaChkDskLst(dv,tmpde1->sub,bits,bits2,size,bpc);
j=(tmpde1->size+bpc-1)/bpc;
for (i=0;i<j;i++) {
if (i+tmpde1->clus-dv->data_area>size) {
PrintErr("Invalid Clus:%s Clus:%X\n",tmpde1->full_name,
i+tmpde1->clus);
errs++;
break;
}
if (LBts(bits,i+tmpde1->clus-dv->data_area)) {
PrintErr("Dbl Alloc:%s Clus:%X\n",tmpde1->full_name,
i+tmpde1->clus);
errs++;
}
if (!LBtr(bits2,i+tmpde1->clus-dv->data_area)) {
PrintErr("UnAlloc:%s Clus:%X\n",tmpde1->full_name,
i+tmpde1->clus);
errs++;
}
}
DirEntryDel(tmpde1);
tmpde1=tmpde2;
}
return errs;
}
I64 RedSeaChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
{
I64 i,j,bpc,size,errs=0;
CDrv *dv=Let2Drv(drv_let),*old_dv=Fs->cur_dv;
U8 *files_find_mask=MStrPrint("%c:/*",Drv2Let(dv)),
*old_dir=StrNew(Fs->cur_dir),
*bits,*bits2;
CDirEntry *ptr,*ptr2;
Drv(drv_let);
"Scanning...\n";
size=(dv->size-(dv->data_area-dv->drv_offset))/dv->spc;
bpc=dv->spc<<BLK_SIZE_BITS;
bits=CAlloc((size+7)>>3);
bits2=CAlloc((size+7)>>3+BLK_SIZE);
BlkRead(dv,bits2,dv->fat1,((size+7)>>3+BLK_SIZE-1)>>BLK_SIZE_BITS);
//Get Root Dir size
ptr2=MAlloc(bpc);
BlkRead(dv,ptr2,dv->root_clus,1);
ptr=ptr2(U8 *)-offset(CDirEntry.start);
j=(ptr->size+bpc-1)/bpc;
Free(ptr2);
for (i=0;i<j;i++) {
if (i+dv->root_clus-dv->data_area>size) {
PrintErr("Invalid Clus: RootDir Clus:%X\n",i+dv->root_clus);
errs++;
break;
}
if (LBts(bits,i+dv->root_clus-dv->data_area)) {
PrintErr("Dbl Alloc: RootDir Clus:%X\n",i+dv->root_clus);
errs++;
}
if (!LBtr(bits2,i+dv->root_clus-dv->data_area)) {
PrintErr("UnAlloc: RootDir Clus:%X\n",i+dv->root_clus);
errs++;
}
}
errs+=RedSeaChkDskLst(dv,FilesFind(files_find_mask,FUF_RECURSE),
bits,bits2,size,bpc);
for (i=1;i<size;i++)
if (Bt(bits2,i)) {
PrintWarn("Shouldn't Alloc Clus:%0X\n",i+dv->data_area);
errs++;
if (ChkDskConfirm(_fix,_confirm))
RedSeaFreeClus(dv,i+dv->data_area,1);
}
Free(files_find_mask);
Free(bits);
Free(bits2);
Drv(Drv2Let(old_dv));
Cd(old_dir);
Free(old_dir);
return errs;
}
I64 FAT32ChkDskLst(CDrv *dv,CDirEntry *tmpde1,
U8 *bits,U32 *bits2,I64 size,I64 bpc)
{
CDirEntry *tmpde2;
I64 i,c,errs=0;
while (tmpde1) {
tmpde2=tmpde1->next;
if (tmpde1->attr & RS_ATTR_DIR && tmpde1->sub)
errs+=FAT32ChkDskLst(dv,tmpde1->sub,bits,bits2,size,bpc);
i=0;
c=tmpde1->clus;
while (0<c<0x0FFFFFF8) {
if (c>size) {
PrintErr("Invalid Clus:%s Clus:%X\n",tmpde1->full_name,c);
errs++;
break;
}
if (LBts(bits,c)) {
PrintErr("Dbl Alloc:%s Clus:%X\n",tmpde1->full_name,c);
errs++;
}
if (!bits2[c]) {
PrintErr("UnAlloc:%s Clus:%X\n",tmpde1->full_name,c);
errs++;
} else
bits2[c]=0;
c=ClusNumNext(dv,c);
i++;
}
if (!(tmpde1->attr & RS_ATTR_DIR)) {
i*=bpc;
if (tmpde1->size>i) {
PrintErr("Alloced File Too Short:%s\n",tmpde1->full_name);
errs++;
}
if (i>tmpde1->size+bpc-1) {
PrintWarn("Alloced File Too Long:%s\n",tmpde1->full_name);
errs++;
}
}
DirEntryDel(tmpde1);
tmpde1=tmpde2;
}
return errs;
}
I64 FAT32ChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
{
I64 i,bpc,size,c,errs=0;
CDrv *dv=Let2Drv(drv_let),*old_dv=Fs->cur_dv;
U8 *files_find_mask=MStrPrint("%c:/*",Drv2Let(dv)),
*old_dir=StrNew(Fs->cur_dir),
*bits;
U32 *bits2;
Drv(drv_let);
"Scanning...\n";
size=(dv->size-(dv->data_area-dv->drv_offset))/dv->spc;
bpc=dv->spc<<BLK_SIZE_BITS;
bits=CAlloc((size+7)>>3);
bits2=CAlloc(size*4+BLK_SIZE);
BlkRead(dv,bits2,dv->fat1,(size*4+BLK_SIZE-1)>>BLK_SIZE_BITS);
c=dv->root_clus;
while (0<c<0x0FFFFFF8) {
if (c>size) {
PrintErr("Invalid Clus: RootDir Clus:%X\n",c);
errs++;
break;
}
if (LBts(bits,c)) {
PrintErr("Dbl Alloc: RootDir Clus:%X\n",c);
errs++;
}
if (!bits2[c]) {
PrintErr("UnAlloc: RootDir Clus:%X\n",c);
errs++;
} else
bits2[c]=0;
c=ClusNumNext(dv,c);
}
errs+=FAT32ChkDskLst(dv,FilesFind(files_find_mask,FUF_RECURSE),
bits,bits2,size,bpc);
bits2[1]=0; //See $LK,"FAT32Fmt",A="MN:FAT32Fmt"$()
for (i=1;i<size;i++)
if (bits2[i]) {
PrintWarn("Shouldn't Alloc Clus:%0X\n",i);
errs++;
if (ChkDskConfirm(_fix,_confirm))
FAT32FreeClus(dv,i);
}
Free(files_find_mask);
Free(bits);
Free(bits2);
Drv(Drv2Let(old_dv));
Cd(old_dir);
Free(old_dir);
return errs;
}
public I64 DskChk(U8 drv_let=0,Bool fix=FALSE,Bool confirm=TRUE)
{//Check disk for allocation errors and, optionally, fix.
//You probably want to reformat and reinstall.
I64 errs=0;
CDrv *dv=Let2Drv(drv_let);
switch (dv->fs_type) {
case FSt_REDSEA:
errs=RedSeaChkDsk(drv_let,&fix,&confirm);
break;
case FSt_FAT32:
errs=FAT32ChkDsk(drv_let,&fix,&confirm);
break;
default:
PrintErr("File System Not Supported\n");
}
if (errs) {
if (fix)
"It might be a little better. ";
"Copy files to another partition or CD/DVD, "
"reformat, and copy back. "
"Or, copy from a back-up.\n";
}
return errs;
}
U0 RedSeaDrvView(U8 drv_let=0)
{
CDrv *dv=Let2Drv(drv_let);
I64 lohi,c1,i,x,y,l=(GR_HEIGHT-3*FONT_HEIGHT)*(GR_WIDTH-FONT_WIDTH<<1),
s=dv->size+dv->drv_offset-dv->data_area;
U8 *bitmap;
CDC *dc=DCAlias;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
WinMax;
WinBorder(ON);
DocCursor;
DocClear;
DCFill;
try {
i=((s+7)>>3+BLK_SIZE-1)>>BLK_SIZE_BITS;
bitmap=MAlloc(i<<BLK_SIZE_BITS);
BlkRead(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=(GR_HEIGHT-3*FONT_HEIGHT)*(GR_WIDTH-FONT_WIDTH<<1),
s=(dv->size+dv->spc-1)/dv->spc-(2+dv->data_area-dv->drv_offset);
U32 *bitmap;
CDC *dc=DCAlias;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
WinMax;
WinBorder(ON);
DocCursor;
DocClear;
DCFill;
try {
i=(s*4+BLK_SIZE-1)>>BLK_SIZE_BITS;
bitmap=MAlloc(i<<BLK_SIZE_BITS);
BlkRead(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<DRVS_NUM;i++) {
dv=&blkdev.drvs[i];
if (bd==dv->bd && dv->fs_type) {
sect_start=-(dv->drv_offset*2*ã/(bd->max_blk+1));
sect_end =-((dv->drv_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 res=0,i,l;
U8 *bitmap;
try {
l=dv->size+dv->drv_offset-dv->data_area;
i=((l+7)>>3+BLK_SIZE-1)>>BLK_SIZE_BITS;
bitmap=MAlloc(i<<BLK_SIZE_BITS);
BlkRead(dv,bitmap,dv->fat1,i);
for (i=0;i<l;i++)
if (!Bt(bitmap,i))
res++;
Free(bitmap);
} catch
DrvUnlock(dv);
return res*BLK_SIZE*dv->spc;
}
I64 FAT32UnusedDrvSpace(U8 drv_let=0)
{
CDrv *dv=Let2Drv(drv_let);
I64 res=0,i,l;
U32 *bitmap;
try {
l=(dv->size+dv->spc-1)/dv->spc-(2+dv->data_area-dv->drv_offset);
i=(l*4+BLK_SIZE-1)>>BLK_SIZE_BITS;
bitmap=MAlloc(i<<BLK_SIZE_BITS);
BlkRead(dv,bitmap,dv->fat1,i);
for (i=0;i<l;i++)
if (!bitmap[i])
res++;
Free(bitmap);
} catch
DrvUnlock(dv);
return res*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 res=0;
Drv(drv_let);
switch (dv->fs_type) {
case FSt_REDSEA:
res=RedSeaUnusedDrvSpace(drv_let);
break;
case FSt_FAT32:
res=FAT32UnusedDrvSpace(drv_let);
break;
default:
PrintErr("File System Not Supported\n");
}
Drv(Drv2Let(old_dv));
Cd(old_dir);
Free(old_dir);
return res;
}
+167
View File
@@ -0,0 +1,167 @@
#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;
};
public I64 DskPrt(U8 drv_let=0,...)
{/*Partition the disk containing partition drv_let.
drv_let=0 means add new drive that is not already mounted.
>DskPrt('C',0.5,0.25,0.25); //Make three. 50% C, 25% D, 25% E, round-up to blk.
*/
CBlkDev *bd;
CPlannedDrv head,*tmppp;
CMasterBoot mbr;
Bool pri=TRUE;
I64 ext_base,drv_let2,pri_cnt=0,i,start_offset,offset,
total,remaining,cur_arg=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,\"BootMHDZero\",\"MN:BootMHDZero\"$$()\n\n\n"
"Continue";
if (argc<=cur_arg && !YorN)
return 0;
'\n';
if (drv_let && !Let2BlkDev(drv_let,FALSE))
drv_let=0;
if (!drv_let && !(drv_let=Mount(TRUE)) ||
!(bd=Let2BlkDev(drv_let,FALSE)) || bd->type!=BDT_ATA)
return 0;
total=bd->max_blk+1;
QueInit(&head);
drv_let2=bd->first_drv_let;
remaining=FloorU64(bd->max_blk+1,ROUND_DRV_TO);
while (FloorU64(remaining,ROUND_DRV_TO)>=ROUND_DRV_TO) {
tmppp=MAlloc(sizeof(CPlannedDrv));
do {
"$$RED$$Partition %C$$FG$$\n",drv_let2;
tmppp->pri=FALSE;
if (pri) {
"Primary Partition";
if (argc>cur_arg || YorN) {
pri_cnt++;
tmppp->pri=TRUE;
if (pri_cnt==3)
pri=FALSE;
} else
pri=FALSE;
}
"\nBlocks Remaining:%d (0x%X)\n",
remaining-DRV_HEADER,remaining-DRV_HEADER;
if (argc>cur_arg)
tmppp->size=MinI64(CeilU64(MaxI64(remaining,DRV_HEADER),ROUND_DRV_TO),
CeilU64(argv[cur_arg++](F64)*total,ROUND_DRV_TO));
else
tmppp->size=CeilU64(GetI64("Size in Blocks :",
remaining-DRV_HEADER)+DRV_HEADER,ROUND_DRV_TO);
} while (!(ROUND_DRV_TO<=tmppp->size<=FloorU64(remaining,ROUND_DRV_TO)));
QueIns(tmppp,head.last);
remaining-=tmppp->size;
drv_let2++;
}
"\n\n!!! Repartition Drive !!!\n\n";
tmppp=head.next;
drv_let2=bd->first_drv_let;
while (tmppp!=&head) {
"Drive %C:%08X ",drv_let2,tmppp->size;
if (tmppp->pri)
"Primary\n";
else
"Logical\n";
tmppp=tmppp->next;
drv_let2++;
}
if (!argc && !AreYouSure)
goto pd_done;
remaining=FloorU64(bd->max_blk+1,ROUND_DRV_TO)-ROUND_DRV_TO;
tmppp=head.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=tmppp->size-DRV_HEADER;
offset+=tmppp->size;
remaining-=tmppp->size;
tmppp=tmppp->next;
}
if (!i) i++;
if (tmppp!=&head) {
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 (tmppp!=&head) {
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=tmppp->size-DRV_HEADER;
offset+=tmppp->size;
tmppp=tmppp->next;
if (tmppp!=&head) {
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=tmppp->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 (head.next!=&head) {
tmppp=head.next;
QueRem(tmppp);
Free(tmppp);
}
return total;
}
+4 -4
View File
@@ -284,7 +284,7 @@ U0 FMMkDir(CDoc *doc)
Cd(parent->full_name);
if (DocForm(&fn)) {
Silent;
MkDir(fn.name);
DirMk(fn.name);
Silent(OFF);
}
}
@@ -293,7 +293,7 @@ U0 FMMkDir(CDoc *doc)
Cd(tmpde->full_name);
if (DocForm(&fn)) {
Silent;
MkDir(fn.name);
DirMk(fn.name);
Silent(OFF);
}
}
@@ -335,7 +335,7 @@ U0 FMChgDsk(CDoc *doc)
while (tmpde->parent)
tmpde=tmpde->parent;
Silent;
ChgDsk(*tmpde->full_name);
DskChg(*tmpde->full_name);
Silent(OFF);
}
}
@@ -596,7 +596,7 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
CDirEntry *head=NULL,*tmpde,*tmpde1,*tmpde2;
I64 sc,ch,arg1,arg2,msg_code;
CDoc *doc=NULL,*old_put_doc=DocPut,*old_display_doc=DocDisplay;
U8 *res=NULL,*st,*st2,*old_cur_dir=CurDir;
U8 *res=NULL,*st,*st2,*old_cur_dir=DirCur;
CDocEntry *doc_ce=NULL,*doc_e;
Bool okay;
+2 -2
View File
@@ -1,8 +1,8 @@
Cd(__DIR__);;
#include "ADskA"
#include "ADskB"
#include "PrtDsk"
#include "DskPrt"
#include "Mount"
#include "ChkDsk"
#include "DskChk"
#include "FileMgr"
Cd("..");;
+4 -4
View File
@@ -120,9 +120,9 @@ U8 Mount2(U8 boot_drv_let,CDoc *_doc,Bool _caller_is_prtdsk)
if ((cnt=ExeDoc(doc)) && whole_drv) {
if (_caller_is_prtdsk) {
res=drv_let;
PrtDsk(drv_let,1.0); //First mount whole drive.
DskPrt(drv_let,1.0); //First mount whole drive.
} else
PrtDsk(drv_let);
DskPrt(drv_let);
}
DocDel(doc);
}
@@ -136,7 +136,7 @@ U8 Mount2(U8 boot_drv_let,CDoc *_doc,Bool _caller_is_prtdsk)
}
public U8 Mount(Bool caller_is_prtdsk=FALSE)
{//Mount drives. Called from $LK,"PrtDsk(Mount)",A="FF:::/Adam/ABlkDev/PrtDsk.HC,Mount("$.
{//Mount drives. Called from $LK,"DskPrt(Mount)",A="FF:::/Adam/ABlkDev/DskPrt.HC,Mount("$.
return Mount2(0,NULL,caller_is_prtdsk);
}
@@ -147,7 +147,7 @@ public U0 Unmount(U8 drv_let=0)
public U8 MountFile(U8 *filename)
{//Mount ISO.C file.
U8 *filename2=DftExt(filename,"ISO.C"),*filename3=FileNameAbs(filename2);
U8 *filename2=ExtDft(filename,"ISO.C"),*filename3=FileNameAbs(filename2);
CDrv *dv=DrvMakeFreeSlot(DrvNextFreeLet('M')); //First $LK,"BDT_ISO_FILE_READ",A="MN:BDT_ISO_FILE_READ"$
CBlkDev *bd=BlkDevNextFreeSlot(dv->drv_let,BDT_ISO_FILE_READ);
bd->drv_offset=19<<2+(DVD_BLK_SIZE*2+DVD_BOOT_LOADER_SIZE)/BLK_SIZE;
+1 -1
View File
@@ -373,7 +373,7 @@ public U0 PopUpHelpIndex(U8 *idx,CTask *parent=NULL)
#help_index "Hash/System"
public U0 MapFileLoad(U8 *filename)
{//Load map file so we have src line info.
U8 *st,*ptr,*name=DftExt(filename,"MAP.Z"),
U8 *st,*ptr,*name=ExtDft(filename,"MAP.Z"),
*absname=FileNameAbs(name);
CDoc *doc=DocRead(name);
CDocEntry *doc_e;
+2 -2
View File
@@ -11,7 +11,7 @@ public U8 *ACDDefGet(U8 *st,I64 def_num=1)
if (f=FOpen(ACD_DEF_FILENAME,"r")) {
buf=MAlloc(ACD_BLK_SIZE*2+1);
buf[ACD_BLK_SIZE*2]=0; //terminate
FRBlks(f,buf,tmph->user_data0*ACD_BLK_SIZE/BLK_SIZE,
FBlkRead(f,buf,tmph->user_data0*ACD_BLK_SIZE/BLK_SIZE,
ACD_BLK_SIZE*2/BLK_SIZE);
FClose(f);
in_ptr=buf;
@@ -55,7 +55,7 @@ public U8 *ACDDefsGet(U8 *st)
if (f=FOpen(ACD_DEF_FILENAME,"r")) {
buf=MAlloc(ACD_BLK_SIZE*2+1);
buf[ACD_BLK_SIZE*2]=0; //terminate
FRBlks(f,buf,tmph->user_data0*ACD_BLK_SIZE/BLK_SIZE,
FBlkRead(f,buf,tmph->user_data0*ACD_BLK_SIZE/BLK_SIZE,
ACD_BLK_SIZE*2/BLK_SIZE);
FClose(f);
in_ptr=buf;
+1 -1
View File
@@ -96,7 +96,7 @@ U0 ACMainFileLstTraverse(U8 *files_find_mask)
CDirEntry *tmpde,*tmpde1;
try {
tmpde=tmpde1=FilesFind(files_find_mask,
FUF_RECURSE|FUF_JUST_TXT|FUF_JUST_FILES|FUF_CLUSTER_ORDER);
FUF_RECURSE|FUF_JUST_TXT|FUF_JUST_FILES|FUF_CLUS_ORDER);
while (tmpde) {
"%s\n",tmpde->full_name;
buf=FileRead(tmpde->full_name);
+1 -1
View File
@@ -440,7 +440,7 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action,Bool beep=TRUE)
DocFlagsToggle(doc,DOCF_PLAIN_TEXT);
DocWrite(doc);
task=Spawn(&SrvCmdLine,NULL,"Srv",,Fs);
st2=CurDir;
st2=DirCur;
st=MStrPrint("Cd(\"%s\");",st2);
tmpc=TaskExe(task,Fs,st,1<<JOBf_WAKE_MASTER|1<<JOBf_FOCUS_MASTER);
Free(st2);
+5 -5
View File
@@ -28,7 +28,7 @@ public U8 *PopUpPickFile(U8 *dir=NULL)
if (dir)
st=MStrPrint("Cd(\"%Q\");FileMgr(FM_PICK_FILE,Fs->parent_task);",dir);
else {
st2=CurDir;
st2=DirCur;
st=MStrPrint("Cd(\"%Q\");FileMgr(FM_PICK_FILE,Fs->parent_task);",st2);
Free(st2);
}
@@ -43,7 +43,7 @@ public U8 *PopUpPickDir(U8 *dir=NULL)
if (dir)
st=MStrPrint("Cd(\"%Q\");FileMgr(FM_PICK_DIR,Fs->parent_task);",dir);
else {
st2=CurDir;
st2=DirCur;
st=MStrPrint("Cd(\"%Q\");FileMgr(FM_PICK_DIR,Fs->parent_task);",st2);
Free(st2);
}
@@ -264,7 +264,7 @@ public I64 AdamFile(U8 *filename,Bool warn_ext=TRUE)
{//Make adam_task execute file.
Bool okay=TRUE;
U8 *name=FileNameAbs(filename),
*name2=DftExt(name,"HC.Z");
*name2=ExtDft(name,"HC.Z");
I64 res=0;
if (warn_ext &&
!FilesFindMatch(name2,FILEMASK_JIT) &&
@@ -282,7 +282,7 @@ public I64 PopUpFile(U8 *filename,Bool warn_ext=TRUE,
{//$LK,"ExeFile2",A="MN:ExeFile2"$() in $LK,"PopUp",A="MN:PopUp"$ task. Cont as User.
Bool okay=TRUE;
U8 *st,*name=FileNameAbs(filename),
*name2=DftExt(name,"HC.Z");
*name2=ExtDft(name,"HC.Z");
I64 res=0;
if (warn_ext &&
!FilesFindMatch(name2,FILEMASK_JIT) &&
@@ -304,7 +304,7 @@ public I64 PopUpFile(U8 *filename,Bool warn_ext=TRUE,
public I64 PopUpRunFile(U8 *filename,I64 ccf_flags=0,...)
{//$LK,"ExeFile",A="MN:ExeFile"$() with args using $LK,"LastFun",A="MN:LastFun"$() in $LK,"PopUp",A="MN:PopUp"$ task.
U8 *st,*name=FileNameAbs(filename),
*name2=DftExt(name,"HC.Z");
*name2=ExtDft(name,"HC.Z");
I64 res=0;
st=MStrPrint(
"\"$$$$WW+H,1$$$$\";ExeFile2(\"%s\",0x%X);LastFun(0x%X,0x%X);",
+2 -2
View File
@@ -379,7 +379,7 @@ public CDC *DCLoad(U8 *src,I64 *_size=NULL,CTask *task=NULL)
public I64 GRWrite(U8 *filename,CDC *dc,I64 dcsf_flags=DCSF_COMPRESSED)
{//TempleOS GR File.
I64 size;
U8 *st=DftExt(filename,"GR.Z"),
U8 *st=ExtDft(filename,"GR.Z"),
*src=DCSave(dc,&size,dcsf_flags);
FileWrite(st,src,size);
Free(st);
@@ -390,7 +390,7 @@ public I64 GRWrite(U8 *filename,CDC *dc,I64 dcsf_flags=DCSF_COMPRESSED)
public CDC *GRRead(U8 *filename,CTask *task=NULL)
{//TempleOS GR File.
CDC *dc=NULL;
U8 *st=DftExt(filename,"GR.Z"),
U8 *st=ExtDft(filename,"GR.Z"),
*src=FileRead(st);
if (src)
dc=DCLoad(src,,task);
+2 -2
View File
@@ -59,8 +59,8 @@ Place the CDDVD %s in the drive.
",iso_filename;
}
if (PressAKey!=CH_SHIFT_ESC) {
">$FG,2$ChgDsk('T');$FG$\n\n";
ChgDsk('T');
">$FG,2$DskChg('T');$FG$\n\n";
DskChg('T');
res=TRUE;
}
} catch
+3 -3
View File
@@ -35,19 +35,19 @@ public U0 BootHDIns(U8 drv_let=0)
else {
Free(de.full_name);
"Modifying partition boot record.\n";
RBlks(dv,&br,dv->drv_offset,1);
BlkRead(dv,&br,dv->drv_offset,1);
br.jump_and_nop[0]=OC_JMP_REL8;
br.jump_and_nop[1]=offset(CFAT32Boot.code)-2;
#assert offset(CFAT32Boot.code)>=offset(CRedSeaBoot.code)
br.jump_and_nop[2]=OC_NOP;
*BHD_BLK_CNT(U16 *)=(de.size+BLK_SIZE-1)>>BLK_SIZE_BITS;
*BHD_DAP_BLK(I64 *)=Cluster2Blk(dv,de.cluster);
*BHD_DAP_BLK(I64 *)=Clus2Blk(dv,de.clus);
for (i=0;i<BHD_END-BHD_CODE;i++)
br.code[i]=BHD_CODE(U8 *)[i];
#assert sizeof(CFAT32Boot.code)>=BHD_END-BHD_CODE
for (;i<sizeof(CFAT32Boot.code);i++)
br.code[i]=0;
WBlks(dv,&br,dv->drv_offset,1);
BlkWrite(dv,&br,dv->drv_offset,1);
}
break;
default:
+3 -3
View File
@@ -29,7 +29,7 @@ public U0 BootMHDOldRead(U8 src_drv,U8 dst_drv)
BlkDevUnlock(bd);
Drv(dst_drv);
MkDir(BOOT_DIR);
DirMk(BOOT_DIR);
FileWrite(BOOT_DIR_OLDMBR_BIN_C,&mbr,BLK_SIZE);
}
}
@@ -103,7 +103,7 @@ public Bool BootMHDIns(U8 drv_let,U8 *drv_lst=NULL)
j=0;
if (FileFind(BOOT_DIR_OLDMBR_BIN_C,&de,FUF_JUST_FILES)) {
Free(de.full_name);
*_q++=Cluster2Blk(dv,de.cluster);
*_q++=Clus2Blk(dv,de.clus);
CatPrint(menu_ptr,"0. Old Boot Record\n\r");
j++;
}
@@ -127,7 +127,7 @@ public Bool BootMHDIns(U8 drv_let,U8 *drv_lst=NULL)
else {
Free(de.full_name);
*BMHD_BLK_CNT(U16 *)=(size+BLK_SIZE-1)>>BLK_SIZE_BITS;
*BMHD_DAP_BLK(I64 *)=Cluster2Blk(dv,de.cluster);
*BMHD_DAP_BLK(I64 *)=Clus2Blk(dv,de.clus);
//Bypass partition bounds-checking
BlkDevLock(bd);
ATAReadBlks(bd,&mbr,0,1);
+18 -18
View File
@@ -124,8 +124,8 @@ I64 DVDFileCreate2(CFile *out_file,CDirEntry *tmpde,CISO1DirEntry *tmpi,
MemSet(buf,0,DVD_BLK_SIZE);
}
if (write) {
FRBlks(in_file,buf,i<<2,n);
FWBlks(out_file,buf,*_cur_blk<<2,n);
FBlkRead(in_file,buf,i<<2,n);
FBlkWrite(out_file,buf,*_cur_blk<<2,n);
}
*_cur_blk+=1;
}
@@ -181,7 +181,7 @@ I64 DVDFileCreate2(CFile *out_file,CDirEntry *tmpde,CISO1DirEntry *tmpi,
if (write)
"%X:%s\n",*_cur_blk,tmpde->full_name;
if (write)
FWBlks(out_file,dir_blk_buf,*_cur_blk<<2,n<<2);
FBlkWrite(out_file,dir_blk_buf,*_cur_blk<<2,n<<2);
*_cur_blk+=n;
tmpi2->len=sizeof(CISO1DirEntry)-1;
@@ -212,7 +212,7 @@ I64 DVDFileCreate2(CFile *out_file,CDirEntry *tmpde,CISO1DirEntry *tmpi,
if (write)
"%X:%s\n",*_cur_blk,tmpde->full_name;
if (write)
FWBlks(out_file,dir_blk_buf2,*_cur_blk<<2,n<<2);
FBlkWrite(out_file,dir_blk_buf2,*_cur_blk<<2,n<<2);
*_cur_blk+=n;
Free(dir_blk_buf);
@@ -328,7 +328,7 @@ public I64 ISO9660ISO(U8 *_filename=NULL,U8 *src_files_find_mask,
if (!_filename)
_filename=blkdev.dft_iso_filename;
filename=DftExt(_filename,"ISO");
filename=ExtDft(_filename,"ISO");
if (_stage2_filename)
stage2_filename=FileNameAbs(_stage2_filename);
@@ -367,7 +367,7 @@ public I64 ISO9660ISO(U8 *_filename=NULL,U8 *src_files_find_mask,
goto cf_done;
while (cur_blk<20<<2>>2)
FWBlks(out_file,zero_buf,cur_blk++<<2,4);
FBlkWrite(out_file,zero_buf,cur_blk++<<2,4);
iso_pri->type=ISO1T_PRI_VOL_DESC;
StrCpy(iso_pri->id,"CD001");
@@ -407,7 +407,7 @@ public I64 ISO9660ISO(U8 *_filename=NULL,U8 *src_files_find_mask,
et->sect_cnt=4; //5 seems like the limit, 4 is safer
et->load_rba=cur_blk+1;
"%X: Pre Boot Blk\n",cur_blk;
FWBlks(out_file,et,cur_blk++<<2,4);
FBlkWrite(out_file,et,cur_blk++<<2,4);
"%X: Boot Stage 1\n",cur_blk;
cur_blk+=DVD_BOOT_LOADER_SIZE/DVD_BLK_SIZE;
}
@@ -434,10 +434,10 @@ public I64 ISO9660ISO(U8 *_filename=NULL,U8 *src_files_find_mask,
for (i=1;i<=max_depth;i++)
DVDFillPathTable(headdir,&itabbuf,&itabbuf2,1,FALSE,&first_free,1,i);
"%X: Path Table 0\n",cur_blk;
FWBlks(out_file,tabbuf,cur_blk<<2,tabsize<<2);
FBlkWrite(out_file,tabbuf,cur_blk<<2,tabsize<<2);
cur_blk+=tabsize;
"%X: Path Table 1\n",cur_blk;
FWBlks(out_file,tabbuf2,cur_blk<<2,tabsize2<<2);
FBlkWrite(out_file,tabbuf2,cur_blk<<2,tabsize2<<2);
cur_blk+=tabsize2;
MemSet(tabbuf,0,tabsize*DVD_BLK_SIZE);
@@ -458,35 +458,35 @@ public I64 ISO9660ISO(U8 *_filename=NULL,U8 *src_files_find_mask,
for (i=1;i<=max_depth;i++)
DVDFillPathTable(headdir,&itabbuf,&itabbuf2,1,TRUE,&first_free,1,i);
"%X: Path Table 2\n",cur_blk;
FWBlks(out_file,tabbuf,cur_blk<<2,tabsize<<2);
FBlkWrite(out_file,tabbuf,cur_blk<<2,tabsize<<2);
cur_blk+=tabsize;
"%X: Path Table 3\n",cur_blk;
FWBlks(out_file,tabbuf2,cur_blk<<2,tabsize2<<2);
FBlkWrite(out_file,tabbuf2,cur_blk<<2,tabsize2<<2);
cur_blk+=tabsize2;
DirTreeDel2(headdir);
FillU32Palindrome(&iso_pri->vol_space_size,cur_blk);
FillU32Palindrome(&iso_sup->vol_space_size,cur_blk);
FWBlks(out_file,iso_pri,16<<2,4);
FBlkWrite(out_file,iso_pri,16<<2,4);
iso_term->type=ISO1T_TERMINATOR;
StrCpy(iso_term->id,"CD001");
iso_term->version=1;
if (stage2_filename) {
FWBlks(out_file,iso_boot,17<<2,4);
FWBlks(out_file,iso_sup,18<<2,4);
FWBlks(out_file,iso_term,19<<2,4);
FBlkWrite(out_file,iso_boot,17<<2,4);
FBlkWrite(out_file,iso_sup,18<<2,4);
FBlkWrite(out_file,iso_term,19<<2,4);
stage2_size=(Size(stage2_filename,"+s")+DVD_BLK_SIZE-1)/DVD_BLK_SIZE;
MemCpy(stage1_buf,BDVD_START,BDVD_END-BDVD_START);
*(BDVD_BLK_CNT-BDVD_START+stage1_buf)(U16 *)=stage2_size;
*(BDVD_BLK_LO -BDVD_START+stage1_buf)(U32 *)=stage2_blk;
"$$RED$$!!! Boot Stage 2 !!! %X-%X$$FG$$\n",
stage2_blk,stage2_blk+stage2_size-1;
FWBlks(out_file,stage1_buf,
FBlkWrite(out_file,stage1_buf,
20<<2+1<<2,DVD_BOOT_LOADER_SIZE/BLK_SIZE);
} else {
FWBlks(out_file,iso_sup,17<<2,4);
FWBlks(out_file,iso_term,18<<2,4);
FBlkWrite(out_file,iso_sup,17<<2,4);
FBlkWrite(out_file,iso_term,18<<2,4);
}
cf_done:
+12 -12
View File
@@ -32,13 +32,13 @@ U0 RedSeaISO9660Stage1(U8 *iso_filename,U8 *stage2_filename)
U8 *stage1_buf=CAlloc(DVD_BOOT_LOADER_SIZE);
if (FileFind(stage2_filename,&de) && (out_file=FOpen(iso_filename,"wc+"))) {
MemCpy(stage1_buf,BDVD_START,BDVD_END-BDVD_START);
*(BDVD_BLK_LO -BDVD_START+stage1_buf)(U32 *)=de.cluster>>2;
*(BDVD_BLK_LO -BDVD_START+stage1_buf)(U32 *)=de.clus>>2;
*(BDVD_BLK_CNT -BDVD_START+stage1_buf)(U16 *)=
(de.size+DVD_BLK_SIZE-1)>>(BLK_SIZE_BITS+2);
*(BDVD_SHIFT_BLKS -BDVD_START+stage1_buf)(U16 *)=de.cluster&3;
if (de.cluster&3)
*(BDVD_SHIFT_BLKS -BDVD_START+stage1_buf)(U16 *)=de.clus&3;
if (de.clus&3)
*(BDVD_BLK_CNT -BDVD_START+stage1_buf)(U16 *)+=1;
FWBlks(out_file,stage1_buf,
FBlkWrite(out_file,stage1_buf,
20<<2+1<<2,DVD_BOOT_LOADER_SIZE/BLK_SIZE);
FClose(out_file);
}
@@ -61,7 +61,7 @@ U0 RedSeaISO9660(U8 *iso_filename,U8 drv_let)
if (out_file=FOpen(iso_filename,"wc+")) {
iso_size=FSize(out_file)/DVD_BLK_SIZE;
for (i=0;i<dv->bd->drv_offset;i+=4)
FWBlks(out_file,zero_buf,i,4);
FBlkWrite(out_file,zero_buf,i,4);
iso_pri->type=ISO1T_PRI_VOL_DESC;
StrCpy(iso_pri->id,"CD001");
@@ -70,7 +70,7 @@ U0 RedSeaISO9660(U8 *iso_filename,U8 drv_let)
FillU16Palindrome(&iso_pri->vol_seq_num,1);
FillU16Palindrome(&iso_pri->log_block_size,DVD_BLK_SIZE);
FillU32Palindrome(&iso_pri->vol_space_size,iso_size);
FillU32Palindrome(&iso_pri->root_dir_record,dv->root_cluster);
FillU32Palindrome(&iso_pri->root_dir_record,dv->root_clus);
iso_pri->file_structure_version=1;
StrCpy(iso_pri->publisher_id,"TempleOS RedSea");
@@ -82,17 +82,17 @@ U0 RedSeaISO9660(U8 *iso_filename,U8 drv_let)
iso_boot->version=1;
StrCpy(iso_boot(U8 *)+7,"EL TORITO SPECIFICATION");
FWBlks(out_file,iso_pri,16<<2,4);
FBlkWrite(out_file,iso_pri,16<<2,4);
iso_term->type=ISO1T_TERMINATOR;
StrCpy(iso_term->id,"CD001");
iso_term->version=1;
d=iso_boot(U8 *)+0x47;
*d=20<<2>>2;
FWBlks(out_file,iso_boot,17<<2,4);
FBlkWrite(out_file,iso_boot,17<<2,4);
FWBlks(out_file,iso_sup,18<<2,4);
FWBlks(out_file,iso_term,19<<2,4);
FBlkWrite(out_file,iso_sup,18<<2,4);
FBlkWrite(out_file,iso_term,19<<2,4);
et->w[0]=1;
StrCpy(&et->w[2],"TempleOS");
@@ -105,7 +105,7 @@ U0 RedSeaISO9660(U8 *iso_filename,U8 drv_let)
et->media_type=0;//0=no emu 2=1.44meg 4=hard drive
et->sect_cnt=4; //5 seems like the limit, 4 is safer
et->load_rba=20<<2>>2+1;
FWBlks(out_file,et,20<<2,4);
FBlkWrite(out_file,et,20<<2,4);
FClose(out_file);
}
Free(zero_buf);
@@ -147,7 +147,7 @@ public I64 RedSeaISO(U8 *_iso_filename=NULL,U8 *_src_dir,
else {
if (!_iso_filename)
_iso_filename=blkdev.dft_iso_c_filename;
iso_filename=ChgExt(_iso_filename,"ISO.C");
iso_filename=ExtChg(_iso_filename,"ISO.C");
src_dir=DirNameAbs(_src_dir);
if (_stage2_filename) {
stage2_filename=FileNameAbs(_stage2_filename);
+1 -1
View File
@@ -63,7 +63,7 @@ I64 SizeRep1(CDirEntry *tmpde,I64 *_fuf_flags)
else if ((i=tmpde->size) && Bt(_fuf_flags,FUf_EXPAND) &&
FileAttr(tmpde->name)&RS_ATTR_COMPRESSED) {
dv=Let2Drv(*tmpde->full_name);
RBlks(dv,buf,Cluster2Blk(dv,tmpde->cluster),1);
BlkRead(dv,buf,Clus2Blk(dv,tmpde->clus),1);
i=(&buf)(CArcCompress *)->expanded_size;
}
tmpde->user_data=i;
+1 -1
View File
@@ -115,7 +115,7 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
"HashTable\t:%010X\n",HashTableSize2(task->hash_table);
"FPU\t\t:%010X\n",MSize2(task->fpu_mmx);
"CurDir\t:%010X\n",MSize2(task->cur_dir);
"DirCur\t:%010X\n",MSize2(task->cur_dir);
if (pdoc=DocPut(task))
"PutDoc\t:%010X\n",DocSize(pdoc);
+2 -2
View File
@@ -14,9 +14,9 @@ public I64 Sort(U8 *_in_name,U8 *_out_name=NULL,
I64 i,j,cnt=0,res;
if (!_in_name) return 0;
in_name=DftExt(_in_name,"DD.Z");
in_name=ExtDft(_in_name,"DD.Z");
if (_out_name)
out_name=DftExt(_out_name,"DD.Z");
out_name=ExtDft(_out_name,"DD.Z");
else
out_name=StrNew(in_name);
+3 -3
View File
@@ -112,11 +112,11 @@ public U0 ToTXT(U8 *_in_name,U8 *_out_name=NULL,I64 width=70)
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
WinHorz(0,width-1); //Sets doc width for word wrap.
in_name=DftExt(_in_name,"DD.Z");
in_name=ExtDft(_in_name,"DD.Z");
if (_out_name)
out_name=DftExt(_out_name,"TXT");
out_name=ExtDft(_out_name,"TXT");
else
out_name=ChgExt(_in_name,"TXT");
out_name=ExtChg(_in_name,"TXT");
doc_in=DocRead(in_name);
doc_out=Doc2TXT(doc_in);
+1 -1
View File
@@ -10,7 +10,7 @@ public CTaskSettings *SettingsPush(CTask *task=NULL,I64 flags=0)
if (!task) task=Fs;
if (!TaskValidate(task)) return NULL;
tmpse=CAlloc(sizeof(CTaskSettings),task);
tmpse->cur_dir=CurDir(task,task);
tmpse->cur_dir=DirCur(task,task);
tmpse->draw_it=task->draw_it;
GrPaletteGet(tmpse->palette);
tmpse->task_end_cb=task->task_end_cb;
+1 -1
View File
@@ -1,5 +1,5 @@
Cd(__DIR__);;
if (!FileFind("~/Budget",,FUF_JUST_DIRS)) {
MkDir("~/Budget");
DirMk("~/Budget");
Copy("Accts.DD.Z","~/Budget");
}
+1 -1
View File
@@ -1,2 +1,2 @@
if (!FileFind("~/Psalmody",,FUF_JUST_DIRS))
MkDir("~/Psalmody");
DirMk("~/Psalmody");
+1 -1
View File
@@ -1 +1 @@
MkDir("~/Span");
DirMk("~/Span");
+2 -2
View File
@@ -69,7 +69,7 @@ Bool SpanWrite(CMathODE *ode)
U8 *name,*buf;
I64 size;
Bool res=FALSE,old_silent=Silent;
MkDir("~/Span");
DirMk("~/Span");
Silent(old_silent);
if (name=PopUpFileName("~/Span/Game.DATA")) {
if (buf=SpanSave(ode,&size)) {
@@ -115,7 +115,7 @@ U8 *SpanRead()
{
U8 *src=NULL,*name;
Bool old_silent=Silent;
MkDir("~/Span");
DirMk("~/Span");
Silent(old_silent);
if (name=PopUpPickFile("~/Span")) {
src=FileRead(name);
+1 -1
View File
@@ -1,5 +1,5 @@
if (!FileFind("~/TimeClock",,FUF_JUST_DIRS)) {
MkDir("~/TimeClock");
DirMk("~/TimeClock");
DocClear;
"After Loading, type $$GREEN$$PunchIn;$$FG$$, "
"$$GREEN$$PunchOut;$$FG$$ or $$GREEN$$TimeRep;$$FG$$\n"
+1 -1
View File
@@ -1,2 +1,2 @@
MkDir("~/ToTheFront");
DirMk("~/ToTheFront");
+2 -2
View File
@@ -71,13 +71,13 @@ U0 DrawHexes()
}
}
U0 MakeTerrain(U8 color,I64 cnt,I64 cluster_lo,I64 cluster_hi)
U0 MakeTerrain(U8 color,I64 cnt,I64 clus_lo,I64 clus_hi)
{
I64 i,j,l,row,col;
for (i=0;i<cnt;i++) {
col=RandU32%map_cols;
row=RandU32%map_rows;
l=cluster_lo+RandU16%(cluster_hi-cluster_lo+1);
l=clus_lo+RandU16%(clus_hi-clus_lo+1);
for (j=0;j<l;j++) {
terrain[row][col]=color;
Toward(&row,&col,RandU16%6);
+1 -1
View File
@@ -891,7 +891,7 @@ U0 PrsBinFile(CCmpCtrl *cc)
U8 *buf,*st;
if (cc->token!=TK_STR)
LexExcept(cc,"Expecting string at ");
st=DftExt(cc->cur_str,"BIN");
st=ExtDft(cc->cur_str,"BIN");
buf=FileRead(st,&size);
Free(st);
for (i=0;i<size;i++)
+6 -6
View File
@@ -428,10 +428,10 @@ I64 Cmp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0)
CAOTHeapGlblRef *tmphgr,*tmphgr1;
CAOTHeapGlbl *tmphg,*tmphg1;
fbuf=DftExt(filename,"PRJ.Z");
fbuf=ExtDft(filename,"PRJ.Z");
fbuf2=MStrPrint("#include \"%s\"",fbuf);
if (map_name)
fbuf3=DftExt(map_name,"MAP.Z");
fbuf3=ExtDft(map_name,"MAP.Z");
if (tmpaot=CmpBuf(fbuf2,fbuf3,&error_cnt,&warning_cnt,mapfile_drv_let)) {
aot_U8s=tmpaot->aot_U8s;
@@ -550,9 +550,9 @@ I64 Cmp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drv_let=0)
size-aot_U8s-sizeof(CBinFile));
Free(fbuf2);
if (out_name)
fbuf2=DftExt(out_name,"BIN.Z");
fbuf2=ExtDft(out_name,"BIN.Z");
else
fbuf2=ChgExt(fbuf,"BIN.Z");
fbuf2=ExtChg(fbuf,"BIN.Z");
FileWrite(fbuf2,bfh,size);
Free(bfh);
Free(tmpaot->buf);
@@ -614,7 +614,7 @@ I64 ExePrint(U8 *fmt,...)
I64 ExeFile(U8 *name,I64 ccf_flags=0)
{//JIT Compile and execute a file.
I64 res;
U8 *name2=DftExt(name,"HC.Z"),
U8 *name2=ExtDft(name,"HC.Z"),
*st=MStrPrint("#include \"%s\";",name2);
res=ExePutS(st,name,ccf_flags);
Free(st);
@@ -657,7 +657,7 @@ I64 ExePrint2(U8 *fmt,...)
I64 ExeFile2(U8 *name,I64 ccf_flags=0)
{//throws exceptions
I64 res;
U8 *name2=DftExt(name,"HC.Z"),*st=MStrPrint("#include \"%s\";",name2);
U8 *name2=ExtDft(name,"HC.Z"),*st=MStrPrint("#include \"%s\";",name2);
res=ExePutS2(st,name,ccf_flags);
Free(st);
Free(name2);
+1 -1
View File
@@ -135,7 +135,7 @@ U8 *CmdLinePmt()
"%8.6fs ans=0x%08X=%d\n",Fs->answer_time,Fs->answer,Fs->answer;
Fs->new_answer=FALSE;
}
if (st=CurDir) {
if (st=DirCur) {
"%s",st;
Free(st);
}
Binary file not shown.
+1
View File
@@ -11,6 +11,7 @@ public _extern _LAST_FUN I64 LastFun(I64 argc,I64 *argv);
public extern I64 RunFile(U8 *name,I64 ccf_flags=0,...);
public extern I64 RunFile2(U8 *name,I64 ccf_flags=0,...);
public extern CCmpGlbls cmp;
#help_index "Compiler/Directive"
#help_file "::/Doc/Directives"
public extern Bool Echo(Bool val);
+2 -2
View File
@@ -698,7 +698,7 @@ lex_float_start:
case KW_INCLUDE:
if (Lex(cc)!=TK_STR)
goto lex_end;
fbuf=DftExt(cc->cur_str,"HC.Z");
fbuf=ExtDft(cc->cur_str,"HC.Z");
buf2=FileNameAbs(fbuf);
Free(fbuf);
if (Bt(&sys_run_level,RLf_DOC))
@@ -1029,7 +1029,7 @@ lex_ifjit:
if (Lex(cc)!=TK_STR)
goto lex_end;
tmph=CAlloc(sizeof(CHashSrcSym));
fbuf=DftExt(cc->cur_str,"DD.Z");
fbuf=ExtDft(cc->cur_str,"DD.Z");
tmph->str=FileNameAbs(fbuf);
Free(fbuf);
tmph->type=HTT_HELP_FILE|HTF_PUBLIC;
+1 -1
View File
@@ -39,7 +39,7 @@ U0 StartUpTasks()
if (DrvIsWritable(':')) {
DelTree("::/Tmp/ScrnShots");
MkDir("::/Tmp/ScrnShots");
DirMk("::/Tmp/ScrnShots");
}
StartUpTasks;
+3 -3
View File
@@ -1,4 +1,4 @@
$MA,"Cd ",LM="Cd;Dir;\n"$$MA,"DrvC ",LM="Drv('C');\n"$$MA,"DrvD ",LM="Drv('D');\n"$$MA,"/ ",LM="Cd(\"/\");Dir;\n"$$MA,"TOS ",LM="Cd(\"/Home/TOS\");Dir;\n"$$MA,"Home ",LM="Cd(\"/Home\");Dir;\n"$$MA,"ChgDskT ",LM="ChgDsk('T');\n"$$MA,"MergeD ",LM="S2T(\"C:/*\",\"+r+S\");Merge(\"C:/*;!*/LineRep*\",\"D:/*;!*/LineRep*\",\"+r+d\");\n"$$MA,"MergeT ",LM="S2T(\"C:/*\",\"+r+S\");Merge(\"C:/*;!*/LineRep*\",\"T:/*;!*/LineRep*\",\"+r+d\");\n"$$MA,"D:/Wb ",LM="Cd(\"D:/Wb\");Dir;\n"$
$MA,"Cd ",LM="Cd;Dir;\n"$$MA,"DrvC ",LM="Drv('C');\n"$$MA,"DrvD ",LM="Drv('D');\n"$$MA,"/ ",LM="Cd(\"/\");Dir;\n"$$MA,"TOS ",LM="Cd(\"/Home/TOS\");Dir;\n"$$MA,"Home ",LM="Cd(\"/Home\");Dir;\n"$$MA,"ChgDskT ",LM="DskChg('T');\n"$$MA,"MergeD ",LM="S2T(\"C:/*\",\"+r+S\");Merge(\"C:/*;!*/LineRep*\",\"D:/*;!*/LineRep*\",\"+r+d\");\n"$$MA,"MergeT ",LM="S2T(\"C:/*\",\"+r+S\");Merge(\"C:/*;!*/LineRep*\",\"T:/*;!*/LineRep*\",\"+r+d\");\n"$$MA,"D:/Wb ",LM="Cd(\"D:/Wb\");Dir;\n"$
$MA,"MakeC ",LM="TOSBootHDIns('C');\n"$$MA+PU,"BootC ",LM="BootRAM(\"C:/Kernel.BIN.C\");"$$MA,"Regen ",LM="TOSRegen;\n"$$MA,"PreRegen",LM="TOSPreRegen;\n"$$MA,"MakeD ",LM="TOSBootHDIns('D');\n"$$MA+PU,"BootD ",LM="BootRAM(\"D:/Kernel.BIN.C\");"$$MA,"CopyDrv ",LM="TOSPmtAndCopyDrv;\n"$
$MA,"Kernel ",LM="Cd(\"/Kernel\");Dir;\n"$$MA,"Compiler",LM="Cd(\"/Compiler\");Dir;\n"$$MA,"BlkDev ",LM="Cd(\"/Kernel/BlkDev\");Dir;\n"$$MA,"Mem ",LM="Cd(\"/Kernel/Mem\");Dir;\n"$$MA,"Serial ",LM="Cd(\"/Kernel/SerialDev\");Dir;\n"$$MA,"Bin ",LM="Cd(\"/Home/Sup1/Sup1Bin\");Dir;\n"$$MA,"HDAudio ",LM="Cd(\"/Home/Sup1/Sup1HDAudio\");Dir;\n"$$MA,"Examples",LM="Cd(\"/Home/Sup1/Sup1HDAudio/Examples\");Dir;\n"$$MA,"Dist ",LM="Cd(\"/Home/Sup1/Sup1Distro\");Dir;\n"$
$MA,"Adam ",LM="Cd(\"/Adam\");Dir;\n"$$MA,"AutoComp",LM="Cd(\"/Adam/AutoComplete\");Dir;\n"$$MA,"Ctrls ",LM="Cd(\"/Adam/Ctrls\");Dir;\n"$$MA,"ABlkDev ",LM="Cd(\"/Adam/ABlkDev\");Dir;\n"$$MA,"DolDoc ",LM="Cd(\"/Adam/DolDoc\");Dir;\n"$$MA,"Gr ",LM="Cd(\"/Adam/Gr\");Dir;\n"$$MA,"God ",LM="Cd(\"/Adam/God\");Dir;\n"$$MA,"Snd ",LM="Cd(\"/Adam/Snd\");Dir;\n"$$MA,"Boot ",LM="Cd(\"/Adam/Opt/Boot\");Dir;\n"$$MA,"Utils ",LM="Cd(\"/Adam/Opt/Utils\");Dir;\n"$
@@ -9,9 +9,9 @@ $MA,"Apps ",LM="Cd(\"/Apps\");Dir;\n"$$MA,"Budget ",LM="Cd(\"/Apps/Budget\")
$MA,"Titan ",LM="Cd(\"/Apps/Titanium\");Dir;\n"$$MA,"ToTheFrt",LM="Cd(\"/Apps/ToTheFront\");Dir;\n"$$MA,"Vocab ",LM="Cd(\"/Apps/Vocabulary\");Dir;\n"$$MA,"XCaliber",LM="Cd(\"/Apps/X-Caliber\");Dir;\n"$$MA,"Books1 ",LM="Cd(\"/Home/Books1\");Dir;\n"$$MA,"Books2 ",LM="Cd(\"/Home/Books2\");Dir;\n"$$MA,"Hymns ",LM="Cd(\"/Home/Sup1/Sup1Hymns\");Dir;\n"$$MA,"Songs ",LM="Cd(\"/Home/Sup1/Sup1Songs\");Dir;\n"$
$MA,"Demo ",LM="Cd(\"/Demo\");Dir;\n"$$MA,"AcctEmpl",LM="Cd(\"/Demo/AcctExample\");Dir;\n"$$MA,"Asm ",LM="Cd(\"/Demo/Asm\");Dir;\n"$$MA,"DocDoc ",LM="Cd(\"/Demo/DolDoc\");Dir;\n"$$MA,"Dsk ",LM="Cd(\"/Demo/Dsk\");Dir;\n"$$MA,"Games ",LM="Cd(\"/Demo/Games\");Dir;\n"$$MA,"Graphics",LM="Cd(\"/Demo/Graphics\");Dir;\n"$$MA,"InFile ",LM="Cd(\"/Demo/InFile\");Dir;\n"$$MA,"Lectures",LM="Cd(\"/Demo/Lectures\");Dir;\n"$$MA,"MultCore",LM="Cd(\"/Demo/MultiCore\");Dir;\n"$
$MA,"RevFile ",LM="Cd(\"/Demo/RevFileDemo\");Dir;\n"$$MA,"Snd ",LM="Cd(\"/Demo/Snd\");Dir;\n"$$MA,"SortFile",LM="Cd(\"/Demo/SortFileDemo\");Dir;\n"$$MA,"Template",LM="Cd(\"/Demo/Templates\");Dir;\n"$$MA,"HtmlTXT ",LM="Cd(\"/Demo/ToHtmlToTXTDemo\");Dir;\n"$$MA,"WebLog ",LM="Cd(\"/Demo/WebLogDemo\");Dir;\n"$$MA,"Stadium ",LM="Cd(\"/Demo/Games/Stadium\");Dir;\n"$
$MA,"Doc ",LM="Cd(\"/Doc\");Dir;\n"$$MA,"Misc ",LM="Cd(\"/Misc\");Dir;\n"$$MA,"Tour ",LM="Cd(\"/Misc/Tour\");Dir;\n"$$MA,"Tmp ",LM="Cd(\"/Tmp\");Dir;\n"$$MA,"ScrnShot",LM="Cd(\"/Tmp/ScrnShots\");Dir;\n"$$MA,"DelScrSt",LM="Del(\"D:/Tmp/*.SND\");DelTree(\"D:/Tmp/ScrnShots\");MkDir(\"D:/Tmp/ScrnShots\");Del(\"C:/Tmp/*.SND\");DelTree(\"C:/Tmp/ScrnShots\");MkDir(\"C:/Tmp/ScrnShots\");\n"$$MA,"0000Boot",LM="Cd(\"/0000Boot\");Dir;\n"$$MA,"Linux ",LM="Cd(\"/Linux\");Dir;\n"$
$MA,"Doc ",LM="Cd(\"/Doc\");Dir;\n"$$MA,"Misc ",LM="Cd(\"/Misc\");Dir;\n"$$MA,"Tour ",LM="Cd(\"/Misc/Tour\");Dir;\n"$$MA,"Tmp ",LM="Cd(\"/Tmp\");Dir;\n"$$MA,"ScrnShot",LM="Cd(\"/Tmp/ScrnShots\");Dir;\n"$$MA,"DelScrSt",LM="Del(\"D:/Tmp/*.SND\");DelTree(\"D:/Tmp/ScrnShots\");DirMk(\"D:/Tmp/ScrnShots\");Del(\"C:/Tmp/*.SND\");DelTree(\"C:/Tmp/ScrnShots\");DirMk(\"C:/Tmp/ScrnShots\");\n"$$MA,"0000Boot",LM="Cd(\"/0000Boot\");Dir;\n"$$MA,"Linux ",LM="Cd(\"/Linux\");Dir;\n"$
$MA,"LinxDict",LM="Adam(\"GodInit(\\\"~/Sup1/Sup1Words/LinuxDict.TXT**\\\");\");\n"$$MA,"August ",LM="Adam(\"GodInit(\\\"~/Sup1/Sup1Words/AugustWords.TXT**\\\");\");\n"$$MA,"Happy ",LM="Adam(\"GodInit(\\\"~/Sup1/Sup1Words/HappyWords.TXT*\\\");\");\n"$$MA,"Yiddish ",LM="Adam(\"GodInit(\\\"~/Sup1/Sup1Words/Yiddish.TXT*\\\");\");\n"$$MA,"Bible ",LM="Adam(\"GodInit(\\\"~/Sup1/Sup1Words/BibleWords.TXT*\\\");\");\n"$$MA,"Huck ",LM="Adam(\"GodInit(\\\"~/Sup1/Sup1Words/HuckWords.TXT*\\\");\");\n"$$MA,"Ingreds ",LM="Adam(\"GodInit(\\\"~/Sup1/Sup1Words/Ingredients.TXT*\\\");\");\n"$$MA,"Chess ",LM="Adam(\"GodInit(\\\"~/Sup1/Sup1Words/Chess.DD*\\\");\");\n"$$MA,"Words ",LM="Cd(\"/Home/Sup1/Sup1Words\");Dir;\n"$
$MA,"MakeStd ",LM="MakeStdDistro;MkDir(\"D:/Wb\");Move(TOS_ISO_NAME,\"D:/Wb/TempleOSCD.ISO\");\n"$$MA,"MakeStRS",LM="MakeStdRedSeaDistro;MkDir(\"D:/Wb\");Move(TOS_ISO_C_NAME,\"D:/Wb/TempleOSCDRS.ISO\");\n"$$MA,"MakeUlt ",LM="MakeUltraDistro;MkDir(\"D:/Wb\");Move(TOS_ISO_NAME,\"D:/Wb/TempleOSUltra.ISO\");\n"$$MA,"MakeUtRS",LM="MakeUltraRedSeaDistro;MkDir(\"D:/Wb\");Move(TOS_ISO_C_NAME,\"D:/Wb/TempleOSUltraRS.ISO\");\n"$$MA,"MakeStaf",LM="MakeStaffDistro;MkDir(\"D:/Wb\");Move(TOS_ISO_NAME,\"D:/Wb/TempleOSStaff.ISO\");\n"$$MA,"MakeDbg ",LM="MakeDbgDistro;MkDir(\"D:/Wb\");Move(TOS_ISO_NAME,\"D:/Wb/TempleOSDbg.ISO\");\n"$
$MA,"MakeStd ",LM="MakeStdDistro;DirMk(\"D:/Wb\");Move(TOS_ISO_NAME,\"D:/Wb/TempleOSCD.ISO\");\n"$$MA,"MakeStRS",LM="MakeStdRedSeaDistro;DirMk(\"D:/Wb\");Move(TOS_ISO_C_NAME,\"D:/Wb/TempleOSCDRS.ISO\");\n"$$MA,"MakeUlt ",LM="MakeUltraDistro;DirMk(\"D:/Wb\");Move(TOS_ISO_NAME,\"D:/Wb/TempleOSUltra.ISO\");\n"$$MA,"MakeUtRS",LM="MakeUltraRedSeaDistro;DirMk(\"D:/Wb\");Move(TOS_ISO_C_NAME,\"D:/Wb/TempleOSUltraRS.ISO\");\n"$$MA,"MakeStaf",LM="MakeStaffDistro;DirMk(\"D:/Wb\");Move(TOS_ISO_NAME,\"D:/Wb/TempleOSStaff.ISO\");\n"$$MA,"MakeDbg ",LM="MakeDbgDistro;DirMk(\"D:/Wb\");Move(TOS_ISO_NAME,\"D:/Wb/TempleOSDbg.ISO\");\n"$
$MA,"BurnStd ",LM="MakeStdDistro;DVDImageWrite('T',TOS_ISO_NAME);\n"$$MA,"BurnStRS",LM="MakeStdRedSeaDistro;DVDImageWrite('T',TOS_ISO_C_NAME);\n"$$MA,"BurnUlt ",LM="MakeUltraDistro;DVDImageWrite('T',TOS_ISO_NAME);\n"$$MA,"BurnUtRS",LM="MakeUltraRedSeaDistro;DVDImageWrite('T',TOS_ISO_C_NAME);\n"$$MA,"BurnStaf",LM="MakeStaffDistro;DVDImageWrite('T',TOS_ISO_NAME);\n"$$MA,"BurnDbg ",LM="MakeDbgDistro;DVDImageWrite('T',TOS_ISO_NAME);\n"$
+1 -1
View File
@@ -181,7 +181,7 @@ $FG,5$$TX+CX,"Bugs? Not really sure."$$FG$
* 4/13/14 Strut or RawHide crashed when $LK,"sys_var_init_flag",A="MN:sys_var_init_flag"$ was set during testsuite. Perhaps, floodfill?
* $LK,"ChkDsk",A="MN:ChkDsk"$ alloc unalloced. I don't know if I fixed this.
* $LK,"DskChk",A="MN:DskChk"$ alloc unalloced. I don't know if I fixed this.
* 1/?/2015,8/10/2015 Macro sel in Menu did not go to shell? No, I think just <CTRL-m> twice. Not a bug.
+1 -1
View File
@@ -62,7 +62,7 @@ $ID,-2$$TR,"Titanium"$
$ID,2$I64 best_score=16469;
$ID,-2$$TR,"TOSRegen"$
$ID,2$progress1_tf=0.000;progress2_tf=0.000;
progress3_tf=0.000;progress4_tf=193.596;
progress3_tf=0.000;progress4_tf=189.347;
$ID,-2$$ID,-2$$TR,"Once"$
$ID,2$$TR,"Adam"$
$ID,2$$ID,-2$$TR,"User"$
+6 -6
View File
@@ -8,7 +8,7 @@ public U8 *BlogLocalDir(CDate cdt=0)
Date2Struct(&ds,cdt);
StrPrint(dir,BLOG_LOCAL_BASE "/%d%Z",ds.year,ds.mon-1,"ST_MONTHS");
if (!FileFind(dir,,FUF_JUST_DIRS))
MkDir(dir);
DirMk(dir);
return dir;
}
@@ -89,11 +89,11 @@ public U0 BlogScrnShot()
public U0 FreshenBlog()
{//Regen html files for D:/Home/Web.
MkDir("D:/Wb");
MkDir("D:/Wb/Home");
MkDir("D:/Wb/Home/Web");
MkDir("D:/Wb/Home/Web/" INS_REG_PERSONAL_INITIALS);
MkDir("D:/Wb/Home/Web/" INS_REG_PERSONAL_INITIALS "/BlogDir");
DirMk("D:/Wb");
DirMk("D:/Wb/Home");
DirMk("D:/Wb/Home/Web");
DirMk("D:/Wb/Home/Web/" INS_REG_PERSONAL_INITIALS);
DirMk("D:/Wb/Home/Web/" INS_REG_PERSONAL_INITIALS "/BlogDir");
FreshenWebDir("/Home/Web");
FreshenWebDir("/Home/Web/" INS_REG_PERSONAL_INITIALS);
+4 -4
View File
@@ -54,14 +54,14 @@ U0 TOSInit()
#define TOS_ISO_NAME "B:/TempleOSCD.ISO"
#define TOS_ISO_C_NAME "B:/TempleOSCD.ISO.C"
#define TOS_DISTRO_DIR "B:/Distro"
#define CFG_OPTS "StaffMode\nAutoMountIDE\nCT\n"
#define CFG_DBG_OPTS "StaffMode\nAutoMountIDE\nCT"\
#define CFG_OPTS "StaffMode\nMountIDEAuto\nCT\n"
#define CFG_DBG_OPTS "StaffMode\nMountIDEAuto\nCT"\
"HeapInit\n130\nMemInit\n131\nVarInit\n132\n\n"
#define CFG_DBGZ_OPTS "StaffMode\nAutoMountIDE\nCT"\
#define CFG_DBGZ_OPTS "StaffMode\nMountIDEAuto\nCT"\
"HeapInit\n0\nMemInit\n0\nVarInit\n0\n\n"
#define TOS_CFG "\n" CFG_RAM_DRVS CFG_DVD_DRVS CFG_HARD_DRVS "\n"\
CFG_DSK_CACHE CFG_OPTS
#define TOS_DVD_CFG "TB\n0x20000\nT \n\n\nStaffMode\nAutoMountIDE\nCT\n"
#define TOS_DVD_CFG "TB\n0x20000\nT \n\n\nStaffMode\nMountIDEAuto\nCT\n"
#define TOS_DVD_DBG_CFG "A" CFG_DBG_DISTRO\
"B\nScale2Mem(2048,0x40000)\n\n\n"\
"NoMP\nTextMode\nDontProbe\nDbgDistro\n"\
+14 -14
View File
@@ -63,9 +63,9 @@ U0 DistroSongsPrep(U8 threshold='7')
CDoc *doc;
CDocEntry *doc_e;
CDirEntry *tmpde=FilesFind("/Home/Sup1/Sup1Hymns/*.HC*",
FUF_CLUSTER_ORDER),*tmpde1=tmpde;
FUF_CLUS_ORDER),*tmpde1=tmpde;
DelTree("/Apps/Psalmody/Examples");
MkDir("/Apps/Psalmody/Examples");
DirMk("/Apps/Psalmody/Examples");
while (tmpde) {
doc=DocRead(tmpde->full_name);
doc_e=doc->head.next;
@@ -88,8 +88,8 @@ U0 DistroPrep()
DistroSongsPrep;
DelTree("/Tmp");
MkDir("/Tmp");
MkDir("/Tmp/ScrnShots");
DirMk("/Tmp");
DirMk("/Tmp/ScrnShots");
Touch("/PersonalMenu.DD.Z","+T");
Touch("/Home/PersonalMenu.DD.Z","+T");
@@ -130,19 +130,19 @@ U0 DbgDistroFilePrep()
bd=Let2BlkDev('A');
Fmt('A',,FALSE,FSt_REDSEA);
MkDir("A:/Compiler");
DirMk("A:/Compiler");
Copy("C:/Compiler/Compiler.BIN.Z", "A:/Compiler");
Copy("C:/Compiler/OpCodes.DD.Z", "A:/Compiler");
Copy("C:/Compiler/CompilerA.HH.Z", "A:/Compiler");
Copy("C:/Compiler/CompilerB.HH.Z", "A:/Compiler");
MkDir("A:/Kernel");
DirMk("A:/Kernel");
Copy("C:/Kernel/*.HH*", "A:/Kernel");
CopyTree("C:/Kernel/BlkDev", "A:/Kernel/BlkDev");
Copy("C:/Home/Sup1/Sup1Distro/DbgStartOS.HC.Z","A:/StartOS.HC.Z");
MkDir("A:/Adam");
DirMk("A:/Adam");
Copy("C:/Home/Sup1/Sup1Distro/DbgMakeAdam.HC.Z","A:/Adam/MakeAdam.HC.Z");
Copy("C:/Home/Sup1/Sup1Distro/DbgMount.HC.Z","A:/Adam");
Copy("C:/Adam/AExts.HC.Z", "A:/Adam");
@@ -266,7 +266,7 @@ U0 DbgDistroPrep()
DelTree(TOS_DISTRO_DIR);
CopyTree("C:/",TOS_DISTRO_DIR "/");
DelTree(TOS_DISTRO_DIR "/Home");
MkDir(TOS_DISTRO_DIR "/Home");
DirMk(TOS_DISTRO_DIR "/Home");
Del(TOS_DISTRO_DIR "/" KERNEL_BIN_C);
Del(TOS_DISTRO_DIR BOOT_DIR "/OldMBR.BIN.C");
Del(TOS_DISTRO_DIR BOOT_DIR "/BootMHD2.BIN.C");
@@ -292,7 +292,7 @@ U0 StdDistroPrep()
DelTree(TOS_DISTRO_DIR);
CopyTree("C:/",TOS_DISTRO_DIR "/");
DelTree(TOS_DISTRO_DIR "/Home");
MkDir(TOS_DISTRO_DIR "/Home");
DirMk(TOS_DISTRO_DIR "/Home");
Del(TOS_DISTRO_DIR "/" KERNEL_BIN_C);
Del(TOS_DISTRO_DIR BOOT_DIR "/OldMBR.BIN.C");
Del(TOS_DISTRO_DIR BOOT_DIR "/BootMHD2.BIN.C");
@@ -327,7 +327,7 @@ U0 UltraDistroPrep()
Del(TOS_DISTRO_DIR "/Misc/Bible.TXT.Z");
DelTree(TOS_DISTRO_DIR "/Apps");
MkDir(TOS_DISTRO_DIR "/Apps");
DirMk(TOS_DISTRO_DIR "/Apps");
DelTree(TOS_DISTRO_DIR "/Demo");
DelTree(TOS_DISTRO_DIR "/Misc/Tour");
Del(TOS_DISTRO_DIR "/" KERNEL_BIN_C);
@@ -446,11 +446,11 @@ U0 TOSRegen3()
tos_progress_t0=tS;
RegExe("TempleOS/TOSRegen");
TOSProgress("ChkDsk All");
TOSProgress("DskChk All");
AutoComplete;
WinBorder;
WinMax;
ChkAll;
DskChkAll;
TOSProgress("Make LineRep");
MakeLineRepFile;
@@ -548,9 +548,9 @@ U0 TOSRegen3()
TOSProgress("Find /Home");
slash_home=F2("/Home","-i+la");
TOSProgress("ChkDsk All");
TOSProgress("DskChk All");
Drv('C');
ChkAll;
DskChkAll;
TOSProgress("Done");
SettingsPop;
+1 -1
View File
@@ -177,7 +177,7 @@ U0 TOSIns()
public U0 GodCodeJmp()
{//Jump to rand code in OS. See $LK,"::/Adam/God/HSNotes.DD"$.
CDirEntry *tmpde1=FilesFind("/*",
FUF_JUST_FILES|FUF_RECURSE|FUF_JUST_SRC|FUF_CLUSTER_ORDER),
FUF_JUST_FILES|FUF_RECURSE|FUF_JUST_SRC|FUF_CLUS_ORDER),
*tmpde=tmpde1;
I64 cnt=0,num;
CDoc *doc;
+7 -7
View File
@@ -20,7 +20,7 @@ U0 FrameGrabberTask(I64)
st_dir="B:/Tmp/ScrnShots";
else
st_dir="::/Tmp/ScrnShots";
MkDir(st_dir);
DirMk(st_dir);
while (fg_on) {
StrPrint(buf,"%s/VID%05d.BMP.Z",st_dir,frame_num++);
StrCpy(buf2,buf);
@@ -96,11 +96,11 @@ public U0 JukeLines(I64 start_line,I64 end_line)
FrameGrabberToggle;
}
public U0 ChkAll()
{//ChkDsk on C & D.
public U0 DskChkAll()
{//DskChk on C & D.
U8 *ptr=TOS_HDS;
while (*ptr)
ChkDsk(*ptr++);
DskChk(*ptr++);
}
public CDoc *DC2Doc(CDC *dc,I64 dx=0,I64 dy=0,I64 *_total_score=NULL)
@@ -156,11 +156,11 @@ public U0 BMP2Doc(U8 *_in_name,U8 *_out_name=NULL)
I64 dx,dy,score,best_score=I64_MAX;
CDC *dc;
CDoc *doc;
in_name=DftExt(_in_name,"BMP");
in_name=ExtDft(_in_name,"BMP");
if (_out_name)
out_name=DftExt(_out_name,"DD.Z");
out_name=ExtDft(_out_name,"DD.Z");
else
out_name=ChgExt(_in_name,"DD.Z");
out_name=ExtChg(_in_name,"DD.Z");
if (dc=BMPRead(in_name)) {
for (dy=-3;dy<=4;dy++)
for (dx=-3;dx<=4;dx++) {
+8 -8
View File
@@ -88,7 +88,7 @@ U8 *TOSLinkCvt2(U8 *filename,I64 line_num)
//Make your own LinkCvt routine
U8 *res=NULL,*st;
if (filename) {
st=ChgExt(filename,"html");
st=ExtChg(filename,"html");
if (st && StrLen(st)>3 && !StrNCmp(st+1,":/",2))
res=MStrPrint(PERSONAL_WEB "/%s#l%d",st+3,line_num);
Free(st);
@@ -380,11 +380,11 @@ public U0 TOSToHtml(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,"HC.Z");
in_name=ExtDft(_in_name,"HC.Z");
if (_out_name)
out_name=DftExt(_out_name,"html");
out_name=ExtDft(_out_name,"html");
else
out_name=ChgExt(_in_name,"html");
out_name=ExtChg(_in_name,"html");
doc_in=DocRead(in_name);
DocTop(doc_in);
@@ -413,7 +413,7 @@ U0 TOSWebFile(U8 *name,Bool line_nums=FALSE)
"File:%s\n",name;
Collapse(name,FALSE);
Touch(name,"",,de.datetime);
name2=ChgExt(name,"html");
name2=ExtChg(name,"html");
if (StrMatch(BLOG_BASE,name) || StrMatch(DAILY_BASE,name))
line_anchors=FALSE;
@@ -451,7 +451,7 @@ U0 FreshenWebDir(U8 *dirname,Bool line_nums=FALSE)
U8 *src,*dst;
src=MStrPrint("D:/Wb%s",dirname);
MkDir(src);
DirMk(src);
Free(src);
src=MStrPrint("D:/Wb%s/*",dirname);
@@ -465,7 +465,7 @@ U0 FreshenWebDir(U8 *dirname,Bool line_nums=FALSE)
Free(dst);
src=MStrPrint("D:/Wb%s/*",dirname);
tmpde=tmpde1=FilesFind(src,FUF_JUST_FILES|FUF_JUST_TXT|FUF_CLUSTER_ORDER);
tmpde=tmpde1=FilesFind(src,FUF_JUST_FILES|FUF_JUST_TXT|FUF_CLUS_ORDER);
while (tmpde) {
TOSWebFile(tmpde->full_name,line_nums);
tmpde=tmpde->next;
@@ -487,7 +487,7 @@ public U0 FreshenSite()
Touch("D:/Wb/Home/Web/DownloadOS.DD.Z","");
Touch("D:/Wb/Home/Web/TempleOS.DD.Z","");
tmpde=tmpde1=FilesFind("*",
FUF_RECURSE|FUF_JUST_FILES|FUF_JUST_TXT|FUF_CLUSTER_ORDER);
FUF_RECURSE|FUF_JUST_FILES|FUF_JUST_TXT|FUF_CLUS_ORDER);
while (tmpde) {
TOSWebFile(tmpde->full_name);
tmpde=tmpde->next;
+2 -2
View File
@@ -26,7 +26,7 @@ U0 WriteAcct()
MemSet(&a,0,BLK_SIZE);
if (DocForm(&a)) {
f=FOpen(DB_FILENAME,"w+");
FWBlks(f,&a,acctnum*DB_ACCT_BLKS,DB_ACCT_BLKS);
FBlkWrite(f,&a,acctnum*DB_ACCT_BLKS,DB_ACCT_BLKS);
FClose(f);
}
}
@@ -41,7 +41,7 @@ U0 ReadAcct()
acctnum=GetI64("Acct #",-1);
if (0<=acctnum<DB_ACCT_MAX) {
f=FOpen(DB_FILENAME,"r");
FRBlks(f,&a,acctnum*DB_ACCT_BLKS,DB_ACCT_BLKS);
FBlkRead(f,&a,acctnum*DB_ACCT_BLKS,DB_ACCT_BLKS);
FClose(f);
ClassRep(&a);
}
+3 -3
View File
@@ -24,7 +24,7 @@ U0 RawAccess(I64 drv_let=0)
try {
blk=GetI64("Blk to Read: ",old_offset,0,bd->max_blk);
RBlks(dv,buf,blk,1);
BlkRead(dv,buf,blk,1);
D(buf,BLK_SIZE);
} catch
PutExcept;
@@ -37,5 +37,5 @@ U0 RawAccess(I64 drv_let=0)
RawAccess;
//See $LK,"RBlks",A="MN:RBlks"$(), $LK,"WBlks",A="MN:WBlks"$(), $LK,"DrvLock",A="MN:DrvLock"$(), $LK,"DrvUnlock",A="MN:DrvUnlock"$()
//$LK,"DBlk",A="MN:DBlk"$(), $LK,"DCluster",A="MN:DCluster"$(), $LK,"BlkDevLock",A="MN:BlkDevLock"$() and $LK,"BlkDevUnlock",A="MN:BlkDevUnlock"$().
//See $LK,"BlkRead",A="MN:BlkRead"$(), $LK,"BlkWrite",A="MN:BlkWrite"$(), $LK,"DrvLock",A="MN:DrvLock"$(), $LK,"DrvUnlock",A="MN:DrvUnlock"$()
//$LK,"DBlk",A="MN:DBlk"$(), $LK,"DClus",A="MN:DClus"$(), $LK,"BlkDevLock",A="MN:BlkDevLock"$() and $LK,"BlkDevUnlock",A="MN:BlkDevUnlock"$().
+4 -4
View File
@@ -83,7 +83,7 @@ U8 *TOSLinkCvt2(U8 *filename,I64 line_num)
//Make your own LinkCvt routine
U8 *res=NULL,*st;
if (filename) {
st=ChgExt(filename,"html");
st=ExtChg(filename,"html");
if (st && StrLen(st)>3 && !StrNCmp(st+1,":/",2))
res=MStrPrint("http://www.templeos.org/Wb/%s#l%d",st+3,line_num);
Free(st);
@@ -368,11 +368,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,"HC.Z");
in_name=ExtDft(_in_name,"HC.Z");
if (_out_name)
out_name=DftExt(_out_name,"html");
out_name=ExtDft(_out_name,"html");
else
out_name=ChgExt(_in_name,"html");
out_name=ExtChg(_in_name,"html");
doc_in=DocRead(in_name);
doc_out=Doc2Html(doc_in,html_header,body_header,body_footer,html_footer,
+1 -1
View File
@@ -59,7 +59,7 @@ U0 LogScrambleDemo()
{
U8 *dirname;
Cd(__DIR__);
dirname=CurDir;
dirname=DirCur;
ST_WARN_ST "This will scramble all .LOG files in '%s'.\n\n",dirname;
Free(dirname);
if (AreYouSure)
+19 -3
View File
@@ -2,7 +2,23 @@ $WW,1$$FG,5$$TX+CX,"Change Log"$$FG$
Use $LK,"R",A="MN:R"$() to rename if I change a label.
$IV,1$----01/25/17 07:49:39----$IV,0$
$IV,1$----01/25/17 19:55:36----$IV,0$
* $LK,"R",A="MN:R"$("AutoMountIDE","MountIDEAuto");
* $LK,"R",A="MN:R"$("ChgExt","ExtChg");
* $LK,"R",A="MN:R"$("DftExt","ExtDft");
* $LK,"R",A="MN:R"$("CurDir","DirCur");
* $LK,"R",A="MN:R"$("MkDir","DirMk");
* $LK,"R",A="MN:R"$("ChkDsk","DskChk");
* $LK,"R",A="MN:R"$("ChgDsk","DskChg");
* $LK,"R",A="MN:R"$("PrtDsk","DskPrt");
* $LK,"R",A="MN:R"$("RBlks","BlkRead");
* $LK,"R",A="MN:R"$("WBlks","BlkWrite");
* $LK,"R",A="MN:R"$("FRBlks","FBlkRead");
* $LK,"R",A="MN:R"$("FWBlks","FBlkWrite");
* $LK,"R",A="MN:R"$("Cluster","Clus");
* $LK,"R",A="MN:R"$("RClusters","ClusRead");
* $LK,"R",A="MN:R"$("WClusters","ClusWrite");
$IV,1$----01/24/17 21:56:06----$IV,0$
* Improved $LK,"::/Apps/Psalmody/JukeBox.HC"$
@@ -55,7 +71,7 @@ $IV,1$----01/10/17 11:45:41----$IV,0$
* Added $LK,"::/Adam/InsReg.HC"$ with $LK,"InsReg",A="MN:InsReg"$(), $LK,"InsRereg",A="MN:InsRereg"$() and $LK,"InsUnreg",A="MN:InsUnreg"$().
* Added $LK,"::/Adam/Host.HC"$ with $LK,"HostChgDsk",A="MN:HostChgDsk"$().
* Added $LK,"::/Adam/Opt/Utils/TOS.HC"$ with $LK,"TOSStdIns",A="MN:TOSStdIns"$().
* Added cmd line args for partition % to $LK,"PrtDsk",A="MN:PrtDsk"$().
* Added cmd line args for partition % to $LK,"DskPrt",A="MN:DskPrt"$().
$IV,1$----01/09/17 21:48:34----$IV,0$
* $LK,"R",A="MN:R"$("a1","arg1");
@@ -71,7 +87,7 @@ $IV,1$----01/09/17 02:30:59----$IV,0$
* Moved AfterEgypt to the supplemental disk.
$IV,1$----01/06/17 06:07:19----$IV,0$
* Fixed $LK,"ChgDsk",A="MN:ChgDsk"$().
* Fixed $LK,"DskChg",A="MN:DskChg"$().
* Improved $LK,"::/Misc/OSTestSuite.HC"$.
$IV,1$----01/05/17 04:53:21----$IV,0$
+1 -1
View File
@@ -11,7 +11,7 @@ See $LK,"::/Kernel/BlkDev/FileSysRedSea.HC"$ and $LK,"::/Adam/Opt/Boot/DskISORed
$LK,"::/Kernel/BlkDev/FileSysFAT.HC"$ :974 lines for FAT32 gets eliminated.
$LK,"::/Kernel/BlkDev/FileSysISO.HC"$ :233 lines for ISO9660 gets eliminated.
$LK,"::/Adam/Opt/Boot/DskISO9660.HC"$ :507 lines for making ISO files.
$LK,"::/Kernel/BlkDev/DskCluster.HC"$ :152 All the cluster operations become blk.
$LK,"::/Kernel/BlkDev/DskClus.HC"$ :152 All the clus operations become blk.
* Microsoft must cancel SecureBoot because it makes dual booting impossible. TempleOS is an additional operating system that must be used along-side Windows or Linux, not as a replacement. It must dual boot because it has no networking. Real hardware as opposed to VMware is like the difference between looking in a telescope eye piece vs just looking at an off-line image. God said the C64/Apple II generation owned ancestral lands. VMware is like being taken off of our land and moved onto a reservation. In this case, however, it will not stand.
+1 -1
View File
@@ -20,7 +20,7 @@
* ATAPI PIO $FG,2$CD/DVD$FG$ support with $FG,2$ISO9660$FG$ file system. Can make bootable $FG,2$ISO9660$FG$ ISO files so you can roll-your-own distro's.
* $LK,"Partitioning",A="MN:PrtDsk"$ tool, installer, $FG,2$boot loaders$FG$ for CD/DVD and hard disk.
* $LK,"Partitioning",A="MN:DskPrt"$ tool, installer, $FG,2$boot loaders$FG$ for CD/DVD and hard disk.
* $FG,2$Editor/Browser$FG$ for a new $LK,"Document Format",A="FI:::/Doc/DolDocOverview.DD"$. Source files and the command line window can have graphics, links, icons, trees, colors, super/sub scripts, margins. Everything is seamless through-out the tool chain. No need for separate resource files.
Binary file not shown.
+2 -2
View File
@@ -37,7 +37,7 @@ $FG,2$'d'$FG$
$ID,2$Make Dir.
$ID,-2$
$FG,2$'c'$FG$
$ID,2$ChgDsk (Remount removable media). Do not do this on blank disks.
$ID,2$DskChg (Remount removable media). Do not do this on blank disks.
$ID,-2$
$FG,2$'f'$FG$
$ID,2$Format drive.
@@ -59,7 +59,7 @@ $ID,2$Burn CD/DVD ISO file. This burns a CD/DVD using the image file, $FG,2$$TX
$ID,-2$
$FG,5$Instructions on Using CD/DVD's$FG$
$ID,2$If you have not recompiled Kernel and defined your CD/DVD drive, exit the FileMgr and use $LK,"Mount",A="MN:Mount"$ to define your CD/DVD drive. Place a CD/DVD in the drive and press $FG,2$'c'$FG$ when on top of the CD/DVD drive letter to mount the drive. It will call $LK,"ChgDsk",A="MN:ChgDsk"$(), the TempleOS cmd to mount removable media.
$ID,2$If you have not recompiled Kernel and defined your CD/DVD drive, exit the FileMgr and use $LK,"Mount",A="MN:Mount"$ to define your CD/DVD drive. Place a CD/DVD in the drive and press $FG,2$'c'$FG$ when on top of the CD/DVD drive letter to mount the drive. It will call $LK,"DskChg",A="MN:DskChg"$(), the TempleOS cmd to mount removable media.
$ID,-2$
$FG,5$Instructions on Burning CD/DVD's$FG$
+2 -2
View File
@@ -1,7 +1,7 @@
File
{
Rename(,'r');
MkDir(,'d');
DirMk(,'d');
FmtDrv(,'f');
UnmountDrv(,'u');
Abort(,CH_SHIFT_ESC);
@@ -19,7 +19,7 @@ Edit
CDDVD
{
ChgDsk(,'c');
DskChg(,'c');
MountISOC(,'i');
MakeRedSeaISOC(,'m');
MakeISO9660ISO(,'M');
+1 -1
View File
@@ -16,7 +16,7 @@ Flags are either text or int values.
$LK,"FUF_FLATTEN_TREE",A="MN:FUF_FLATTEN_TREE"$ $FG,2$+f$FG$ use with '$FG,2$+F$FG$'. Just use $FG,2$+F$FG$, probably.
$LK,"FUF_JUST_DIRS",A="MN:FUF_JUST_DIRS"$ $FG,2$+D$FG$ just directories
$LK,"FUF_JUST_FILES",A="MN:FUF_JUST_FILES"$ $FG,2$+F$FG$ just files (Flattens trees)
$LK,"FUF_CLUSTER_ORDER",A="MN:FUF_CLUSTER_ORDER"$ $FG,2$+O$FG$ sort by cluster (move head one direction)
$LK,"FUF_CLUS_ORDER",A="MN:FUF_CLUS_ORDER"$ $FG,2$+O$FG$ sort by clus (move head one direction)
$LK,"FUF_JUST_TXT",A="MN:FUF_JUST_TXT"$ $FG,2$+T$FG$ just text files : $LK,"FILEMASK_TXT",A="MN:FILEMASK_TXT"$
$LK,"FUF_JUST_DD",A="MN:FUF_JUST_DD"$ $FG,2$+$$$FG$ just $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.DD"$ files : $LK,"FILEMASK_DD",A="MN:FILEMASK_DD"$
$LK,"FUF_JUST_SRC",A="MN:FUF_JUST_SRC"$ $FG,2$+S$FG$ just src files : $LK,"FILEMASK_SRC",A="MN:FILEMASK_SRC"$
+3 -2
View File
@@ -25,11 +25,12 @@ $FG,2$CB$FG$ Call-Back, Code Block
$FG,2$Cfg$FG$ Config
$FG,2$Chg$FG$ Change
$FG,2$Chk$FG$ Check
$FG,2$Const$FG$ Consant
$FG,2$Cont$FG$ Continue
$FG,2$Clus$FG$ Cluster
$FG,2$Cmd$FG$ Command
$FG,2$Cmp$FG$ Compiler
$FG,2$Cnt$FG$ Count
$FG,2$Const$FG$ Consant
$FG,2$Cont$FG$ Continue
$FG,2$Ctrl$FG$ Control. The ctrl key is indicated with "$FG,2$^$FG$" in documentation.
$FG,2$Cur$FG$ Current
$FG,2$Cvt$FG$ Convert
+1 -1
View File
@@ -14,7 +14,7 @@ Two TempleOS partitions are highly recommended, so you can boot to a back-up and
$ID,2$$LK,"Mount",A="MN:Mount"$() use if the drive is partitioned.
$ID,2$This command mounts a drive making it accessible. For simplicity, sel $FG,2$'C'$FG$ as the first drive letter for your hard drive. The first partition will be $FG,2$'C'$FG$, second, $FG,2$'D'$FG$, etc. TempleOS needs 3 numbers to utilize a hard drive -- base0, base1, and unit. When you enter a hexadecimal number, do it like in $FG,2$C$FG$ with a $FG,2$0x$FG$ prefix. If the probe was successful, you can just enter the number in the probe box instead of base0.
$ID,-2$
$LK,"PrtDsk",A="MN:PrtDsk"$($FG,2$'C'$FG$) use if drive is not partitioned
$LK,"DskPrt",A="MN:DskPrt"$($FG,2$'C'$FG$) use if drive is not partitioned
$ID,2$This will perform a special $LK,"Mount",A="MN:Mount"$() automatically.
+2 -2
View File
@@ -8,9 +8,9 @@ $WW,1$* You run a risk of problems if you do file operations on the same files s
* The syntax highlighting occassionally glitches. The compiler doesn't.
* Call $LK,"ChgDsk",A="MN:ChgDsk"$() when you insert a new removable media.
* Call $LK,"DskChg",A="MN:DskChg"$() when you insert a new removable media.
* Accessing CD/DVD's is flacky. Try $LK,"Drv",A="MN:Drv"$() or $LK,"ChgDsk",A="MN:ChgDsk"$() twice.
* Accessing CD/DVD's is flacky. Try $LK,"Drv",A="MN:Drv"$() or $LK,"DskChg",A="MN:DskChg"$() twice.
* You can only $FG,2$extern$FG$ something once. There is a varient called $FG,2$_extern$FG$ which binds a HolyC definition to a asm sym. This, too, can only be done once.
+3 -3
View File
@@ -1,6 +1,6 @@
$WW,1$$FG,5$$TX+CX,"RedSea File System"$$FG$
The RedSea file system is a simple, 64-bit, file system which is similar to FAT32, but with absolute block addresses instead of clusters, fixed-sized 64-byte directory entries and no FAT table, just an allocation bitmap. A cluster is just one 512 byte sector. Files are stored in contiguous blocks and cannot grow in size.
The RedSea file system is a simple, 64-bit, file system which is similar to FAT32, but with absolute block addresses instead of clus, fixed-sized 64-byte directory entries and no FAT table, just an allocation bitmap. A clus is just one 512 byte sector. Files are stored in contiguous blocks and cannot grow in size.
$HL,1$#define CDIR_FILENAME_LEN 38 //Must include terminator zero
@@ -13,7 +13,7 @@ public class CDirEntry //64-byte fixed-size
{
U16 attr; //See $LK,"RS_ATTR_DIR",A="MN:RS_ATTR_DIR"$. I would like to change these.
U8 name[CDIR_FILENAME_LEN]; //See $LK,"char_bmp_filename",A="MN:char_bmp_filename"$, $LK,"FileNameChk",A="MN:FileNameChk"$
I64 cluster; (blk) //One sector per cluster.
I64 clus; (blk) //One sector per clus.
I64 size; //In bytes
CDate datetime; //See $LK,"DateTime",A="::/Doc/TimeDate.DD"$, $LK,"Implementation of DateTime",A="FI:::/Kernel/KDate.HC"$
};
@@ -24,7 +24,7 @@ public class CRedSeaBoot //RedSea is type FAT32 in partition table to fool BIOS.
U8 signature,reserved[4]; //MBR_PT_REDSEA=0x88. Distinguish from real FAT32.
I64 drv_offset; //For CD/DVD image copy.
I64 sects;
I64 root_cluster; (root_blk)
I64 root_clus; (root_blk)
I64 bitmap_sects;
I64 unique_id;
U8 code[462];
+2 -2
View File
@@ -75,9 +75,9 @@ There are no object files in TempleOS and, normally, you don't make executable f
Tasks have no priority and are never removed from the queue. Instead, they often poll whatever they are waiting on and swap-out. (Swapping tasks takes half a microsecond and does not involve disk activity or memory maps.) See $LK,"Scheduler",A="FL:::/Kernel/Sched.HC,1"$. Polling keeps it simple. It might be a problem if you had lots of tasks busy, which rarely happens on a home computer. The order of the tasks in the queue determines front-to-back window order.
The $FG,2$FAT32$FG$ filesystem is supported to makes exchanging files with a dual booted other operating system easy and there is the simple, 64-bit TempleOS $LK,"RedSea",A="FI:::/Doc/RedSea.DD"$ filesystem. The $LK,"RedSea",A="FI:::/Doc/RedSea.DD"$ has allocation bitmap for clusters and all files are stored contiguously. You can't grow files.
The $FG,2$FAT32$FG$ filesystem is supported to makes exchanging files with a dual booted other operating system easy and there is the simple, 64-bit TempleOS $LK,"RedSea",A="FI:::/Doc/RedSea.DD"$ filesystem. The $LK,"RedSea",A="FI:::/Doc/RedSea.DD"$ has allocation bitmap for clus and all files are stored contiguously. You can't grow files.
TempleOS is geared toward reading and writing whole files. Since whole files are processed, compression is possible. Filenames ending in "$FG,2$.Z$FG$" are automatically compressed or uncompressed when stored and fetched. TempleOS does support direct block random access into files, however -- $LK,"FRBlks",A="MN:FRBlks"$() and $LK,"FWBlks",A="MN:FWBlks"$().
TempleOS is geared toward reading and writing whole files. Since whole files are processed, compression is possible. Filenames ending in "$FG,2$.Z$FG$" are automatically compressed or uncompressed when stored and fetched. TempleOS does support direct block random access into files, however -- $LK,"FBlkRead",A="MN:FBlkRead"$() and $LK,"FBlkWrite",A="MN:FBlkWrite"$().
If a file is not found, "$FG,2$.Z$FG$" is added or removed and a search is done, again. There is no $FG,2$PATH$FG$, but parent directories are searched when a file is not found. This feature is especially useful for default account files.
+1 -1
View File
@@ -463,7 +463,7 @@ Bool ATARBlks(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
U0 ATAWriteBlks(CBlkDev *bd,U8 *buf, I64 blk, I64 cnt)
{//For low level disk access.
//Use WBlks() instead.
//Use BlkWrite() instead.
I64 i,U32s_avail,sects_avail,retries=3;
F64 timeout;
Bool unlock=BlkDevLock(bd);
+2 -2
View File
@@ -260,7 +260,7 @@ CBlkDev *ATAMount(U8 first_drv_let,I64 type,I64 base0,I64 base1,I64 unit)
return NULL;
}
I64 AutoMountIDE()
I64 MountIDEAuto()
{//Try to mount hard drive and CD/DVD, automatically. (Kernel.Cfg option).
//It uses 'C' and 'T' as first drive letters or whatever you set
//in config when compiling Kernel.BIN.
@@ -288,6 +288,6 @@ I64 AutoMountIDE()
tmpha=tmpha->next;
}
LinkedLstDel(head);
blkdev.auto_mount_ide_cnt=res;
blkdev.mount_ide_auto_cnt=res;
return res;
}
+4 -4
View File
@@ -78,7 +78,7 @@ I64 BlkDevAdd(CBlkDev *bd,I64 prt_num=I64_MIN,
break;
}
offset=0;
ext_base=INVALID_CLUSTER;
ext_base=INVALID_CLUS;
while (prt_num<0 || num<=prt_num) {
ATAReadBlks(bd,&mbr,offset,1);
if (mbr.signature!=0xAA55)
@@ -144,7 +144,7 @@ I64 BlkDevAdd(CBlkDev *bd,I64 prt_num=I64_MIN,
break;
if (!mbr.p[j].offset)
break;
if (ext_base==INVALID_CLUSTER) {
if (ext_base==INVALID_CLUS) {
offset=mbr.p[j].offset;
ext_base=offset;
} else
@@ -231,8 +231,8 @@ U0 BlkDevsInitAll()
for (i=0;i<DRVS_NUM;i++)
blkdev.let_to_drv[i]=&blkdev.drvs[i];
#exe {
if (kernel_cfg->opts[CFG_AUTO_MOUNT_IDE])
StreamPrint("AutoMountIDE;");
if (kernel_cfg->opts[CFG_MOUNT_IDE_AUTO])
StreamPrint("MountIDEAuto;");
StreamPrint("#exe {Option(OPTf_WARN_PAREN,OFF);}");
StreamDoc(kernel_cfg->add_dev);
StreamPrint("#exe {Option(OPTf_WARN_PAREN,ON);}");
+6 -6
View File
@@ -1,5 +1,5 @@
#define ZERO_BUF_SIZE 2048
U0 WZeroBlks(CDrv *dv,I64 blk,I64 cnt)
U0 BlkWriteZero(CDrv *dv,I64 blk,I64 cnt)
{//Fill blk cnt with zeros in Drv.
I64 n;
U8 *z=CAlloc(ZERO_BUF_SIZE<<BLK_SIZE_BITS);
@@ -14,7 +14,7 @@ U0 WZeroBlks(CDrv *dv,I64 blk,I64 cnt)
n=cnt;
if (n>ZERO_BUF_SIZE)
n=ZERO_BUF_SIZE;
WBlks(dv,z,blk,n);
BlkWrite(dv,z,blk,n);
blk+=n;
cnt-=n;
if (show_progress)
@@ -28,7 +28,7 @@ U0 WZeroBlks(CDrv *dv,I64 blk,I64 cnt)
}
}
Bool RBlks(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
Bool BlkRead(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
{//Read blk cnt from Drv to buf.
Bool res=TRUE,unlock;
CBlkDev *bd=dv->bd;
@@ -49,7 +49,7 @@ Bool RBlks(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
break;
case BDT_ISO_FILE_READ:
case BDT_ISO_FILE_WRITE:
FRBlks(bd->file_dsk,buf,blk,cnt);
FBlkRead(bd->file_dsk,buf,blk,cnt);
break;
case BDT_ATA:
case BDT_ATAPI:
@@ -68,7 +68,7 @@ Bool RBlks(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
return res;
}
Bool WBlks(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
Bool BlkWrite(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
{//Write blk cnt from buf to Drv.
Bool res=TRUE,unlock;
CBlkDev *bd=dv->bd;
@@ -89,7 +89,7 @@ Bool WBlks(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
break;
case BDT_ISO_FILE_READ:
case BDT_ISO_FILE_WRITE:
FWBlks(bd->file_dsk,buf,blk,cnt);
FBlkWrite(bd->file_dsk,buf,blk,cnt);
break;
case BDT_ATA:
case BDT_ATAPI:
+8 -8
View File
@@ -15,10 +15,10 @@ Bool ISOInit(CDrv *dv,I64 blk)
unlock=DrvLock(dv);
dv->fs_type=FSt_ISO9660;
dv->spc=spc;
dv->data_area=dv->root_cluster=dv->drv_offset=bd->drv_offset=dv->size=0;
dv->data_area=dv->root_clus=dv->drv_offset=bd->drv_offset=dv->size=0;
while (TRUE) {
dv->size=MaxI64(dv->size,(i+1)*spc);
RBlks(dv,iso,i*spc,spc);
BlkRead(dv,iso,i*spc,spc);
buf[0](U32)=iso->id[0](U32);
buf[4](U16)=iso->id[4](U8);
switch (LstMatch(buf,"CD001\0CDW02\0BEA01\0BOOT2\0NSR02\0NSR03\0TEA01\0",
@@ -38,7 +38,7 @@ Bool ISOInit(CDrv *dv,I64 blk)
dv->size-=bd->drv_offset;
RedSeaInit(dv);
} else
dv->root_cluster=de->loc.little;
dv->root_clus=de->loc.little;
res=TRUE;
goto di_done;
case ISO1T_TERMINATOR:
@@ -58,7 +58,7 @@ di_done:
} catch {
dv->fs_type=FSt_ISO9660;
dv->spc=spc;
dv->drv_offset=bd->drv_offset=dv->data_area=dv->root_cluster=0;
dv->drv_offset=bd->drv_offset=dv->data_area=dv->root_clus=0;
Free(iso);
if (unlock)
DrvUnlock(dv);
@@ -71,7 +71,7 @@ U0 DVDImageRead(U8 dvd_drv_let,U8 *out_name)
CDrv *dv=Let2Drv(dvd_drv_let);
CBlkDev *bd=dv->bd;
U8 *buf=MAlloc(COPY_BUF_BLKS<<BLK_SIZE_BITS),
*out_name2=DftExt(out_name,"ISO");
*out_name2=ExtDft(out_name,"ISO");
CFile *f=FOpen(out_name2,"w");
I64 n,spc=bd->blk_size>>BLK_SIZE_BITS,blk=0,cnt,retry;
BlkDevInit(bd);
@@ -97,7 +97,7 @@ U0 DVDImageRead(U8 dvd_drv_let,U8 *out_name)
if (!retry)
ATAPIReadBlks2(bd,0,buf,blk/spc,n/spc,TRUE);
FWBlks(f,buf,blk,n);
FBlkWrite(f,buf,blk,n);
cnt-=n;
blk+=n;
}
@@ -136,7 +136,7 @@ U0 DVDImageWriteTask(CDualBuf *d)
buf=d->buf0;
while (d->in_buf>d->out_buf+1)
Yield;
FRBlks(f,buf,blk,n);
FBlkRead(f,buf,blk,n);
d->in_buf++;
cnt-=n;
blk+=n;
@@ -156,7 +156,7 @@ U0 DVDImageWrite(U8 dvd_drv_let,U8 *in_name=NULL,I64 media_type=MT_DVD)
if (!in_name)
in_name=blkdev.dft_iso_filename;
in_name3=DftExt(in_name,"ISO");
in_name3=ExtDft(in_name,"ISO");
in_name2=FileNameAbs(in_name3);
f=FOpen(in_name2,"r");
if (!f) {
+54 -54
View File
@@ -14,13 +14,13 @@ CFile *FOpen(U8 *filename,U8 *flags,I64 cnt=0)
U8 *full_name;
Bool contiguous=StrOcc(flags,'c');
f->cluster=INVALID_CLUSTER;
f->clus=INVALID_CLUS;
f->fblk_num=0;
if (cnt>0)
f->max_blk=cnt-1;
else
f->max_blk=I64_MAX;
f->file_cluster_num=INVALID_CLUSTER;
f->file_clus_num=INVALID_CLUS;
full_name=FileNameAbs(filename);
f->dv=Let2Drv(*full_name);
if (f->dv->fs_type==FSt_REDSEA)
@@ -31,7 +31,7 @@ CFile *FOpen(U8 *filename,U8 *flags,I64 cnt=0)
!(FileAttr(filename) & RS_ATTR_CONTIGUOUS))
throw('File');
}
f->cluster_buf=CAlloc(f->dv->spc<<BLK_SIZE_BITS);
f->clus_buf=CAlloc(f->dv->spc<<BLK_SIZE_BITS);
if (StrOcc(flags,'w')) {
f->flags=f->flags|FF_WRITE|FF_NEEDS_WRITE;
if (StrOcc(flags,'+')) {
@@ -48,7 +48,7 @@ CFile *FOpen(U8 *filename,U8 *flags,I64 cnt=0)
if (dirc=DirContextNew(full_name)) {
StrCpy(f->de.name,dirc->mask);
if (cnt>0) {//We pre-alloc the whole thing.
f->de.cluster=ClustersAlloc(f->dv,0,
f->de.clus=ClusAlloc(f->dv,0,
(cnt+f->dv->spc-1)/f->dv->spc,contiguous);
f->de.size=cnt<<BLK_SIZE_BITS;
DirNew(dirc->dv,Fs->cur_dir,&f->de,TRUE);
@@ -64,7 +64,7 @@ CFile *FOpen(U8 *filename,U8 *flags,I64 cnt=0)
return f;
}
}
Free(f->cluster_buf);
Free(f->clus_buf);
Free(full_name);
Free(f);
return NULL;
@@ -75,7 +75,7 @@ U0 FClose(CFile *f)
CDirContext *dirc;
if (f) {
if (f->flags & FF_BUF_DIRTY) {
WClusters(f->dv,f->cluster_buf,f->cluster,1);
ClusWrite(f->dv,f->clus_buf,f->clus,1);
f->flags&=~FF_BUF_DIRTY;
}
if (f->flags & FF_NEEDS_WRITE) {
@@ -90,46 +90,46 @@ U0 FClose(CFile *f)
} else
throw('File');
}
Free(f->cluster_buf);
Free(f->clus_buf);
Free(f->de.full_name);
Free(f);
}
}
I64 FSetCluster(CFile *f,I64 c,I64 blk,Bool read)
I64 FSetClus(CFile *f,I64 c,I64 blk,Bool read)
{
CDrv *dv=f->dv;
I64 i;
if (f->cluster!=c) {
if (f->clus!=c) {
if (f->flags & FF_BUF_DIRTY) {
i=dv->spc;
if (f->max_blk!=I64_MAX) {
i=f->max_blk+1-f->file_cluster_num*dv->spc;
i=f->max_blk+1-f->file_clus_num*dv->spc;
if (i>dv->spc)
i=dv->spc;
}
WClustersBlks(dv,f->cluster_buf,f->cluster,i);
ClusBlkWrite(dv,f->clus_buf,f->clus,i);
f->flags=f->flags & ~FF_BUF_DIRTY;
}
f->cluster=c;
f->file_cluster_num=blk/dv->spc;
f->clus=c;
f->file_clus_num=blk/dv->spc;
if (read) {
i=dv->spc;
if (f->max_blk!=I64_MAX) {
i=f->max_blk+1-f->file_cluster_num*dv->spc;
i=f->max_blk+1-f->file_clus_num*dv->spc;
if (i>dv->spc)
i=dv->spc;
}
c=RClustersBlks(dv,f->cluster_buf,c,i);
c=ClusBlkRead(dv,f->clus_buf,c,i);
}
}
return c;
}
Bool FRBlks(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
Bool FBlkRead(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
{//Read [nth,n+cnt) blks of file.
CDrv *dv=f->dv;
I64 spc=dv->spc,i,j,c=f->de.cluster;
I64 spc=dv->spc,i,j,c=f->de.clus;
if (!f || !dv) return FALSE;
if (blk==FFB_NEXT_BLK)
blk=f->fblk_num;
@@ -138,38 +138,38 @@ Bool FRBlks(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
if (cnt<=0) return TRUE;
if (f->flags & FF_CONTIGUOUS) {
RBlks(dv,buf,Cluster2Blk(dv,c)+blk,cnt);
BlkRead(dv,buf,Clus2Blk(dv,c)+blk,cnt);
blk+=cnt;
} else {
i=blk/spc;
if (0<=f->file_cluster_num<=i) {
c=f->cluster;
i-=f->file_cluster_num;
if (0<=f->file_clus_num<=i) {
c=f->clus;
i-=f->file_clus_num;
}
if (i>0)
c=ClusterNumNext(dv,c,i);
c=ClusNumNext(dv,c,i);
if (i=blk%spc) {
c=FSetCluster(f,c,blk,TRUE);
c=FSetClus(f,c,blk,TRUE);
if (cnt<spc-i)
j=cnt;
else
j=spc-i;
MemCpy(buf,f->cluster_buf+i<<BLK_SIZE_BITS,j<<BLK_SIZE_BITS);
MemCpy(buf,f->clus_buf+i<<BLK_SIZE_BITS,j<<BLK_SIZE_BITS);
buf+=j<<BLK_SIZE_BITS;
cnt-=j;
blk+=j;
}
while (cnt>=spc) {
c=FSetCluster(f,c,blk,TRUE);
MemCpy(buf,f->cluster_buf,spc<<BLK_SIZE_BITS);
c=FSetClus(f,c,blk,TRUE);
MemCpy(buf,f->clus_buf,spc<<BLK_SIZE_BITS);
buf+=spc<<BLK_SIZE_BITS;
cnt-=spc;
blk+=spc;
}
if (cnt>0) {
c=FSetCluster(f,c,blk,TRUE);
MemCpy(buf,f->cluster_buf,cnt<<BLK_SIZE_BITS);
c=FSetClus(f,c,blk,TRUE);
MemCpy(buf,f->clus_buf,cnt<<BLK_SIZE_BITS);
buf+=cnt<<BLK_SIZE_BITS;
blk+=cnt;
}
@@ -178,10 +178,10 @@ Bool FRBlks(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
return TRUE;
}
Bool FWBlks(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
Bool FBlkWrite(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
{//Write [nth,n+cnt) blks of file.
CDrv *dv=f->dv;
I64 spc=dv->spc,i,j,c=f->de.cluster,c1;
I64 spc=dv->spc,i,j,c=f->de.clus,c1;
if (!f || !dv) return FALSE;
if (blk==FFB_NEXT_BLK)
blk=f->fblk_num;
@@ -191,68 +191,68 @@ Bool FWBlks(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
return FALSE;
if (cnt<=0) return TRUE;
if (f->flags & FF_CONTIGUOUS) {
WBlks(dv,buf,Cluster2Blk(dv,c)+blk,cnt);
BlkWrite(dv,buf,Clus2Blk(dv,c)+blk,cnt);
blk+=cnt;
} else {
if (!c) {
c=ClustersAlloc(dv,0,1,FALSE);
f->file_cluster_num=0;
f->cluster=c;
f->de.cluster=c;
c=ClusAlloc(dv,0,1,FALSE);
f->file_clus_num=0;
f->clus=c;
f->de.clus=c;
f->flags|=FF_NEEDS_WRITE|FF_NEW_FILE;
}
i=blk/spc;
if (0<=f->file_cluster_num<=i) {
c=f->cluster;
i-=f->file_cluster_num;
if (0<=f->file_clus_num<=i) {
c=f->clus;
i-=f->file_clus_num;
}
while (i>0) {
c1=c;
c=ClusterNumNext(dv,c1,1);
if (c==INVALID_CLUSTER) {
c=ClustersAlloc(dv,c1,i,FALSE);
c=ClusNumNext(dv,c1,1);
if (c==INVALID_CLUS) {
c=ClusAlloc(dv,c1,i,FALSE);
if (i>1)
c=ClusterNumNext(dv,c,i-1);
c=ClusNumNext(dv,c,i-1);
break;
} else
i--;
}
if (i=blk%spc) {
FSetCluster(f,c,blk,TRUE);
FSetClus(f,c,blk,TRUE);
if (cnt<spc-i)
j=cnt;
else
j=spc-i;
MemCpy(f->cluster_buf+BLK_SIZE*i,buf,j<<BLK_SIZE_BITS);
MemCpy(f->clus_buf+BLK_SIZE*i,buf,j<<BLK_SIZE_BITS);
f->flags|=FF_BUF_DIRTY;
buf+=j<<BLK_SIZE_BITS;
cnt-=j;
blk+=j;
if (cnt>0) {
c1=c;
c=ClusterNumNext(dv,c1,1);
if (c==INVALID_CLUSTER)
c=ClustersAlloc(dv,c1,1,FALSE);
c=ClusNumNext(dv,c1,1);
if (c==INVALID_CLUS)
c=ClusAlloc(dv,c1,1,FALSE);
}
}
while (cnt>=spc) {
FSetCluster(f,c,blk,FALSE);
MemCpy(f->cluster_buf,buf,spc<<BLK_SIZE_BITS);
FSetClus(f,c,blk,FALSE);
MemCpy(f->clus_buf,buf,spc<<BLK_SIZE_BITS);
f->flags|=FF_BUF_DIRTY;
buf+=spc<<BLK_SIZE_BITS;
cnt-=spc;
blk+=spc;
if (cnt>0) {
c1=c;
c=ClusterNumNext(dv,c1,1);
if (c==INVALID_CLUSTER)
c=ClustersAlloc(dv,c1,1,FALSE);
c=ClusNumNext(dv,c1,1);
if (c==INVALID_CLUS)
c=ClusAlloc(dv,c1,1,FALSE);
}
}
if (cnt>0) {
FSetCluster(f,c,blk,TRUE);
MemCpy(f->cluster_buf,buf,cnt<<BLK_SIZE_BITS);
FSetClus(f,c,blk,TRUE);
MemCpy(f->clus_buf,buf,cnt<<BLK_SIZE_BITS);
f->flags|=FF_BUF_DIRTY;
buf+=cnt<<BLK_SIZE_BITS;
blk+=cnt;
+151
View File
@@ -0,0 +1,151 @@
I64 ClusNumNext(CDrv *dv,I64 c,I64 cnt=1)
{//Return next cnt'th clus in chain.
Bool unlock;
DrvChk(dv);
if (cnt<=0) return c;
try {
unlock=DrvLock(dv);
switch (dv->fs_type) {
case FSt_ISO9660:
case FSt_REDSEA:
c+=cnt;
break;
case FSt_FAT32:
while (cnt-->0 && 0<c<0x0FFFFFF8) {
DrvFATBlkSet(dv,c);
c=dv->cur_fat_blk[c & (BLK_SIZE/4-1)];
}
if (!(0<c<0x0FFFFFF8))
c=INVALID_CLUS;
break;
default:
throw('Drv');
}
if (unlock)
DrvUnlock(dv);
} catch
if (unlock)
DrvUnlock(dv);
return c;
}
I64 Clus2Blk(CDrv *dv,I64 c)
{//Drv clus num to blk num.
DrvChk(dv);
switch (dv->fs_type) {
case FSt_REDSEA:
return c;
case FSt_ISO9660:
case FSt_FAT32:
return dv->data_area+c*dv->spc;
default:
throw('Drv');
}
}
I64 ClusBlkRead(CDrv *dv,U8 *buf,I64 c,I64 blks)
{//Accepts blk count, so padding on last clus is not read.
I64 i;
Bool unlock;
DrvChk(dv);
if (blks<=0) return c;
try {
unlock=DrvLock(dv);
switch (dv->fs_type) {
case FSt_ISO9660:
BlkRead(dv,buf,dv->data_area+c*dv->spc,blks);
c+=(blks+dv->spc-1)/dv->spc;
break;
case FSt_REDSEA:
BlkRead(dv,buf,c,blks);
c+=blks;
break;
case FSt_FAT32:
while (blks && 0<c<0x0FFFFFF8) {
i=blks;
if (i>dv->spc)
i=dv->spc;
BlkRead(dv,buf,dv->data_area+c*dv->spc,i);
buf+=i<<BLK_SIZE_BITS;
c=ClusNumNext(dv,c,1);
blks-=i;
}
if (blks)
throw('Drv');
break;
default:
throw('Drv');
}
if (unlock)
DrvUnlock(dv);
} catch
if (unlock)
DrvUnlock(dv);
return c;
}
I64 ClusRead(CDrv *dv,U8 *buf,I64 c,I64 cnt)
{//Read clus cnt from drv to buf.
return ClusBlkRead(dv,buf,c,cnt*dv->spc);
}
I64 ClusBlkWrite(CDrv *dv,U8 *buf,I64 c,I64 blks)
{//Accepts blk count, so padding on last clus is not written.
I64 i;
Bool unlock;
DrvChk(dv);
if (blks<=0) return c;
try {
unlock=DrvLock(dv);
switch (dv->fs_type) {
case FSt_REDSEA:
BlkWrite(dv,buf,c,blks);
c=0;
break;
case FSt_FAT32:
while (blks) {
if (!(0<c<0x0FFFFFF8))
throw('Drv');
i=blks;
if (i>dv->spc)
i=dv->spc;
BlkWrite(dv,buf,dv->data_area+c*dv->spc,i);
buf+=i<<BLK_SIZE_BITS;
c=ClusNumNext(dv,c);
blks-=i;
}
break;
default:
throw('Drv');
}
if (unlock)
DrvUnlock(dv);
} catch
if (unlock)
DrvUnlock(dv);
return c;
}
I64 ClusWrite(CDrv *dv,U8 *buf,I64 c,I64 cnt)
{//Write clus cnt from buf to drv.
return ClusBlkWrite(dv,buf,c,cnt*dv->spc);
}
I64 ClusAlloc(CDrv *dv,I64 c=0,I64 cnt=1,Bool contiguous=FALSE)
{//Alloc clus cnt into chain.
//c=0 means first clus in chain
DrvChk(dv);
if (cnt<=0) return c;
switch (dv->fs_type) {
case FSt_REDSEA:
return RedSeaAllocClus(dv,cnt);
case FSt_FAT32:
if (contiguous) {
if (c) throw('File');
return FAT32AllocContiguousClus(dv,cnt);
} else
return FAT32AllocClus(dv,c,cnt);
default:
throw('Drv');
}
}
+2 -2
View File
@@ -57,8 +57,8 @@ Bool CopySingle(U8 *f1,U8 *f2) //Just one file
n=cnt;
i=j;
}
FRBlks(in_file, buf,FFB_NEXT_BLK,n);
FWBlks(out_file,buf,FFB_NEXT_BLK,n);
FBlkRead(in_file, buf,FFB_NEXT_BLK,n);
FBlkWrite(out_file,buf,FFB_NEXT_BLK,n);
cnt-=n;
j-=n<<BLK_SIZE_BITS;
}
+5 -5
View File
@@ -81,13 +81,13 @@ I64 DirEntryCompareName(CDirEntry *e1,CDirEntry *e2)
}
}
I64 DirEntryCompareCluster(CDirEntry *e1,CDirEntry *e2)
I64 DirEntryCompareClus(CDirEntry *e1,CDirEntry *e2)
{
return e1->cluster-e2->cluster;
return e1->clus-e2->clus;
}
#define SK_NAME 0
#define SK_CLUSTER 1
#define SK_CLUS 1
U0 DirFilesSort(CDirEntry **_tmpde,I64 key)
{
@@ -107,8 +107,8 @@ U0 DirFilesSort(CDirEntry **_tmpde,I64 key)
case SK_NAME:
QSortI64(sort_buf,cnt,&DirEntryCompareName);
break;
case SK_CLUSTER:
QSortI64(sort_buf,cnt,&DirEntryCompareCluster);
case SK_CLUS:
QSortI64(sort_buf,cnt,&DirEntryCompareClus);
break;
}
tmpde=sort_buf[0];
+12 -12
View File
@@ -8,7 +8,7 @@ U0 HomeSet(U8 *dirname)
Bool Cd(U8 *dirname=NULL,Bool make_dirs=FALSE)
{//Change directory. Optionally, make directories, too.
I64 maxlen,cur_dir_cluster=0;
I64 maxlen,cur_dir_clus=0;
U8 *chg_to_buf,*new_cur_dir,*buf;
CDrv *dv;
Bool res=TRUE;
@@ -52,16 +52,16 @@ Bool Cd(U8 *dirname=NULL,Bool make_dirs=FALSE)
return FALSE;
} else if (StrCmp(buf,".") && *buf) {
dv=Fs->cur_dv;
cur_dir_cluster=Name2DirCluster(dv,new_cur_dir);
cur_dir_clus=Name2DirClus(dv,new_cur_dir);
switch (dv->fs_type) {
case FSt_REDSEA:
res=RedSeaCd(buf,cur_dir_cluster);
res=RedSeaCd(buf,cur_dir_clus);
break;
case FSt_FAT32:
res=FAT32Cd(buf,cur_dir_cluster);
res=FAT32Cd(buf,cur_dir_clus);
break;
case FSt_ISO9660:
res=ISO1Cd(buf,cur_dir_cluster);
res=ISO1Cd(buf,cur_dir_clus);
break;
default:
PrintErr("File System Not Supported\n");
@@ -70,7 +70,7 @@ Bool Cd(U8 *dirname=NULL,Bool make_dirs=FALSE)
if (!res && make_dirs) {
Free(Fs->cur_dir);
Fs->cur_dir=StrNew(new_cur_dir);
res=MkDir(buf);
res=DirMk(buf);
}
if (res) {
if (StrCmp(new_cur_dir,"/"))
@@ -109,7 +109,7 @@ I64 Dir(U8 *files_find_mask,Bool full)
CDateStruct ds;
I64 csize=0xFFFF,c=0xFFFF,res=0;
tmpde1=FilesFind(files_find_mask);
if (!(st=CurDir))
if (!(st=DirCur))
PrintErr("Invalid Drive\n");
else {
if (tmpde1) {
@@ -123,8 +123,8 @@ I64 Dir(U8 *files_find_mask,Bool full)
while (tmpde2) {
if (tmpde2->size>csize)
csize=tmpde2->size;
if (tmpde2->cluster>c)
c=tmpde2->cluster;
if (tmpde2->clus>c)
c=tmpde2->clus;
tmpde2=tmpde2->next;
}
csize=Bsr(csize)/4+1;
@@ -133,7 +133,7 @@ I64 Dir(U8 *files_find_mask,Bool full)
"$$MA,T=\"Directory\",LM=\"PopUpCd;Dir;\n\"$$ of %s\n",st;
if (full)
"__DATE__ __TIME__ %*ts %*ts\n",
csize,"SIZE",c,"CLUSTER";
csize,"SIZE",c,"CLUS";
else
"DATE_ TIME_ %*ts\n",csize,"SIZE";
while (tmpde1) {
@@ -141,7 +141,7 @@ I64 Dir(U8 *files_find_mask,Bool full)
res++;
if (full)
"%D %T %0*tX %0*tX ",tmpde1->datetime,tmpde1->datetime,
csize,tmpde1->size,c,tmpde1->cluster;
csize,tmpde1->size,c,tmpde1->clus;
else {
Date2Struct(&ds,tmpde1->datetime+local_time_offset);
"%02d/%02d %02d:%02d %0*tX ",ds.mon,ds.day_of_mon,ds.hour,ds.min,
@@ -162,7 +162,7 @@ I64 Dir(U8 *files_find_mask,Bool full)
return res;
}
Bool MkDir(U8 *filename,I64 entry_cnt=0)
Bool DirMk(U8 *filename,I64 entry_cnt=0)
{//Make directory. $LK,"Cd",A="MN:Cd"$() can also make directories.
//entry_cnt is for preallocating dir blks, leave it zero if you like.
U8 *name;
+10 -10
View File
@@ -93,7 +93,7 @@ U0 DrvFATBlkAlloc(CDrv *dv)
dv->cur_fat_blk=AMAlloc(BLK_SIZE);
dv->cur_fat_blk_num=0;
dv->fat_blk_dirty=0;
RBlks(dv,dv->cur_fat_blk,dv->fat1,1);
BlkRead(dv,dv->cur_fat_blk,dv->fat1,1);
}
U0 DrvFATBlkClean(CDrv *dv,I64 fat_sel=3)
@@ -101,13 +101,13 @@ U0 DrvFATBlkClean(CDrv *dv,I64 fat_sel=3)
if ((dv->fs_type==FSt_FAT32 || dv->fs_type==FSt_REDSEA) &&
Bt(&dv->fat_blk_dirty,0)) {
if (dv->fat1==dv->fat2) {
WBlks(dv,dv->cur_fat_blk,dv->fat1+dv->cur_fat_blk_num,1);
BlkWrite(dv,dv->cur_fat_blk,dv->fat1+dv->cur_fat_blk_num,1);
LBtr(&dv->fat_blk_dirty,0);
} else {
if (fat_sel==3 || !fat_sel)
WBlks(dv,dv->cur_fat_blk,dv->fat1+dv->cur_fat_blk_num,1);
BlkWrite(dv,dv->cur_fat_blk,dv->fat1+dv->cur_fat_blk_num,1);
if (fat_sel==3 || fat_sel==1) {
WBlks(dv,dv->cur_fat_blk,dv->fat2+dv->cur_fat_blk_num,1);
BlkWrite(dv,dv->cur_fat_blk,dv->fat2+dv->cur_fat_blk_num,1);
LBtr(&dv->fat_blk_dirty,0);
}
}
@@ -117,7 +117,7 @@ U0 DrvFATBlkClean(CDrv *dv,I64 fat_sel=3)
U0 DrvFATBlkSet(CDrv *dv,I64 c,I64 fat_sel=3)
{
I64 fat_blk_num;
if (c==INVALID_CLUSTER)
if (c==INVALID_CLUS)
throw('Drv');
switch (dv->fs_type) {
case FSt_FAT32:
@@ -133,9 +133,9 @@ U0 DrvFATBlkSet(CDrv *dv,I64 c,I64 fat_sel=3)
DrvFATBlkClean(dv,fat_sel);
dv->cur_fat_blk_num=fat_blk_num;
if (fat_sel==3 || !fat_sel)
RBlks(dv,dv->cur_fat_blk,dv->fat1+dv->cur_fat_blk_num,1);
BlkRead(dv,dv->cur_fat_blk,dv->fat1+dv->cur_fat_blk_num,1);
else
RBlks(dv,dv->cur_fat_blk,dv->fat2+dv->cur_fat_blk_num,1);
BlkRead(dv,dv->cur_fat_blk,dv->fat2+dv->cur_fat_blk_num,1);
}
}
@@ -216,7 +216,7 @@ CBlkDev *DrvIsWritable(U8 drv_let=0,Bool except=FALSE)
}
U0 DskCacheInvalidate(CDrv *dv)
{//Needed for removable media. Called by $LK,"ChgDsk",A="MN:ChgDsk"$().
{//Needed for removable media. Called by $LK,"DskChg",A="MN:DskChg"$().
Bool unlock;
CBlkDev *bd=dv->bd;
DrvChk(dv);
@@ -234,7 +234,7 @@ U0 DskCacheInvalidate(CDrv *dv)
DrvUnlock(dv);
}
U0 ChgDsk(U8 drv_let=0)
U0 DskChg(U8 drv_let=0)
{//Change disk. (Needed for removable media.)
CDrv *dv=Let2Drv(drv_let);
CBlkDev *bd=dv->bd;
@@ -267,7 +267,7 @@ Bool Drv(U8 drv_let)
bd=BlkDevChk(dv->bd);
if (dv!=Fs->cur_dv) {
if (bd->flags & BDF_REMOVABLE && !(bd->flags & BDF_INITIALIZED))
ChgDsk(Drv2Let(dv));
DskChg(Drv2Let(dv));
if (bd->type==BDT_RAM ||
bd->type==BDT_ISO_FILE_READ || bd->type==BDT_ISO_FILE_WRITE)
BlkDevInit(bd);
+12 -12
View File
@@ -21,8 +21,8 @@ CDirEntry *FilesFind2(U8 *files_find_mask,I64 fuf_flags)
DirFilesSort(&res,SK_NAME);
if (fuf_flags&(FUF_FLATTEN_TREE|FUF_JUST_FILES))
DirFilesFlatten(res,&res,fuf_flags);
if (fuf_flags&FUF_CLUSTER_ORDER)
DirFilesSort(&res,SK_CLUSTER);
if (fuf_flags&FUF_CLUS_ORDER)
DirFilesSort(&res,SK_CLUS);
}
return res;
}
@@ -57,7 +57,7 @@ $LK,"DirTreeDel",A="MN:DirTreeDel"$() or $LK,"DirTreeDel2",A="MN:DirTreeDel2"$()
Bool FileFind(U8 *filename,CDirEntry *_de=NULL,I64 fuf_flags=0)
{//$LK,"FUF_JUST_DIRS",A="MN:FUF_JUST_DIRS"$, $LK,"FUF_JUST_FILES",A="MN:FUF_JUST_FILES"$, $LK,"FUF_Z_OR_NOT_Z",A="MN:FUF_Z_OR_NOT_Z"$, $LK,"FUF_SCAN_PARENTS",A="MN:FUF_SCAN_PARENTS"$
//If you pass _de, you must Free(_de->full_name);
I64 i,j,cur_dir_cluster;
I64 i,j,cur_dir_clus;
U8 *altname,*curname,*full_name=NULL;
CDirEntry de;
CDirContext *dirc;
@@ -81,18 +81,18 @@ Bool FileFind(U8 *filename,CDirEntry *_de=NULL,I64 fuf_flags=0)
Silent(old_silent);
else {
Silent(old_silent);
cur_dir_cluster=Name2DirCluster(dirc->dv,Fs->cur_dir);
cur_dir_clus=Name2DirClus(dirc->dv,Fs->cur_dir);
switch (dirc->dv->fs_type) {
case FSt_REDSEA:
res=RedSeaFileFind(dirc->dv,cur_dir_cluster,dirc->mask,
res=RedSeaFileFind(dirc->dv,cur_dir_clus,dirc->mask,
&de,fuf_flags);
break;
case FSt_FAT32:
res=FAT32FileFind(dirc->dv,cur_dir_cluster,dirc->mask,
res=FAT32FileFind(dirc->dv,cur_dir_clus,dirc->mask,
&de,fuf_flags);
break;
case FSt_ISO9660:
res=ISO1FileFind(dirc->dv,cur_dir_cluster,dirc->mask,
res=ISO1FileFind(dirc->dv,cur_dir_clus,dirc->mask,
&de,fuf_flags);
break;
default:
@@ -118,21 +118,21 @@ Bool FileFind(U8 *filename,CDirEntry *_de=NULL,I64 fuf_flags=0)
Silent(old_silent);
else {
Silent(old_silent);
cur_dir_cluster=Name2DirCluster(dirc->dv,Fs->cur_dir);
cur_dir_clus=Name2DirClus(dirc->dv,Fs->cur_dir);
while (!res && StrCmp(Fs->cur_dir,"/")) {
Cd("..");
cur_dir_cluster=Name2DirCluster(dirc->dv,Fs->cur_dir);
cur_dir_clus=Name2DirClus(dirc->dv,Fs->cur_dir);
switch (dirc->dv->fs_type) {
case FSt_REDSEA:
res=RedSeaFileFind(dirc->dv,cur_dir_cluster,
res=RedSeaFileFind(dirc->dv,cur_dir_clus,
dirc->mask,&de,fuf_flags);
break;
case FSt_FAT32:
res=FAT32FileFind(dirc->dv,cur_dir_cluster,
res=FAT32FileFind(dirc->dv,cur_dir_clus,
dirc->mask,&de,fuf_flags);
break;
case FSt_ISO9660:
res=ISO1FileFind(dirc->dv,cur_dir_cluster,
res=ISO1FileFind(dirc->dv,cur_dir_clus,
dirc->mask,&de,fuf_flags);
break;
default:
+2 -2
View File
@@ -9,7 +9,7 @@ Bool DrvTypeSet(U8 drv_let,I64 type=FSt_REDSEA)
switch (bd->type) {
case BDT_ATA:
offset=0;
ext_base=INVALID_CLUSTER;
ext_base=INVALID_CLUS;
while (TRUE) {
ATAReadBlks(bd,&mbr,offset,1);
j=-1;
@@ -42,7 +42,7 @@ Bool DrvTypeSet(U8 drv_let,I64 type=FSt_REDSEA)
break;
if (!mbr.p[j].offset)
break;
if (ext_base==INVALID_CLUSTER) {
if (ext_base==INVALID_CLUS) {
offset=mbr.p[j].offset;
ext_base=offset;
} else
+3 -3
View File
@@ -200,7 +200,7 @@ U8 *FileNameAbs(U8 *_filename,I64 fuf_flags=0)
return res;
}
U8 *ChgExt(U8 *filename,U8 *extension)
U8 *ExtChg(U8 *filename,U8 *extension)
{//Change filename extension.
U8 *res=MAlloc(StrLen(filename)+1+StrLen(extension)+1);
StrCpy(res,filename);
@@ -209,7 +209,7 @@ U8 *ChgExt(U8 *filename,U8 *extension)
return CatPrint(res,".%s",extension);
}
U8 *DftExt(U8 *filename,U8 *extension)
U8 *ExtDft(U8 *filename,U8 *extension)
{//Give extension if has none.
U8 *res=MAlloc(StrLen(filename)+1+StrLen(extension)+1);
StrCpy(res,filename);
@@ -278,7 +278,7 @@ U8 *FileNameTmpTxt()
return MStrPrint("~/SysTmp%X.DD.Z",GetTSC>>8&0xFFFFFFFF);
}
U8 *CurDir(CTask *task=NULL,CTask *mem_task=NULL)
U8 *DirCur(CTask *task=NULL,CTask *mem_task=NULL)
{//MAlloc copy of cur dir with drv letter.
U8 *st;
if (!task) task=Fs;
+19 -19
View File
@@ -7,39 +7,39 @@ Bool CFileNameTo(U8 *dst,U8 *src)
return TRUE;
}
I64 Name2DirCluster(CDrv *dv,U8 *dirname)
I64 Name2DirClus(CDrv *dv,U8 *dirname)
{
Bool cont=TRUE,unlock;
I64 cur_dir_cluster;
I64 cur_dir_clus;
CDirEntry de;
U8 *buf=StrNew(dirname),*buf2=StrNew(dirname);
DrvChk(dv);
try {
unlock=DrvLock(dv);
cur_dir_cluster=dv->root_cluster;
cur_dir_clus=dv->root_clus;
while (*buf && cont) {
StrFirstRem(buf,"/",buf2);
if (*buf2) {
switch (dv->fs_type) {
case FSt_REDSEA:
cont=RedSeaFileFind(dv,cur_dir_cluster,buf2,&de,FUF_JUST_DIRS);
cont=RedSeaFileFind(dv,cur_dir_clus,buf2,&de,FUF_JUST_DIRS);
break;
case FSt_FAT32:
cont=FAT32FileFind(dv,cur_dir_cluster,buf2,&de,FUF_JUST_DIRS);
cont=FAT32FileFind(dv,cur_dir_clus,buf2,&de,FUF_JUST_DIRS);
break;
case FSt_ISO9660:
cont=ISO1FileFind(dv,cur_dir_cluster,buf2,&de,FUF_JUST_DIRS);
cont=ISO1FileFind(dv,cur_dir_clus,buf2,&de,FUF_JUST_DIRS);
break;
default:
throw('Drv');
}
cur_dir_cluster=de.cluster;
cur_dir_clus=de.clus;
}
}
if (!cont) {
"%s ",dirname;
PrintErr("File not found.\n");
cur_dir_cluster=0;
cur_dir_clus=0;
}
if (unlock)
DrvUnlock(dv);
@@ -48,43 +48,43 @@ I64 Name2DirCluster(CDrv *dv,U8 *dirname)
DrvUnlock(dv);
Free(buf);
Free(buf2);
return cur_dir_cluster;
return cur_dir_clus;
}
I64 Name2ParentDirCluster(CDrv *dv,U8 *dirname)
I64 Name2ParentDirClus(CDrv *dv,U8 *dirname)
{
Bool cont=TRUE,unlock;
I64 cur_dir_cluster,cur_dir_cluster2;
I64 cur_dir_clus,cur_dir_clus2;
CDirEntry de;
U8 *buf=StrNew(dirname),*buf2=StrNew(dirname);
DrvChk(dv);
try {
unlock=DrvLock(dv);
cur_dir_cluster=cur_dir_cluster2=dv->root_cluster;
cur_dir_clus=cur_dir_clus2=dv->root_clus;
while (*buf && cont) {
cur_dir_cluster2=cur_dir_cluster;
cur_dir_clus2=cur_dir_clus;
StrFirstRem(buf,"/",buf2);
if (*buf2) {
switch (dv->fs_type) {
case FSt_REDSEA:
cont=RedSeaFileFind(dv,cur_dir_cluster,buf2,&de,FUF_JUST_DIRS);
cont=RedSeaFileFind(dv,cur_dir_clus,buf2,&de,FUF_JUST_DIRS);
break;
case FSt_FAT32:
cont=FAT32FileFind(dv,cur_dir_cluster,buf2,&de,FUF_JUST_DIRS);
cont=FAT32FileFind(dv,cur_dir_clus,buf2,&de,FUF_JUST_DIRS);
break;
case FSt_ISO9660:
cont=ISO1FileFind(dv,cur_dir_cluster,buf2,&de,FUF_JUST_DIRS);
cont=ISO1FileFind(dv,cur_dir_clus,buf2,&de,FUF_JUST_DIRS);
break;
default:
throw('Drv');
}
cur_dir_cluster=de.cluster;
cur_dir_clus=de.clus;
}
}
if (!cont) {
"%s ",dirname;
PrintErr("File not found.\n");
cur_dir_cluster2=0;
cur_dir_clus2=0;
}
if (unlock)
DrvUnlock(dv);
@@ -93,5 +93,5 @@ I64 Name2ParentDirCluster(CDrv *dv,U8 *dirname)
DrvUnlock(dv);
Free(buf);
Free(buf2);
return cur_dir_cluster2;
return cur_dir_clus2;
}
+121 -121
View File
@@ -26,18 +26,18 @@ U0 FAT32Init(CDrv *dv)
try {
unlock=DrvLock(dv);
dv->fs_type=FSt_FAT32;
RBlks(dv,&br32,dv->drv_offset,1);
BlkRead(dv,&br32,dv->drv_offset,1);
dv->file_system_info_sect=dv->drv_offset+br32.file_system_info_sect;
dv->fat1=dv->drv_offset+br32.reserved_sects;
dv->fat2=dv->fat1+br32.sects_per_fat;
dv->data_area=dv->fat2+br32.sects_per_fat
-2*br32.sects_per_cluster; //Starts at Cluster 2
dv->spc=br32.sects_per_cluster;
dv->root_cluster=br32.root_cluster;
-2*br32.sects_per_clus; //Starts at Clus 2
dv->spc=br32.sects_per_clus;
dv->root_clus=br32.root_clus;
DrvFATBlkAlloc(dv);
Free(dv->fis);
dv->fis=AMAlloc(BLK_SIZE);
RBlks(dv,dv->fis,dv->file_system_info_sect,1);
BlkRead(dv,dv->fis,dv->file_system_info_sect,1);
if (unlock)
DrvUnlock(dv);
} catch
@@ -61,27 +61,27 @@ U0 FAT32Fmt(U8 drv_let,Bool quick=TRUE)
br->oem_name[0](I64)='MSWIN4.1';
br->bytes_per_sect=BLK_SIZE;
if (dv->size<= 500000)
br->sects_per_cluster=1;
br->sects_per_clus=1;
else if (dv->size<=2000000)
br->sects_per_cluster=2;
br->sects_per_clus=2;
else if (dv->size<=6000000)
br->sects_per_cluster=4;
br->sects_per_clus=4;
else if (dv->size<=12000000)
br->sects_per_cluster=8;
br->sects_per_clus=8;
else if (dv->size<=33000000)
br->sects_per_cluster=16;
br->sects_per_clus=16;
else if (dv->size<=67000000)
br->sects_per_cluster=32;
br->sects_per_clus=32;
else
br->sects_per_cluster=64;
br->sects_per_clus=64;
br->reserved_sects=32;
br->copies_of_fat=2;
br->media_desc=0xF8;
br->sects=dv->size;
l=(br->sects/br->sects_per_cluster)>>(BLK_SIZE_BITS-2)+1;
l=(br->sects/br->sects_per_clus)>>(BLK_SIZE_BITS-2)+1;
br->sects_per_fat=l;
br->root_cluster=2;
br->root_clus=2;
br->file_system_info_sect=1;
br->log_drv_num=0x80;
br->ext_signature=0x29;
@@ -91,22 +91,22 @@ U0 FAT32Fmt(U8 drv_let,Bool quick=TRUE)
br->signature=0xAA55;
fis->signature1='RRaA';
fis->signature2='rrAa';
fis->free_clusters=-1;
fis->free_clus=-1;
fis->most_recently_alloced=0;
fis->signature3=0xAA550000;
if (quick)
i=br->reserved_sects+2*l+4*br->sects_per_cluster;
i=br->reserved_sects+2*l+4*br->sects_per_clus;
else
i=dv->size;
WZeroBlks(dv,dv->drv_offset,i);
BlkWriteZero(dv,dv->drv_offset,i);
WBlks(dv,fis,dv->drv_offset+br->file_system_info_sect,1);
WBlks(dv,br,dv->drv_offset,1);
BlkWrite(dv,fis,dv->drv_offset+br->file_system_info_sect,1);
BlkWrite(dv,br,dv->drv_offset,1);
FAT32Init(dv);
ClustersAlloc(dv,0,1,FALSE); //Alloc #1
br->root_cluster=ClustersAlloc(dv,0,1,FALSE);
WBlks(dv,br,dv->drv_offset,1);
ClusAlloc(dv,0,1,FALSE); //Alloc #1
br->root_clus=ClusAlloc(dv,0,1,FALSE);
BlkWrite(dv,br,dv->drv_offset,1);
FAT32Init(dv);
DrvUnlock(dv);
} catch
@@ -219,7 +219,7 @@ Bool FAT32CDirFill(CDirEntry *tmpde,
res=TRUE;
else
res=FATFromName(tmpde->name,de->name);
tmpde->cluster=de->cluster_lo+de->cluster_hi<<16;
tmpde->clus=de->clus_lo+de->clus_hi<<16;
tmpde->size=de->size;
tmpde->attr=de->attr;
tmpde->datetime=Dos2CDate(de->WrtTime,de->WrtDate)-_local_time_offset;
@@ -269,8 +269,8 @@ Bool FAT32DirFill(CFAT32DirEntry *de,
MemSet(&de[de_cnt],0,sizeof(CFAT32DirEntry));
res=FATNameTo(de[de_cnt].name,tmpde->name);
}
de[de_cnt].cluster_lo=tmpde->cluster.u16[0];
de[de_cnt].cluster_hi=tmpde->cluster.u16[1];
de[de_cnt].clus_lo=tmpde->clus.u16[0];
de[de_cnt].clus_hi=tmpde->clus.u16[1];
if (!(tmpde->attr&RS_ATTR_DIR))
de[de_cnt].size=tmpde->size;
de[de_cnt].attr=tmpde->attr;
@@ -283,12 +283,12 @@ Bool FAT32DirFill(CFAT32DirEntry *de,
return res;
}
Bool FAT32FileFind(CDrv *dv,I64 cur_dir_cluster,
Bool FAT32FileFind(CDrv *dv,I64 cur_dir_clus,
U8 *name,CDirEntry *_res,I64 fuf_flags=0)
{//$LK,"FUF_JUST_DIRS",A="MN:FUF_JUST_DIRS"$, $LK,"FUF_JUST_FILES",A="MN:FUF_JUST_FILES"$
Bool res=FALSE,unlock;
CFAT32DirEntry *buf;
I64 xsum=0,attr,cur_dir_entry,entries_per_cluster;
I64 xsum=0,attr,cur_dir_entry,entries_per_clus;
U8 dname[CDIR_FILENAME_LEN],ch;
CDirEntry long_name;
if (fuf_flags&~FUG_FILE_FIND)
@@ -304,8 +304,8 @@ Bool FAT32FileFind(CDrv *dv,I64 cur_dir_cluster,
try {
unlock=DrvLock(dv);
buf=MAlloc(BLK_SIZE*dv->spc);
entries_per_cluster=dv->spc<<FAT32_ENTRIES_BITS;
RClusters(dv,buf,cur_dir_cluster,1);
entries_per_clus=dv->spc<<FAT32_ENTRIES_BITS;
ClusRead(dv,buf,cur_dir_clus,1);
cur_dir_entry=0;
while (ch=*buf[cur_dir_entry].name) {
attr=buf[cur_dir_entry].attr;
@@ -331,12 +331,12 @@ Bool FAT32FileFind(CDrv *dv,I64 cur_dir_cluster,
}
} else
MemSet(&long_name,0,sizeof(CDirEntry));
if (++cur_dir_entry==entries_per_cluster) {
cur_dir_cluster=ClusterNumNext(dv,cur_dir_cluster);
if (!(0<cur_dir_cluster<0x0FFFFFF8))
if (++cur_dir_entry==entries_per_clus) {
cur_dir_clus=ClusNumNext(dv,cur_dir_clus);
if (!(0<cur_dir_clus<0x0FFFFFF8))
break;
else {
RClusters(dv,buf,cur_dir_cluster,1);
ClusRead(dv,buf,cur_dir_clus,1);
cur_dir_entry=0;
}
}
@@ -356,7 +356,7 @@ U8 *FAT32FileRead(CDrv *dv,U8 *cur_dir,U8 *filename,I64 *_size,I64 *_attr)
{
U8 *buf=NULL;
CDirEntry de;
I64 c,blk_cnt,cur_dir_cluster;
I64 c,blk_cnt,cur_dir_clus;
DrvChk(dv);
*_size=0;
*_attr=0;
@@ -365,15 +365,15 @@ U8 *FAT32FileRead(CDrv *dv,U8 *cur_dir,U8 *filename,I64 *_size,I64 *_attr)
else
try {
DrvLock(dv);
cur_dir_cluster=Name2DirCluster(dv,cur_dir);
if (FAT32FileFind(dv,cur_dir_cluster,filename,&de,FUF_JUST_FILES)) {
cur_dir_clus=Name2DirClus(dv,cur_dir);
if (FAT32FileFind(dv,cur_dir_clus,filename,&de,FUF_JUST_FILES)) {
blk_cnt=(de.size+BLK_SIZE-1)>>BLK_SIZE_BITS;
buf=MAlloc(blk_cnt<<BLK_SIZE_BITS+1);
c=de.cluster;
c=de.clus;
if (!(0<c<0x0FFFFFF8))
c=0x0FFFFFFF;
else
c=RClustersBlks(dv,buf,c,blk_cnt);
c=ClusBlkRead(dv,buf,c,blk_cnt);
buf[de.size]=0; //Terminate
*_size=de.size;
*_attr=FileAttr(de.name,de.attr);
@@ -384,12 +384,12 @@ U8 *FAT32FileRead(CDrv *dv,U8 *cur_dir,U8 *filename,I64 *_size,I64 *_attr)
return buf;
}
Bool FAT32Cd(U8 *name,I64 cur_dir_cluster)
Bool FAT32Cd(U8 *name,I64 cur_dir_clus)
{
CDirEntry de;
if (Fs->cur_dv->fs_type!=FSt_FAT32)
PrintErr("Not FAT32 Drv\n");
else if (FAT32FileFind(Fs->cur_dv,cur_dir_cluster,name,&de,FUF_JUST_DIRS))
else if (FAT32FileFind(Fs->cur_dv,cur_dir_clus,name,&de,FUF_JUST_DIRS))
return TRUE;
else {
"%s ",name;
@@ -398,7 +398,7 @@ Bool FAT32Cd(U8 *name,I64 cur_dir_cluster)
return FALSE;
}
U0 FAT32FreeClusters(CDrv *dv,I64 c)
U0 FAT32FreeClus(CDrv *dv,I64 c)
{
I64 next,saved_c=c;
Bool unlock,unlock_break;
@@ -441,10 +441,10 @@ U0 FAT32FreeClusters(CDrv *dv,I64 c)
}
}
I64 FAT32AllocClusters(CDrv *dv,I64 c,I64 cnt)
I64 FAT32AllocClus(CDrv *dv,I64 c,I64 cnt)
{
Bool wrap_around=FALSE,unlock,unlock_break;
I64 first=INVALID_CLUSTER,j,l;
I64 first=INVALID_CLUS,j,l;
if (cnt<=0) return 0x0FFFFFFF;
try {
@@ -484,8 +484,8 @@ I64 FAT32AllocClusters(CDrv *dv,I64 c,I64 cnt)
DrvFATBlkClean(dv);
dv->fis->most_recently_alloced=j;
dv->fis->free_clusters=-1;
WBlks(dv,dv->fis,dv->file_system_info_sect,1);
dv->fis->free_clus=-1;
BlkWrite(dv,dv->fis,dv->file_system_info_sect,1);
} catch {
if (unlock)
DrvUnlock(dv);
@@ -499,7 +499,7 @@ I64 FAT32AllocClusters(CDrv *dv,I64 c,I64 cnt)
return first;
}
I64 FAT32AllocContiguousClusters(CDrv *dv,I64 cnt)
I64 FAT32AllocContiguousClus(CDrv *dv,I64 cnt)
{
I64 i,first=1;
Bool cont,unlock,unlock_break;
@@ -566,8 +566,8 @@ Bool FAT32DirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
//See $LK,"::/Doc/CutCorners.DD"$.
CFAT32DirEntry *buf,*last_buf,*tmp_buf,de[3];
I64 i,attr,avail_cnt,de_cnt,c,
cur_dir_entry,entries_per_cluster,
cur_dir_cluster,xsum=0,last_dir_cluster=INVALID_CLUSTER;
cur_dir_entry,entries_per_clus,
cur_dir_clus,xsum=0,last_dir_clus=INVALID_CLUS;
U8 ch;
Bool written=FALSE,unlock,unlock_break;
CDirEntry long_name;
@@ -576,11 +576,11 @@ Bool FAT32DirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
try {
unlock_break=BreakLock;
unlock=DrvLock(dv);
cur_dir_cluster=Name2DirCluster(dv,cur_dir);
cur_dir_clus=Name2DirClus(dv,cur_dir);
buf =MAlloc(BLK_SIZE*dv->spc);
last_buf=CAlloc(BLK_SIZE*dv->spc);
entries_per_cluster=dv->spc<<FAT32_ENTRIES_BITS;
RClusters(dv,buf,cur_dir_cluster,1);
entries_per_clus=dv->spc<<FAT32_ENTRIES_BITS;
ClusRead(dv,buf,cur_dir_clus,1);
cur_dir_entry=0;
while (ch=*buf[cur_dir_entry].name) {
attr=buf[cur_dir_entry].attr;
@@ -597,8 +597,8 @@ Bool FAT32DirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
}
if (ch==0xE5 && !written && avail_cnt>=de_cnt) {
MemCpy(&buf[cur_dir_entry],&de,de_cnt*sizeof(CFAT32DirEntry));
WBlks(dv,&buf[cur_dir_entry & -FAT32_ENTRIES_PER_BLK],
dv->data_area+cur_dir_cluster*dv->spc
BlkWrite(dv,&buf[cur_dir_entry & -FAT32_ENTRIES_PER_BLK],
dv->data_area+cur_dir_clus*dv->spc
+cur_dir_entry>>FAT32_ENTRIES_BITS,1);
cur_dir_entry+=de_cnt-1; //gets inc'ed
written=TRUE;
@@ -610,12 +610,12 @@ Bool FAT32DirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
//Del old entry with same name
if (!StrCmp(long_name.name,tmpde->name)) {
if (free_old_chain)
FAT32FreeClusters(dv,buf[cur_dir_entry].cluster_lo+
buf[cur_dir_entry].cluster_hi<<16);
FAT32FreeClus(dv,buf[cur_dir_entry].clus_lo+
buf[cur_dir_entry].clus_hi<<16);
if (!written) {
MemCpy(&buf[cur_dir_entry],&de[de_cnt-1],sizeof(CFAT32DirEntry));
WBlks(dv,&buf[cur_dir_entry & -FAT32_ENTRIES_PER_BLK],
dv->data_area+cur_dir_cluster*dv->spc
BlkWrite(dv,&buf[cur_dir_entry & -FAT32_ENTRIES_PER_BLK],
dv->data_area+cur_dir_clus*dv->spc
+cur_dir_entry>>FAT32_ENTRIES_BITS,1);
written=TRUE;
} else {
@@ -626,20 +626,20 @@ Bool FAT32DirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
==RS_ATTR_LONG_NAME)
*buf[cur_dir_entry-i++].name=0xE5;
i--;
WBlks(dv,&buf[(cur_dir_entry-i)&-FAT32_ENTRIES_PER_BLK],
dv->data_area+cur_dir_cluster*dv->spc
BlkWrite(dv,&buf[(cur_dir_entry-i)&-FAT32_ENTRIES_PER_BLK],
dv->data_area+cur_dir_clus*dv->spc
+(cur_dir_entry-i)>>FAT32_ENTRIES_BITS,
(i+FAT32_ENTRIES_PER_BLK)>>FAT32_ENTRIES_BITS);
if (i==cur_dir_entry && 0<last_dir_cluster<0x0FFFFFF8) {
if (i==cur_dir_entry && 0<last_dir_clus<0x0FFFFFF8) {
i=1;
while (i<=entries_per_cluster &&
last_buf[entries_per_cluster-i].attr
while (i<=entries_per_clus &&
last_buf[entries_per_clus-i].attr
&RS_ATTR_LONG_NAME_MASK==RS_ATTR_LONG_NAME)
*last_buf[entries_per_cluster-i++].name=0xE5;
*last_buf[entries_per_clus-i++].name=0xE5;
if (--i>0)
WBlks(dv,&buf[(entries_per_cluster-i)&-FAT32_ENTRIES_PER_BLK],
dv->data_area+last_dir_cluster*dv->spc
+(entries_per_cluster-i)>>FAT32_ENTRIES_BITS,
BlkWrite(dv,&buf[(entries_per_clus-i)&-FAT32_ENTRIES_PER_BLK],
dv->data_area+last_dir_clus*dv->spc
+(entries_per_clus-i)>>FAT32_ENTRIES_BITS,
(i+FAT32_ENTRIES_PER_BLK-1)>>FAT32_ENTRIES_BITS);
}
}
@@ -648,17 +648,17 @@ Bool FAT32DirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
}
MemSet(&long_name,0,sizeof(CDirEntry));
}
if (++cur_dir_entry==entries_per_cluster) {
last_dir_cluster=cur_dir_cluster;
if (++cur_dir_entry==entries_per_clus) {
last_dir_clus=cur_dir_clus;
tmp_buf=buf; buf=last_buf; last_buf=tmp_buf;
c=ClusterNumNext(dv,cur_dir_cluster);
c=ClusNumNext(dv,cur_dir_clus);
if (!(0<c<0x0FFFFFF8)) {
c=ClustersAlloc(dv,cur_dir_cluster,1,FALSE);
c=ClusAlloc(dv,cur_dir_clus,1,FALSE);
MemSet(buf,0,BLK_SIZE*dv->spc);
WClusters(dv,buf,c,1);
ClusWrite(dv,buf,c,1);
} else
RClusters(dv,buf,c,1);
cur_dir_cluster=c;
ClusRead(dv,buf,c,1);
cur_dir_clus=c;
cur_dir_entry=0;
}
}
@@ -667,32 +667,32 @@ Bool FAT32DirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
if (avail_cnt<de_cnt) {
for (i=0;i<avail_cnt;i++)
*buf[cur_dir_entry+i].name=0xE5;
WBlks(dv,&buf[cur_dir_entry &-FAT32_ENTRIES_PER_BLK],
dv->data_area+cur_dir_cluster*dv->spc
BlkWrite(dv,&buf[cur_dir_entry &-FAT32_ENTRIES_PER_BLK],
dv->data_area+cur_dir_clus*dv->spc
+cur_dir_entry>>FAT32_ENTRIES_BITS,1);
cur_dir_entry+=avail_cnt;
if (cur_dir_entry==entries_per_cluster) {
last_dir_cluster=cur_dir_cluster;
if (cur_dir_entry==entries_per_clus) {
last_dir_clus=cur_dir_clus;
tmp_buf=buf; buf=last_buf; last_buf=tmp_buf;
cur_dir_cluster=ClustersAlloc(dv,cur_dir_cluster,1);
cur_dir_clus=ClusAlloc(dv,cur_dir_clus,1);
cur_dir_entry=0;
MemSet(buf,0,BLK_SIZE*dv->spc);
WClusters(dv,buf,cur_dir_cluster,1);
ClusWrite(dv,buf,cur_dir_clus,1);
}
}
MemCpy(&buf[cur_dir_entry],&de,de_cnt*sizeof(CFAT32DirEntry));
WBlks(dv,&buf[cur_dir_entry &-FAT32_ENTRIES_PER_BLK],
dv->data_area+cur_dir_cluster*dv->spc+
BlkWrite(dv,&buf[cur_dir_entry &-FAT32_ENTRIES_PER_BLK],
dv->data_area+cur_dir_clus*dv->spc+
cur_dir_entry>>FAT32_ENTRIES_BITS,1);
cur_dir_entry+=de_cnt;
if (cur_dir_entry==entries_per_cluster) {
cur_dir_cluster=ClustersAlloc(dv,cur_dir_cluster,1);
if (cur_dir_entry==entries_per_clus) {
cur_dir_clus=ClusAlloc(dv,cur_dir_clus,1);
MemSet(buf,0,BLK_SIZE*dv->spc);
WClusters(dv,buf,cur_dir_cluster,1);
ClusWrite(dv,buf,cur_dir_clus,1);
} else {
MemSet(&buf[cur_dir_entry],0,sizeof(CFAT32DirEntry));
WBlks(dv,&buf[cur_dir_entry &-FAT32_ENTRIES_PER_BLK],
dv->data_area+cur_dir_cluster*dv->spc
BlkWrite(dv,&buf[cur_dir_entry &-FAT32_ENTRIES_PER_BLK],
dv->data_area+cur_dir_clus*dv->spc
+cur_dir_entry>>FAT32_ENTRIES_BITS,1);
}
}
@@ -715,8 +715,8 @@ I64 FAT32FilesDel(CDrv *dv,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
Bool del_dir,Bool print_msg)
{
CFAT32DirEntry *buf,*last_buf,*tmp_buf;
I64 i,res=0,attr,xsum=0,last_dir_cluster=INVALID_CLUSTER,
cur_dir_entry,entries_per_cluster,cur_dir_cluster;
I64 i,res=0,attr,xsum=0,last_dir_clus=INVALID_CLUS,
cur_dir_entry,entries_per_clus,cur_dir_clus;
U8 ch;
Bool unlock_break;
CDirEntry long_name;
@@ -724,11 +724,11 @@ I64 FAT32FilesDel(CDrv *dv,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
try {
unlock_break=BreakLock;
DrvLock(dv);
cur_dir_cluster=Name2DirCluster(dv,cur_dir);
cur_dir_clus=Name2DirClus(dv,cur_dir);
buf =MAlloc(BLK_SIZE*dv->spc);
last_buf=CAlloc(BLK_SIZE*dv->spc);
entries_per_cluster=dv->spc<<FAT32_ENTRIES_BITS;
RClusters(dv,buf,cur_dir_cluster,1);
entries_per_clus=dv->spc<<FAT32_ENTRIES_BITS;
ClusRead(dv,buf,cur_dir_clus,1);
cur_dir_entry=0;
while (ch=*buf[cur_dir_entry].name) {
attr=buf[cur_dir_entry].attr;
@@ -753,35 +753,35 @@ I64 FAT32FilesDel(CDrv *dv,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
==RS_ATTR_LONG_NAME)
*buf[cur_dir_entry-i++].name=0xE5;
i--;
WBlks(dv,&buf[(cur_dir_entry-i)&-FAT32_ENTRIES_PER_BLK],
dv->data_area+cur_dir_cluster*dv->spc
BlkWrite(dv,&buf[(cur_dir_entry-i)&-FAT32_ENTRIES_PER_BLK],
dv->data_area+cur_dir_clus*dv->spc
+(cur_dir_entry-i)>>FAT32_ENTRIES_BITS,
(i+FAT32_ENTRIES_PER_BLK)>>FAT32_ENTRIES_BITS);
if (i==cur_dir_entry && last_dir_cluster!=INVALID_CLUSTER) {
if (i==cur_dir_entry && last_dir_clus!=INVALID_CLUS) {
i=1;
while (i<=entries_per_cluster &&
last_buf[entries_per_cluster-i].attr
while (i<=entries_per_clus &&
last_buf[entries_per_clus-i].attr
&RS_ATTR_LONG_NAME_MASK==RS_ATTR_LONG_NAME)
*last_buf[entries_per_cluster-i++].name=0xE5;
*last_buf[entries_per_clus-i++].name=0xE5;
if (--i>0)
WBlks(dv,&buf[(entries_per_cluster-i)&-FAT32_ENTRIES_PER_BLK],
dv->data_area+last_dir_cluster*dv->spc
+(entries_per_cluster-i)>>FAT32_ENTRIES_BITS,
BlkWrite(dv,&buf[(entries_per_clus-i)&-FAT32_ENTRIES_PER_BLK],
dv->data_area+last_dir_clus*dv->spc
+(entries_per_clus-i)>>FAT32_ENTRIES_BITS,
(i+FAT32_ENTRIES_PER_BLK-1)>>FAT32_ENTRIES_BITS);
}
FAT32FreeClusters(dv,buf[cur_dir_entry].cluster_lo+
buf[cur_dir_entry].cluster_hi<<16);
FAT32FreeClus(dv,buf[cur_dir_entry].clus_lo+
buf[cur_dir_entry].clus_hi<<16);
}
}
MemSet(&long_name,0,sizeof(CDirEntry));
}
} else
MemSet(&long_name,0,sizeof(CDirEntry));
if (++cur_dir_entry==entries_per_cluster) {
last_dir_cluster=cur_dir_cluster;
cur_dir_cluster=ClusterNumNext(dv,cur_dir_cluster,1);
if (++cur_dir_entry==entries_per_clus) {
last_dir_clus=cur_dir_clus;
cur_dir_clus=ClusNumNext(dv,cur_dir_clus,1);
tmp_buf=buf; buf=last_buf; last_buf=tmp_buf;
RClusters(dv,buf,cur_dir_cluster,1);
ClusRead(dv,buf,cur_dir_clus,1);
cur_dir_entry=0;
}
}
@@ -818,14 +818,14 @@ I64 FAT32FileWrite(CDrv *dv,U8 *cur_dir,U8 *name,U8 *buf,I64 size,
contiguous=FALSE;
de.size=size;
if (blk_cnt=(size+BLK_SIZE-1)>>BLK_SIZE_BITS)
c=ClustersAlloc(dv,0,(blk_cnt+dv->spc-1)/dv->spc,contiguous);
c=ClusAlloc(dv,0,(blk_cnt+dv->spc-1)/dv->spc,contiguous);
else
c=0x0FFFFFFF;
de.cluster=c;
de.clus=c;
de.attr=attr;
de.datetime=cdt;
if (blk_cnt)
WClustersBlks(dv,buf,c,blk_cnt);
ClusBlkWrite(dv,buf,c,blk_cnt);
FAT32DirNew(dv,cur_dir,&de,TRUE);
}
return c;
@@ -837,7 +837,7 @@ CDirEntry *FAT32FilesFind(U8 *files_find_mask,
CDrv *dv=Fs->cur_dv;
CFAT32DirEntry *buf;
I64 attr,xsum=0,dir_size=0,sub_dir_size,
cur_dir_cluster,cur_dir_entry,entries_per_cluster;
cur_dir_clus,cur_dir_entry,entries_per_clus;
U8 ch;
CDirEntry *res=NULL,*tmpde,long_name;
if (fuf_flags&~FUG_FILES_FIND)
@@ -845,10 +845,10 @@ CDirEntry *FAT32FilesFind(U8 *files_find_mask,
try {
MemSet(&long_name,0,sizeof(CDirEntry));
DrvLock(dv);
cur_dir_cluster=Name2DirCluster(dv,Fs->cur_dir);
cur_dir_clus=Name2DirClus(dv,Fs->cur_dir);
buf=MAlloc(BLK_SIZE*dv->spc);
entries_per_cluster=dv->spc<<FAT32_ENTRIES_BITS;
RClusters(dv,buf,cur_dir_cluster,1);
entries_per_clus=dv->spc<<FAT32_ENTRIES_BITS;
ClusRead(dv,buf,cur_dir_clus,1);
dir_size+=dv->spc*BLK_SIZE;
cur_dir_entry=0;
while (ch=*buf[cur_dir_entry].name) {
@@ -898,12 +898,12 @@ CDirEntry *FAT32FilesFind(U8 *files_find_mask,
}
} else
MemSet(&long_name,0,sizeof(CDirEntry));
if (++cur_dir_entry==entries_per_cluster) {
cur_dir_cluster=ClusterNumNext(dv,cur_dir_cluster);
if (cur_dir_cluster==INVALID_CLUSTER)
if (++cur_dir_entry==entries_per_clus) {
cur_dir_clus=ClusNumNext(dv,cur_dir_clus);
if (cur_dir_clus==INVALID_CLUS)
break;
else {
RClusters(dv,buf,cur_dir_cluster,1);
ClusRead(dv,buf,cur_dir_clus,1);
dir_size+=dv->spc*BLK_SIZE;
cur_dir_entry=0;
}
@@ -920,7 +920,7 @@ CDirEntry *FAT32FilesFind(U8 *files_find_mask,
Bool FAT32MkDir(CDrv *dv,U8 *cur_dir,U8 *name,I64 entry_cnt)
{
I64 c,cur_dir_cluster=Name2DirCluster(dv,cur_dir),
I64 c,cur_dir_clus=Name2DirClus(dv,cur_dir),
//Rough estimate of size
size=CeilU64((entry_cnt+2)<<FAT32_ENTRIES_BITS,dv->spc<<BLK_SIZE_BITS);
U8 *buf=CAlloc(size);
@@ -935,7 +935,7 @@ Bool FAT32MkDir(CDrv *dv,U8 *cur_dir,U8 *name,I64 entry_cnt)
d_native.attr=RS_ATTR_DIR;
*d_native.name='.';
d_native.name[1]=0;
d_native.cluster=c;
d_native.clus=c;
d_native.size=0;
d_native.datetime=Now;
FAT32DirFill(dFAT,&d_native,NULL,dv->fat32_local_time_offset);
@@ -946,11 +946,11 @@ Bool FAT32MkDir(CDrv *dv,U8 *cur_dir,U8 *name,I64 entry_cnt)
*d_native.name='.';
d_native.name[1]='.';
d_native.name[2]=0;
d_native.cluster=cur_dir_cluster;
d_native.clus=cur_dir_clus;
d_native.size=0;
d_native.datetime=Now;
FAT32DirFill(dFAT,&d_native,NULL,dv->fat32_local_time_offset);
WClusters(dv,buf,c,1);
ClusWrite(dv,buf,c,1);
Free(buf);
if (unlock_break)
BreakUnlock;
+14 -14
View File
@@ -58,7 +58,7 @@ Bool ISO1CDirFill(CDirEntry *tmpde,CISO1DirEntry *de)
Bool res;
MemSet(tmpde,0,sizeof(CDirEntry));
res=ISO1FromName(tmpde->name,&de->name_len);
tmpde->cluster=de->loc.little;
tmpde->clus=de->loc.little;
tmpde->size=de->size.little;
tmpde->attr=FileAttr(tmpde->name);
if (de->flags & ISO1_ATTR_DIR)
@@ -67,7 +67,7 @@ Bool ISO1CDirFill(CDirEntry *tmpde,CISO1DirEntry *de)
return res;
}
Bool ISO1FileFind(CDrv *dv,I64 cur_dir_cluster,U8 *name,
Bool ISO1FileFind(CDrv *dv,I64 cur_dir_clus,U8 *name,
CDirEntry *_res,I64 fuf_flags=0)
{//$LK,"FUF_JUST_DIRS",A="MN:FUF_JUST_DIRS"$, $LK,"FUF_JUST_FILES",A="MN:FUF_JUST_FILES"$
CISO1DirEntry *isoptr,*buf;
@@ -83,11 +83,11 @@ Bool ISO1FileFind(CDrv *dv,I64 cur_dir_cluster,U8 *name,
try {
unlock=DrvLock(dv);
isoptr=MAlloc(dv->spc<<BLK_SIZE_BITS);
RClusters(dv,isoptr,cur_dir_cluster,1);
ClusRead(dv,isoptr,cur_dir_clus,1);
if (isoptr->name_len==1 && !isoptr->name) {//curdir
i=(isoptr->size.little+dv->spc<<BLK_SIZE_BITS-1)/dv->spc<<BLK_SIZE_BITS;
buf=MAlloc(dv->spc<<BLK_SIZE_BITS*i);
RClusters(dv,buf,cur_dir_cluster,i);
ClusRead(dv,buf,cur_dir_clus,i);
Free(isoptr);
} else {
buf=isoptr;
@@ -131,7 +131,7 @@ U8 *ISO1FileRead(CDrv *dv,U8 *cur_dir,U8 *filename,I64 *_size,I64 *_attr)
{
U8 *buf=NULL;
CDirEntry de;
I64 c,blk_cnt,cur_dir_cluster;
I64 c,blk_cnt,cur_dir_clus;
DrvChk(dv);
*_size=0;
*_attr=0;
@@ -140,12 +140,12 @@ U8 *ISO1FileRead(CDrv *dv,U8 *cur_dir,U8 *filename,I64 *_size,I64 *_attr)
else
try {
DrvLock(dv);
cur_dir_cluster=Name2DirCluster(dv,cur_dir);
if (ISO1FileFind(dv,cur_dir_cluster,filename,&de,FUF_JUST_FILES)) {
cur_dir_clus=Name2DirClus(dv,cur_dir);
if (ISO1FileFind(dv,cur_dir_clus,filename,&de,FUF_JUST_FILES)) {
blk_cnt=(de.size+BLK_SIZE-1)>>BLK_SIZE_BITS;
buf=MAlloc(blk_cnt<<BLK_SIZE_BITS+1);
c=de.cluster;
c=RClustersBlks(dv,buf,c,blk_cnt);
c=de.clus;
c=ClusBlkRead(dv,buf,c,blk_cnt);
buf[de.size]=0; //Terminate
*_size=de.size;
*_attr=FileAttr(de.name,de.attr);
@@ -156,12 +156,12 @@ U8 *ISO1FileRead(CDrv *dv,U8 *cur_dir,U8 *filename,I64 *_size,I64 *_attr)
return buf;
}
Bool ISO1Cd(U8 *name,I64 cur_dir_cluster)
Bool ISO1Cd(U8 *name,I64 cur_dir_clus)
{
CDirEntry de;
if (Fs->cur_dv->fs_type!=FSt_ISO9660)
PrintErr("Not ISO9660 Drv\n");
else if (ISO1FileFind(Fs->cur_dv,cur_dir_cluster,name,&de,FUF_JUST_DIRS))
else if (ISO1FileFind(Fs->cur_dv,cur_dir_clus,name,&de,FUF_JUST_DIRS))
return TRUE;
else {
"%s ",name;
@@ -175,16 +175,16 @@ CDirEntry *ISO1FilesFind(U8 *files_find_mask,
{
CDrv *dv=Fs->cur_dv;
CISO1DirEntry *buf,*buf2,*isoptr;
I64 i,cur_dir_cluster=Name2DirCluster(dv,Fs->cur_dir);
I64 i,cur_dir_clus=Name2DirClus(dv,Fs->cur_dir);
CDirEntry *res=NULL,*tmpde;
if (fuf_flags&~FUG_FILES_FIND)
throw('FUF');
isoptr=MAlloc(dv->spc<<BLK_SIZE_BITS);
RClusters(dv,isoptr,cur_dir_cluster,1);
ClusRead(dv,isoptr,cur_dir_clus,1);
if (isoptr->name_len==1 && !isoptr->name) {//curdir
i=(isoptr->size.little+dv->spc<<BLK_SIZE_BITS-1)/dv->spc<<BLK_SIZE_BITS;
buf=MAlloc(dv->spc<<BLK_SIZE_BITS*i);
RClusters(dv,buf,cur_dir_cluster,i);
ClusRead(dv,buf,cur_dir_clus,i);
Free(isoptr);
} else {
buf=isoptr;
+63 -63
View File
@@ -32,7 +32,7 @@ U0 RedSeaFreeLstBuild(CDrv *dv)
RedSeaFreeFreeLst(dv);
QueInit(&dv->next_free);
while (first<max_blk) {
i=0; //count free clusters
i=0; //count free clus
while (first+i<max_blk) {
DrvFATBlkSet(dv,first+i);
if (Bt(dv->cur_fat_blk,(first+i-dv->data_area)&(BLK_SIZE<<3-1)))
@@ -61,7 +61,7 @@ U0 RedSeaInit(CDrv *dv)
Bool unlock;
try {
unlock=DrvLock(dv);
RBlks(dv,&br,dv->drv_offset,1);
BlkRead(dv,&br,dv->drv_offset,1);
if (br.signature!=MBR_PT_REDSEA || br.signature2!=0xAA55)
throw('Drv');
dv->fs_type=FSt_REDSEA;
@@ -69,7 +69,7 @@ U0 RedSeaInit(CDrv *dv)
dv->spc=1;
dv->size=br.sects;
dv->data_area=dv->drv_offset+br.bitmap_sects;
dv->root_cluster=br.root_cluster;
dv->root_clus=br.root_clus;
dv->fat1=dv->fat2=dv->drv_offset+1;
DrvFATBlkAlloc(dv);
if (unlock)
@@ -84,7 +84,7 @@ Bool RedSeaValidate(U8 drv_let)
CDrv *dv;
CRedSeaBoot br;
if ((dv=Let2Drv(drv_let,FALSE)) && dv->fs_type==FSt_REDSEA &&
RBlks(dv,&br,dv->drv_offset,1) && br.signature==MBR_PT_REDSEA &&
BlkRead(dv,&br,dv->drv_offset,1) && br.signature==MBR_PT_REDSEA &&
br.signature2==0xAA55 && br.sects==dv->size)
return TRUE;
else
@@ -110,28 +110,28 @@ U0 RedSeaFmt(U8 drv_let,Bool quick=TRUE)
n=(br->sects+BLK_SIZE<<3-1)/BLK_SIZE<<3;
br->bitmap_sects=n;
br->unique_id=GetTSC^Now()(U64);
br->root_cluster=0;
br->root_clus=0;
if (quick)
i=n+1;
else
i=dv->size;
WZeroBlks(dv,dv->drv_offset,i);
BlkWriteZero(dv,dv->drv_offset,i);
WBlks(dv,br,dv->drv_offset,1);
BlkWrite(dv,br,dv->drv_offset,1);
RedSeaInit(dv);
ClustersAlloc(dv,0,1,FALSE); //Alloc #1
ClusAlloc(dv,0,1,FALSE); //Alloc #1
root_dir_blks=MaxI64(1,dv->bd->init_root_dir_blks);
br->root_cluster=ClustersAlloc(dv,0,root_dir_blks,FALSE);
WBlks(dv,br,dv->drv_offset,1);
br->root_clus=ClusAlloc(dv,0,root_dir_blks,FALSE);
BlkWrite(dv,br,dv->drv_offset,1);
root_dir=CAlloc(BLK_SIZE*root_dir_blks);
d_native=root_dir-offset(CDirEntry.start);
d_native->attr=RS_ATTR_DIR|RS_ATTR_CONTIGUOUS;
*d_native->name='.';
d_native->cluster=br->root_cluster;
d_native->clus=br->root_clus;
d_native->size=BLK_SIZE*root_dir_blks;
d_native->datetime=Now;
@@ -140,10 +140,10 @@ U0 RedSeaFmt(U8 drv_let,Bool quick=TRUE)
*d_native->name='.';
d_native->name[1]='.';
d_native->attr=RS_ATTR_DIR|RS_ATTR_CONTIGUOUS;
d_native->cluster=br->root_cluster;
d_native->clus=br->root_clus;
d_native->datetime=Now;
WBlks(dv,root_dir,br->root_cluster,root_dir_blks);
BlkWrite(dv,root_dir,br->root_clus,root_dir_blks);
RedSeaInit(dv);
DrvUnlock(dv);
} catch
@@ -152,7 +152,7 @@ U0 RedSeaFmt(U8 drv_let,Bool quick=TRUE)
Free(root_dir);
}
Bool RedSeaFileFind(CDrv *dv,I64 cur_dir_cluster,U8 *name,
Bool RedSeaFileFind(CDrv *dv,I64 cur_dir_clus,U8 *name,
CDirEntry *_res,I64 fuf_flags=0)
{//$LK,"FUF_JUST_DIRS",A="MN:FUF_JUST_DIRS"$, $LK,"FUF_JUST_FILES",A="MN:FUF_JUST_FILES"$
CDirEntry *buf,*buf2,*ptr;
@@ -171,11 +171,11 @@ Bool RedSeaFileFind(CDrv *dv,I64 cur_dir_cluster,U8 *name,
try {
unlock=DrvLock(dv);
buf2=MAlloc(BLK_SIZE);
RBlks(dv,buf2,cur_dir_cluster,1);
BlkRead(dv,buf2,cur_dir_clus,1);
ptr=buf2(U8 *)-offset(CDirEntry.start);
buf=MAlloc(ptr->size);
RBlks(dv,buf,cur_dir_cluster,ptr->size>>BLK_SIZE_BITS);
BlkRead(dv,buf,cur_dir_clus,ptr->size>>BLK_SIZE_BITS);
Free(buf2);
ptr=buf(U8 *)-offset(CDirEntry.start);
@@ -208,7 +208,7 @@ U8 *RedSeaFileRead(CDrv *dv,U8 *cur_dir,U8 *filename,I64 *_size,I64 *_attr)
{
U8 *buf=NULL;
CDirEntry de;
I64 c,blk_cnt,cur_dir_cluster;
I64 c,blk_cnt,cur_dir_clus;
DrvChk(dv);
*_size=0;
*_attr=0;
@@ -217,12 +217,12 @@ U8 *RedSeaFileRead(CDrv *dv,U8 *cur_dir,U8 *filename,I64 *_size,I64 *_attr)
else
try {
DrvLock(dv);
cur_dir_cluster=Name2DirCluster(dv,cur_dir);
if (RedSeaFileFind(dv,cur_dir_cluster,filename,&de,FUF_JUST_FILES)) {
cur_dir_clus=Name2DirClus(dv,cur_dir);
if (RedSeaFileFind(dv,cur_dir_clus,filename,&de,FUF_JUST_FILES)) {
blk_cnt=(de.size+BLK_SIZE-1)>>BLK_SIZE_BITS;
buf=MAlloc(blk_cnt<<BLK_SIZE_BITS+1);
c=de.cluster;
c=RBlks(dv,buf,c,blk_cnt);
c=de.clus;
c=BlkRead(dv,buf,c,blk_cnt);
buf[de.size]=0; //Terminate
*_size=de.size;
*_attr=FileAttr(de.name,de.attr);
@@ -233,12 +233,12 @@ U8 *RedSeaFileRead(CDrv *dv,U8 *cur_dir,U8 *filename,I64 *_size,I64 *_attr)
return buf;
}
Bool RedSeaCd(U8 *name,I64 cur_dir_cluster)
Bool RedSeaCd(U8 *name,I64 cur_dir_clus)
{
CDirEntry de;
if (Fs->cur_dv->fs_type!=FSt_REDSEA)
PrintErr("Not RedSea Drv\n");
else if (RedSeaFileFind(Fs->cur_dv,cur_dir_cluster,name,&de,FUF_JUST_DIRS))
else if (RedSeaFileFind(Fs->cur_dv,cur_dir_clus,name,&de,FUF_JUST_DIRS))
return TRUE;
else {
"%s ",name;
@@ -247,7 +247,7 @@ Bool RedSeaCd(U8 *name,I64 cur_dir_cluster)
return FALSE;
}
U0 RedSeaFreeClusters(CDrv *dv,I64 c,I64 cnt)
U0 RedSeaFreeClus(CDrv *dv,I64 c,I64 cnt)
{
CFreeLst *tmpf;
Bool found=FALSE,unlock,unlock_break;
@@ -299,7 +299,7 @@ U0 RedSeaFreeClusters(CDrv *dv,I64 c,I64 cnt)
}
}
I64 RedSeaAllocClusters(CDrv *dv,I64 cnt)
I64 RedSeaAllocClus(CDrv *dv,I64 cnt)
{
CFreeLst *tmpf,*best_free=NULL;
I64 i,first,best_size=I64_MAX;
@@ -353,20 +353,20 @@ Bool RedSeaDirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
{
CDirEntry *buf,*buf2,*ptr,de2;
CRedSeaBoot *br;
I64 c,ch,i=1,j=0,n=BLK_SIZE/CDIR_SIZE,dir_size,cur_dir_cluster;
I64 c,ch,i=1,j=0,n=BLK_SIZE/CDIR_SIZE,dir_size,cur_dir_clus;
Bool written=FALSE,unlock,unlock_break;
U8 *tmp,*parent_dir;
try {
unlock_break=BreakLock;
tmpde->attr|=RS_ATTR_CONTIGUOUS;
unlock=DrvLock(dv);
cur_dir_cluster=Name2DirCluster(dv,cur_dir);
cur_dir_clus=Name2DirClus(dv,cur_dir);
buf2=MAlloc(BLK_SIZE);
RBlks(dv,buf2,cur_dir_cluster,1);
BlkRead(dv,buf2,cur_dir_clus,1);
ptr=buf2(U8 *)-offset(CDirEntry.start);
buf=MAlloc(ptr->size);
RBlks(dv,buf,cur_dir_cluster,ptr->size>>BLK_SIZE_BITS);
BlkRead(dv,buf,cur_dir_clus,ptr->size>>BLK_SIZE_BITS);
dir_size=ptr->size;
ptr=buf(U8 *)-offset(CDirEntry.start)+CDIR_SIZE;
@@ -376,26 +376,26 @@ Bool RedSeaDirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
if (!written)
MemCpy(&ptr->start,&tmpde->start,CDIR_SIZE);
if ((i+1)*CDIR_SIZE+j<<BLK_SIZE_BITS<dir_size)
WBlks(dv,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_cluster+j,1);
BlkWrite(dv,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_clus+j,1);
else {
buf2=CAlloc(dir_size+BLK_SIZE);
MemCpy(buf2,buf,dir_size);
RedSeaFreeClusters(dv,cur_dir_cluster,dir_size>>BLK_SIZE_BITS);
RedSeaFreeClus(dv,cur_dir_clus,dir_size>>BLK_SIZE_BITS);
dir_size+=BLK_SIZE;
c=ClustersAlloc(dv,0,dir_size>>BLK_SIZE_BITS,TRUE);
c=ClusAlloc(dv,0,dir_size>>BLK_SIZE_BITS,TRUE);
Free(buf);
buf=buf2;
ptr=buf(U8 *)-offset(CDirEntry.start);
ptr->size=dir_size;
ptr->cluster=c;
WBlks(dv,buf,c,dir_size>>BLK_SIZE_BITS);
if (cur_dir_cluster==dv->root_cluster) {
ptr->clus=c;
BlkWrite(dv,buf,c,dir_size>>BLK_SIZE_BITS);
if (cur_dir_clus==dv->root_clus) {
br=CAlloc(BLK_SIZE);
RBlks(dv,br,dv->drv_offset,1);
br->root_cluster=c;
WBlks(dv,br,dv->drv_offset,1);
BlkRead(dv,br,dv->drv_offset,1);
br->root_clus=c;
BlkWrite(dv,br,dv->drv_offset,1);
Free(br);
dv->root_cluster=c;
dv->root_clus=c;
} else {
tmp=StrNew(cur_dir);
parent_dir=StrNew(cur_dir);
@@ -404,9 +404,9 @@ Bool RedSeaDirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
Free(parent_dir);
parent_dir=StrNew("/");
}
if (RedSeaFileFind(dv,Name2DirCluster(dv,parent_dir),
if (RedSeaFileFind(dv,Name2DirClus(dv,parent_dir),
tmp,&de2,FUF_JUST_DIRS)) {
de2.cluster=c;
de2.clus=c;
de2.size=dir_size;
RedSeaDirNew(dv,parent_dir,&de2,FALSE);
} else
@@ -419,19 +419,19 @@ Bool RedSeaDirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
} else if (ptr->attr & RS_ATTR_DELETED) {
if (!written) {
MemCpy(&ptr->start,&tmpde->start,CDIR_SIZE);
WBlks(dv,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_cluster+j,1);
BlkWrite(dv,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_clus+j,1);
written=TRUE;
}
} else {
if (!StrCmp(tmpde->name,ptr->name)) {
if (free_old_chain)
RedSeaFreeClusters(dv,ptr->cluster,
RedSeaFreeClus(dv,ptr->clus,
(ptr->size+BLK_SIZE-1)>>BLK_SIZE_BITS);
if (!written)
MemCpy(&ptr->start,&tmpde->start,CDIR_SIZE);
else
ptr->attr|=RS_ATTR_DELETED;
WBlks(dv,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_cluster+j,1);
BlkWrite(dv,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_clus+j,1);
break;
}
}
@@ -459,18 +459,18 @@ I64 RedSeaFilesDel(CDrv *dv,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
Bool del_dir,Bool print_msg)
{
CDirEntry *buf,*buf2,*ptr;
I64 i=0,res=0,ch,j=0,n=BLK_SIZE/CDIR_SIZE,cur_dir_cluster;
I64 i=0,res=0,ch,j=0,n=BLK_SIZE/CDIR_SIZE,cur_dir_clus;
Bool unlock_break;
try {
unlock_break=BreakLock;
DrvLock(dv);
cur_dir_cluster=Name2DirCluster(dv,cur_dir);
cur_dir_clus=Name2DirClus(dv,cur_dir);
buf2=MAlloc(BLK_SIZE);
RBlks(dv,buf2,cur_dir_cluster,1);
BlkRead(dv,buf2,cur_dir_clus,1);
ptr=buf2(U8 *)-offset(CDirEntry.start);
buf=MAlloc(ptr->size);
RBlks(dv,buf,cur_dir_cluster,ptr->size>>BLK_SIZE_BITS);
BlkRead(dv,buf,cur_dir_clus,ptr->size>>BLK_SIZE_BITS);
Free(buf2);
ptr=buf(U8 *)-offset(CDirEntry.start);
@@ -486,8 +486,8 @@ I64 RedSeaFilesDel(CDrv *dv,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
if (print_msg)
"Del %s\n",ptr->name;
ptr->attr|=RS_ATTR_DELETED;
WBlks(dv,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_cluster+j,1);
RedSeaFreeClusters(dv,ptr->cluster,
BlkWrite(dv,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_clus+j,1);
RedSeaFreeClus(dv,ptr->clus,
(ptr->size+BLK_SIZE-1)>>BLK_SIZE_BITS);
}
ptr(U8 *)+=CDIR_SIZE;
@@ -523,14 +523,14 @@ I64 RedSeaFileWrite(CDrv *dv,U8 *cur_dir,U8 *name,U8 *buf,I64 size,
RedSeaFilesDel(dv,cur_dir,de.name,0,FALSE,FALSE);
de.size=size;
if (blk_cnt=(size+BLK_SIZE-1)>>BLK_SIZE_BITS)
c=ClustersAlloc(dv,0,blk_cnt,TRUE); //Always contiguous
c=ClusAlloc(dv,0,blk_cnt,TRUE); //Always contiguous
else
c=INVALID_CLUSTER;
de.cluster=c;
c=INVALID_CLUS;
de.clus=c;
de.attr=attr|RS_ATTR_CONTIGUOUS;
de.datetime=cdt;
if (blk_cnt)
WBlks(dv,buf,c,blk_cnt);
BlkWrite(dv,buf,c,blk_cnt);
RedSeaDirNew(dv,cur_dir,&de,TRUE);
}
return c;
@@ -541,25 +541,25 @@ CDirEntry *RedSeaFilesFind(U8 *files_find_mask,I64 fuf_flags,
{
CDrv *dv=Fs->cur_dv;
CDirEntry *buf,*buf2,*ptr,*res=NULL,*tmpde;
I64 ch,cur_dir_cluster;
I64 ch,cur_dir_clus;
if (fuf_flags&~FUG_FILES_FIND)
throw('FUF');
try {
DrvLock(dv);
cur_dir_cluster=Name2DirCluster(dv,Fs->cur_dir);
cur_dir_clus=Name2DirClus(dv,Fs->cur_dir);
buf2=MAlloc(BLK_SIZE);
RBlks(dv,buf2,cur_dir_cluster,1);
BlkRead(dv,buf2,cur_dir_clus,1);
ptr=buf2(U8 *)-offset(CDirEntry.start);
buf=MAlloc(ptr->size);
RBlks(dv,buf,cur_dir_cluster,ptr->size>>BLK_SIZE_BITS);
BlkRead(dv,buf,cur_dir_clus,ptr->size>>BLK_SIZE_BITS);
Free(buf2);
ptr=buf(U8 *)-offset(CDirEntry.start);
*ptr->name='.';
ptr->name[1]=0;
ptr(U8 *)+=CDIR_SIZE;
ptr->cluster=Name2ParentDirCluster(dv,Fs->cur_dir);
ptr->clus=Name2ParentDirClus(dv,Fs->cur_dir);
ptr(U8 *)-=CDIR_SIZE;
while (TRUE) {
if (!(ch=*ptr->name))
@@ -603,7 +603,7 @@ CDirEntry *RedSeaFilesFind(U8 *files_find_mask,I64 fuf_flags,
Bool RedSeaMkDir(CDrv *dv,U8 *cur_dir,U8 *name,I64 entry_cnt)
{//entry_cnt is for preallocating dir blks.
I64 c,cur_dir_cluster=Name2DirCluster(dv,cur_dir),
I64 c,cur_dir_clus=Name2DirClus(dv,cur_dir),
size=CeilU64((entry_cnt+3)<<6,BLK_SIZE);
#assert CDIR_SIZE==64
U8 *buf=CAlloc(size);
@@ -614,7 +614,7 @@ Bool RedSeaMkDir(CDrv *dv,U8 *cur_dir,U8 *name,I64 entry_cnt)
c=FileWrite(name,buf,size,0,RS_ATTR_DIR);
d_native->attr=RS_ATTR_DIR|RS_ATTR_CONTIGUOUS;
StrCpy(d_native->name,name);
d_native->cluster=c;
d_native->clus=c;
d_native->size=size;
d_native->datetime=Now;
d_native(U8 *)+=CDIR_SIZE;
@@ -623,10 +623,10 @@ Bool RedSeaMkDir(CDrv *dv,U8 *cur_dir,U8 *name,I64 entry_cnt)
*d_native->name='.';
d_native->name[1]='.';
d_native->name[2]=0;
d_native->cluster=cur_dir_cluster;
d_native->clus=cur_dir_clus;
d_native->size=0;
d_native->datetime=Now;
WBlks(dv,buf,c,1);
BlkWrite(dv,buf,c,1);
Free(buf);
if (unlock_break)
BreakUnlock;
+1 -1
View File
@@ -6,7 +6,7 @@
#include "DskBlkDev"
#include "DskDrv"
#include "DskBlk"
#include "DskCluster"
#include "DskClus"
#include "DskStrB"
#include "DskAddDev"
#include "DskDirA"
+1 -1
View File
@@ -473,7 +473,7 @@ U0 InStr(U8 *fmt,...)
U0 InFile(U8 *filename)
{//Send InFile code file to self.
U8 *name=DftExt(filename,"IN.Z");
U8 *name=ExtDft(filename,"IN.Z");
InStr("Cd(\"%C:%s\");;#include \"%s\"",
Drv2Let(Fs->cur_dv),Fs->cur_dir,name);
Free(name);
+17 -17
View File
@@ -1,7 +1,7 @@
//This is run in a $LK,"#exe",A="FF:::/Kernel/Kernel.PRJ,KCfg"${}.
U8 *kernel_cfg_options="MemInit\0HeapInit\0VarInit\0StaffMode\0"
"HomeDir\0NoMP\0TextMode\0DontProbe\0AutoMountIDE\0DbgDistro\0Help\0";
"HomeDir\0NoMP\0TextMode\0DontProbe\0MountIDEAuto\0DbgDistro\0Help\0";
#define CFG_MEM_INIT 0
#define CFG_HEAP_INIT 1
@@ -11,7 +11,7 @@ U8 *kernel_cfg_options="MemInit\0HeapInit\0VarInit\0StaffMode\0"
#define CFG_NO_MP 5
#define CFG_TEXT_MODE 6
#define CFG_DONT_PROBE 7
#define CFG_AUTO_MOUNT_IDE 8
#define CFG_MOUNT_IDE_AUTO 8
#define CFG_DBG_DISTRO 9
#define CFG_OPTIONS_NUM 10
@@ -25,7 +25,7 @@ class CKCfg
U8 *home_dir;
Bool opts[CFG_OPTIONS_NUM];
U8 mem_init_val,heap_init_val,var_init_val,
boot_drv_let,auto_mount_ide_hd_let,auto_mount_ide_cd_let;
boot_drv_let,mount_ide_auto_hd_let,mount_ide_auto_cd_let;
};
CDoc *KCfgAddDev(CKCfg *c)
@@ -72,7 +72,7 @@ U0 KCfgOptions(CKCfg *c)
"$$PURPLE$$NoMP$$FG$$ No multicore.\n"
"$$PURPLE$$TextMode$$FG$$ Text Mode (requires hard reboot).\n"
"$$PURPLE$$DontProbe$$FG$$ Just prompt CD/DVD ports, don't probe.\n"
"$$PURPLE$$AutoMountIDE$$FG$$ AutoMount IDE drives to 'C' and 'T'.\n"
"$$PURPLE$$MountIDEAuto$$FG$$ Auto Mount IDE drives to 'C' and 'T'.\n"
"$$PURPLE$$DbgDistro$$FG$$ Include RAM Drv in Kernel.BIN.\n"
"\n";
else
@@ -107,30 +107,30 @@ U0 KCfgOptions(CKCfg *c)
else
c->opts[i]=FALSE;
break;
case CFG_AUTO_MOUNT_IDE:
case CFG_MOUNT_IDE_AUTO:
if (state) {
"First HD Drive Let:";
c->auto_mount_ide_hd_let=Let2Let(GetChar);
if (!('A'<=c->auto_mount_ide_hd_let<='Z'))
c->auto_mount_ide_hd_let=0;
c->mount_ide_auto_hd_let=Let2Let(GetChar);
if (!('A'<=c->mount_ide_auto_hd_let<='Z'))
c->mount_ide_auto_hd_let=0;
'\n';
if (c->auto_mount_ide_hd_let)
"First HD Drive:%C\n",c->auto_mount_ide_hd_let;
if (c->mount_ide_auto_hd_let)
"First HD Drive:%C\n",c->mount_ide_auto_hd_let;
else
"First HD Drive:%C\n",'C';
"First CD Drive Let:";
c->auto_mount_ide_cd_let=Let2Let(GetChar);
if (!('A'<=c->auto_mount_ide_cd_let<='Z'))
c->auto_mount_ide_cd_let=0;
c->mount_ide_auto_cd_let=Let2Let(GetChar);
if (!('A'<=c->mount_ide_auto_cd_let<='Z'))
c->mount_ide_auto_cd_let=0;
'\n';
if (c->auto_mount_ide_cd_let)
"First CD Drive:%C\n",c->auto_mount_ide_cd_let;
if (c->mount_ide_auto_cd_let)
"First CD Drive:%C\n",c->mount_ide_auto_cd_let;
else
"First CD Drive:%C\n",'T';
} else {
c->auto_mount_ide_hd_let=0;
c->auto_mount_ide_cd_let=0;
c->mount_ide_auto_hd_let=0;
c->mount_ide_auto_cd_let=0;
}
break;
case CFG_DBG_DISTRO:
+8 -8
View File
@@ -14,14 +14,14 @@ U0 SysGlblsInit()
blkdev.tmp_filename =AStrNew("~/Tmp.DD.Z");
blkdev.dvd_boot_is_good=TRUE;
#exe {
if (!kernel_cfg->auto_mount_ide_hd_let)
kernel_cfg->auto_mount_ide_hd_let='C';
if (!kernel_cfg->auto_mount_ide_cd_let)
kernel_cfg->auto_mount_ide_cd_let='T';
if (!kernel_cfg->mount_ide_auto_hd_let)
kernel_cfg->mount_ide_auto_hd_let='C';
if (!kernel_cfg->mount_ide_auto_cd_let)
kernel_cfg->mount_ide_auto_cd_let='T';
StreamPrint("blkdev.first_hd_drv_let=%d;",
kernel_cfg->auto_mount_ide_hd_let);
kernel_cfg->mount_ide_auto_hd_let);
StreamPrint("blkdev.first_dvd_drv_let=%d;",
kernel_cfg->auto_mount_ide_cd_let);
kernel_cfg->mount_ide_auto_cd_let);
}
DbgMode(ON);
@@ -172,8 +172,8 @@ U0 KMain()
TimeStampFreqCal;
BlkDevsInitAll;
"ChgDsk(':');\n";
ChgDsk(':');
"DskChg(':');\n";
DskChg(':');
#exe {
StreamPrint("HomeSet(\"%s\");\n"
"blkdev.ins_base0=%d;blkdev.ins_base1=%d;blkdev.ins_unit =%d;\n",
+12 -12
View File
@@ -17,6 +17,8 @@ extern Bool BlkDevLock(CBlkDev *bd);
extern CBlkDev *BlkDevNextFreeSlot(U8 first_drv_let,I64 type);
extern Bool BlkDevUnlock(CBlkDev *bd,Bool rst=FALSE);
extern U0 BlkDevsRelease();
extern Bool BlkRead(CDrv *dv,U8 *buf, I64 blk, I64 cnt);
extern Bool BlkWrite(CDrv *dv,U8 *buf, I64 blk, I64 cnt);
extern U8 *Caller(I64 num=1);
extern U8 *CatPrint(U8 *_dst,U8 *fmt,...);
extern Bool Cd(U8 *dirname=NULL,Bool make_dirs=FALSE);
@@ -26,7 +28,7 @@ extern I64 DefineMatch(U8 *needle,U8 *haystack_lst_dname,I64 flags=0);
extern U8 *DefineSub(I64 sub,U8 *dname);
extern I64 Del(U8 *files_find_mask,Bool make_mask=FALSE,
Bool del_dir=FALSE,Bool print_msg=TRUE);
extern U8 *DftExt(U8 *filename,U8 *extension);
extern Bool DirMk(U8 *filename,I64 entry_cnt=0);
extern Bool Drv(U8 drv_let);
extern U8 Drv2Let(CDrv *dv=NULL);
extern U0 DrvBlkDevDel(CBlkDev *bd);
@@ -36,17 +38,18 @@ extern Bool DrvTypeSet(U8 drv_let,I64 type=FSt_REDSEA);
extern U0 DrvsRelease();
extern U0 DskCacheInvalidate(CDrv *dv);
extern U0 Exit();
extern I64 FAT32AllocClusters(CDrv *dv,I64 c,I64 cnt);
extern I64 FAT32AllocContiguousClusters(CDrv *dv,I64 cnt);
extern U8 *ExtDft(U8 *filename,U8 *extension);
extern I64 FAT32AllocClus(CDrv *dv,I64 c,I64 cnt);
extern I64 FAT32AllocContiguousClus(CDrv *dv,I64 cnt);
extern Bool FAT32DirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,
Bool free_old_chain);
extern Bool FAT32FileFind(CDrv *dv,I64 cur_dir_cluster,U8 *name,
extern Bool FAT32FileFind(CDrv *dv,I64 cur_dir_clus,U8 *name,
CDirEntry *_res,I64 fuf_flags=0);
extern U0 FAT32Init(CDrv *dv);
extern Bool FBlkRead(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1);
extern Bool FBlkWrite(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1);
extern U0 FClose(CFile *f);
extern CFile *FOpen(U8 *filename,U8 *flags,I64 cnt=0);
extern Bool FRBlks(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1);
extern Bool FWBlks(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1);
extern U8 *FileExtRem(U8 *src,U8 *dst=NULL);
extern Bool FileFind(U8 *filename,CDirEntry *_de=NULL,I64 fuf_flags=0);
extern U8 *FileNameAbs(U8 *_filename,I64 fuf_flags=0);
@@ -57,7 +60,7 @@ extern I64 GetChar(I64 *_scan_code=NULL,Bool echo=TRUE,Bool raw_cursor=FALSE);
extern I64 GetS(U8 *buf,I64 size,Bool allow_ext=TRUE);
extern CHeapCtrl *HeapCtrlInit(CHeapCtrl *hc=NULL,
CTask *task=NULL,CBlkPool *bp);
extern Bool ISO1FileFind(CDrv *dv,I64 cur_dir_cluster,U8 *name,
extern Bool ISO1FileFind(CDrv *dv,I64 cur_dir_clus,U8 *name,
CDirEntry *_res,I64 fuf_flags=0);
extern Bool ISOInit(CDrv *dv,I64 blk);
extern Bool IsDbgMode();
@@ -73,7 +76,6 @@ extern CDrv *Let2Drv(U8 drv_let=0,Bool except=TRUE);
extern U8 Let2Let(U8 drv_let=0);
extern U0 MPInt(U8 num,I64 cpu_num=1);
extern U8 *MStrPrint(U8 *fmt,...);
extern Bool MkDir(U8 *filename,I64 entry_cnt=0);
extern U0 MsHardSet(I64 x,I64 y,I64 z,I64 l,I64 r);
extern U0 Msg(I64 msg_code,I64 arg1,I64 arg2,I64 flags=0);
extern U0 Panic(U8 *msg=NULL,I64 msg_num=0,Bool panic=TRUE);
@@ -81,11 +83,10 @@ extern I64 PopUp(U8 *buf,CTask *parent=NULL,CTask **_pu_task=NULL);
extern U0 Print(U8 *fmt,...);
extern U0 PutChars(U64 ch);
extern U0 PutS(U8 *st); //Use $LK,"Print",A="MN:Print"$()
extern Bool RBlks(CDrv *dv,U8 *buf, I64 blk, I64 cnt);
extern I64 RedSeaAllocClusters(CDrv *dv,I64 cnt);
extern I64 RedSeaAllocClus(CDrv *dv,I64 cnt);
extern Bool RedSeaDirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,
Bool free_old_chain);
extern Bool RedSeaFileFind(CDrv *dv,I64 cur_dir_cluster,U8 *name,
extern Bool RedSeaFileFind(CDrv *dv,I64 cur_dir_clus,U8 *name,
CDirEntry *_res,I64 fuf_flags=0);
extern U0 RedSeaFmt(U8 drv_let,Bool quick=TRUE);
extern U0 RedSeaFreeFreeLst(CDrv *dv);
@@ -104,6 +105,5 @@ extern Bool TaskValidate(CTask *task);
extern U0 TaskWait(CTask *task=NULL,Bool cmd_line_pmt=FALSE);
extern CTask *User(U8 *fmt=NULL,...);
extern U0 UserTaskCont();
extern Bool WBlks(CDrv *dv,U8 *buf, I64 blk, I64 cnt);
extern U0 XTalk(CTask *task,U8 *fmt,...);
extern U0 throw(I64 ch=0,Bool no_log=FALSE);
+1 -1
View File
@@ -185,7 +185,7 @@ CBinFile *Load(U8 *filename,I64 ld_flags=0,CBinFile *bfh_addr=INVALID_PTR)
I64 size,module_align,misalignment;
CBinFile *bfh;
fbuf=DftExt(filename,"BIN.Z");
fbuf=ExtDft(filename,"BIN.Z");
if (!(bfh=FileRead(fbuf,&size))) {
Free(fbuf);
return NULL;
+1 -1
View File
@@ -228,7 +228,7 @@ I64 TaskInit(CTask *task,I64 stk_size)
task->win_top =13;
task->win_bottom =text.rows-2;
if (blkdev.home_dir) {//Beware Adam $LK,"TaskInit",A="FF:::/Kernel/KStart64.HC,TaskInit"$. I guess ok until $LK,"ChgDsk",A="FF:::/Kernel/KEnd.HC,ChgDsk"$().
if (blkdev.home_dir) {//Beware Adam $LK,"TaskInit",A="FF:::/Kernel/KStart64.HC,TaskInit"$. I guess ok until $LK,"DskChg",A="FF:::/Kernel/KEnd.HC,DskChg"$().
task->cur_dv=blkdev.let_to_drv[*blkdev.home_dir-'A'];
task->cur_dir=StrNew(blkdev.home_dir+2,task);
} else
File diff suppressed because it is too large. Load diff
+16 -16
View File
@@ -2295,7 +2295,7 @@ public class CATARep
#define BLK_SIZE (1<<BLK_SIZE_BITS)
#define DVD_BLK_SIZE (4*BLK_SIZE)
#define DVD_BOOT_LOADER_SIZE DVD_BLK_SIZE*1
#define INVALID_CLUSTER (-1)
#define INVALID_CLUS (-1)
class CMBRPrt
{
@@ -2324,7 +2324,7 @@ class CRedSeaBoot
signature,reserved[4]; //MBR_PT_REDSEA=0x88. Distinguish from real FAT32
I64 drv_offset, //For CD/DVD image copy.
sects,
root_cluster,
root_clus,
bitmap_sects,
unique_id;
U8 code[462];
@@ -2336,7 +2336,7 @@ class CFAT32Boot
U8 jump_and_nop[3],
oem_name[8];
U16 bytes_per_sect;
U8 sects_per_cluster;
U8 sects_per_clus;
U16 reserved_sects;
U8 copies_of_fat;
U16 max_root_dir_entries, //Not used
@@ -2350,7 +2350,7 @@ class CFAT32Boot
sects_per_fat;
U16 flags,
version;
U32 root_cluster;
U32 root_clus;
U16 file_system_info_sect,
backup_boot_sect;
U8 reserved[12],
@@ -2369,7 +2369,7 @@ class CFAT32FileInfoSect
U32 signature1;
U8 unknown[480];
U32 signature2,
free_clusters,
free_clus,
most_recently_alloced;
U8 reserved[12];
U32 signature3;
@@ -2384,10 +2384,10 @@ class CFAT32DirEntry
U16 CrtTime,
CrtDate,
LstAccDate,
cluster_hi,
clus_hi,
WrtTime,
WrtDate,
cluster_lo;
clus_lo;
U32 size;
};
@@ -2556,7 +2556,7 @@ public class CDirEntry
U0 start;
U16 attr;
U8 name[CDIR_FILENAME_LEN];
I64 cluster,size;
I64 clus,size;
CDate datetime;
};
#define CDIR_SIZE (sizeof(CDirEntry)-offset(CDirEntry.start))
@@ -2584,7 +2584,7 @@ public class CDirEntry
#define FUf_JUST_JIT 16
#define FUf_JUST_GR 17
#define FUf_Z_OR_NOT_Z 18
#define FUf_CLUSTER_ORDER 19
#define FUf_CLUS_ORDER 19
#define FUf_SCAN_PARENTS 20
#define FUf_FLATTEN_TREE 21
#define FUf_WHOLE_LABELS 22
@@ -2611,14 +2611,14 @@ public class CDirEntry
#define FUF_JUST_JIT 0x0010000 //J
#define FUF_JUST_GR 0x0020000 //G
#define FUF_Z_OR_NOT_Z 0x0040000 //Z
#define FUF_CLUSTER_ORDER 0x0080000 //O Move disk head one direction
#define FUF_CLUS_ORDER 0x0080000 //O Move disk head one direction
#define FUF_SCAN_PARENTS 0x0100000 //P
#define FUF_FLATTEN_TREE 0x0200000 //f
#define FUF_WHOLE_LABELS 0x0400000 //l
#define FUF_WHOLE_LABELS_BEFORE 0x0800000 //lb
#define FUF_WHOLE_LABELS_AFTER 0x1000000 //la
#define FUG_FILES_FIND (FUF_RECURSE|FUF_SINGLE|FUF_CLUSTER_ORDER|\
#define FUG_FILES_FIND (FUF_RECURSE|FUF_SINGLE|FUF_CLUS_ORDER|\
FUF_JUST_DIRS|FUF_JUST_FILES|FUF_JUST_TXT|FUF_JUST_DD|\
FUF_JUST_SRC|FUF_JUST_AOT|FUF_JUST_JIT|FUF_JUST_GR|FUF_FLATTEN_TREE)
#define FUG_FILE_FIND (FUF_JUST_DIRS|FUF_JUST_FILES|FUF_Z_OR_NOT_Z|\
@@ -2728,9 +2728,9 @@ public class CDrv
prt_num,
file_system_info_sect,
fat1,fat2,
root_cluster,
root_clus,
data_area,
spc; //sectors per cluster
spc; //sectors per clus
CDate fat32_local_time_offset;
CTask *owning_task;
CBlkDev *bd;
@@ -2767,7 +2767,7 @@ public class CBlkDevGlbls
CCacheBlk *cache_base,*cache_ctrl,**cache_hash_table;
I64 cache_size,read_cnt,write_cnt;
CDrv *drvs,*let_to_drv[32];
I64 auto_mount_ide_cnt,
I64 mount_ide_auto_cnt,
ins_base0,ins_base1; //Install cd/dvd controller.
U8 boot_drv_let,first_hd_drv_let,first_dvd_drv_let;
Bool dvd_boot_is_good,ins_unit,pad[3];
@@ -2795,8 +2795,8 @@ public class CFile //See $LK,"::/Demo/Dsk/DataBase.HC"$.
I64 flags;
CDirEntry de;
CDrv *dv;
I64 fblk_num,cluster,file_cluster_num,max_blk;
U8 *cluster_buf;
I64 fblk_num,clus,file_clus_num,max_blk;
U8 *clus_buf;
};
#help_index "Memory/Heap"
+22 -23
View File
@@ -270,33 +270,33 @@ public extern U0 DVDImageWrite(U8 dvd_drv_let,
U8 *in_name=NULL,I64 media_type=MT_DVD);
#help_index "File/CFile"
public extern Bool FBlkRead(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1);
public extern Bool FBlkWrite(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1);
public extern U0 FClose(CFile *f);
public extern CFile *FOpen(U8 *filename,U8 *flags,I64 cnt=0);
public extern Bool FRBlks(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1);
public extern I64 FSize(CFile *f);
public extern Bool FWBlks(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1);
#help_index "File/Cmd Line (Typically);Cmd Line (Typically)"
public extern Bool Cd(U8 *dirname=NULL,Bool make_dirs=FALSE);
public extern U0 ChgDsk(U8 drv_let=0);
public extern I64 Del(U8 *files_find_mask,Bool make_mask=FALSE,
Bool del_dir=FALSE,Bool print_msg=TRUE);
public extern I64 Dir(U8 *files_find_mask="*",Bool full=FALSE);
public extern Bool DirMk(U8 *filename,I64 entry_cnt=0);
public extern Bool Drv(U8 drv_let);
public extern U0 DskChg(U8 drv_let=0);
public extern U0 HomeSet(U8 *dirname);
public extern Bool MkDir(U8 *filename,I64 entry_cnt=0);
#help_index "File/Cmd Line (Typically);Cmd Line (Typically);Install"
public extern Bool DrvMap(U8 drv_let,CDrv *dv);
#help_index "File/FileNames"
extern CDirEntry *Cd2DirEntry(CDirEntry *tmpde,U8 *abs_name);
public extern U8 *ChgExt(U8 *filename,U8 *extension);
public extern U8 *CurDir(CTask *task=NULL,CTask *mem_task=NULL);
public extern U8 *DftExt(U8 *filename,U8 *extension);
public extern U8 *DirCur(CTask *task=NULL,CTask *mem_task=NULL);
public extern U8 *DirFile(U8 *dirname,U8 *name=NULL,U8 *_extension=NULL);
public extern U8 *DirNameAbs(U8 *dirname);
public extern CBlkDev *DrvIsWritable(U8 drv_let=0,Bool except=FALSE);
public extern U8 *ExtChg(U8 *filename,U8 *extension);
public extern U8 *ExtDft(U8 *filename,U8 *extension);
public extern U8 *FileExtDot(U8 *src);
public extern U8 *FileExtRem(U8 *src,U8 *dst=NULL);
public extern U8 *FileNameAbs(U8 *filename,I64 fuf_flags=0);
@@ -331,10 +331,17 @@ public extern Bool BlkDevLock(CBlkDev *bd);
public extern CBlkDev *BlkDevNextFreeSlot(U8 first_drv_let,I64 type);
public extern Bool BlkDevUnlock(CBlkDev *bd,Bool rst=FALSE);
public extern U0 BlkDevsRelease();
public extern I64 Cluster2Blk(CDrv *dv,I64 c);
public extern I64 ClusterNumNext(CDrv *dv,I64 c,I64 cnt=1);
public extern I64 ClustersAlloc(CDrv *dv,I64 c=0,
public extern Bool BlkRead(CDrv *dv,U8 *buf, I64 blk, I64 cnt);
public extern Bool BlkWrite(CDrv *dv,U8 *buf, I64 blk, I64 cnt);
public extern U0 BlkWriteZero(CDrv *dv,I64 blk,I64 cnt);
public extern I64 Clus2Blk(CDrv *dv,I64 c);
public extern I64 ClusAlloc(CDrv *dv,I64 c=0,
I64 cnt=1,Bool contiguous=FALSE);
public extern I64 ClusBlkRead(CDrv *dv,U8 *buf,I64 c,I64 blks);
public extern I64 ClusBlkWrite(CDrv *dv,U8 *buf,I64 c,I64 blks);
public extern I64 ClusNumNext(CDrv *dv,I64 c,I64 cnt=1);
public extern I64 ClusRead(CDrv *dv,U8 *buf,I64 c,I64 cnt);
public extern I64 ClusWrite(CDrv *dv,U8 *buf,I64 c,I64 cnt);
extern Bool CopySingle(U8 *f1,U8 *f2); //Just one file
public extern U8 Drv2Let(CDrv *dv=NULL);
public extern CDrv *DrvChk(CDrv *dv,Bool except=TRUE);
@@ -347,21 +354,14 @@ public extern U8 *DrvSerialNum(U8 drv_let=0);
public extern U8 DrvTextAttrGet(U8 drv_let=0);
public extern Bool DrvUnlock(CDrv *dv,Bool rst=FALSE);
public extern U0 DrvsRelease();
extern U0 FAT32FreeClusters(CDrv *dv,I64 c);
extern U0 FAT32FreeClus(CDrv *dv,I64 c);
public extern CBlkDev *Let2BlkDev(U8 drv_let=0,Bool except=TRUE);
public extern I64 Let2BlkDevType(U8 drv_let);
public extern CDrv *Let2Drv(U8 drv_let=0,Bool except=TRUE);
public extern U8 Let2Let(U8 drv_let=0);
extern I64 Name2DirCluster(CDrv *dv,U8 *dirname);
extern I64 Name2ParentDirCluster(CDrv *dv,U8 *dirname);
public extern Bool RBlks(CDrv *dv,U8 *buf, I64 blk, I64 cnt);
public extern I64 RClusters(CDrv *dv,U8 *buf,I64 c,I64 cnt);
public extern I64 RClustersBlks(CDrv *dv,U8 *buf,I64 c,I64 blks);
extern U0 RedSeaFreeClusters(CDrv *dv,I64 c,I64 cnt);
public extern Bool WBlks(CDrv *dv,U8 *buf, I64 blk, I64 cnt);
public extern I64 WClusters(CDrv *dv,U8 *buf,I64 c,I64 cnt);
public extern I64 WClustersBlks(CDrv *dv,U8 *buf,I64 c,I64 blks);
public extern U0 WZeroBlks(CDrv *dv,I64 blk,I64 cnt);
extern I64 Name2DirClus(CDrv *dv,U8 *dirname);
extern I64 Name2ParentDirClus(CDrv *dv,U8 *dirname);
extern U0 RedSeaFreeClus(CDrv *dv,I64 c,I64 cnt);
#help_index "File/Program Routines"
public extern U0 DirEntryDel(CDirEntry *tmpde);
@@ -385,11 +385,11 @@ extern Bool ATAPIStartStop(CBlkDev *bd,F64 timeout,Bool start);
extern I64 ATAProbe(I64 base0,I64 base1,I64 unit);
extern U0 ATAReadBlks(CBlkDev *bd,U8 *buf, I64 blk, I64 cnt);
extern U0 ATAWriteBlks(CBlkDev *bd,U8 *buf, I64 blk, I64 cnt);
public extern I64 AutoMountIDE();
extern I64 BlkDevAdd(CBlkDev *bd,I64 prt_num=I64_MIN,
Bool whole_drv,Bool make_free);
extern U0 DskCacheInit(I64 size_in_U8s);
public extern U0 DskCacheInvalidate(CDrv *dv);
public extern I64 MountIDEAuto();
public extern CBlkDevGlbls blkdev;
#help_index "Graphics/Color"
@@ -488,7 +488,6 @@ public extern U0 XTalk(CTask *task,U8 *fmt,...);
public extern U0 XTalkStr(CTask *task,U8 *fmt,...);
public extern U0 XTalkStrWait(CTask *task,U8 *fmt,...);
public extern U0 XTalkWait(CTask *task,U8 *fmt,...);
#help_index "Job/Text & Msgs;Task/Job/Text & Msgs;Messages"
public extern U0 Msg(I64 msg_code,I64 arg1,I64 arg2,I64 flags=0);
public extern U0 PostMsg(CTask *task,
+3 -3
View File
@@ -13,7 +13,7 @@ U0 MakeMyISO(U8 *_out_iso_filename)
DelTree("/Distro");
Del(out_iso_filename);
MkDir("/Distro");
DirMk("/Distro");
In(STD_DISTRO_DVD_CFG);
BootDVDIns;
@@ -33,8 +33,8 @@ U0 MakeMyISO(U8 *_out_iso_filename)
//To save space, optionally delete dictionary.
//Del("/Distro/Adam/AutoComplete/ACDefs.DATA");
CopyTree("/Linux","/Distro/Linux"); //You can leave this out.
MkDir("/Distro/Tmp");
MkDir("/Distro/Tmp/ScrnShots");
DirMk("/Distro/Tmp");
DirMk("/Distro/Tmp/ScrnShots");
ISO9660ISO(out_iso_filename,"/Distro/*",,"/Distro" BOOT_DIR_KERNEL_BIN_C);
//If you want $LK,"RedSea",A="FI:::/Doc/RedSea.DD"$ filesystem, use this instead but make it ISO.C.
+4 -4
View File
@@ -2,9 +2,9 @@ U0 InstallDrv(U8 drv_let)
{
U8 *st;
ExePrint("CopyTree(\"::/\",\"%C:/\");",drv_let);
ExePrint("MkDir(\"%C:/Tmp\");",drv_let);
ExePrint("MkDir(\"%C:/Tmp/ScrnShots\");",drv_let);
ExePrint("MkDir(\"%C:/Home\");",drv_let);
ExePrint("DirMk(\"%C:/Tmp\");",drv_let);
ExePrint("DirMk(\"%C:/Tmp/ScrnShots\");",drv_let);
ExePrint("DirMk(\"%C:/Home\");",drv_let);
st=MStrPrint("%C:/Home/DoDistro.HC.Z",drv_let);
if (!FileFind(st))
@@ -20,7 +20,7 @@ U0 InstallDrv(U8 drv_let)
Bool VMPrtDsk(CTask *task,CATARep *ata_drv)
{
if (ata_drv) {
XTalkWait(task,"PrtDsk(,0.5,0.5);\nC\np%d\nY",ata_drv->num);
XTalkWait(task,"DskPrt(,0.5,0.5);\nC\np%d\nY",ata_drv->num);
return TRUE;
} else
return FALSE;
+2 -2
View File
@@ -1661,8 +1661,8 @@ U0 OSTestSuite()
TS("HeapLogSizeRep"); XTalkWait(task,"HeapLogSizeRep;Sleep(750);\n");
TS("CPURep"); if (mp_cnt>1)
XTalkWait(task,"CPURep(TRUE);Sleep(750);\n");
TS("ChkDsk"); if (DrvIsWritable(':'))
XTalkWait(task,"ChkDsk;Sleep(750);\n");
TS("DskChk"); if (DrvIsWritable(':'))
XTalkWait(task,"DskChk;Sleep(750);\n");
TS("DrvView"); if (DrvIsWritable(':')) {
XTalkWait(task,"DrvView;\n");
Sleep(750);
+1 -1
View File
@@ -34,7 +34,7 @@ if (!ins_reg.registered)
WallPaperInit;
if (DrvIsWritable)
MkDir("/Tmp"); //Good to have a Tmp
DirMk("/Tmp"); //Good to have a Tmp
Option(OPTf_WARN_PAREN,OFF);
Option(OPTf_WARN_DUP_TYPES,OFF);