TempleOSCDV4.12.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:47:56 +02:00
1 parent 93ca216483
commit b84bbff6db
381 files changed
+18356 -18798

No files matched your search

+112 -112
View File
@@ -6,12 +6,12 @@ class CCDVDUserData //Create DVD
short_dir_blks,long_dir_blks;
};
I64 DVDFileCreate2(CFile *out_file,CDirEntry *tempde,CISO1DirEntry *tempi,
CISO1DirEntry *tempi2,I64 *_cur_blk,CDirEntry *parent,Bool write,
I64 DVDFileCreate2(CFile *out_file,CDirEntry *tmpde,CISO1DirEntry *tmpi,
CISO1DirEntry *tmpi2,I64 *_cur_blk,CDirEntry *parent,Bool write,
U8 *stage2_filename,I64 *_stage2_blk)
{
CCDVDUserData *tempc;
CDirEntry *tempde1,*tempde2;
CCDVDUserData *tmpc;
CDirEntry *tmpde1,*tmpde2;
CFile *in_file;
U8 *buf=MAlloc(DVD_BLK_SIZE),*ptr1,*ptr2;
CISO1DirEntry *dir_blk_buf =CAlloc(DVD_BLK_SIZE*128),
@@ -20,12 +20,12 @@ I64 DVDFileCreate2(CFile *out_file,CDirEntry *tempde,CISO1DirEntry *tempi,
*de2=dir_blk_buf2,*de12;
I64 i,n;
tempc=parent->user_data;
tmpc=parent->user_data;
de->len=sizeof(CISO1DirEntry)-1;
de->ext_attr_len=0;
FillU16Palindrome(&de->vol_seq_num,1);
Date2ISO1(&de->date,tempde->datetime);
Date2ISO1(&de->date,tmpde->datetime);
de->flags=ISO1_ATTR_DIR;
de->name_len=1;
de->name=0;
@@ -34,8 +34,8 @@ I64 DVDFileCreate2(CFile *out_file,CDirEntry *tempde,CISO1DirEntry *tempi,
de->len=sizeof(CISO1DirEntry)-1;
de->ext_attr_len=0;
FillU32Palindrome(&de->loc,tempc->loc);
FillU32Palindrome(&de->size,tempc->short_dir_blks*DVD_BLK_SIZE);
FillU32Palindrome(&de->loc,tmpc->loc);
FillU32Palindrome(&de->size,tmpc->short_dir_blks*DVD_BLK_SIZE);
FillU16Palindrome(&de->vol_seq_num,1);
Date2ISO1(&de->date,parent->datetime);
de->flags=ISO1_ATTR_DIR;
@@ -47,7 +47,7 @@ I64 DVDFileCreate2(CFile *out_file,CDirEntry *tempde,CISO1DirEntry *tempi,
de2->len=sizeof(CISO1DirEntry)-1;
de2->ext_attr_len=0;
FillU16Palindrome(&de2->vol_seq_num,1);
Date2ISO1(&de2->date,tempde->datetime);
Date2ISO1(&de2->date,tmpde->datetime);
de2->flags=ISO1_ATTR_DIR;
de2->name_len=1;
de2->name=0;
@@ -56,8 +56,8 @@ I64 DVDFileCreate2(CFile *out_file,CDirEntry *tempde,CISO1DirEntry *tempi,
de2->len=sizeof(CISO1DirEntry)-1;
de2->ext_attr_len=0;
FillU32Palindrome(&de2->loc,tempc->loc+tempc->short_dir_blks);
FillU32Palindrome(&de2->size,tempc->long_dir_blks*DVD_BLK_SIZE);
FillU32Palindrome(&de2->loc,tmpc->loc+tmpc->short_dir_blks);
FillU32Palindrome(&de2->size,tmpc->long_dir_blks*DVD_BLK_SIZE);
FillU16Palindrome(&de2->vol_seq_num,1);
Date2ISO1(&de2->date,parent->datetime);
de2->flags=ISO1_ATTR_DIR;
@@ -66,49 +66,49 @@ I64 DVDFileCreate2(CFile *out_file,CDirEntry *tempde,CISO1DirEntry *tempi,
de2->len+=de2->name_len;
de2(U8 *)+=de2->len;
tempde1=tempde->sub;
while (tempde1) {
tempde2=tempde1->next;
if (!write) tempde1->user_data=CAlloc(sizeof(CCDVDUserData));
tmpde1=tmpde->sub;
while (tmpde1) {
tmpde2=tmpde1->next;
if (!write) tmpde1->user_data=CAlloc(sizeof(CCDVDUserData));
de1=de;
de12=de2;
if (tempde1->attr & RS_ATTR_DIR) {
n=DVDFileCreate2(out_file,tempde1,de,de2,_cur_blk,
tempde,write,stage2_filename,_stage2_blk);
if (tmpde1->attr & RS_ATTR_DIR) {
n=DVDFileCreate2(out_file,tmpde1,de,de2,_cur_blk,
tmpde,write,stage2_filename,_stage2_blk);
de(U8 *)+=sizeof(CISO1DirEntry)-1+n;
de2(U8 *)+=sizeof(CISO1DirEntry)-1+n<<1;
} else {
tempc=tempde1->user_data;
tmpc=tmpde1->user_data;
de->len=sizeof(CISO1DirEntry)-1;
de->ext_attr_len=0;
FillU32Palindrome(&de->loc,*_cur_blk);
tempc->loc=*_cur_blk;
tmpc->loc=*_cur_blk;
if (write) {
if (stage2_filename && !StrCmp(tempde1->full_name,stage2_filename)) {
if (stage2_filename && !StrCmp(tmpde1->full_name,stage2_filename)) {
"$$RED$$!!! Boot Stage 2 !!!$$FG$$\n";
if (_stage2_blk) *_stage2_blk=*_cur_blk;
}
"%X:%s\n",*_cur_blk,tempde1->full_name;
"%X:%s\n",*_cur_blk,tmpde1->full_name;
}
FillU32Palindrome(&de->size,tempde1->size);
FillU32Palindrome(&de->size,tmpde1->size);
FillU16Palindrome(&de->vol_seq_num,1);
Date2ISO1(&de->date,tempde1->datetime);
Date2ISO1(&de->date,tmpde1->datetime);
de->flags=0;
de->name_len=StrLen(tempde1->name);
StrCpy(&de->name,tempde1->name);
de->name_len=StrLen(tmpde1->name);
StrCpy(&de->name,tmpde1->name);
de->len=de->len+de->name_len;
de(U8 *)+=de->len;
de2->len=sizeof(CISO1DirEntry)-1;
de2->ext_attr_len=0;
FillU32Palindrome(&de2->loc,*_cur_blk);
FillU32Palindrome(&de2->size,tempde1->size);
FillU32Palindrome(&de2->size,tmpde1->size);
FillU16Palindrome(&de2->vol_seq_num,1);
Date2ISO1(&de2->date,tempde1->datetime);
Date2ISO1(&de2->date,tmpde1->datetime);
de2->flags=0;
de2->name_len=StrLen(tempde1->name)<<1;
de2->name_len=StrLen(tmpde1->name)<<1;
ptr1=&de2->name;
ptr2=&tempde1->name;
ptr2=&tmpde1->name;
for (i=0;i<de2->name_len;i=i+2) {
ptr1++;
*ptr1++=*ptr2++;
@@ -116,7 +116,7 @@ I64 DVDFileCreate2(CFile *out_file,CDirEntry *tempde,CISO1DirEntry *tempi,
de2->len+=de2->name_len;
de2(U8 *)+=de2->len;
in_file=FOpen(tempde1->full_name,"r");
in_file=FOpen(tmpde1->full_name,"r");
for (i=0;i<(FSize(in_file)+DVD_BLK_SIZE-1)/DVD_BLK_SIZE;i++) {
n=4;
if ((i+1)<<2>(FSize(in_file)+BLK_SIZE-1)>>BLK_SIZE_BITS) {
@@ -151,66 +151,66 @@ I64 DVDFileCreate2(CFile *out_file,CDirEntry *tempde,CISO1DirEntry *tempi,
MemCpy(de2,buf,i);
de2(U8 *)+=i;
}
tempde1=tempde2;
tmpde1=tmpde2;
}
tempc=tempde->user_data;
tmpc=tmpde->user_data;
tempi->len=sizeof(CISO1DirEntry)-1;
tempi->ext_attr_len=0;
tempi->flags=ISO1_ATTR_DIR;
if (!tempde->name[0]) {
tempi->name_len=1;
tempi->name=1;
tmpi->len=sizeof(CISO1DirEntry)-1;
tmpi->ext_attr_len=0;
tmpi->flags=ISO1_ATTR_DIR;
if (!tmpde->name[0]) {
tmpi->name_len=1;
tmpi->name=1;
} else {
tempi->name_len=StrLen(tempde->name);
StrCpy(&tempi->name,tempde->name);
tmpi->name_len=StrLen(tmpde->name);
StrCpy(&tmpi->name,tmpde->name);
}
tempi->len+=tempi->name_len;
tmpi->len+=tmpi->name_len;
n=de(U8 *)+1-dir_blk_buf(U8 *);
n=(n+DVD_BLK_SIZE-1)/DVD_BLK_SIZE;
FillU32Palindrome(&tempi->size,n*DVD_BLK_SIZE);
FillU32Palindrome(&tempi->loc,*_cur_blk);
tempc->short_dir_blks=n;
tempc->loc=*_cur_blk;
FillU32Palindrome(&tmpi->size,n*DVD_BLK_SIZE);
FillU32Palindrome(&tmpi->loc,*_cur_blk);
tmpc->short_dir_blks=n;
tmpc->loc=*_cur_blk;
FillU32Palindrome(&dir_blk_buf->size,n*DVD_BLK_SIZE);
FillU32Palindrome(&dir_blk_buf->loc,*_cur_blk);
FillU16Palindrome(&tempi->vol_seq_num,1);
Date2ISO1(&tempi->date,tempde->datetime);
FillU16Palindrome(&tmpi->vol_seq_num,1);
Date2ISO1(&tmpi->date,tmpde->datetime);
if (write)
"%X:%s\n",*_cur_blk,tempde->full_name;
"%X:%s\n",*_cur_blk,tmpde->full_name;
if (write)
FWBlks(out_file,dir_blk_buf,*_cur_blk<<2,n<<2);
*_cur_blk+=n;
tempi2->len=sizeof(CISO1DirEntry)-1;
tempi2->ext_attr_len=0;
tempi2->flags=ISO1_ATTR_DIR;
if (!tempde->name[0]) {
tempi2->name_len=1;
tempi->name=1;
tmpi2->len=sizeof(CISO1DirEntry)-1;
tmpi2->ext_attr_len=0;
tmpi2->flags=ISO1_ATTR_DIR;
if (!tmpde->name[0]) {
tmpi2->name_len=1;
tmpi->name=1;
} else {
tempi2->name_len=StrLen(tempde->name)<<1;
ptr1=&tempi2->name;
ptr2=&tempde->name;
for (i=0;i<tempi2->name_len;i=i+2) {
tmpi2->name_len=StrLen(tmpde->name)<<1;
ptr1=&tmpi2->name;
ptr2=&tmpde->name;
for (i=0;i<tmpi2->name_len;i=i+2) {
ptr1++;
*ptr1++=*ptr2++;
}
}
tempi2->len+=tempi2->name_len;
tmpi2->len+=tmpi2->name_len;
n=de2(U8 *)+1-dir_blk_buf2(U8 *);
n=(n+DVD_BLK_SIZE-1)/DVD_BLK_SIZE;
FillU32Palindrome(&tempi2->size,n*DVD_BLK_SIZE);
FillU32Palindrome(&tempi2->loc,*_cur_blk);
tempc->long_dir_blks=n;
FillU32Palindrome(&tmpi2->size,n*DVD_BLK_SIZE);
FillU32Palindrome(&tmpi2->loc,*_cur_blk);
tmpc->long_dir_blks=n;
FillU32Palindrome(&dir_blk_buf2->size,n*DVD_BLK_SIZE);
FillU32Palindrome(&dir_blk_buf2->loc,*_cur_blk);
FillU16Palindrome(&tempi2->vol_seq_num,1);
Date2ISO1(&tempi2->date,tempde->datetime);
FillU16Palindrome(&tmpi2->vol_seq_num,1);
Date2ISO1(&tmpi2->date,tmpde->datetime);
if (write)
"%X:%s\n",*_cur_blk,tempde->full_name;
"%X:%s\n",*_cur_blk,tmpde->full_name;
if (write)
FWBlks(out_file,dir_blk_buf2,*_cur_blk<<2,n<<2);
*_cur_blk+=n;
@@ -218,26 +218,26 @@ I64 DVDFileCreate2(CFile *out_file,CDirEntry *tempde,CISO1DirEntry *tempi,
Free(dir_blk_buf);
Free(dir_blk_buf2);
Free(buf);
return tempi->name_len;
return tmpi->name_len;
}
I64 DVDTableLen(CDirEntry *tempde,I64 *size1,I64 *size2,I64 cur_depth)
I64 DVDTableLen(CDirEntry *tmpde,I64 *size1,I64 *size2,I64 cur_depth)
{//Returns depth
CDirEntry *tempde1=tempde->sub;
CDirEntry *tmpde1=tmpde->sub;
I64 max_depth=cur_depth,i;
while (tempde1) {
if (tempde1->attr & RS_ATTR_DIR) {
*size1+=sizeof(CISO1PathEntry)-2+ (StrLen(tempde1->name)+1)&-0x2;
*size2+=sizeof(CISO1PathEntry)-2+StrLen(tempde1->name)<<1;
i=DVDTableLen(tempde1,size1,size2,cur_depth+1);
while (tmpde1) {
if (tmpde1->attr & RS_ATTR_DIR) {
*size1+=sizeof(CISO1PathEntry)-2+ (StrLen(tmpde1->name)+1)&-0x2;
*size2+=sizeof(CISO1PathEntry)-2+StrLen(tmpde1->name)<<1;
i=DVDTableLen(tmpde1,size1,size2,cur_depth+1);
if (i>max_depth) max_depth=i;
}
tempde1=tempde1->next;
tmpde1=tmpde1->next;
}
return max_depth;
}
U0 DVDFillPathTable(CDirEntry *tempde,
U0 DVDFillPathTable(CDirEntry *tmpde,
CISO1PathEntry **_itabbuf,CISO1PathEntry **_itabbuf2,
I64 parent_entry_num,Bool big_endian,I64 *first_free,
I64 cur_level,I64 output_level)
@@ -245,59 +245,59 @@ U0 DVDFillPathTable(CDirEntry *tempde,
U8 *ptr1,*ptr2;
I64 i;
CISO1PathEntry *tabbuf=*_itabbuf,*tabbuf2=*_itabbuf2;
CDirEntry *tempde1=tempde->sub,*tempde2;
CCDVDUserData *tempc;
CDirEntry *tmpde1=tmpde->sub,*tmpde2;
CCDVDUserData *tmpc;
if (cur_level==output_level) {
while (tempde1) {
if (tempde1->attr & RS_ATTR_DIR) {
tempc=tempde1->user_data;
tempc->path_entry_num=*first_free;
tabbuf->name_len=StrLen(tempde1->name);
while (tmpde1) {
if (tmpde1->attr & RS_ATTR_DIR) {
tmpc=tmpde1->user_data;
tmpc->path_entry_num=*first_free;
tabbuf->name_len=StrLen(tmpde1->name);
if (big_endian) {
tabbuf->blk=EndianU32(tempc->loc);
tabbuf->blk=EndianU32(tmpc->loc);
tabbuf->parent_entry_num=EndianU16(parent_entry_num);
} else {
tabbuf->blk=tempc->loc;
tabbuf->blk=tmpc->loc;
tabbuf->parent_entry_num=parent_entry_num;
}
StrCpy(&tabbuf->name,tempde1->name);
StrCpy(&tabbuf->name,tmpde1->name);
tabbuf(U8 *)+=sizeof(CISO1PathEntry)-2+
(StrLen(tempde1->name)+1) & -0x2;
(StrLen(tmpde1->name)+1) & -0x2;
tabbuf2->name_len=StrLen(tempde1->name)<<1;
tabbuf2->name_len=StrLen(tmpde1->name)<<1;
if (big_endian) {
tabbuf2->blk=EndianU32(tempc->loc+tempc->short_dir_blks);
tabbuf2->blk=EndianU32(tmpc->loc+tmpc->short_dir_blks);
tabbuf2->parent_entry_num=EndianU16(parent_entry_num);
} else {
tabbuf2->blk=tempc->loc+tempc->short_dir_blks;
tabbuf2->blk=tmpc->loc+tmpc->short_dir_blks;
tabbuf2->parent_entry_num=parent_entry_num;
}
ptr1=&tabbuf2->name;
ptr2=&tempde1->name;
ptr2=&tmpde1->name;
for (i=0;i<tabbuf2->name_len;i=i+2) {
ptr1++;
*ptr1++=*ptr2++;
}
tabbuf2(U8 *)+=sizeof(CISO1PathEntry)-2+
StrLen(tempde1->name)<<1;
StrLen(tmpde1->name)<<1;
*first_free+=1;
}
tempde1=tempde1->next;
tmpde1=tmpde1->next;
}
*_itabbuf=tabbuf;
*_itabbuf2=tabbuf2;
}
tempde1=tempde->sub;
while (tempde1) {
tempde2=tempde1->next;
if (tempde1->attr & RS_ATTR_DIR) {
tempc=tempde1->user_data;
DVDFillPathTable(tempde1,_itabbuf,_itabbuf2,tempc->path_entry_num,
tmpde1=tmpde->sub;
while (tmpde1) {
tmpde2=tmpde1->next;
if (tmpde1->attr & RS_ATTR_DIR) {
tmpc=tmpde1->user_data;
DVDFillPathTable(tmpde1,_itabbuf,_itabbuf2,tmpc->path_entry_num,
big_endian,first_free,cur_level+1,output_level);
}
tempde1=tempde2;
tmpde1=tmpde2;
}
}
@@ -320,8 +320,8 @@ public I64 ISO9660ISO(U8 *_filename=NULL,U8 *src_files_find_mask,
*zero_buf=CAlloc(DVD_BLK_SIZE);
CISO1PathEntry *tabbuf=NULL,*tabbuf2=NULL,*itabbuf,*itabbuf2;
CFile *out_file=NULL;
CISO1DirEntry *tempi;
CCDVDUserData *tempc;
CISO1DirEntry *tmpi;
CCDVDUserData *tmpc;
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
@@ -339,8 +339,8 @@ public I64 ISO9660ISO(U8 *_filename=NULL,U8 *src_files_find_mask,
headdir->sub=FilesFind(src_files_find_mask,fuf_flags);
headdir->datetime=Now;
headdir->user_data=CAlloc(sizeof(CCDVDUserData));
tempc=headdir->user_data;
tempc->path_entry_num=1;
tmpc=headdir->user_data;
tmpc->path_entry_num=1;
cur_blk=20<<2>>2;
if (stage2_filename) //preboot and bootloader
@@ -419,14 +419,14 @@ public I64 ISO9660ISO(U8 *_filename=NULL,U8 *src_files_find_mask,
tabbuf=CAlloc(tabsize*DVD_BLK_SIZE);
iso_pri->type_l_path_table=cur_blk;
tabbuf->name_len=2; //Fill-in adam entry
tempi=&iso_pri->root_dir_record;
tabbuf->blk=tempi->loc.little;
tmpi=&iso_pri->root_dir_record;
tabbuf->blk=tmpi->loc.little;
tabbuf->parent_entry_num=1;
tabbuf2=CAlloc(tabsize2*DVD_BLK_SIZE);
iso_sup->type_l_path_table=cur_blk+tabsize;
tabbuf2->name_len=2; //Fill-in adam entry
tempi=&iso_sup->root_dir_record;
tabbuf2->blk=tempi->loc.little;
tmpi=&iso_sup->root_dir_record;
tabbuf2->blk=tmpi->loc.little;
tabbuf2->parent_entry_num=1;
itabbuf=tabbuf+1;
itabbuf2=tabbuf2+1;
@@ -443,14 +443,14 @@ public I64 ISO9660ISO(U8 *_filename=NULL,U8 *src_files_find_mask,
MemSet(tabbuf,0,tabsize*DVD_BLK_SIZE);
iso_pri->type_m_path_table=EndianU32(cur_blk);
tabbuf->name_len=2; //Fill-in adam entry
tempi=&iso_pri->root_dir_record;
tabbuf->blk=tempi->loc.big;
tmpi=&iso_pri->root_dir_record;
tabbuf->blk=tmpi->loc.big;
tabbuf->parent_entry_num=EndianU16(1);
MemSet(tabbuf2,0,tabsize2*DVD_BLK_SIZE);
iso_sup->type_m_path_table=EndianU32(cur_blk+tabsize);
tabbuf2->name_len=2; //Fill-in adam entry
tempi=&iso_sup->root_dir_record;
tabbuf2->blk=tempi->loc.big;
tmpi=&iso_sup->root_dir_record;
tabbuf2->blk=tmpi->loc.big;
tabbuf2->parent_entry_num=EndianU16(1);
itabbuf=tabbuf+1;
itabbuf2=tabbuf2+1;
+12 -12
View File
@@ -108,18 +108,18 @@ U0 RedSeaISO9660(U8 *iso_filename,U8 drv_let,I64 stage2_blk=0,I64 stage2_size=0)
Free(iso_term);
}
I64 RedSeaISOPass1(CDirEntry *tempde)
I64 RedSeaISOPass1(CDirEntry *tmpde)
{
I64 dir_entry_cnt=3+LinkedLstCnt(tempde),res=0;
while (tempde) {
if (tempde->attr & RS_ATTR_DIR) {
if (tempde->sub)
res+=RedSeaISOPass1(tempde->sub);
I64 dir_entry_cnt=3+LinkedLstCnt(tmpde),res=0;
while (tmpde) {
if (tmpde->attr & RS_ATTR_DIR) {
if (tmpde->sub)
res+=RedSeaISOPass1(tmpde->sub);
else
res+=BLK_SIZE; //Empty dir
} else
res+=CeilU64(tempde->size,BLK_SIZE);
tempde=tempde->next;
res+=CeilU64(tmpde->size,BLK_SIZE);
tmpde=tmpde->next;
}
res+=CeilU64(dir_entry_cnt<<6,BLK_SIZE); //Size in bytes
#assert CDIR_SIZE==64
@@ -129,7 +129,7 @@ public I64 RedSeaISO(U8 *_iso_filename=NULL,U8 *_src_dir,
U8 *_stage2_filename=NULL)
{//See $LK,"::/Misc/DoDistro.HC"$. Must be ISO.C
I64 i,res,root_cnt,root_dir_blks,bitmap_blks,bitmap_blks1;
CDirEntry *tempde,de;
CDirEntry *tmpde,de;
U8 buf[STR_LEN],*iso_filename,*src_dir,*stage2_filename;
CDrv *dv=DrvMakeFreeSlot(DrvNextFreeLet('Q')); //First $LK,"BDT_ISO_FILE_WRITE",A="MN:BDT_ISO_FILE_WRITE"$
CBlkDev *bd=BlkDevNextFreeSlot(dv->drv_let,BDT_ISO_FILE_WRITE);
@@ -147,10 +147,10 @@ public I64 RedSeaISO(U8 *_iso_filename=NULL,U8 *_src_dir,
StrCpy(stage2_filename+3,stage2_filename+i);
} else
stage2_filename=NULL;
tempde=FilesFind(src_dir,FUF_RECURSE);
root_cnt=LinkedLstCnt(tempde)+3;
tmpde=FilesFind(src_dir,FUF_RECURSE);
root_cnt=LinkedLstCnt(tmpde)+3;
root_dir_blks=CeilU64(root_cnt<<6,BLK_SIZE)>>BLK_SIZE_BITS;
if (res=RedSeaISOPass1(tempde)>>BLK_SIZE_BITS) {
if (res=RedSeaISOPass1(tmpde)>>BLK_SIZE_BITS) {
bd->drv_offset=19<<2+(DVD_BLK_SIZE*2+DVD_BOOT_LOADER_SIZE)/BLK_SIZE;
bitmap_blks=1;
do {
+17 -17
View File
@@ -219,17 +219,17 @@ Bool DiffSub(CDoc *doc,I64 *_df_flags,I64 j1_lo,I64 j1_hi,I64 j2_lo,I64 j2_hi,
Bool DiffBins(CDoc *doc1,CDoc *doc2)
{
CDocBin *tempb1=doc1->bin_head.next,
*tempb2=doc2->bin_head.next;
CDocBin *tmpb1=doc1->bin_head.next,
*tmpb2=doc2->bin_head.next;
if (tempb1->last->last->num!=tempb2->last->last->num)
if (tmpb1->last->last->num!=tmpb2->last->last->num)
return TRUE;
while (tempb1!=&doc1->bin_head) {
if (tempb1->size!=tempb2->size ||
MemCmp(tempb1->data,tempb2->data,tempb1->size))
while (tmpb1!=&doc1->bin_head) {
if (tmpb1->size!=tmpb2->size ||
MemCmp(tmpb1->data,tmpb2->data,tmpb1->size))
return TRUE;
tempb1=tempb1->next;
tempb2=tempb2->next;
tmpb1=tmpb1->next;
tmpb2=tmpb2->next;
}
return FALSE;
}
@@ -323,24 +323,24 @@ public U0 ZipRep(U8 *files_find_mask="/*",U8 *fu_flags=NULL,
//Dft is just src files. (Used to spot
//src files with redundancy in them.)
I64 i=0,cnt,size,fuf_flags=0;
CDirEntry *tempde,*tempde1,**sort_buf;
CDirEntry *tmpde,*tmpde1,**sort_buf;
U8 *buf;
CArcCompress *arc;
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+F+S");
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
cnt=FileCnt(tempde);
tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
cnt=FileCnt(tmpde);
sort_buf=MAlloc(sizeof(CDirEntry *)*cnt);
while (tempde) {
sort_buf[i++]=tempde;
buf=FileRead(tempde->full_name,&size);
while (tmpde) {
sort_buf[i++]=tmpde;
buf=FileRead(tmpde->full_name,&size);
if (just_text_not_graphics)
size=StrLen(buf);
arc=CompressBuf(buf,size);
Free(buf);
tempde->user_data(F64)=100.0*arc->compressed_size/arc->expanded_size;
tmpde->user_data(F64)=100.0*arc->compressed_size/arc->expanded_size;
Free(arc);
tempde=tempde->next;
tmpde=tmpde->next;
}
QSortI64(sort_buf,cnt,&ZRepCompare);
for (i=0;i<cnt;i++) {
@@ -349,5 +349,5 @@ public U0 ZipRep(U8 *files_find_mask="/*",U8 *fu_flags=NULL,
'\n';
}
Free(sort_buf);
DirTreeDel(tempde1);
DirTreeDel(tmpde1);
}
+4 -4
View File
@@ -333,10 +333,10 @@ public U0 DocBMP(CDoc *doc=NULL,U8 *filename,Bool dither_probability=FALSE,
DCDel(dc);
}
#help_index "Graphics/Windows BMP Files;Graphics/Screen"
public I64 BMPScreenCapture(U8 *filename,I64 bits=4,Bool include_zoom=TRUE)
{//Capture screen as BMP file.
CDC *dc=DCScreenCapture(include_zoom);
#help_index "Graphics/Windows BMP Files;Graphics/Scrn"
public I64 BMPScrnCapture(U8 *filename,I64 bits=4,Bool include_zoom=TRUE)
{//Capture scrn as BMP file.
CDC *dc=DCScrnCapture(include_zoom);
I64 size=BMPWrite(filename,dc,bits);
DCDel(dc);
return size;
+6 -6
View File
@@ -161,21 +161,21 @@ before or after "dd" are label characters.
"+la"=only checks for label chars after.
*/
I64 cnt=0,fuf_flags=0;
CDirEntry *tempde,*tempde1;
CDirEntry *tmpde,*tmpde1;
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+i+f+F+T");
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
if (fuf_flags&~(FUG_FILES_FIND|FUF_IGNORE|FUF_ALL|
FUF_WHOLE_LABELS|FUF_WHOLE_LABELS_BEFORE|FUF_WHOLE_LABELS_AFTER))
throw('FUF');
LBEqu(&fuf_flags,FUf_REPLACE,replace_text);
tempde=tempde1=FilesFind(files_find_mask,fuf_flags&FUG_FILES_FIND);
tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags&FUG_FILES_FIND);
fuf_flags&=FUF_ALL|FUF_REPLACE|FUF_IGNORE|FUF_WHOLE_LABELS|
FUF_WHOLE_LABELS_BEFORE|FUF_WHOLE_LABELS_AFTER;
while (tempde && !Bt(&fuf_flags,FUf_CANCEL)) {
cnt+=FindFile(needle_str,tempde->full_name,&fuf_flags,replace_text);
tempde=tempde->next;
while (tmpde && !Bt(&fuf_flags,FUf_CANCEL)) {
cnt+=FindFile(needle_str,tmpde->full_name,&fuf_flags,replace_text);
tmpde=tmpde->next;
}
DirTreeDel(tempde1);
DirTreeDel(tmpde1);
return cnt;
}
+41 -41
View File
@@ -25,19 +25,19 @@ CHeapLogHash *heaplog_head=NULL;
U0 HeapLogMAlloc(U8 *addr)
{
CHeapLog *temphl;
CHeapLog *tmphl;
I64 i;
if (MHeapCtrl(addr)==heaplog_hc_watched) {
temphl=MAlloc(sizeof(CHeapLog),heaplog_hc);
temphl->addr=addr;
tmphl=MAlloc(sizeof(CHeapLog),heaplog_hc);
tmphl->addr=addr;
for (i=0;i<HL_CALLER_DEPTH;i++)
temphl->caller[i]=Caller(i+2);
tmphl->caller[i]=Caller(i+2);
i=addr>>3 &(HL_HASH_SIZE-1);
PUSHFD
CLI
while (LBts(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0))
PAUSE
QueIns(temphl,heaplog_head[i].last);
QueIns(tmphl,heaplog_head[i].last);
LBtr(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0);
POPFD
}
@@ -46,7 +46,7 @@ U0 HeapLogMAlloc(U8 *addr)
U0 HeapLogFree(U8 *addr)
{
I64 i;
CHeapLog *temphl;
CHeapLog *tmphl;
if (!addr) return;
if (MHeapCtrl(addr)==heaplog_hc_watched) {
i=addr>>3 &(HL_HASH_SIZE-1);
@@ -54,16 +54,16 @@ U0 HeapLogFree(U8 *addr)
CLI
while (LBts(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0))
PAUSE
temphl=heaplog_head[i].next;
while (temphl!=&heaplog_head[i]) {
if (addr==temphl->addr) {
QueRem(temphl);
tmphl=heaplog_head[i].next;
while (tmphl!=&heaplog_head[i]) {
if (addr==tmphl->addr) {
QueRem(tmphl);
LBtr(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0);
POPFD
Free(temphl);
Free(tmphl);
return;
}
temphl=temphl->next;
tmphl=tmphl->next;
}
LBtr(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0);
POPFD
@@ -115,7 +115,7 @@ public Bool HeapLog(Bool val=ON,CTask *task=NULL)
public U0 HeapLogAddrRep(Bool leave_it=OFF)
{//Call $LK,"HeapLog",A="MN:HeapLog"$() first and collect data.
I64 i,j,total=0;
CHeapLog *temphl,hl;
CHeapLog *tmphl,hl;
if (!LBtr(&sys_semas[SYS_SEMA_HEAPLOG_ACTIVE],0)) {
"HeapLog Not Active\n";
return;
@@ -124,16 +124,16 @@ public U0 HeapLogAddrRep(Bool leave_it=OFF)
while (LBts(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0))
PAUSE
for (i=0;i<HL_HASH_SIZE;i++) {
temphl=heaplog_head[i].next;
while (temphl!=&heaplog_head[i]) {
tmphl=heaplog_head[i].next;
while (tmphl!=&heaplog_head[i]) {
//Take snapshot in case modified. (while we work)
MemCpy(&hl,temphl,sizeof(CHeapLog));
MemCpy(&hl,tmphl,sizeof(CHeapLog));
"$$PURPLE$$%08X$$FG$$ %08X",MSize(hl.addr),hl.addr;
for (j=0;j<HL_CALLER_DEPTH;j++)
" %P",hl.caller[j];
'\n';
total+=MSize(hl.addr);
temphl=hl.next;
tmphl=hl.next;
}
}
LBtr(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0);
@@ -146,7 +146,7 @@ public U0 HeapLogAddrRep(Bool leave_it=OFF)
public U0 HeapLogSizeRep(Bool leave_it=OFF)
{//Call $LK,"HeapLog",A="MN:HeapLog"$() first and collect data.
I64 i,j,k,total=0;
CHeapLog *temphla,hla,*temphls,*temphls1;
CHeapLog *tmphla,hla,*tmphls,*tmphls1;
CHeapLogHash *size_head;
if (!LBtr(&sys_semas[SYS_SEMA_HEAPLOG_ACTIVE],0)) {
"HeapLog Not Active\n";
@@ -161,45 +161,45 @@ public U0 HeapLogSizeRep(Bool leave_it=OFF)
while (LBts(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0))
PAUSE
for (i=0;i<HL_HASH_SIZE;i++) {
temphla=heaplog_head[i].next;
while (temphla!=&heaplog_head[i]) {
tmphla=heaplog_head[i].next;
while (tmphla!=&heaplog_head[i]) {
//Take snapshot in case modified. (while we work)
MemCpy(&hla,temphla,sizeof(CHeapLog));
MemCpy(&hla,tmphla,sizeof(CHeapLog));
k=(MSize(hla.addr)>>3+hla.caller[0])&(HL_HASH_SIZE-1);
temphls=size_head[k].next;
while (temphls!=&size_head[k]) {
if (MSize(hla.addr)==temphls->size) {
tmphls=size_head[k].next;
while (tmphls!=&size_head[k]) {
if (MSize(hla.addr)==tmphls->size) {
for (j=0;j<HL_CALLER_DEPTH;j++)
if (hla.caller[j]!=temphls->caller[j])
if (hla.caller[j]!=tmphls->caller[j])
goto hl_next;
temphls->cnt++;
tmphls->cnt++;
goto hl_found;
}
hl_next:
temphls=temphls->next;
tmphls=tmphls->next;
}
temphls=MAlloc(sizeof(CHeapLog),heaplog_hc);
MemCpy(temphls,&hla,sizeof(CHeapLog));
temphls->cnt=1;
temphls->size=MSize(hla.addr);
QueIns(temphls,size_head[k].last);
tmphls=MAlloc(sizeof(CHeapLog),heaplog_hc);
MemCpy(tmphls,&hla,sizeof(CHeapLog));
tmphls->cnt=1;
tmphls->size=MSize(hla.addr);
QueIns(tmphls,size_head[k].last);
hl_found:
temphla=hla.next;
tmphla=hla.next;
}
}
LBtr(&sys_semas[SYS_SEMA_HEAPLOG_LOCK],0);
for (i=0;i<HL_HASH_SIZE;i++) {
temphls=size_head[i].next;
while (temphls!=&size_head[i]) {
temphls1=temphls->next;
"%08X*%08X=%08X",temphls->size,temphls->cnt,temphls->size*temphls->cnt;
tmphls=size_head[i].next;
while (tmphls!=&size_head[i]) {
tmphls1=tmphls->next;
"%08X*%08X=%08X",tmphls->size,tmphls->cnt,tmphls->size*tmphls->cnt;
for (j=0;j<HL_CALLER_DEPTH;j++)
" %P",temphls->caller[j];
" %P",tmphls->caller[j];
'\n';
total+=temphls->size*temphls->cnt;
Free(temphls);
temphls=temphls1;
total+=tmphls->size*tmphls->cnt;
Free(tmphls);
tmphls=tmphls1;
}
}
Free(size_head);
+42 -42
View File
@@ -1,107 +1,107 @@
#help_index "Cmd Line (Typically)"
I64 LineRep1(CDirEntry *tempde)
I64 LineRep1(CDirEntry *tmpde)
{
CDoc *doc;
I64 res=0,i;
while (tempde) {
while (tmpde) {
i=0;
if (tempde->attr&RS_ATTR_DIR)
i=LineRep1(tempde->sub);
if (tmpde->attr&RS_ATTR_DIR)
i=LineRep1(tmpde->sub);
else {
doc=DocRead(tempde->full_name);
doc=DocRead(tmpde->full_name);
if (doc->head.next!=doc)
i=doc->head.last->y+2;
DocDel(doc);
}
tempde->user_data=i;
tmpde->user_data=i;
res+=i;
tempde=tempde->next;
tmpde=tmpde->next;
}
return res;
}
U0 LineRep2(CDoc *doc,CDirEntry *tempde)
U0 LineRep2(CDoc *doc,CDirEntry *tmpde)
{
while (tempde) {
if (tempde->attr&RS_ATTR_DIR) {
DocPrint(doc,"%8,d $$TR+C,\"%s\"$$\n$$ID,2$$",tempde->user_data,tempde->name);
LineRep2(doc,tempde->sub);
while (tmpde) {
if (tmpde->attr&RS_ATTR_DIR) {
DocPrint(doc,"%8,d $$TR+C,\"%s\"$$\n$$ID,2$$",tmpde->user_data,tmpde->name);
LineRep2(doc,tmpde->sub);
DocPrint(doc,"$$ID,-2$$");
} else
DocPrint(doc,"%8,d $$LK,\"%s\",A=\"FI:%s\"$$\n",
tempde->user_data,tempde->name,tempde->full_name);
tempde=tempde->next;
tmpde->user_data,tmpde->name,tmpde->full_name);
tmpde=tmpde->next;
}
}
public I64 LineRep(U8 *files_find_mask="/*",U8 *fu_flags=NULL)
{//Source line-of-code count report.
I64 fuf_flags=0,res=0;
CDoc *doc=DocNew;
CDirEntry *tempde1=NULL;
CDirEntry *tmpde1=NULL;
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+S");
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
if (tempde1=FilesFind(files_find_mask,fuf_flags)) {
res=LineRep1(tempde1);
if (tmpde1=FilesFind(files_find_mask,fuf_flags)) {
res=LineRep1(tmpde1);
DocPrint(doc,"%8,d $$TR+C,\"%s\"$$\n$$ID,2$$",res,files_find_mask);
LineRep2(doc,tempde1);
LineRep2(doc,tmpde1);
DocPrint(doc,"$$ID,-2$$");
DirTreeDel(tempde1);
DirTreeDel(tmpde1);
}
DocInsDoc(DocPut,doc);
DocDel(doc);
return res;
}
I64 SizeRep1(CDirEntry *tempde,I64 *_fuf_flags)
I64 SizeRep1(CDirEntry *tmpde,I64 *_fuf_flags)
{
I64 res=0,i;
U8 buf[BLK_SIZE];
CDrv *dv;
while (tempde) {
if (tempde->attr&RS_ATTR_DIR)
i=SizeRep1(tempde->sub,_fuf_flags);
else if ((i=tempde->size) && Bt(_fuf_flags,FUf_EXPAND) &&
FileAttr(tempde->name)&RS_ATTR_COMPRESSED) {
dv=Let2Drv(*tempde->full_name);
RBlks(dv,buf,Cluster2Blk(dv,tempde->cluster),1);
while (tmpde) {
if (tmpde->attr&RS_ATTR_DIR)
i=SizeRep1(tmpde->sub,_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);
i=(&buf)(CArcCompress *)->expanded_size;
}
tempde->user_data=i;
tmpde->user_data=i;
res+=i;
tempde=tempde->next;
tmpde=tmpde->next;
}
return res;
}
U0 SizeRep2(CDoc *doc,CDirEntry *tempde)
U0 SizeRep2(CDoc *doc,CDirEntry *tmpde)
{
while (tempde) {
if (tempde->attr&RS_ATTR_DIR) {
while (tmpde) {
if (tmpde->attr&RS_ATTR_DIR) {
DocPrint(doc,"%10,d $$TR+C,\"%s\"$$\n$$ID,2$$",
tempde->user_data,tempde->name);
SizeRep2(doc,tempde->sub);
tmpde->user_data,tmpde->name);
SizeRep2(doc,tmpde->sub);
DocPrint(doc,"$$ID,-2$$");
} else {
DocPrint(doc,"%10,d ",tempde->user_data);
DocPrint(doc,"%10,d ",tmpde->user_data);
DocPrint(doc,"$$LK,\"%s\",A=\"FI:%s\"$$\n",
tempde->name,tempde->full_name);
tmpde->name,tmpde->full_name);
}
tempde=tempde->next;
tmpde=tmpde->next;
}
}
public I64 SizeRep(U8 *files_find_mask="/*",U8 *fu_flags=NULL)
{//Report file sizes. "+x" for expanded size of compressed files.
I64 fuf_flags=0,res=0;
CDoc *doc=DocNew;
CDirEntry *tempde1=NULL;
CDirEntry *tmpde1=NULL;
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
if (tempde1=FilesFind(files_find_mask,fuf_flags&FUG_FILES_FIND)) {
if (tmpde1=FilesFind(files_find_mask,fuf_flags&FUG_FILES_FIND)) {
fuf_flags&=FUF_EXPAND;
res=SizeRep1(tempde1,&fuf_flags);
res=SizeRep1(tmpde1,&fuf_flags);
DocPrint(doc,"%10,d $$TR+C,\"%s\"$$\n$$ID,2$$",res,files_find_mask);
SizeRep2(doc,tempde1);
SizeRep2(doc,tmpde1);
DocPrint(doc,"$$ID,-2$$");
DirTreeDel(tempde1);
DirTreeDel(tmpde1);
}
DocInsDoc(DocPut,doc);
DocDel(doc);
+8 -8
View File
@@ -16,7 +16,7 @@ I64 LinkChkDoc(CDoc *doc,I64 *_fuf_flags)
old_doc=DocPut;
DocLock(old_doc);
Fs->put_doc=doc;
found=DocLinkChk(st);
found=DocLinkChk(doc,st);
Fs->put_doc=old_doc;
DocUnlock(old_doc);
if (!found) {
@@ -47,14 +47,14 @@ I64 LinkChkFile(U8 *filename,I64 *_fuf_flags)
public I64 LinkChk(U8 *files_find_mask="/*",U8 *fu_flags=NULL)
{//Check documents for broken file links.
I64 fuf_flags=0,res=0;
CDirEntry *tempde,*tempde1;
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+T+f+F+O");
CDirEntry *tmpde,*tmpde1;
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+$$+f+F+O");
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
while (tempde && !Bt(&fuf_flags,FUf_CANCEL)) {
res+=LinkChkFile(tempde->full_name,&fuf_flags);
tempde=tempde->next;
tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
while (tmpde && !Bt(&fuf_flags,FUf_CANCEL)) {
res+=LinkChkFile(tmpde->full_name,&fuf_flags);
tmpde=tmpde->next;
}
DirTreeDel(tempde1);
DirTreeDel(tmpde1);
return res;
}
+20 -20
View File
@@ -14,46 +14,46 @@ I64 PenBrushesSize()
return res;
}
I64 ScreenZoomTablesSize()
I64 ScrnZoomTablesSize()
{
I64 res=0,i;
for (i=1;i<=GR_MAX_SCREEN_ZOOM;i++)
res+=MSize2(gr.screen_zoom_tables[i]);
for (i=1;i<=GR_MAX_SCRN_ZOOM;i++)
res+=MSize2(gr.scrn_zoom_tables[i]);
return res;
}
I64 TaskStkSize(CTask *task)
{
CTaskStk *temps=task->stk;
CTaskStk *tmps=task->stk;
I64 res=0;
while (temps) {
res+=MSize2(temps);
temps=temps->next_stk;
while (tmps) {
res+=MSize2(tmps);
tmps=tmps->next_stk;
}
return res;
}
I64 TaskQueSize(CTask *task)
{
CSrvCmd *tempc,*tempc1;
CSrvCmd *tmpc,*tmpc1;
I64 res=0;
PUSHFD
CLI
while (LBts(&task->srv_ctrl.flags,SVCRf_LOCKED))
PAUSE
tempc1=&task->srv_ctrl.next_waiting;
tempc=tempc1->next;
while (tempc!=tempc1) {
res+=MSize2(tempc)+MSize2(tempc->aux_str);
tempc=tempc->next;
tmpc1=&task->srv_ctrl.next_waiting;
tmpc=tmpc1->next;
while (tmpc!=tmpc1) {
res+=MSize2(tmpc)+MSize2(tmpc->aux_str);
tmpc=tmpc->next;
}
tempc1=&task->srv_ctrl.next_done;
tempc=tempc1->next;
while (tempc!=tempc1) {
res+=MSize2(tempc)+MSize2(tempc->aux_str);
tempc=tempc->next;
tmpc1=&task->srv_ctrl.next_done;
tmpc=tmpc1->next;
while (tmpc!=tmpc1) {
res+=MSize2(tmpc)+MSize2(tmpc->aux_str);
tmpc=tmpc->next;
}
LBtr(&task->srv_ctrl.flags,SVCRf_LOCKED);
@@ -136,7 +136,7 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
if (task==sys_winmgr_task) {
"gr.pen_brushes\t:%010X\n",PenBrushesSize;
"gr_screen_zoom_tbles:%010X\n",ScreenZoomTablesSize;
"gr_scrn_zoom_tbles:%010X\n",ScrnZoomTablesSize;
} else if (task==adam_task) {
j=0;k=0;m=0;n=0;
for (i=0;i<mp_cnt;i++) {
@@ -182,7 +182,7 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
"gr.dc1\t\t:%010X\n",DCSize(gr.dc1);
"gr.dc2\t\t:%010X\n",DCSize(gr.dc2);
"gr.dc_cache\t\t:%010X\n",DCSize(gr.dc_cache);
"gr.screen_image\t:%010X\n",DCSize(gr.screen_image);
"gr.scrn_image\t:%010X\n",DCSize(gr.scrn_image);
"gr.zoomed_dc\t:%010X\n",DCSize(gr.zoomed_dc);
}
"$$ID,-2$$";
+26 -26
View File
@@ -10,28 +10,28 @@ CDirEntry MGFind(CDirEntry *needle_entry,CDirEntry *haystack_lst)
return NULL;
}
U0 Merge2(CDirEntry *tempde1,CDirEntry *tempde2,I64 *_fuf_flags,I64 *_df_flags)
U0 Merge2(CDirEntry *tmpde1,CDirEntry *tmpde2,I64 *_fuf_flags,I64 *_df_flags)
{
CDirEntry *tempde;
while (tempde1 && !(*_df_flags & DF_ABORT_ALL_FILES)) {
tempde=MGFind(tempde1,tempde2);
if (!tempde)
"$$BROWN$$Does Not Exist:%s$$FG$$\n",tempde1->full_name;
CDirEntry *tmpde;
while (tmpde1 && !(*_df_flags & DF_ABORT_ALL_FILES)) {
tmpde=MGFind(tmpde1,tmpde2);
if (!tmpde)
"$$BROWN$$Does Not Exist:%s$$FG$$\n",tmpde1->full_name;
else {
if (tempde1->attr & RS_ATTR_DIR)
Merge2(tempde1->sub,tempde->sub,_fuf_flags,_df_flags);
if (tmpde1->attr & RS_ATTR_DIR)
Merge2(tmpde1->sub,tmpde->sub,_fuf_flags,_df_flags);
else {
if (AbsI64(tempde1->datetime-tempde->datetime)>CDATE_FREQ*2) {//slop
"%s",tempde1->full_name;
if (AbsI64(tmpde1->datetime-tmpde->datetime)>CDATE_FREQ*2) {//slop
"%s",tmpde1->full_name;
'\n';
if (Bt(_fuf_flags,FUf_DIFF)) {
if (FilesFindMatch(tempde1->full_name,FILEMASK_TXT))
Diff(tempde->full_name,tempde1->full_name,_df_flags);
if (FilesFindMatch(tmpde1->full_name,FILEMASK_TXT))
Diff(tmpde->full_name,tmpde1->full_name,_df_flags);
}
}
}
}
tempde1=tempde1->next;
tmpde1=tmpde1->next;
}
}
public U0 Merge(U8 *dst_files_find_mask="/*",U8 *src_files_find_mask="/*",
@@ -44,18 +44,18 @@ merge changes from source files into
destination files.
*/
I64 df_flags=0,fuf_flags=0;
CDirEntry *tempde1=NULL,*tempde2=NULL;
CDirEntry *tmpde1=NULL,*tmpde2=NULL;
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
if (fuf_flags&~(FUG_FILES_FIND|FUF_DIFF))
throw('FUF');
PrintWarn("This is based strictly on file dates.\n");
tempde1=FilesFind(src_files_find_mask,fuf_flags&FUG_FILES_FIND);
tempde2=FilesFind(dst_files_find_mask,fuf_flags&FUG_FILES_FIND);
tmpde1=FilesFind(src_files_find_mask,fuf_flags&FUG_FILES_FIND);
tmpde2=FilesFind(dst_files_find_mask,fuf_flags&FUG_FILES_FIND);
fuf_flags&=FUF_DIFF;
Merge2(tempde1,tempde2,&fuf_flags,&df_flags);
DirTreeDel(tempde1);
DirTreeDel(tempde2);
Merge2(tmpde1,tmpde2,&fuf_flags,&df_flags);
DirTreeDel(tmpde1);
DirTreeDel(tmpde2);
}
#help_index "Utils;Cmd Line (Typically)"
@@ -63,15 +63,15 @@ destination files.
public U0 NewFiles(U8 *files_find_mask="/*",CDate cdt=0,U8 *fu_flags=NULL)
{//Report files newer than a certain date.
I64 fuf_flags=0;
CDirEntry *tempde,*tempde1;
CDirEntry *tmpde,*tmpde1;
if (!cdt) cdt=sys_compile_time;
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+F");
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
while (tempde) {
if (tempde->datetime>cdt)
"%s\n",tempde->full_name;
tempde=tempde->next;
tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
while (tmpde) {
if (tmpde->datetime>cdt)
"%s\n",tmpde->full_name;
tmpde=tmpde->next;
}
DirTreeDel(tempde1);
DirTreeDel(tmpde1);
}
+1 -1
View File
@@ -27,7 +27,7 @@ U0 ProfTimerInt(CTask *task)
public U0 Prof(I64 depth=0,I64 cpu_num=0)
{/*Start collecting profiler statistics.
Profilers report where time is spent
by sampling RIP during the $TX,"1000 Hz",D="DD_JIFFY_HZ"$
by sampling RIP during the $TX,"1000Hz",D="DD_JIFFY_HZ"$
timer interrupt.
Do a $LK,"ProfRep",A="MN:ProfRep"$(), (profiler report)
+18 -18
View File
@@ -105,15 +105,15 @@ public I64 Words(U8 *files_find_mask="*",U32 *chars_bmp=chars_bmp_alpha,
{//Break file into list of not-unique words.
I64 fuf_flags=0,res=0;
CDoc *doc_out=DocNew;
CDirEntry *tempde,*tempde1;
CDirEntry *tmpde,*tmpde1;
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F+T");
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
while (tempde) {
res+=DocWordsFile(doc_out,tempde->full_name,chars_bmp);
tempde=tempde->next;
tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
while (tmpde) {
res+=DocWordsFile(doc_out,tmpde->full_name,chars_bmp);
tmpde=tmpde->next;
}
DirTreeDel(tempde1);
DirTreeDel(tmpde1);
DocInsDoc(NULL,doc_out);
DocDel(doc_out);
return res;
@@ -140,16 +140,16 @@ I64 LongLinesFile(U8 *filename,I64 cols)
public I64 LongLines(U8 *files_find_mask="*",I64 cols=80,U8 *fu_flags=NULL)
{//Report files with lines of too many cols.
I64 res=0,fuf_flags=0;
CDirEntry *tempde,*tempde1;
CDirEntry *tmpde,*tmpde1;
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F+S");
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
while (tempde) {
if (LongLinesFile(tempde->full_name,cols))
tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
while (tmpde) {
if (LongLinesFile(tmpde->full_name,cols))
res++;
tempde=tempde->next;
tmpde=tmpde->next;
}
DirTreeDel(tempde1);
DirTreeDel(tmpde1);
return res;
}
@@ -187,15 +187,15 @@ public U0 SU(U8 *files_find_mask,I64 suf_flags,U8 *fu_flags=NULL,
//or removing trailing spaces on lines.
//See $LK,"SUF Flags",A="MN:SUF_SINGLE_SPACE"$.
I64 fuf_flags=0;
CDirEntry *tempde,*tempde1;
CDirEntry *tmpde,*tmpde1;
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+f+F+T");
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
while (tempde) {
SUFile(tempde->full_name,suf_flags,indent_scale_factor);
tempde=tempde->next;
tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
while (tmpde) {
SUFile(tmpde->full_name,suf_flags,indent_scale_factor);
tmpde=tmpde->next;
}
DirTreeDel(tempde1);
DirTreeDel(tmpde1);
}
public U0 S2T(U8 *files_find_mask,U8 *fu_flags=NULL)
+7 -7
View File
@@ -4,16 +4,16 @@ public U0 ToDolDoc(U8 *files_find_mask,U8 *fu_flags=NULL)
{//Convert text file to $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.DD"$ by making double $$'s.
CDoc *doc;
I64 fuf_flags=0;
CDirEntry *tempde,*tempde1;
CDirEntry *tmpde,*tmpde1;
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F");
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
while (tempde) {
"%s\n",tempde->full_name;
doc=DocRead(tempde->full_name,DOCF_PLAIN_TEXT|DOCF_DBL_DOLLARS);
tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
while (tmpde) {
"%s\n",tmpde->full_name;
doc=DocRead(tmpde->full_name,DOCF_PLAIN_TEXT|DOCF_DBL_DOLLARS);
DocWrite(doc);
DocDel(doc);
tempde=tempde->next;
tmpde=tmpde->next;
}
DirTreeDel(tempde1);
DirTreeDel(tmpde1);
}