TempleOSCD_150720.ISO
This commit is contained in:
1 parent
401601816c
commit
f8c05f98f4
554 files changed
+26046
-24853
No files matched your search
+28
-22
@@ -97,20 +97,24 @@ U0 DiffSelect(CDoc *doc,I64 *_df_flags,I64 j1_lo,I64 j1_hi,
|
||||
use_file1=FALSE;
|
||||
break;
|
||||
case DS_REMAINDER_1:
|
||||
*_df_flags=*_df_flags&~DF_REMAINDER_ALL_FILE2|DF_REMAINDER_ALL_FILE1|DF_NO_MORE_PMTS_THIS_FILE;
|
||||
*_df_flags=*_df_flags&~DF_REMAINDER_ALL_FILE2|
|
||||
DF_REMAINDER_ALL_FILE1|DF_NO_MORE_PMTS_THIS_FILE;
|
||||
break;
|
||||
case DS_REMAINDER_2:
|
||||
*_df_flags=*_df_flags&~DF_REMAINDER_ALL_FILE1|DF_REMAINDER_ALL_FILE2|DF_NO_MORE_PMTS_THIS_FILE;
|
||||
*_df_flags=*_df_flags&~DF_REMAINDER_ALL_FILE1|
|
||||
DF_REMAINDER_ALL_FILE2|DF_NO_MORE_PMTS_THIS_FILE;
|
||||
break;
|
||||
case DS_ABORT_FILE:
|
||||
*_df_flags|=DF_DONT_MODIFIED|DF_ABORT_FILE|DF_NO_MORE_PMTS_THIS_FILE;
|
||||
*_df_flags|=DF_DONT_MODIFIED|DF_ABORT_FILE|
|
||||
DF_NO_MORE_PMTS_THIS_FILE;
|
||||
break;
|
||||
default:
|
||||
*_df_flags|=DF_DONT_MODIFIED|DF_ABORT_ALL_FILES|DF_NO_MORE_PMTS_THIS_FILE;
|
||||
*_df_flags|=DF_DONT_MODIFIED|DF_ABORT_ALL_FILES|
|
||||
DF_NO_MORE_PMTS_THIS_FILE;
|
||||
}
|
||||
}
|
||||
if (*_df_flags & DF_REMAINDER_ALL_FILE2 &&
|
||||
!(*_df_flags & (DF_DONT_MODIFIED|DF_REMAINDER_ALL_FILE1)))
|
||||
!(*_df_flags & (DF_DONT_MODIFIED|DF_REMAINDER_ALL_FILE1)))
|
||||
use_file1=FALSE;
|
||||
if (!use_file1) {
|
||||
*_df_flags|=DF_MODIFIED;
|
||||
@@ -141,13 +145,13 @@ Bool DiffSub(CDoc *doc,I64 *_df_flags,I64 j1_lo,I64 j1_hi,I64 j2_lo,I64 j2_hi,
|
||||
CDocEntry **doc_unsorted1,CDocEntry **doc_unsorted2)
|
||||
{
|
||||
I64 i,i1=0,i2=0,i2b,j1,j2,n,
|
||||
best_j1,best_j2,best_score=0,score;
|
||||
best_j1,best_j2,best_score=0,score;
|
||||
Bool result=FALSE;
|
||||
|
||||
if (j1_lo>=j1_hi || j2_lo>=j2_hi) {
|
||||
if (j1_lo<j1_hi || j2_lo<j2_hi) {
|
||||
DiffSelect(doc,_df_flags,j1_lo,j1_hi,j2_lo,j2_hi,cnt1,cnt2,
|
||||
doc_unsorted1,doc_unsorted2);
|
||||
doc_unsorted1,doc_unsorted2);
|
||||
return TRUE;
|
||||
} else
|
||||
return FALSE;
|
||||
@@ -157,7 +161,7 @@ Bool DiffSub(CDoc *doc,I64 *_df_flags,I64 j1_lo,I64 j1_hi,I64 j2_lo,I64 j2_hi,
|
||||
while (i1<cnt1 && i2<cnt2) {
|
||||
if (!(j1_lo<=doc_sorted1[i1]->user_data<j1_hi)) //user_data is the new y
|
||||
i1++;
|
||||
else if (!(j2_lo<=doc_sorted2[i2]->user_data<j2_hi)) //user_data is the new y
|
||||
else if (!(j2_lo<=doc_sorted2[i2]->user_data<j2_hi)) //user_data is new y
|
||||
i2++;
|
||||
else {
|
||||
i=StrCmp(doc_sorted1[i1]->tag,doc_sorted2[i2]->tag);
|
||||
@@ -177,7 +181,7 @@ Bool DiffSub(CDoc *doc,I64 *_df_flags,I64 j1_lo,I64 j1_hi,I64 j2_lo,I64 j2_hi,
|
||||
n=j2_hi-j2;
|
||||
while (score<n) {
|
||||
if (!StrCmp(doc_unsorted1[j1+score]->tag,
|
||||
doc_unsorted2[j2+score]->tag))
|
||||
doc_unsorted2[j2+score]->tag))
|
||||
score++;
|
||||
else
|
||||
break;
|
||||
@@ -199,14 +203,15 @@ Bool DiffSub(CDoc *doc,I64 *_df_flags,I64 j1_lo,I64 j1_hi,I64 j2_lo,I64 j2_hi,
|
||||
}
|
||||
if (!best_score) {
|
||||
DiffSelect(doc,_df_flags,j1_lo,j1_hi,j2_lo,j2_hi,cnt1,cnt2,
|
||||
doc_unsorted1,doc_unsorted2);
|
||||
doc_unsorted1,doc_unsorted2);
|
||||
return TRUE;
|
||||
} else {
|
||||
if (DiffSub(doc,_df_flags,j1_lo,best_j1,j2_lo,best_j2,cnt1,cnt2,
|
||||
doc_sorted1,doc_sorted2,doc_unsorted1,doc_unsorted2))
|
||||
doc_sorted1,doc_sorted2,doc_unsorted1,doc_unsorted2))
|
||||
result=TRUE;
|
||||
if (DiffSub(doc,_df_flags,best_j1+best_score,j1_hi,best_j2+best_score,j2_hi,cnt1,cnt2,
|
||||
doc_sorted1,doc_sorted2,doc_unsorted1,doc_unsorted2))
|
||||
if (DiffSub(doc,_df_flags,best_j1+best_score,j1_hi,best_j2+best_score,
|
||||
j2_hi,cnt1,cnt2,
|
||||
doc_sorted1,doc_sorted2,doc_unsorted1,doc_unsorted2))
|
||||
result=TRUE;
|
||||
return result;
|
||||
}
|
||||
@@ -215,12 +220,13 @@ 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_root.next,
|
||||
*tempb2=doc2->bin_root.next;
|
||||
*tempb2=doc2->bin_root.next;
|
||||
|
||||
if (tempb1->last->last->num!=tempb2->last->last->num)
|
||||
return TRUE;
|
||||
while (tempb1!=&doc1->bin_root) {
|
||||
if (tempb1->size!=tempb2->size || MemCmp(tempb1->data,tempb2->data,tempb1->size))
|
||||
if (tempb1->size!=tempb2->size ||
|
||||
MemCmp(tempb1->data,tempb2->data,tempb1->size))
|
||||
return TRUE;
|
||||
tempb1=tempb1->next;
|
||||
tempb2=tempb2->next;
|
||||
@@ -232,7 +238,7 @@ public Bool Diff(U8 *dst_file,U8 *src_file,I64 *_df_flags=NULL)
|
||||
{//Report differences between two files and merge differences
|
||||
//from src_file to dst_file. Don't use _df_flags arg. (Used by $LK,"Merge",A="MN:Merge"$().)
|
||||
CDoc *doc1=DocRead(dst_file,DOCF_PLAIN_TEXT_WITH_TABS|DOCF_NO_CURSOR),
|
||||
*doc2=DocRead(src_file,DOCF_PLAIN_TEXT_WITH_TABS|DOCF_NO_CURSOR);
|
||||
*doc2=DocRead(src_file,DOCF_PLAIN_TEXT_WITH_TABS|DOCF_NO_CURSOR);
|
||||
CDocEntry *doc_e,**doc_sorted1,**doc_sorted2,**doc_unsorted1,**doc_unsorted2;
|
||||
I64 i,cnt1=0,cnt2=0,df_flags;
|
||||
Bool result=FALSE;
|
||||
@@ -286,7 +292,7 @@ public Bool Diff(U8 *dst_file,U8 *src_file,I64 *_df_flags=NULL)
|
||||
QSortI64(doc_sorted2,cnt2,&DiffEntriesCompare);
|
||||
|
||||
result=DiffSub(doc1,&df_flags,0,cnt1,0,cnt2,cnt1,cnt2,
|
||||
doc_sorted1,doc_sorted2,doc_unsorted1,doc_unsorted2);
|
||||
doc_sorted1,doc_sorted2,doc_unsorted1,doc_unsorted2);
|
||||
if (df_flags&DF_MODIFIED && !(df_flags&DF_DONT_MODIFIED))
|
||||
DocWrite(doc1);
|
||||
|
||||
@@ -315,11 +321,11 @@ public U0 ZipRep(U8 *files_find_mask="/*",U8 *fu_flags=NULL,
|
||||
Bool just_text_not_graphics=TRUE)
|
||||
{//Report file compressibility.
|
||||
//Dft is just src files. (Used to spot
|
||||
//src files with redundancy in them.)
|
||||
//src files with redundancy in them.)
|
||||
I64 i=0,cnt,size,fuf_flags=0;
|
||||
CDirEntry *tempde,*tempde1,**sort_buf;
|
||||
U8 *buf;
|
||||
CArcCompress *ac;
|
||||
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);
|
||||
@@ -330,10 +336,10 @@ public U0 ZipRep(U8 *files_find_mask="/*",U8 *fu_flags=NULL,
|
||||
buf=FileRead(tempde->full_name,&size);
|
||||
if (just_text_not_graphics)
|
||||
size=StrLen(buf);
|
||||
ac=CompressBuf(buf,size);
|
||||
arc=CompressBuf(buf,size);
|
||||
Free(buf);
|
||||
tempde->user_data(F64)=100.0*ac->compressed_size/ac->expanded_size;
|
||||
Free(ac);
|
||||
tempde->user_data(F64)=100.0*arc->compressed_size/arc->expanded_size;
|
||||
Free(arc);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
QSortI64(sort_buf,cnt,&ZRepCompare);
|
||||
|
||||
+112
-90
@@ -1,12 +1,14 @@
|
||||
#help_index "Graphics/Windows BMP Files"
|
||||
|
||||
#define NUM_BMP_COLORS 16
|
||||
|
||||
class CFileBMP
|
||||
{
|
||||
U16 type;
|
||||
U32 file_size;
|
||||
U32 reserved;
|
||||
U32 data_offset;
|
||||
|
||||
|
||||
U32 header_size;
|
||||
U32 width;
|
||||
U32 height;
|
||||
@@ -21,26 +23,34 @@ class CFileBMP
|
||||
|
||||
U0 end;
|
||||
|
||||
CBGR palette[16];
|
||||
CBGR24 palette[NUM_BMP_COLORS];
|
||||
};
|
||||
|
||||
public CFileBMP *BMP4To(CDC *dc)
|
||||
{//To Windows 4-bit BMP.
|
||||
U8 *src,*ptr;
|
||||
I64 x,y,w=dc->width>>1,
|
||||
size=sizeof(CFileBMP)+dc->width*dc->height>>1;
|
||||
CFileBMP *r =CAlloc(size);
|
||||
r->type ='BM';
|
||||
r->planes =1;
|
||||
r->file_size =size;
|
||||
r->data_offset=sizeof(CFileBMP);
|
||||
r->header_size=offset(CFileBMP.end)-offset(CFileBMP.header_size);
|
||||
r->width =dc->width;
|
||||
r->height =dc->height;
|
||||
r->bit_cnt =4;
|
||||
r->image_size =dc->width*dc->height>>1;
|
||||
GetVGAPalette4(r->palette);
|
||||
ptr=r(U8 *)+r->data_offset;
|
||||
CBGR48 palette[NUM_COLORS];
|
||||
I64 i,x,y,w=dc->width>>1,
|
||||
size=sizeof(CFileBMP)+dc->width*dc->height>>1;
|
||||
CFileBMP *bmp =CAlloc(size);
|
||||
bmp->type ='BM';
|
||||
bmp->planes =1;
|
||||
bmp->file_size =size;
|
||||
bmp->data_offset=sizeof(CFileBMP);
|
||||
bmp->header_size=offset(CFileBMP.end)-offset(CFileBMP.header_size);
|
||||
bmp->width =dc->width;
|
||||
bmp->height =dc->height;
|
||||
bmp->bit_cnt =4;
|
||||
bmp->image_size =dc->width*dc->height>>1;
|
||||
GrPaletteGet(palette);
|
||||
#assert NUM_COLORS==NUM_BMP_COLORS
|
||||
for (i=0;i<NUM_BMP_COLORS;i++) {
|
||||
bmp->palette[i].b=palette[i].b>>8;
|
||||
bmp->palette[i].g=palette[i].g>>8;
|
||||
bmp->palette[i].r=palette[i].r>>8;
|
||||
bmp->palette[i].pad=0;
|
||||
}
|
||||
ptr=bmp(U8 *)+bmp->data_offset;
|
||||
for (y=dc->height-1;y>=0;y--) {
|
||||
src=y*dc->width_internal+dc->body;
|
||||
for (x=0;x<w;x++) {
|
||||
@@ -49,24 +59,32 @@ public CFileBMP *BMP4To(CDC *dc)
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
return r;
|
||||
return bmp;
|
||||
}
|
||||
|
||||
public CFileBMP *BMPRLE4To(CDC *dc)
|
||||
{//To Windows RLE4 bit BMP.
|
||||
U8 *src,*ptr,*start;
|
||||
I64 x,y,w=dc->width,cnt,pattern;
|
||||
CFileBMP *r =CAlloc(sizeof(CFileBMP)+2*(dc->width+1)*dc->height);
|
||||
r->type ='BM';
|
||||
r->planes =1;
|
||||
r->data_offset=sizeof(CFileBMP);
|
||||
r->header_size=offset(CFileBMP.end)-offset(CFileBMP.header_size);
|
||||
r->width =dc->width;
|
||||
r->height =dc->height;
|
||||
r->bit_cnt =4;
|
||||
r->compression=2; //RLE4
|
||||
GetVGAPalette4(r->palette);
|
||||
start=ptr=r(U8 *)+r->data_offset;
|
||||
I64 i,x,y,w=dc->width,cnt,pattern;
|
||||
CBGR48 palette[NUM_COLORS];
|
||||
CFileBMP *bmp =CAlloc(sizeof(CFileBMP)+2*(dc->width+1)*dc->height);
|
||||
bmp->type ='BM';
|
||||
bmp->planes =1;
|
||||
bmp->data_offset=sizeof(CFileBMP);
|
||||
bmp->header_size=offset(CFileBMP.end)-offset(CFileBMP.header_size);
|
||||
bmp->width =dc->width;
|
||||
bmp->height =dc->height;
|
||||
bmp->bit_cnt =4;
|
||||
bmp->compression=2; //RLE4
|
||||
GrPaletteGet(palette);
|
||||
#assert NUM_COLORS==NUM_BMP_COLORS
|
||||
for (i=0;i<NUM_BMP_COLORS;i++) {
|
||||
bmp->palette[i].b=palette[i].b>>8;
|
||||
bmp->palette[i].g=palette[i].g>>8;
|
||||
bmp->palette[i].r=palette[i].r>>8;
|
||||
bmp->palette[i].pad=0;
|
||||
}
|
||||
start=ptr=bmp(U8 *)+bmp->data_offset;
|
||||
for (y=dc->height-1;y>=0;y--) {
|
||||
src=y*dc->width_internal+dc->body;
|
||||
x=0;
|
||||
@@ -97,28 +115,28 @@ public CFileBMP *BMPRLE4To(CDC *dc)
|
||||
}
|
||||
*ptr(U16 *)++=0;
|
||||
}
|
||||
r->image_size=ptr-start;
|
||||
r->file_size=sizeof(CFileBMP)+r->image_size;
|
||||
return r;
|
||||
bmp->image_size=ptr-start;
|
||||
bmp->file_size=sizeof(CFileBMP)+bmp->image_size;
|
||||
return bmp;
|
||||
}
|
||||
|
||||
public CFileBMP *BMP24To(CDC *dc)
|
||||
{//To Windows 24-bit BMP.
|
||||
U8 *src;
|
||||
I64 i,x,y,size=offset(CFileBMP.end)+dc->width*dc->height*sizeof(CRGB);
|
||||
CBGR *bgr;
|
||||
CFileBMP *r =CAlloc(size);
|
||||
r->type ='BM';
|
||||
r->planes =1;
|
||||
r->file_size =size;
|
||||
r->data_offset=offset(CFileBMP.end);
|
||||
r->header_size=offset(CFileBMP.end)-offset(CFileBMP.header_size);
|
||||
r->width =dc->width;
|
||||
r->height =dc->height;
|
||||
r->bit_cnt =32;
|
||||
r->image_size =dc->width*dc->height<<2;
|
||||
I64 i,x,y,size=offset(CFileBMP.end)+dc->width*dc->height*sizeof(CBGR24);
|
||||
CBGR24 *bgr;
|
||||
CFileBMP *bmp =CAlloc(size);
|
||||
bmp->type ='BM';
|
||||
bmp->planes =1;
|
||||
bmp->file_size =size;
|
||||
bmp->data_offset=offset(CFileBMP.end);
|
||||
bmp->header_size=offset(CFileBMP.end)-offset(CFileBMP.header_size);
|
||||
bmp->width =dc->width;
|
||||
bmp->height =dc->height;
|
||||
bmp->bit_cnt =32;
|
||||
bmp->image_size =dc->width*dc->height<<2;
|
||||
|
||||
bgr=r(U8 *)+r->data_offset;
|
||||
bgr=bmp(U8 *)+bmp->data_offset;
|
||||
for (y=dc->height-1;y>=0;y--) {
|
||||
src=y*dc->width_internal+dc->body;
|
||||
for (x=0;x<dc->width;x++) {
|
||||
@@ -134,48 +152,49 @@ public CFileBMP *BMP24To(CDC *dc)
|
||||
bgr(U8 *)+=4;
|
||||
}
|
||||
}
|
||||
return r;
|
||||
return bmp;
|
||||
}
|
||||
|
||||
public I64 BMPWrite(U8 *filename,CDC *dc,I64 bits=4)
|
||||
{//Window's BMP Files.
|
||||
I64 size;
|
||||
CFileBMP *r;
|
||||
CFileBMP *bmp;
|
||||
if (bits==4) {
|
||||
if (IsDotZ(filename)) //.Z compression is better than RLE
|
||||
r=BMP4To(dc);
|
||||
bmp=BMP4To(dc);
|
||||
else {
|
||||
r=BMPRLE4To(dc);
|
||||
if (r->file_size>sizeof(CFileBMP)+dc->width*dc->height>>1) {
|
||||
Free(r);
|
||||
r=BMP4To(dc);
|
||||
bmp=BMPRLE4To(dc);
|
||||
if (bmp->file_size>sizeof(CFileBMP)+dc->width*dc->height>>1) {
|
||||
Free(bmp);
|
||||
bmp=BMP4To(dc);
|
||||
}
|
||||
}
|
||||
} else if (bits==24)
|
||||
r=BMP24To(dc);
|
||||
bmp=BMP24To(dc);
|
||||
else {
|
||||
"Format Not Supported.\n";
|
||||
return 0;
|
||||
}
|
||||
size=r->file_size;
|
||||
FileWrite(filename,r,r->file_size);
|
||||
Free(r);
|
||||
size=bmp->file_size;
|
||||
FileWrite(filename,bmp,bmp->file_size);
|
||||
Free(bmp);
|
||||
return size;
|
||||
}
|
||||
|
||||
U8 *BMPPaletteNew(CFileBMP *r)
|
||||
U8 *BMPPaletteNew(CFileBMP *bmp)
|
||||
{
|
||||
I64 i,j,best,score,best_score;
|
||||
CBGR palette[16];
|
||||
U8 *result=CAlloc(16*sizeof(U8));
|
||||
GetVGAPalette4(palette);
|
||||
for (i=0;i<16;i++) {
|
||||
CBGR48 palette[NUM_COLORS];
|
||||
U8 *result=CAlloc(NUM_BMP_COLORS*sizeof(U8));
|
||||
GrPaletteGet(palette);
|
||||
#assert NUM_COLORS==NUM_BMP_COLORS
|
||||
for (i=0;i<NUM_BMP_COLORS;i++) {
|
||||
best=i;
|
||||
best_score=MAX_I64;
|
||||
for (j=0;j<16;j++) {
|
||||
score=SqrI64(r->palette[i].r-palette[j].r)+
|
||||
SqrI64(r->palette[i].g-palette[j].g)+
|
||||
SqrI64(r->palette[i].b-palette[j].b);
|
||||
for (j=0;j<NUM_BMP_COLORS;j++) {
|
||||
score=SqrI64(bmp->palette[i].r-palette[j].r>>8)+
|
||||
SqrI64(bmp->palette[i].g-palette[j].g>>8)+
|
||||
SqrI64(bmp->palette[i].b-palette[j].b>>8);
|
||||
if (score<best_score) {
|
||||
best=j;
|
||||
best_score=score;
|
||||
@@ -186,9 +205,9 @@ U8 *BMPPaletteNew(CFileBMP *r)
|
||||
return result;
|
||||
}
|
||||
|
||||
U8 ms_paint_palette[16]={0,4,2,6,1,5,3,8,7,12,10,14,9,13,11,15};
|
||||
U8 ms_paint_palette[NUM_BMP_COLORS]={0,4,2,6,1,5,3,8,7,12,10,14,9,13,11,15};
|
||||
|
||||
I64 BMP24Color(CBGR *ptr,Bool dither_probability)
|
||||
I64 BMP24Color(CBGR24 *ptr,Bool dither_probability)
|
||||
{
|
||||
I64 result,k;
|
||||
if (dither_probability) {
|
||||
@@ -216,28 +235,29 @@ I64 BMP24Color(CBGR *ptr,Bool dither_probability)
|
||||
return result;
|
||||
}
|
||||
|
||||
public CDC *BMPRead(U8 *filename,Bool dither_probability=FALSE,Bool use_ms_paint_palette=FALSE)
|
||||
public CDC *BMPRead(U8 *filename,Bool dither_probability=FALSE,
|
||||
Bool use_ms_paint_palette=FALSE)
|
||||
{//Window's BMP Files.
|
||||
I64 i,j,cnt;
|
||||
U8 *palette_map,*ptr;
|
||||
Bool rle;
|
||||
CFileBMP *r;
|
||||
CFileBMP *bmp;
|
||||
CDC *result=NULL;
|
||||
if (ptr=FileRead(filename)) {
|
||||
r=ptr;
|
||||
if (0<r->width<MAX_I32 && 0<r->height<MAX_I32) {
|
||||
result=DCNew(r->width,r->height);
|
||||
ptr+=r->data_offset;
|
||||
if (r->compression==2)
|
||||
bmp=ptr;
|
||||
if (0<bmp->width<MAX_I32 && 0<bmp->height<MAX_I32) {
|
||||
result=DCNew(bmp->width,bmp->height);
|
||||
ptr+=bmp->data_offset;
|
||||
if (bmp->compression==2)
|
||||
rle=TRUE;
|
||||
else
|
||||
rle=FALSE;
|
||||
if (use_ms_paint_palette)
|
||||
palette_map=ms_paint_palette;
|
||||
else
|
||||
palette_map=BMPPaletteNew(r);
|
||||
if (r->bit_cnt==4) {
|
||||
for (i=r->height-1;i>=0;i--)
|
||||
palette_map=BMPPaletteNew(bmp);
|
||||
if (bmp->bit_cnt==4) {
|
||||
for (i=bmp->height-1;i>=0;i--)
|
||||
if (rle) {//We don't support full RLE4, just our own subset
|
||||
j=0;
|
||||
while (cnt=*ptr++) {
|
||||
@@ -261,7 +281,7 @@ public CDC *BMPRead(U8 *filename,Bool dither_probability=FALSE,Bool use_ms_paint
|
||||
}
|
||||
ptr++;
|
||||
} else
|
||||
for (j=0;j<(r->width+7)&~7;) {
|
||||
for (j=0;j<(bmp->width+7)&~7;) {
|
||||
result->color=palette_map[*ptr&15];
|
||||
GrPlot(result,j+1,i);
|
||||
result->color=palette_map[*ptr>>4];
|
||||
@@ -271,19 +291,19 @@ public CDC *BMPRead(U8 *filename,Bool dither_probability=FALSE,Bool use_ms_paint
|
||||
}
|
||||
if (!use_ms_paint_palette)
|
||||
Free(palette_map);
|
||||
} else if (r->bit_cnt==24) {
|
||||
for (i=r->height-1;i>=0;i--) {
|
||||
for (j=0;j<r->width;j++,ptr+=3) {
|
||||
} else if (bmp->bit_cnt==24) {
|
||||
for (i=bmp->height-1;i>=0;i--) {
|
||||
for (j=0;j<bmp->width;j++,ptr+=3) {
|
||||
result->color=BMP24Color(ptr,dither_probability);
|
||||
GrPlot(result,j,i);
|
||||
}
|
||||
ptr+=r->width&3;
|
||||
ptr+=bmp->width&3;
|
||||
}
|
||||
if (!use_ms_paint_palette)
|
||||
Free(palette_map);
|
||||
} else if (r->bit_cnt>=32) {
|
||||
for (i=r->height-1;i>=0;i--)
|
||||
for (j=0;j<r->width;j++,ptr+=4) {
|
||||
} else if (bmp->bit_cnt>=32) {
|
||||
for (i=bmp->height-1;i>=0;i--)
|
||||
for (j=0;j<bmp->width;j++,ptr+=4) {
|
||||
result->color=BMP24Color(ptr,dither_probability);
|
||||
GrPlot(result,j,i);
|
||||
}
|
||||
@@ -296,13 +316,15 @@ public CDC *BMPRead(U8 *filename,Bool dither_probability=FALSE,Bool use_ms_paint
|
||||
}
|
||||
} else
|
||||
"Invalid BMP File\n";
|
||||
Free(r);
|
||||
Free(bmp);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "Graphics/Sprite;Graphics/Windows BMP Files;DolDoc/Output"
|
||||
public U0 DocBMP(CDoc *doc=NULL,U8 *filename,Bool dither_probability=FALSE,Bool use_ms_paint_palette=FALSE)
|
||||
#help_index "Graphics/Sprite;Graphics/Windows BMP Files;"\
|
||||
"DolDoc/Output;StdOut/DolDoc"
|
||||
public U0 DocBMP(CDoc *doc=NULL,U8 *filename,Bool dither_probability=FALSE,
|
||||
Bool use_ms_paint_palette=FALSE)
|
||||
{//Put a BMP file into a document as a sprite.
|
||||
CDC *dc=BMPRead(filename,dither_probability,use_ms_paint_palette);
|
||||
CSprite *elems=DC2Sprite(dc);
|
||||
@@ -312,9 +334,9 @@ public U0 DocBMP(CDoc *doc=NULL,U8 *filename,Bool dither_probability=FALSE,Bool
|
||||
}
|
||||
|
||||
#help_index "Graphics/Windows BMP Files;Graphics/Screen"
|
||||
public I64 BMPCaptureScreen(U8 *filename,I64 bits=4,Bool include_zoom=TRUE)
|
||||
public I64 BMPScreenCapture(U8 *filename,I64 bits=4,Bool include_zoom=TRUE)
|
||||
{//Capture screen as BMP file.
|
||||
CDC *dc=DCCaptureScreen(include_zoom);
|
||||
CDC *dc=DCScreenCapture(include_zoom);
|
||||
I64 size=BMPWrite(filename,dc,bits);
|
||||
DCDel(dc);
|
||||
return size;
|
||||
|
||||
+54
-44
@@ -1,34 +1,36 @@
|
||||
#help_index "Cmd Line (Typically)"
|
||||
|
||||
#define GRF_REPLACE 0
|
||||
#define GRF_SKIP 1
|
||||
#define GRF_ALL 2
|
||||
#define GRF_ED 3
|
||||
#define GRF_ABORT_FILE 4
|
||||
#define GRF_SKIP_FILE 5
|
||||
#define FND_REPLACE 0
|
||||
#define FND_SKIP 1
|
||||
#define FND_ALL 2
|
||||
#define FND_ED 3
|
||||
#define FND_ABORT_FILE 4
|
||||
#define FND_SKIP_FILE 5
|
||||
|
||||
I64 PopUpGrepMenu()
|
||||
I64 PopUpFindMenu()
|
||||
{
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
DocPrint(doc,"$$CM+LX,2,4$$$$BT,\"REPLACE\",LE=GRF_REPLACE$$"
|
||||
"$$CM+LX,22,0$$$$BT,\"SKIP\",LE=GRF_SKIP$$"
|
||||
"$$CM+LX,2,4$$$$BT,\"ALL\",LE=GRF_ALL$$"
|
||||
DocPrint(doc,"$$CM+LX,2,4$$$$BT,\"REPLACE\",LE=FND_REPLACE$$"
|
||||
"$$CM+LX,22,0$$$$BT,\"SKIP\",LE=FND_SKIP$$"
|
||||
"$$CM+LX,2,4$$$$BT,\"ALL\",LE=FND_ALL$$"
|
||||
"$$CM+LX,22,0$$$$BT,\"ABORT ALL\",LE=DOCM_CANCEL$$"
|
||||
"$$CM+LX,2,4$$$$BT,\"EDIT\",LE=GRF_ED$$"
|
||||
"$$CM+LX,22,0$$$$BT,\"ABORT FILE\",LE=GRF_ABORT_FILE$$"
|
||||
"$$CM+LX,2,4$$$$BT,\"SKIP FILE\",LE=GRF_SKIP_FILE$$\n");
|
||||
"$$CM+LX,2,4$$$$BT,\"EDIT\",LE=FND_ED$$"
|
||||
"$$CM+LX,22,0$$$$BT,\"ABORT FILE\",LE=FND_ABORT_FILE$$"
|
||||
"$$CM+LX,2,4$$$$BT,\"SKIP FILE\",LE=FND_SKIP_FILE$$\n");
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
return i;
|
||||
}
|
||||
|
||||
I64 GrepFile(U8 *needle_str,U8 *haystack_filename,I64 *_fuf_flags,U8 *replace_text)
|
||||
{
|
||||
I64 FindFile(U8 *needle_str,U8 *haystack_filename,
|
||||
I64 *_fuf_flags,U8 *replace_text)
|
||||
{//Have you confused with $LK,"FileFind",A="MN:FileFind"$()?
|
||||
Bool first_on_line,write_this_file=FALSE,cont=!Bt(_fuf_flags,FUf_CANCEL);
|
||||
U8 *src,*dst,*dst2,*name_buf=NULL;
|
||||
I64 i,j,plen,rlen,dlen,cnt=0,old_flags,ss_flags;
|
||||
CDoc *cur_l,*doc=DocRead(haystack_filename,DOCF_PLAIN_TEXT_WITH_TABS|DOCF_NO_CURSOR);
|
||||
CDoc *cur_l,*doc=DocRead(haystack_filename,
|
||||
DOCF_PLAIN_TEXT_WITH_TABS|DOCF_NO_CURSOR);
|
||||
CDocEntry *doc_e;
|
||||
|
||||
if (Bt(_fuf_flags,FUf_IGNORE))
|
||||
@@ -67,22 +69,22 @@ I64 GrepFile(U8 *needle_str,U8 *haystack_filename,I64 *_fuf_flags,U8 *replace_te
|
||||
}
|
||||
if (Bt(_fuf_flags,FUf_REPLACE)) {
|
||||
if (Bt(_fuf_flags,FUf_ALL))
|
||||
i=GRF_ALL;
|
||||
i=FND_ALL;
|
||||
else {
|
||||
i=PopUpGrepMenu;
|
||||
i=PopUpFindMenu;
|
||||
if (i<0) {
|
||||
LBts(_fuf_flags,FUf_CANCEL);
|
||||
cont=FALSE;
|
||||
write_this_file=FALSE;
|
||||
} else if (i==GRF_ALL)
|
||||
} else if (i==FND_ALL)
|
||||
LBts(_fuf_flags,FUf_ALL);
|
||||
else if (i==GRF_ABORT_FILE) {
|
||||
else if (i==FND_ABORT_FILE) {
|
||||
cont=FALSE;
|
||||
write_this_file=FALSE;
|
||||
} else if (i==GRF_SKIP_FILE)
|
||||
} else if (i==FND_SKIP_FILE)
|
||||
cont=FALSE;
|
||||
}
|
||||
if (i==GRF_REPLACE || i==GRF_ALL) {
|
||||
if (i==FND_REPLACE || i==FND_ALL) {
|
||||
dlen=StrLen(doc_e->tag);
|
||||
dst=MAlloc(dlen+1+rlen-plen);
|
||||
dst2=dst;
|
||||
@@ -106,12 +108,12 @@ I64 GrepFile(U8 *needle_str,U8 *haystack_filename,I64 *_fuf_flags,U8 *replace_te
|
||||
write_this_file=TRUE;
|
||||
} else {
|
||||
src++;
|
||||
if (i==GRF_ED) {
|
||||
if (i==FND_ED) {
|
||||
Free(name_buf);
|
||||
name_buf=StrNew(doc->filename.name);
|
||||
doc->flags&=~DOCF_NO_CURSOR;
|
||||
doc->cur_entry=doc_e;
|
||||
doc->cur_data_col=doc_e->min_col;
|
||||
doc->cur_col=doc_e->min_col;
|
||||
DocWrite(doc);
|
||||
DocDel(doc);
|
||||
"Wrote:%s\n",name_buf;
|
||||
@@ -140,7 +142,8 @@ I64 GrepFile(U8 *needle_str,U8 *haystack_filename,I64 *_fuf_flags,U8 *replace_te
|
||||
return cnt;
|
||||
}
|
||||
|
||||
public I64 Find(U8 *needle_str,U8 *files_find_mask="*",U8 *fu_flags=NULL,U8 *replace_text=NULL)
|
||||
public I64 Find(U8 *needle_str,U8 *files_find_mask="*",
|
||||
U8 *fu_flags=NULL,U8 *replace_text=NULL)
|
||||
{/*Find occurrences of a string in files.
|
||||
This does not do regular expressions.
|
||||
Anyway, it's good for searching and replacing.
|
||||
@@ -149,11 +152,11 @@ Let's say it stands for global replace ;-)
|
||||
"+r" =recurse
|
||||
"+i" =ignore case
|
||||
"+l" =whole labels only.
|
||||
This will check for a nonlabel character before
|
||||
and after. If you have a var, "dd" and don't
|
||||
want to match words like "Add", you
|
||||
set this flag and it will see that the characters
|
||||
before or after "ll" are label characters.
|
||||
This will check for a nonlabel character before
|
||||
and after. If you have a var, "dd" and don't
|
||||
want to match words like "Add", you
|
||||
set this flag and it will see that the characters
|
||||
before or after "dd" are label characters.
|
||||
"+lb"=only checks for label chars before.
|
||||
"+la"=only checks for label chars after.
|
||||
*/
|
||||
@@ -161,21 +164,24 @@ Let's say it stands for global replace ;-)
|
||||
CDirEntry *tempde,*tempde1;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+i+f+F+T");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
if (fuf_flags&~(FUG_FILES_FIND|FUF_IGNORE|FUF_ALL|FUF_WHOLE_LABELS|FUF_WHOLE_LABELS_BEFORE|FUF_WHOLE_LABELS_AFTER))
|
||||
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);
|
||||
fuf_flags&=FUF_ALL|FUF_REPLACE|FUF_IGNORE|FUF_WHOLE_LABELS|FUF_WHOLE_LABELS_BEFORE|FUF_WHOLE_LABELS_AFTER;
|
||||
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+=GrepFile(needle_str,tempde->full_name,&fuf_flags,replace_text);
|
||||
cnt+=FindFile(needle_str,tempde->full_name,&fuf_flags,replace_text);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirTreeDel(tempde1);
|
||||
return cnt;
|
||||
}
|
||||
|
||||
public I64 FileOcc(U8 *needle_str,U8 *files_find_mask="*",U8 *fu_flags="+r+i+l")
|
||||
{/*Report occurrences of a string in files.
|
||||
public I64 FileOcc(U8 *needle_str,
|
||||
U8 *files_find_mask="*",U8 *fu_flags="+r+i+l")
|
||||
{/*Silently return occurrences of a string in files.
|
||||
"+r"=recurse
|
||||
"+i"=ignore case
|
||||
"+l"=whole labels only.
|
||||
@@ -189,22 +195,22 @@ public I64 FileOcc(U8 *needle_str,U8 *files_find_mask="*",U8 *fu_flags="+r+i+l")
|
||||
return cnt;
|
||||
}
|
||||
|
||||
class CGrep
|
||||
class CFind
|
||||
{
|
||||
U8 find_text[136] fmtstr "$$DA-P,135,A=\"FIND :%s\"$$\n";
|
||||
U8 replace_text[136] fmtstr "$$DA-P,135,A=\"REPLACE :%s\"$$\n";
|
||||
U8 find_text[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"FIND :%s\"$$\n";
|
||||
U8 replace_text[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"REPLACE :%s\"$$\n";
|
||||
Bool replace fmtstr "$$CB,\"REPLACE\"$$\n";
|
||||
Bool match_case fmtstr "$$CB,\"MATCH CASE\"$$\n";
|
||||
Bool whole_labels fmtstr "$$CB,\"WHOLE LABELS\"$$\n";
|
||||
U8 filemask[136] fmtstr "$$DA-P,135,A=\"FILE MASK :%s\"$$\n";
|
||||
U8 filemask[STR_LEN] fmtstr "$$DA-P,STR_LEN-1,A=\"FILE MASK :%s\"$$\n";
|
||||
Bool recurse fmtstr "$$CB,\"RECURSE\"$$\n";
|
||||
};
|
||||
|
||||
I64 GrepWiz()
|
||||
I64 FindWiz()
|
||||
{
|
||||
CDoc *doc;
|
||||
U8 buf[32],*dir,*st;
|
||||
CGrep *g=CAlloc(sizeof(CGrep));
|
||||
CFind *g=CAlloc(sizeof(CFind));
|
||||
I64 result=0;
|
||||
g->recurse=TRUE;
|
||||
StrCpy(g->filemask,FILEMASK_TXT);
|
||||
@@ -215,7 +221,7 @@ I64 GrepWiz()
|
||||
g->match_case=doc->find_replace->match_case;
|
||||
g->whole_labels=doc->find_replace->whole_labels;
|
||||
}
|
||||
if (DocFormDo(g,,0,"$$PURPLE$$$$TX+CX,\"Find\"$$\n$$FG$$")) {
|
||||
if (DocForm(g,,0,"$$PURPLE$$$$TX+CX,\"Find\"$$\n$$FG$$")) {
|
||||
if (doc) {
|
||||
StrCpy(doc->find_replace->find_text,g->find_text);
|
||||
StrCpy(doc->find_replace->replace_text,g->replace_text);
|
||||
@@ -233,9 +239,13 @@ I64 GrepWiz()
|
||||
if (g->whole_labels)
|
||||
CatPrint(buf,"+l");
|
||||
if (g->replace)
|
||||
st=MStrPrint("\"$$$$WW+H,1$$$$\";Cd(\"%s\");Find(\"%Q\",\"%Q\",\"%Q\",\"%Q\");UserTaskCont;",dir,g->find_text,g->filemask,buf,g->replace_text);
|
||||
st=MStrPrint("\"$$$$WW+H,1$$$$\";Cd(\"%s\");"
|
||||
"Find(\"%Q\",\"%Q\",\"%Q\",\"%Q\");UserTaskCont;",
|
||||
dir,g->find_text,g->filemask,buf,g->replace_text);
|
||||
else
|
||||
st=MStrPrint("\"$$$$WW+H,1$$$$\";Cd(\"%s\");Find(\"%Q\",\"%Q\",\"%Q\");UserTaskCont;",dir,g->find_text,g->filemask,buf);
|
||||
st=MStrPrint("\"$$$$WW+H,1$$$$\";Cd(\"%s\");"
|
||||
"Find(\"%Q\",\"%Q\",\"%Q\");UserTaskCont;",
|
||||
dir,g->find_text,g->filemask,buf);
|
||||
result=PopUp(st);
|
||||
}
|
||||
Free(dir);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#help_index "Debugging/Heap"
|
||||
#help_file "::/Doc/HeapDbg"
|
||||
|
||||
#define HL_CALLER_DEPTH 4
|
||||
#define HL_HASH_SIZE 0x1000
|
||||
@@ -121,7 +122,7 @@ public U0 HeapLogRep(Bool leave_it=OFF)
|
||||
for (i=0;i<HL_HASH_SIZE;i++) {
|
||||
temphl=heaplog_root[i].next;
|
||||
while (temphl!=&heaplog_root[i]) {
|
||||
//Take snapshot in case modified. (while we work)
|
||||
//Take snapshot in case modified. (while we work)
|
||||
MemCpy(&hl,temphl,sizeof(CHeapLog));
|
||||
"$$PURPLE$$%08X$$FG$$ %08X",MSize(hl.addr),hl.addr;
|
||||
for (j=0;j<HL_CALLER_DEPTH;j++)
|
||||
|
||||
@@ -29,7 +29,7 @@ U0 LineRep2(CDoc *doc,CDirEntry *tempde)
|
||||
DocPrint(doc,"$$ID,-2$$");
|
||||
} else
|
||||
DocPrint(doc,"%8,d $$LK,\"%s\",A=\"FI:%s\"$$\n",
|
||||
tempde->user_data,tempde->name,tempde->full_name);
|
||||
tempde->user_data,tempde->name,tempde->full_name);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ I64 SizeRep1(CDirEntry *tempde,I64 *_fuf_flags)
|
||||
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) {
|
||||
FileAttr(tempde->name)&RS_ATTR_COMPRESSED) {
|
||||
dv=Let2Drv(*tempde->full_name);
|
||||
RBlks(dv,buf,Cluster2Blk(dv,tempde->cluster),1);
|
||||
i=(&buf)(CArcCompress *)->expanded_size;
|
||||
@@ -76,13 +76,14 @@ U0 SizeRep2(CDoc *doc,CDirEntry *tempde)
|
||||
{
|
||||
while (tempde) {
|
||||
if (tempde->attr&RS_ATTR_DIR) {
|
||||
DocPrint(doc,"%10,d $$TR+C,\"%s\"$$\n$$ID,2$$",tempde->user_data,tempde->name);
|
||||
DocPrint(doc,"%10,d $$TR+C,\"%s\"$$\n$$ID,2$$",
|
||||
tempde->user_data,tempde->name);
|
||||
SizeRep2(doc,tempde->sub);
|
||||
DocPrint(doc,"$$ID,-2$$");
|
||||
} else {
|
||||
DocPrint(doc,"%10,d ",tempde->user_data);
|
||||
DocPrint(doc,"$$LK,\"%s\",A=\"FI:%s\"$$\n",
|
||||
tempde->name,tempde->full_name);
|
||||
tempde->name,tempde->full_name);
|
||||
}
|
||||
tempde=tempde->next;
|
||||
}
|
||||
|
||||
+19
-17
@@ -10,7 +10,7 @@ I64 PenBrushesSize()
|
||||
I64 result=0,i;
|
||||
for (i=0;i<GR_NUM_PEN_BRUSHES;i++)
|
||||
result+=DCSize(gr.pen_brushes[i])+DCSize(gr.collision_pen_brushes[i])+
|
||||
DCSize(gr.even_pen_brushes[i])+DCSize(gr.odd_pen_brushes[i]);
|
||||
DCSize(gr.even_pen_brushes[i])+DCSize(gr.odd_pen_brushes[i]);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -70,8 +70,8 @@ I64 BlkDevsSize()
|
||||
if (bd->bd_signature==BD_SIGNATURE_VAL) {
|
||||
if (bd->type==BDT_RAM)
|
||||
"RAMDsk %C\t:%010X Unused:%010X\n",
|
||||
bd->first_drv_let,(bd->max_blk+1)<<BLK_SIZE_BITS,
|
||||
UnusedDrvSpace(bd->first_drv_let);
|
||||
bd->first_drv_let,(bd->max_blk+1)<<BLK_SIZE_BITS,
|
||||
UnusedDrvSpace(bd->first_drv_let);
|
||||
result+=MSize2(bd->dev_id_record);
|
||||
}
|
||||
}
|
||||
@@ -91,7 +91,7 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
|
||||
I64 i,j,k,m,n;
|
||||
U8 *st;
|
||||
CDoc *pdoc,*ddoc,*bdoc;
|
||||
CLex *lx;
|
||||
CCmpCtrl *cc;
|
||||
CMathODE *o;
|
||||
CCPU *c;
|
||||
CTask *task1;
|
||||
@@ -104,8 +104,8 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
|
||||
"$$GREEN$$Task:%010X$$CYAN$$ %-30ts$$FG$$\n$$ID,2$$",task,st;
|
||||
Free(st);
|
||||
"$$PURPLE$$Alloced:%010X Used:%010X$$FG$$\n",
|
||||
TaskMemAlloced(task,override_validate),
|
||||
TaskMemUsed(task,override_validate);
|
||||
TaskMemAlloced(task,override_validate),
|
||||
TaskMemUsed(task,override_validate);
|
||||
"HashTable\t:%010X\n",HashTableSize2(task->hash_table);
|
||||
|
||||
i=UnusedStk(task);
|
||||
@@ -121,10 +121,10 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
|
||||
if (bdoc=DocBorder(task))
|
||||
"BorderDoc\t:%010X\n",DocSize(bdoc);
|
||||
|
||||
lx=task->next_lex;
|
||||
while (lx!=&task->next_lex) {
|
||||
"Lex\t\t:%010X\n",LexSize(lx);
|
||||
lx=lx->next;
|
||||
cc=task->next_lex;
|
||||
while (cc!=&task->next_lex) {
|
||||
"Lex\t\t:%010X\n",CmpCtrlSize(cc);
|
||||
cc=cc->next;
|
||||
}
|
||||
|
||||
o=task->next_ode;
|
||||
@@ -167,14 +167,16 @@ Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
|
||||
"Drvs\t:%010X\n",DrvsSize;
|
||||
if (dsk.cache_base)
|
||||
"DskCache\t:%010X\n",
|
||||
MSize2(dsk.cache_base)+MSize2(dsk.cache_hash_table)+MSize2(dsk.cache_ctrl);
|
||||
MSize2(dsk.cache_base)+MSize2(dsk.cache_hash_table)+
|
||||
MSize2(dsk.cache_ctrl);
|
||||
"Clipboard\t:%010X\n",DocSize(sys_clipboard_doc);
|
||||
"AutoComplete:%010X\n",CallExtStr("AutoCompleteSize");
|
||||
"gr.to_8_bits\t:%010X\n",MSize2(gr.to_8_bits);
|
||||
"gr.to_8_colors\t:%010X\n",MSize2(gr.to_8_colors);
|
||||
"gr.text_base\t:%010X\n",MSize2(gr.text_base);
|
||||
"gr.vga_text_cache\t:%010X\n",MSize2(gr.vga_text_cache);
|
||||
"gr.win_z_buf\t:%010X\n",MSize2(gr.win_z_buf)+MSize2(gr.win_uncovered_bitmap);
|
||||
"gr.win_z_buf\t:%010X\n",MSize2(gr.win_z_buf)+
|
||||
MSize2(gr.win_uncovered_bitmap);
|
||||
"gr.dc\t\t:%010X\n",DCSize(gr.dc);
|
||||
"gr.dc1\t\t:%010X\n",DCSize(gr.dc1);
|
||||
"gr.dc2\t\t:%010X\n",DCSize(gr.dc2);
|
||||
@@ -191,7 +193,7 @@ public U0 MemRep()
|
||||
I64 i;
|
||||
CTask *task;
|
||||
CCPU *c;
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
Bool old_preempt=Preempt;
|
||||
CBinFile *bfh=sys_boot_base-sizeof(CBinFile);
|
||||
bfh(I64)+=bfh->file_size-1;
|
||||
|
||||
@@ -207,12 +209,12 @@ public U0 MemRep()
|
||||
|
||||
if (sys_data_bp) {
|
||||
"$$BLACK$$Code Heap:%010X Used:%010X$$FG$$\n",
|
||||
sys_code_bp->alloced_u8s,sys_code_bp->used_u8s;
|
||||
sys_code_bp->alloced_u8s,sys_code_bp->used_u8s;
|
||||
"$$BLACK$$Data Heap:%010X Used:%010X$$FG$$\n",
|
||||
sys_data_bp->alloced_u8s,sys_data_bp->used_u8s;
|
||||
sys_data_bp->alloced_u8s,sys_data_bp->used_u8s;
|
||||
} else
|
||||
"$$BLACK$$Code/Data Heap:%010X Used:%010X$$FG$$\n",
|
||||
sys_code_bp->alloced_u8s,sys_code_bp->used_u8s;
|
||||
sys_code_bp->alloced_u8s,sys_code_bp->used_u8s;
|
||||
|
||||
for (i=0;i<mp_cnt;i++) {
|
||||
c=&cpu_structs[i];
|
||||
@@ -229,7 +231,7 @@ public U0 MemRep()
|
||||
|
||||
"$$GREEN$$Independent Heaps$$FG$$\n$$ID,2$$";
|
||||
"$$BLACK$$dev.uncached_heap:%010X Used:%010X$$FG$$\n",
|
||||
dev.uncached_heap->bp->alloced_u8s,dev.uncached_heap->used_u8s;
|
||||
dev.uncached_heap->bp->alloced_u8s,dev.uncached_heap->used_u8s;
|
||||
"$$ID,-2$$\n";
|
||||
Preempt(old_preempt);
|
||||
}
|
||||
@@ -21,7 +21,7 @@ U0 Merge2(CDirEntry *tempde1,CDirEntry *tempde2,I64 *_fuf_flags,I64 *_df_flags)
|
||||
if (tempde1->attr & RS_ATTR_DIR)
|
||||
Merge2(tempde1->sub,tempde->sub,_fuf_flags,_df_flags);
|
||||
else {
|
||||
if (AbsI64(tempde1->datetime-tempde->datetime)>CDATE_FREQ*2) {//Filedates can shift due to conversion
|
||||
if (AbsI64(tempde1->datetime-tempde->datetime)>CDATE_FREQ*2) {//slop
|
||||
"%s",tempde1->full_name;
|
||||
'\n';
|
||||
if (Bt(_fuf_flags,FUf_DIFF)) {
|
||||
|
||||
@@ -91,7 +91,7 @@ public U0 ProfRep(I64 filter_cnt=1,Bool leave_it=OFF)
|
||||
}
|
||||
if (*last_buf && routine_total>=filter_cnt)
|
||||
"$$GREEN$$%6.2f %08X:%s\n$$FG$$",100*routine_total/total_time,
|
||||
routine_total,last_buf;
|
||||
routine_total,last_buf;
|
||||
"Total Time:%0.6fs\n",total_time/JIFFY_FREQ;
|
||||
if (leave_it) {
|
||||
cpu_structs[pf_cpu].profiler_timer_irq=&ProfTimerInt;
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
#help_index "Cmd Line (Typically)"
|
||||
|
||||
//$LK,"StrUtil",A="MN:StrUtil"$() operations on files
|
||||
|
||||
U0 SUFile(U8 *name,I64 suf_flags,F64 indent_scale_factor)
|
||||
{//String utility on a single file
|
||||
//See $LK,"SU Flags",A="MN:SUF_SINGLE_SPACE"$
|
||||
U8 *dst;
|
||||
Bool chged=FALSE;
|
||||
I64 reduced=0;
|
||||
CDoc *doc=DocRead(name,DOCF_PLAIN_TEXT_WITH_TABS | DOCF_NO_CURSOR);
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
if (doc_e->type_u8==DOCT_TEXT) {
|
||||
dst=MStrUtil(doc_e->tag,suf_flags,indent_scale_factor);
|
||||
if (StrCmp(dst,doc_e->tag)) {
|
||||
reduced+=StrLen(doc_e->tag)-StrLen(dst);
|
||||
chged=TRUE;
|
||||
Free(doc_e->tag);
|
||||
doc_e->tag=dst;
|
||||
} else
|
||||
Free(dst);
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
if (chged) {
|
||||
"Reduced %s by %d chars\n",name,reduced;
|
||||
DocWrite(doc);
|
||||
}
|
||||
DocDel(doc);
|
||||
}
|
||||
public U0 SU(U8 *files_find_mask,I64 suf_flags,U8 *fu_flags=NULL,F64 indent_scale_factor=0)
|
||||
{//Apply string utilities to files
|
||||
//You can convert spaces to tabs, for example
|
||||
//or removing trailing spaces on lines.
|
||||
//See $LK,"SUF Flags",A="MN:SUF_SINGLE_SPACE"$
|
||||
I64 fuf_flags=0;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+f+F+T");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
||||
while (tempde) {
|
||||
SUFile(tempde->full_name,suf_flags,indent_scale_factor);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirTreeDel(tempde1);
|
||||
}
|
||||
public U0 S2T(U8 *files_find_mask,U8 *fu_flags=NULL)
|
||||
{//Spaces to tabs.
|
||||
//Use "Hard Space" (SHIFT-SPACE) for spaces
|
||||
//in string consts in your code.
|
||||
SU(files_find_mask,SUF_S2T|SUF_REM_TRAILING,fu_flags);
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
#help_index "Cmd Line (Typically)"
|
||||
|
||||
I64 DECompare(CDocEntry *e1,CDocEntry *e2)
|
||||
{
|
||||
return StrCmp(e1->tag,e2->tag);
|
||||
}
|
||||
|
||||
public I64 Sort(U8 *_in_name,U8 *_out_name=NULL,Bool unique=FALSE)
|
||||
{//Sort lines of a text file. Removes blank lines.
|
||||
U8 *in_name,*out_name,*st;
|
||||
CDoc *doc;
|
||||
CDocEntry *doc_e,*doc_e1,**a;
|
||||
I64 i,cnt=0,result;
|
||||
|
||||
if (!_in_name) return 0;
|
||||
in_name=DftExt(_in_name,"TXT.Z");
|
||||
if (_out_name)
|
||||
out_name=DftExt(_out_name,"TXT.Z");
|
||||
else
|
||||
out_name=StrNew(in_name);
|
||||
|
||||
doc=DocRead(in_name,DOCF_PLAIN_TEXT_WITH_TABS|DOCF_NO_CURSOR);
|
||||
doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
if (doc_e->type_u8==DOCT_TEXT)
|
||||
cnt++;
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
a=MAlloc(cnt*sizeof(CDocEntry *));
|
||||
doc_e=doc->root.next;
|
||||
i=0;
|
||||
while (doc_e!=doc) {
|
||||
doc_e1=doc_e->next;
|
||||
if (doc_e->type_u8==DOCT_TEXT) {
|
||||
QueRem(doc_e);
|
||||
a[i++]=doc_e;
|
||||
} else
|
||||
DocEntryDel(doc,doc_e);
|
||||
doc_e=doc_e1;
|
||||
}
|
||||
QSortI64(a,cnt,&DECompare);
|
||||
|
||||
result=0;
|
||||
st=NULL;
|
||||
for (i=0;i<cnt;i++) {
|
||||
QueIns(a[i],doc->root.last);
|
||||
if (!unique || !st || StrCmp(a[i]->tag,st)) {
|
||||
st=a[i]->tag;
|
||||
doc->cur_entry=&doc->root;
|
||||
doc->cur_col=0;
|
||||
DocPrint(doc,"\n");
|
||||
result++;
|
||||
} else
|
||||
DocEntryDel(doc,a[i]);
|
||||
}
|
||||
StrCpy(doc->filename.name,out_name);
|
||||
DocWrite(doc);
|
||||
|
||||
Free(a);
|
||||
DocDel(doc);
|
||||
Free(in_name);
|
||||
Free(out_name);
|
||||
return result; //Num Lines
|
||||
}
|
||||
|
||||
I64 DocWordsFile(CDoc *doc_out=NULL,U8 *filename,U32 *chars_bmp)
|
||||
{
|
||||
U8 *ptr,*ptr2;
|
||||
I64 result=0,ch;
|
||||
CDoc *doc_in=DocRead(filename);
|
||||
CDocEntry *doc_e=doc_in->root.next;
|
||||
while (doc_e!=doc_in) {
|
||||
if (doc_e->de_flags & DOCEF_TAG) {
|
||||
ptr=doc_e->tag;
|
||||
while (*ptr) {
|
||||
while (*ptr && !Bt(chars_bmp,*ptr))
|
||||
ptr++;
|
||||
|
||||
ptr2=ptr;
|
||||
while (*ptr && Bt(chars_bmp,*ptr))
|
||||
ptr++;
|
||||
|
||||
ch=*ptr;
|
||||
*ptr=0;
|
||||
if (*ptr2) {
|
||||
DocPrint(doc_out,"%s\n",ptr2);
|
||||
result++;
|
||||
}
|
||||
*ptr=ch;
|
||||
}
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
DocDel(doc_in);
|
||||
return result;
|
||||
}
|
||||
public I64 Words(U8 *files_find_mask="*",U32 *chars_bmp=chars_bmp_alpha,
|
||||
U8 *fu_flags=NULL)
|
||||
{//Break file into list of not-unique words.
|
||||
I64 fuf_flags=0,result=0;
|
||||
CDoc *doc_out=DocNew;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
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) {
|
||||
result+=DocWordsFile(doc_out,tempde->full_name,chars_bmp);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirTreeDel(tempde1);
|
||||
DocInsDoc(NULL,doc_out);
|
||||
DocDel(doc_out);
|
||||
return result;
|
||||
}
|
||||
|
||||
I64 LongLinesFile(U8 *filename,I64 cols)
|
||||
{
|
||||
I64 result=0;
|
||||
CDoc *doc=DocRead(filename);
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
if (doc_e->type_u8==DOCT_NEW_LINE && doc_e->x>=cols+1)
|
||||
result++;
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
DocDel(doc);
|
||||
if (result) {
|
||||
"%04d ",result;
|
||||
PutFileLink(filename);
|
||||
'\n';
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public I64 LongLines(U8 *files_find_mask="*",I64 cols=80,U8 *fu_flags=NULL)
|
||||
{//Report files with lines of too many cols.
|
||||
I64 result=0,fuf_flags=0;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
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))
|
||||
result++;
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirTreeDel(tempde1);
|
||||
return result;
|
||||
}
|
||||
|
||||
U0 SUFile(U8 *filename,I64 suf_flags,F64 indent_scale_factor)
|
||||
{//String utility on a single file
|
||||
//See $LK,"SU Flags",A="MN:SUF_SINGLE_SPACE"$
|
||||
U8 *dst;
|
||||
Bool chged=FALSE;
|
||||
I64 reduced=0;
|
||||
CDoc *doc=DocRead(filename,DOCF_PLAIN_TEXT_WITH_TABS | DOCF_NO_CURSOR);
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
if (doc_e->type_u8==DOCT_TEXT) {
|
||||
dst=MStrUtil(doc_e->tag,suf_flags,indent_scale_factor);
|
||||
if (StrCmp(dst,doc_e->tag)) {
|
||||
reduced+=StrLen(doc_e->tag)-StrLen(dst);
|
||||
chged=TRUE;
|
||||
Free(doc_e->tag);
|
||||
doc_e->tag=dst;
|
||||
} else
|
||||
Free(dst);
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
if (chged) {
|
||||
"Reduced %s by %d chars\n",filename,reduced;
|
||||
DocWrite(doc);
|
||||
}
|
||||
DocDel(doc);
|
||||
}
|
||||
public U0 SU(U8 *files_find_mask,I64 suf_flags,U8 *fu_flags=NULL,
|
||||
F64 indent_scale_factor=0)
|
||||
{//Apply $LK,"StrUtil",A="MN:StrUtil"$() on files
|
||||
//You can convert spaces to tabs, for example,
|
||||
//or removing trailing spaces on lines.
|
||||
//See $LK,"SUF Flags",A="MN:SUF_SINGLE_SPACE"$.
|
||||
I64 fuf_flags=0;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+f+F+T");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
||||
while (tempde) {
|
||||
SUFile(tempde->full_name,suf_flags,indent_scale_factor);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirTreeDel(tempde1);
|
||||
}
|
||||
|
||||
public U0 S2T(U8 *files_find_mask,U8 *fu_flags=NULL)
|
||||
{//Spaces to tabs.
|
||||
//Use "Hard Space" (SHIFT-SPACE) for spaces
|
||||
//in string consts in your code.
|
||||
SU(files_find_mask,SUF_S2T|SUF_REM_TRAILING,fu_flags);
|
||||
}
|
||||
+64
-43
@@ -2,18 +2,22 @@
|
||||
|
||||
//See $LK,"::/Doc/Credits.TXT"$.
|
||||
|
||||
U0 HtmlPutS(CDoc *doc,I64 u32_attr,I64 *_old_u32_attr,U8 *st,I64 *_col,U8 *style_bitmap=NULL)
|
||||
U0 HtmlPutS(CDoc *doc,I64 u32_attr,I64 *_old_u32_attr,
|
||||
U8 *st,I64 *_col,U8 *style_bitmap=NULL)
|
||||
{
|
||||
U8 *ch,*ptr;
|
||||
u32_attr&=0xFFFFFF00;
|
||||
if (u32_attr&DOCET_INVERT)
|
||||
u32_attr.u8[1]=(u32_attr.u8[1]&15)<<4|u32_attr.u8[1]>>4;
|
||||
if (u32_attr!=*_old_u32_attr) {
|
||||
if (!(u32_attr&DOCET_BLINK) && *_old_u32_attr&DOCET_BLINK)
|
||||
if (!(u32_attr&DOCET_BLINK) &&
|
||||
*_old_u32_attr!=-1 && *_old_u32_attr&DOCET_BLINK)
|
||||
DocPrint(doc,"</blink>");
|
||||
if (*_old_u32_attr!=-1)
|
||||
DocPrint(doc,"</span>");
|
||||
DocPrint(doc,"<span class=c%02X>",u32_attr.u8[1]);
|
||||
if (u32_attr&DOCET_BLINK && !(*_old_u32_attr&DOCET_BLINK))
|
||||
if (u32_attr&DOCET_BLINK &&
|
||||
(*_old_u32_attr==-1 || !(*_old_u32_attr&DOCET_BLINK)))
|
||||
DocPrint(doc,"<blink>");
|
||||
*_old_u32_attr=u32_attr;
|
||||
if (style_bitmap)
|
||||
@@ -120,11 +124,11 @@ public CDoc *Doc2Html(CDoc *doc_in,
|
||||
U8 (*link_cvt)(U8 *link_st)=&TOSLinkCvt1)
|
||||
{//Cvt $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.TXT"$ doc to HTML file.
|
||||
CDocEntry *doc_e,*style,*doc_e2;
|
||||
I64 i,y,old_y=MIN_I64,col,_old_u32_attr=-1,old_attr;
|
||||
I64 i,y,old_y=MIN_I64,col,old_u32_attr=-1,old_attr;
|
||||
U32 *hl,*src;
|
||||
U8 *st,st_2[2],*link_st,*style_bitmap=CAlloc(256/8);
|
||||
CBGR p[16];
|
||||
GetVGAPalette4(p);
|
||||
CBGR48 p[NUM_COLORS];
|
||||
GrPaletteGet(p);
|
||||
CDoc *doc_out=DocNew;
|
||||
Bool unlock_doc_in=DocLock(doc_in),no_bwd;
|
||||
|
||||
@@ -142,19 +146,20 @@ public CDoc *Doc2Html(CDoc *doc_in,
|
||||
if (!body_header) body_header="";
|
||||
if (!body_footer) body_footer="";
|
||||
DocPrint(doc_out,
|
||||
"<!DOCTYPE HTML>\n"
|
||||
"<html>\n"
|
||||
"<head>\n"
|
||||
"<meta http-equiv=\"Content-Type\" content=\"text/html;charset=US-ASCII\">\n"
|
||||
"%s"
|
||||
"<meta name=\"generator\" content=\"TempleOS V%4.2f\">\n"
|
||||
"<style type=\"text/css\">\n",html_header,os_version);
|
||||
"<!DOCTYPE HTML>\n"
|
||||
"<html>\n"
|
||||
"<head>\n"
|
||||
"<meta http-equiv=\"Content-Type\" "
|
||||
"content=\"text/html;charset=US-ASCII\">\n"
|
||||
"%s"
|
||||
"<meta name=\"generator\" content=\"TempleOS V%4.2f\">\n"
|
||||
"<style type=\"text/css\">\n",html_header,os_version);
|
||||
style=doc_out->cur_entry->last;
|
||||
DocPrint(doc_out,
|
||||
"</style>\n"
|
||||
"</head>\n"
|
||||
"<body>\n"
|
||||
"<pre style=\"font-family:courier;font-size:10pt\">\n");
|
||||
"</style>\n"
|
||||
"</head>\n"
|
||||
"<body>\n"
|
||||
"<pre style=\"font-family:courier;font-size:10pt\">\n");
|
||||
DocPrint(doc_out,"%s",body_header);
|
||||
|
||||
doc_e=doc_in->root.next;
|
||||
@@ -167,7 +172,8 @@ public CDoc *Doc2Html(CDoc *doc_in,
|
||||
old_y=y;
|
||||
}
|
||||
while (y<doc_e->y) {
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,&_old_u32_attr,"\n",&col,style_bitmap);
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,"\n",&col,style_bitmap);
|
||||
if (line_anchors && ++y!=old_y) {
|
||||
DocPrint(doc_out,"<a name=\"l%d\"></a>",y+1);
|
||||
old_y=y;
|
||||
@@ -186,7 +192,8 @@ public CDoc *Doc2Html(CDoc *doc_in,
|
||||
}
|
||||
if (no_bwd)
|
||||
while (col<doc_e->x)
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,&_old_u32_attr," ",&col,style_bitmap);
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr," ",&col,style_bitmap);
|
||||
|
||||
link_st=NULL;
|
||||
if (doc_e->de_flags&DOCEF_HTML_LINK)
|
||||
@@ -197,9 +204,9 @@ public CDoc *Doc2Html(CDoc *doc_in,
|
||||
}
|
||||
|
||||
if (link_st) {
|
||||
if (_old_u32_attr!=-1) {
|
||||
if (old_u32_attr!=-1) {
|
||||
DocPrint(doc_out,"</span>");
|
||||
_old_u32_attr=-1;
|
||||
old_u32_attr=-1;
|
||||
}
|
||||
DocPrint(doc_out,"<a href=\"%s\">",link_st);
|
||||
}
|
||||
@@ -208,40 +215,49 @@ public CDoc *Doc2Html(CDoc *doc_in,
|
||||
case DOCT_TEXT:
|
||||
if (doc_e->de_flags&DOCEF_HIGHLIGHT) {
|
||||
if (doc_e->last==doc_in)
|
||||
MemCpy(&doc_e->settings,&doc_in->settings_root,sizeof(CDocSettings));
|
||||
MemCpy(&doc_e->settings,&doc_in->settings_root,
|
||||
sizeof(CDocSettings));
|
||||
else
|
||||
MemCpy(&doc_e->settings,&doc_e->last->settings,sizeof(CDocSettings));
|
||||
src=hl=DocHighlight(doc_e,doc_e->tag,StrLen(doc_e->tag),doc_e->type&0xFF00);
|
||||
MemCpy(&doc_e->settings,&doc_e->last->settings,
|
||||
sizeof(CDocSettings));
|
||||
src=hl=DocHighlight(doc_e,doc_e->tag,StrLen(doc_e->tag),
|
||||
doc_e->type&0xFF00);
|
||||
while (*src) {
|
||||
st_2[0]=*src&0xFF;
|
||||
HtmlPutS(doc_out,*src++,&_old_u32_attr,st_2,&col,style_bitmap);
|
||||
HtmlPutS(doc_out,*src++,&old_u32_attr,st_2,&col,style_bitmap);
|
||||
}
|
||||
Free(hl);
|
||||
} else
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,&_old_u32_attr,doc_e->tag,&col,style_bitmap);
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,doc_e->tag,&col,style_bitmap);
|
||||
break;
|
||||
case DOCT_TAB:
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,&_old_u32_attr,"\t",&col,style_bitmap);
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,"\t",&col,style_bitmap);
|
||||
break;
|
||||
case DOCT_HTML_CODE:
|
||||
if (_old_u32_attr!=-1) {
|
||||
if (old_u32_attr!=-1) {
|
||||
DocPrint(doc_out,"</span>");
|
||||
_old_u32_attr=-1;
|
||||
old_u32_attr=-1;
|
||||
}
|
||||
DocPrint(doc_out,"%s",doc_e->tag);
|
||||
break;
|
||||
case DOCT_SPRITE:
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,&_old_u32_attr,doc_e->tag,&col,style_bitmap);
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,&_old_u32_attr,"/* Graphics Not Rendered in HTML */",&col,style_bitmap);
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,doc_e->tag,&col,style_bitmap);
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,"/* Graphics Not Rendered in HTML */",
|
||||
&col,style_bitmap);
|
||||
break;
|
||||
default:
|
||||
if (doc_e->de_flags&DOCEF_TAG)
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,&_old_u32_attr,doc_e->tag,&col,style_bitmap);
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,doc_e->tag,&col,style_bitmap);
|
||||
}
|
||||
if (link_st) {
|
||||
if (_old_u32_attr!=-1) {
|
||||
if (old_u32_attr!=-1) {
|
||||
DocPrint(doc_out,"</span>");
|
||||
_old_u32_attr=-1;
|
||||
old_u32_attr=-1;
|
||||
}
|
||||
DocPrint(doc_out,"</a>");
|
||||
Free(link_st);
|
||||
@@ -250,14 +266,15 @@ public CDoc *Doc2Html(CDoc *doc_in,
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
while (y++<doc_e->y) {
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,&_old_u32_attr,"\n",&col,style_bitmap);
|
||||
HtmlPutS(doc_out,doc_e->settings.final_u32_attr,
|
||||
&old_u32_attr,"\n",&col,style_bitmap);
|
||||
col=0;
|
||||
}
|
||||
if (_old_u32_attr!=-1) {
|
||||
if (_old_u32_attr&DOCET_BLINK)
|
||||
if (old_u32_attr!=-1) {
|
||||
if (old_u32_attr&DOCET_BLINK)
|
||||
DocPrint(doc_out,"</blink>");
|
||||
DocPrint(doc_out,"</span>");
|
||||
_old_u32_attr=-1;
|
||||
old_u32_attr=-1;
|
||||
}
|
||||
DocPrint(doc_out,"%s",body_footer);
|
||||
DocPrint(doc_out,"</pre></body>\n</html>\n");
|
||||
@@ -265,7 +282,10 @@ public CDoc *Doc2Html(CDoc *doc_in,
|
||||
doc_out->cur_entry=style->next;
|
||||
for (i=0;i<256;i++)
|
||||
if (Bt(style_bitmap,i))
|
||||
DocPrint(doc_out,".c%02X{color:#%02x%02x%02x;background-color:#%02x%02x%02x;}\n",i,p[i&15].r,p[i&15].g,p[i&15].b,p[i/16].r,p[i/16].g,p[i/16].b);
|
||||
DocPrint(doc_out,
|
||||
".c%02X{color:#%02x%02x%02x;background-color:#%02x%02x%02x;}\n",
|
||||
i,p[i&15].r>>8,p[i&15].g>>8,p[i&15].b>>8,
|
||||
p[i/16].r>>8,p[i/16].g>>8,p[i/16].b>>8);
|
||||
doc_out->cur_entry=&doc_out->root;
|
||||
DocRecalc(doc_out);
|
||||
|
||||
@@ -289,13 +309,14 @@ public U0 ToHtml(U8 *_in_name,U8 *_out_name=NULL,U8 *html_header=NULL,
|
||||
WinHorz(0,width-1); //Sets doc width for word wrap.
|
||||
|
||||
in_name=DftExt(_in_name,"CPP.Z"),
|
||||
if (_out_name)
|
||||
out_name=DftExt(_out_name,"html");
|
||||
if (_out_name)
|
||||
out_name=DftExt(_out_name,"html");
|
||||
else
|
||||
out_name=ChgExt(_in_name,"html");
|
||||
out_name=ChgExt(_in_name,"html");
|
||||
|
||||
doc_in=DocRead(in_name);
|
||||
doc_out=Doc2Html(doc_in,html_header,body_header,body_footer,line_anchors,link_cvt);
|
||||
doc_out=Doc2Html(doc_in,html_header,body_header,
|
||||
body_footer,line_anchors,link_cvt);
|
||||
StrCpy(&doc_out->filename.name,out_name);
|
||||
|
||||
SettingsPop;
|
||||
|
||||
@@ -111,10 +111,10 @@ public U0 ToTXT(U8 *_in_name,U8 *_out_name=NULL,I64 width=70)
|
||||
WinHorz(0,width-1); //Sets doc width for word wrap.
|
||||
|
||||
in_name=DftExt(_in_name,"TXT.Z"),
|
||||
if (_out_name)
|
||||
out_name=DftExt(_out_name,"TXT");
|
||||
if (_out_name)
|
||||
out_name=DftExt(_out_name,"TXT");
|
||||
else
|
||||
out_name=ChgExt(_in_name,"TXT");
|
||||
out_name=ChgExt(_in_name,"TXT");
|
||||
|
||||
doc_in=DocRead(in_name);
|
||||
doc_out=Doc2TXT(doc_in);
|
||||
|
||||
Reference in new issue
Block a user