Browse Source

TempleOSCDV4.12.ISO

v6
Terry A. Davis 6 years ago committed by minexew
parent
commit
b84bbff6db
  1. BIN
      0000Boot/0000Kernel.BIN.C
  2. 98
      Adam/ABlkDev/ADskA.HC
  3. 156
      Adam/ABlkDev/ADskB.HC
  4. 70
      Adam/ABlkDev/ChkDsk.HC
  5. 392
      Adam/ABlkDev/FileMgr.HC
  6. 10
      Adam/ABlkDev/Mount.HC
  7. 56
      Adam/ABlkDev/PrtDsk.HC
  8. 80
      Adam/ADbg.HC
  9. 10
      Adam/ADefine.HC
  10. 4
      Adam/AExts.HC
  11. 76
      Adam/AHash.HC
  12. 320
      Adam/AMathODE.HC
  13. 0
      Adam/AutoComplete/ACDefs.DATA
  14. 32
      Adam/AutoComplete/ACFill.HC
  15. 52
      Adam/AutoComplete/ACInit.HC
  16. 32
      Adam/AutoComplete/ACTask.HC
  17. 0
      Adam/AutoComplete/ACWords.DATA
  18. 22
      Adam/Ctrls/CtrlsA.HC
  19. 66
      Adam/Ctrls/CtrlsSlider.HC
  20. 46
      Adam/DevInfo.HC
  21. 32
      Adam/DolDoc/DocBin.HC
  22. 8
      Adam/DolDoc/DocChar.HC
  23. 60
      Adam/DolDoc/DocCodeTools.HC
  24. 4
      Adam/DolDoc/DocEd.HC
  25. 34
      Adam/DolDoc/DocFile.HC
  26. 34
      Adam/DolDoc/DocForm.HC
  27. 66
      Adam/DolDoc/DocHighlight.HC
  28. 10
      Adam/DolDoc/DocInit.HC
  29. 48
      Adam/DolDoc/DocLink.HC
  30. 102
      Adam/DolDoc/DocMacro.HC
  31. 18
      Adam/DolDoc/DocNew.HC
  32. 24
      Adam/DolDoc/DocOpt.HC
  33. 16
      Adam/DolDoc/DocPlain.HC
  34. 2
      Adam/DolDoc/DocPopUp.HC
  35. 7
      Adam/DolDoc/DocPutKey.HC
  36. 144
      Adam/DolDoc/DocRecalc.HC
  37. 20
      Adam/DolDoc/DocRecalcLib.HC
  38. 18
      Adam/DolDoc/DocRun.HC
  39. 44
      Adam/DolDoc/DocTerm.HC
  40. 14
      Adam/DolDoc/DocWidgetWiz.HC
  41. 8
      Adam/DolDoc/MakeDoc.HC
  42. 294
      Adam/God/HSNotes.DD
  43. 20
      Adam/God/HolySpirit.HC
  44. 72
      Adam/Gr/GrBitMap.HC
  45. 48
      Adam/Gr/GrDC.HC
  46. 10
      Adam/Gr/GrEnd.HC
  47. 10
      Adam/Gr/GrGlbls.HC
  48. 22
      Adam/Gr/GrInitB.HC
  49. 84
      Adam/Gr/GrMath.HC
  50. 28
      Adam/Gr/GrPrimatives.HC
  51. 64
      Adam/Gr/GrScrn.HC
  52. 244
      Adam/Gr/GrSpritePlot.HC
  53. 8
      Adam/Gr/MakeGr.HC
  54. 288
      Adam/Gr/SpriteBitMap.HC
  55. 234
      Adam/Gr/SpriteCode.HC
  56. 814
      Adam/Gr/SpriteEd.HC
  57. 470
      Adam/Gr/SpriteMain.HC
  58. 592
      Adam/Gr/SpriteMesh.HC
  59. 102
      Adam/Gr/SpriteNew.HC
  60. 43
      Adam/InFile.HC
  61. 6
      Adam/MakeAdam.HC
  62. 122
      Adam/Menu.HC
  63. 224
      Adam/Opt/Boot/DskISO9660.HC
  64. 24
      Adam/Opt/Boot/DskISORedSea.HC
  65. 34
      Adam/Opt/Utils/Diff.HC
  66. 8
      Adam/Opt/Utils/FileBMP.HC
  67. 12
      Adam/Opt/Utils/Find.HC
  68. 82
      Adam/Opt/Utils/HeapLog.HC
  69. 84
      Adam/Opt/Utils/LineRep.HC
  70. 16
      Adam/Opt/Utils/LinkChk.HC
  71. 40
      Adam/Opt/Utils/MemRep.HC
  72. 52
      Adam/Opt/Utils/Merge.HC
  73. 2
      Adam/Opt/Utils/Profiler.HC
  74. 36
      Adam/Opt/Utils/StrUtils.HC
  75. 14
      Adam/Opt/Utils/ToDolDoc.HC
  76. 2
      Adam/Snd/SndMusic.HC
  77. 9
      Adam/TaskRep.HC
  78. 126
      Adam/TaskSettings.HC
  79. 2
      Adam/Training.HC
  80. 8
      Adam/Win.HC
  81. 32
      Adam/WinMgr.HC
  82. 4
      Apps/AfterEgypt/AfterEgypt.HC
  83. BIN
      Apps/AfterEgypt/Battle.HC
  84. 16
      Apps/AfterEgypt/Comics.HC
  85. 46
      Apps/AfterEgypt/HorebBMP.HC
  86. 46
      Apps/AfterEgypt/HorebBSP.HC
  87. 38
      Apps/AfterEgypt/HorebC.HC
  88. BIN
      Apps/AfterEgypt/Quail.HC
  89. BIN
      Apps/AfterEgypt/WaterRock.HC
  90. 44
      Apps/Budget/BgtAccts.HC
  91. 48
      Apps/Budget/BgtEntry.HC
  92. 118
      Apps/Budget/BgtFile.HC
  93. 98
      Apps/Budget/BgtMain.HC
  94. 54
      Apps/Budget/BgtStrs.HC
  95. 108
      Apps/Budget/BgtTemplate.HC
  96. 2
      Apps/Budget/Budget.HC
  97. 10
      Apps/KeepAway/KeepAway.HC
  98. 2
      Apps/Logic/Logic.HC
  99. 48
      Apps/Psalmody/JukeBox.HC
  100. 22
      Apps/Psalmody/JukePuppet.HC
  101. Some files were not shown because too many files have changed in this diff Show More

BIN
0000Boot/0000Kernel.BIN.C

Binary file not shown.

98
Adam/ABlkDev/ADskA.HC

@ -65,28 +65,28 @@ public Bool Copy(U8 *src_files_find_mask,U8 *dst_files_find_mask=".")
//it will be stored uncompressed.
Bool res=TRUE;
CDirContext *dirc;
CDirEntry *tempde,*tempde1;
CDirEntry *tmpde,*tmpde1;
U8 *st;
if (!(tempde1=FilesFind(src_files_find_mask,FUF_CLUSTER_ORDER)))
if (!(tmpde1=FilesFind(src_files_find_mask,FUF_CLUSTER_ORDER)))
return FALSE;
if (IsDir(dst_files_find_mask)) {
if (dirc=DirContextNew(dst_files_find_mask,TRUE)) {
tempde=tempde1;
while (tempde) {
if (!(tempde->attr & RS_ATTR_DIR)) {
st=FileNameAbs(tempde->name);
if (!CopySingle(tempde->full_name,st))
tmpde=tmpde1;
while (tmpde) {
if (!(tmpde->attr & RS_ATTR_DIR)) {
st=FileNameAbs(tmpde->name);
if (!CopySingle(tmpde->full_name,st))
res=FALSE;
Free(st);
}
tempde=tempde->next;
tmpde=tmpde->next;
}
DirContextDel(dirc);
}
DirTreeDel(tempde1);
DirTreeDel(tmpde1);
return res;
} else {
DirTreeDel(tempde1);
DirTreeDel(tmpde1);
return CopySingle(src_files_find_mask,dst_files_find_mask);
}
}
@ -100,22 +100,22 @@ public Bool Move(U8 *f1,U8 *f2)
return FALSE;
}
I64 CopyTree2(CDirEntry *tempde,I64 src_dir_len,I64 dst_dir_len,U8 *dst_dir)
I64 CopyTree2(CDirEntry *tmpde,I64 src_dir_len,I64 dst_dir_len,U8 *dst_dir)
{
U8 *st;
I64 res=1;
while (tempde) {
st=MAlloc(StrLen(tempde->full_name)+dst_dir_len+2);
while (tmpde) {
st=MAlloc(StrLen(tmpde->full_name)+dst_dir_len+2);
MemCpy(st,dst_dir,dst_dir_len);
StrCpy(st+dst_dir_len,tempde->full_name+src_dir_len);
if (tempde->attr & RS_ATTR_DIR) {
MkDir(st,LinkedLstCnt(tempde->sub));
res+=CopyTree2(tempde->sub,src_dir_len,dst_dir_len,dst_dir);
StrCpy(st+dst_dir_len,tmpde->full_name+src_dir_len);
if (tmpde->attr & RS_ATTR_DIR) {
MkDir(st,LinkedLstCnt(tmpde->sub));
res+=CopyTree2(tmpde->sub,src_dir_len,dst_dir_len,dst_dir);
} else
if (CopySingle(tempde->full_name,st))
if (CopySingle(tmpde->full_name,st))
res++;
Free(st);
tempde=tempde->next;
tmpde=tmpde->next;
}
return res;
}
@ -124,7 +124,7 @@ public I64 CopyTree(U8 *src_files_find_mask,U8 *dst_files_find_mask,
{//Copy directory tree.
//Returns the count of copied files (not dirs).
CDirContext *dirc;
CDirEntry *tempde=NULL;
CDirEntry *tmpde=NULL;
I64 res=0,i1,i2;
U8 *st1,*st2;
@ -139,7 +139,7 @@ public I64 CopyTree(U8 *src_files_find_mask,U8 *dst_files_find_mask,
Free(st1);
Free(st2);
if (dirc=DirContextNew(src_files_find_mask,TRUE,,no_mask)) {
tempde=FilesFind(dirc->mask,FUF_RECURSE);
tmpde=FilesFind(dirc->mask,FUF_RECURSE);
st1=CurDir;
DirContextDel(dirc);
i1=StrLen(st1);
@ -148,45 +148,45 @@ public I64 CopyTree(U8 *src_files_find_mask,U8 *dst_files_find_mask,
st2=CurDir;
i2=StrLen(st2);
if (i2==3) i2--;
res=CopyTree2(tempde,i1,i2,st2);
res=CopyTree2(tmpde,i1,i2,st2);
DirContextDel(dirc);
Free(st2);
}
DirTreeDel(tempde);
DirTreeDel(tmpde);
Free(st1);
}
return res;
}
I64 DelTreeDirs(CDirEntry *tempde1)
I64 DelTreeDirs(CDirEntry *tmpde1)
{
I64 res=0;
CDirEntry *tempde2;
while (tempde1) {
tempde2=tempde1->next;
if (tempde1->attr & RS_ATTR_DIR) {
if (tempde1->sub)
res+=DelTreeDirs(tempde1->sub);
res+=Del(tempde1->full_name,TRUE,TRUE);
CDirEntry *tmpde2;
while (tmpde1) {
tmpde2=tmpde1->next;
if (tmpde1->attr & RS_ATTR_DIR) {
if (tmpde1->sub)
res+=DelTreeDirs(tmpde1->sub);
res+=Del(tmpde1->full_name,TRUE,TRUE);
}
DirEntryDel(tempde1);
tempde1=tempde2;
DirEntryDel(tmpde1);
tmpde1=tmpde2;
}
return res;
}
I64 DelTreeFiles(CDirEntry *tempde1)
I64 DelTreeFiles(CDirEntry *tmpde1)
{
I64 res=0;
CDirEntry *tempde2;
while (tempde1) {
tempde2=tempde1->next;
if (tempde1->attr & RS_ATTR_DIR) {
if (tempde1->sub)
res+=DelTreeFiles(tempde1->sub);
CDirEntry *tmpde2;
while (tmpde1) {
tmpde2=tmpde1->next;
if (tmpde1->attr & RS_ATTR_DIR) {
if (tmpde1->sub)
res+=DelTreeFiles(tmpde1->sub);
} else
res+=Del(tempde1->full_name,FALSE,TRUE);
DirEntryDel(tempde1);
tempde1=tempde2;
res+=Del(tmpde1->full_name,FALSE,TRUE);
DirEntryDel(tmpde1);
tmpde1=tmpde2;
}
return res;
}
@ -240,13 +240,13 @@ To Set DateL:
Touch(filename,"",,datetime);
*/
I64 fuf_flags=0;
CDirEntry *tempde,*tempde1;
CDirEntry *tmpde,*tmpde1;
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+f+F");
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
while (tempde) {
TouchFile(tempde->full_name,attr,cdt);
tempde=tempde->next;
tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
while (tmpde) {
TouchFile(tmpde->full_name,attr,cdt);
tmpde=tmpde->next;
}
DirTreeDel(tempde1);
DirTreeDel(tmpde1);
}

156
Adam/ABlkDev/ADskB.HC

@ -1,102 +1,102 @@
#help_index "File/Internal"
I64 DirTreeSerializeSize(CDirEntry *tempde)
I64 DirTreeSerializeSize(CDirEntry *tmpde)
{
I64 res=0;
while (tempde) {
while (tmpde) {
res+=CDIR_SIZE+1;
if (tempde->attr & RS_ATTR_DIR)
res+=DirTreeSerializeSize(tempde->sub);
tempde=tempde->next;
if (tmpde->attr & RS_ATTR_DIR)
res+=DirTreeSerializeSize(tmpde->sub);
tmpde=tmpde->next;
}
return res+1;
}
I64 DirTreeSerializeFill(CDirEntry *tempde,U8 *dst)
I64 DirTreeSerializeFill(CDirEntry *tmpde,U8 *dst)
{
I64 res=0,i;
while (tempde) {
while (tmpde) {
*dst++=1;
res++;
MemCpy(dst,&tempde->start,CDIR_SIZE);
MemCpy(dst,&tmpde->start,CDIR_SIZE);
dst+=CDIR_SIZE;
res+=CDIR_SIZE;
if (tempde->attr & RS_ATTR_DIR) {
i=DirTreeSerializeFill(tempde->sub,dst);
if (tmpde->attr & RS_ATTR_DIR) {
i=DirTreeSerializeFill(tmpde->sub,dst);
dst+=i;
res+=i;
}
tempde=tempde->next;
tmpde=tmpde->next;
}
*dst=0;
return res+1;
}
public U8 *DirTreeSerialize(CDirEntry *tempde,I64 *_size=NULL)
public U8 *DirTreeSerialize(CDirEntry *tmpde,I64 *_size=NULL)
{//Serialize tree returned from $LK,"FilesFind",A="MN:FilesFind"$() into a one contiguous U8 array.
I64 size=DirTreeSerializeSize(tempde);
I64 size=DirTreeSerializeSize(tmpde);
U8 *buf=MAlloc(size);
DirTreeSerializeFill(tempde,buf);
DirTreeSerializeFill(tmpde,buf);
if (_size) *_size=size;
return buf;
}
U8 *DirTreeUnserialize2(U8 *src,CDirEntry **tempde)
U8 *DirTreeUnserialize2(U8 *src,CDirEntry **tmpde)
{
CDirEntry *tempde1;
CDirEntry *tmpde1;
if (*src++) {
tempde1=CAlloc(sizeof(CDirEntry));
*tempde=tempde1;
MemCpy(&tempde1->start,src,CDIR_SIZE);
tmpde1=CAlloc(sizeof(CDirEntry));
*tmpde=tmpde1;
MemCpy(&tmpde1->start,src,CDIR_SIZE);
src+=CDIR_SIZE;
if (tempde1->attr & RS_ATTR_DIR)
src=DirTreeUnserialize2(src,&tempde1->sub);
src=DirTreeUnserialize2(src,&tempde1->next);
if (tmpde1->attr & RS_ATTR_DIR)
src=DirTreeUnserialize2(src,&tmpde1->sub);
src=DirTreeUnserialize2(src,&tmpde1->next);
} else
*tempde=NULL;
*tmpde=NULL;
return src;
}
public CDirEntry *DirTreeUnserialize(U8 *src)
{//Unserialize tree to make it like a tree returned from $LK,"FilesFind",A="MN:FilesFind"$().
CDirEntry *tempde=NULL;
DirTreeUnserialize2(src,&tempde);
return tempde;
CDirEntry *tmpde=NULL;
DirTreeUnserialize2(src,&tmpde);
return tmpde;
}
#help_index "File/Program Routines"
U0 FOFlatten(CDirEntry *tempde,CDirEntry **a,I64 *i)
U0 FOFlatten(CDirEntry *tmpde,CDirEntry **a,I64 *i)
{
CDirEntry *tempde1;
while (tempde) {
tempde1=tempde->next;
if (tempde->attr&RS_ATTR_DIR) {
FOFlatten(tempde->sub,a,i);
DirEntryDel(tempde);
CDirEntry *tmpde1;
while (tmpde) {
tmpde1=tmpde->next;
if (tmpde->attr&RS_ATTR_DIR) {
FOFlatten(tmpde->sub,a,i);
DirEntryDel(tmpde);
} else {
a[*i]=tempde;
a[*i]=tmpde;
*i=*i+1;
}
tempde=tempde1;
tmpde=tmpde1;
}
}
I64 Size1(CDirEntry *tempde,I64 *_fuf_flags,I64 round_to)
I64 Size1(CDirEntry *tmpde,I64 *_fuf_flags,I64 round_to)
{
U8 buf[BLK_SIZE];
I64 res=0,i;
CDrv *dv;
while (tempde) {
if ((i=tempde->size) && Bt(_fuf_flags,FUf_EXPAND) &&
!(tempde->attr&RS_ATTR_DIR) &&
FileAttr(tempde->name)&RS_ATTR_COMPRESSED) {
dv=Let2Drv(*tempde->full_name);
RBlks(dv,buf,Cluster2Blk(dv,tempde->cluster),1);
while (tmpde) {
if ((i=tmpde->size) && Bt(_fuf_flags,FUf_EXPAND) &&
!(tmpde->attr&RS_ATTR_DIR) &&
FileAttr(tmpde->name)&RS_ATTR_COMPRESSED) {
dv=Let2Drv(*tmpde->full_name);
RBlks(dv,buf,Cluster2Blk(dv,tmpde->cluster),1);
i=(&buf)(CArcCompress *)->expanded_size;
}
if (round_to)
i=CeilU64(tempde->size,round_to);
if (tempde->attr&RS_ATTR_DIR)
i+=Size1(tempde->sub,_fuf_flags,round_to);
tempde->user_data=i;
i=CeilU64(tmpde->size,round_to);
if (tmpde->attr&RS_ATTR_DIR)
i+=Size1(tmpde->sub,_fuf_flags,round_to);
tmpde->user_data=i;
res+=i;
tempde=tempde->next;
tmpde=tmpde->next;
}
return res;
}
@ -105,26 +105,26 @@ public I64 Size(U8 *files_find_mask="/*",U8 *fu_flags=NULL,I64 round_to=0)
//Does not include directory size of base directory, but
//does include size of sub directories.
I64 fuf_flags=0,res=0;
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=Size1(tempde1,&fuf_flags,round_to);
DirTreeDel(tempde1);
res=Size1(tmpde1,&fuf_flags,round_to);
DirTreeDel(tmpde1);
}
return res;
}
public I64 FileCnt(CDirEntry *tempde)
public I64 FileCnt(CDirEntry *tmpde)
{//Cnt of files in $LK,"CDirEntry",A="MN:CDirEntry"$ tree.
I64 cnt=0;
while (tempde) {
if (tempde->attr&RS_ATTR_DIR)
cnt+=FileCnt(tempde->sub);
while (tmpde) {
if (tmpde->attr&RS_ATTR_DIR)
cnt+=FileCnt(tmpde->sub);
else
cnt++;
tempde=tempde->next;
tmpde=tmpde->next;
}
return cnt;
}
@ -133,37 +133,37 @@ public I64 FileCnt(CDirEntry *tempde)
public I64 FF(U8 *files_find_mask,U8 *fu_flags=NULL)
{//Files find. List files matching mask.
I64 cnt=0,fuf_flags=0;
CDirEntry *tempde,*tempde1;
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) {
PutFileLink(tempde->full_name);
tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
while (tmpde) {
PutFileLink(tmpde->full_name);
'\n';
cnt++;
tempde=tempde->next;
tmpde=tmpde->next;
}
DirTreeDel(tempde1);
DirTreeDel(tmpde1);
return cnt;
}
public I64 Zip(U8 *files_find_mask="*",U8 *fu_flags=NULL)
{//Compress files by moving to .Z filename.
U8 *st;
CDirEntry *tempde,*tempde1;
CDirEntry *tmpde,*tmpde1;
I64 res=0,fuf_flags=0;
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) {
if (!IsDotZ(tempde->full_name)) {
st=MStrPrint("%s.Z",tempde->full_name);
res+=Move(tempde->full_name,st);
tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
while (tmpde) {
if (!IsDotZ(tmpde->full_name)) {
st=MStrPrint("%s.Z",tmpde->full_name);
res+=Move(tmpde->full_name,st);
Free(st);
}
tempde=tempde->next;
tmpde=tmpde->next;
}
DirTreeDel(tempde1);
DirTreeDel(tmpde1);
return res;
}
@ -172,20 +172,20 @@ public I64 Unzip(U8 *files_find_mask="*.Z",U8 *fu_flags=NULL)
//You don't have to do this for normal operation.
//It automatically unzips ".Z" files.
U8 *st;
CDirEntry *tempde,*tempde1;
CDirEntry *tmpde,*tmpde1;
I64 res=0,fuf_flags=0;
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) {
if (IsDotZ(tempde->full_name)) {
st=StrNew(tempde->full_name);
tmpde=tmpde1=FilesFind(files_find_mask,fuf_flags);
while (tmpde) {
if (IsDotZ(tmpde->full_name)) {
st=StrNew(tmpde->full_name);
StrLastRem(st,".");
res+=Move(tempde->full_name,st);
res+=Move(tmpde->full_name,st);
Free(st);
}
tempde=tempde->next;
tmpde=tmpde->next;
}
DirTreeDel(tempde1);
DirTreeDel(tmpde1);
return res;
}

70
Adam/ABlkDev/ChkDsk.HC

@ -10,36 +10,36 @@ Bool ChkDskConfirm(Bool *_fix,Bool *_confirm)
return *_fix;
}
I64 RedSeaChkDskLst(CDrv *dv,CDirEntry *tempde1,
I64 RedSeaChkDskLst(CDrv *dv,CDirEntry *tmpde1,
U8 *bits,U8 *bits2,I64 size,I64 bpc)
{
CDirEntry *tempde2;
CDirEntry *tmpde2;
I64 i,j,errs=0;
while (tempde1) {
tempde2=tempde1->next;
if (tempde1->attr & RS_ATTR_DIR && tempde1->sub)
errs+=RedSeaChkDskLst(dv,tempde1->sub,bits,bits2,size,bpc);
j=(tempde1->size+bpc-1)/bpc;
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+tempde1->cluster-dv->data_area>size) {
PrintErr("Invalid Cluster:%s Cluster:%X\n",tempde1->full_name,
i+tempde1->cluster);
if (i+tmpde1->cluster-dv->data_area>size) {
PrintErr("Invalid Cluster:%s Cluster:%X\n",tmpde1->full_name,
i+tmpde1->cluster);
errs++;
break;
}
if (LBts(bits,i+tempde1->cluster-dv->data_area)) {
PrintErr("Dbl Alloc:%s Cluster:%X\n",tempde1->full_name,
i+tempde1->cluster);
if (LBts(bits,i+tmpde1->cluster-dv->data_area)) {
PrintErr("Dbl Alloc:%s Cluster:%X\n",tmpde1->full_name,
i+tmpde1->cluster);
errs++;
}
if (!LBtr(bits2,i+tempde1->cluster-dv->data_area)) {
PrintErr("UnAlloc:%s Cluster:%X\n",tempde1->full_name,
i+tempde1->cluster);
if (!LBtr(bits2,i+tmpde1->cluster-dv->data_area)) {
PrintErr("UnAlloc:%s Cluster:%X\n",tmpde1->full_name,
i+tmpde1->cluster);
errs++;
}
}
DirEntryDel(tempde1);
tempde1=tempde2;
DirEntryDel(tmpde1);
tmpde1=tmpde2;
}
return errs;
}
@ -103,48 +103,48 @@ I64 RedSeaChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
return errs;
}
I64 FAT32ChkDskLst(CDrv *dv,CDirEntry *tempde1,
I64 FAT32ChkDskLst(CDrv *dv,CDirEntry *tmpde1,
U8 *bits,U32 *bits2,I64 size,I64 bpc)
{
CDirEntry *tempde2;
CDirEntry *tmpde2;
I64 i,c,errs=0;
while (tempde1) {
tempde2=tempde1->next;
if (tempde1->attr & RS_ATTR_DIR && tempde1->sub)
errs+=FAT32ChkDskLst(dv,tempde1->sub,bits,bits2,size,bpc);
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=tempde1->cluster;
c=tmpde1->cluster;
while (0<c<0x0FFFFFF8) {
if (c>size) {
PrintErr("Invalid Cluster:%s Cluster:%X\n",tempde1->full_name,c);
PrintErr("Invalid Cluster:%s Cluster:%X\n",tmpde1->full_name,c);
errs++;
break;
}
if (LBts(bits,c)) {
PrintErr("Dbl Alloc:%s Cluster:%X\n",tempde1->full_name,c);
PrintErr("Dbl Alloc:%s Cluster:%X\n",tmpde1->full_name,c);
errs++;
}
if (!bits2[c]) {
PrintErr("UnAlloc:%s Cluster:%X\n",tempde1->full_name,c);
PrintErr("UnAlloc:%s Cluster:%X\n",tmpde1->full_name,c);
errs++;
} else
bits2[c]=0;
c=ClusterNumNext(dv,c);
i++;
}
if (!(tempde1->attr & RS_ATTR_DIR)) {
if (!(tmpde1->attr & RS_ATTR_DIR)) {
i*=bpc;
if (tempde1->size>i) {
PrintErr("Alloced File Too Short:%s\n",tempde1->full_name);
if (tmpde1->size>i) {
PrintErr("Alloced File Too Short:%s\n",tmpde1->full_name);
errs++;
}
if (i>tempde1->size+bpc-1) {
PrintWarn("Alloced File Too Long:%s\n",tempde1->full_name);
if (i>tmpde1->size+bpc-1) {
PrintWarn("Alloced File Too Long:%s\n",tmpde1->full_name);
errs++;
}
}
DirEntryDel(tempde1);
tempde1=tempde2;
DirEntryDel(tmpde1);
tmpde1=tmpde2;
}
return errs;
}

392
Adam/ABlkDev/FileMgr.HC

@ -1,18 +1,18 @@
#help_index "DolDoc/Output;StdOut/DolDoc"
U0 DirFileDoc(CDoc *doc,CDirEntry *tempde)
U0 DirFileDoc(CDoc *doc,CDirEntry *tmpde)
{
while (tempde) {
if (tempde->attr & RS_ATTR_DIR) {
tempde->user_data=DocPrint(doc,"$$TR,\"%s\",U=0x%X$$",tempde->name,tempde);
while (tmpde) {
if (tmpde->attr & RS_ATTR_DIR) {
tmpde->user_data=DocPrint(doc,"$$TR,\"%s\",U=0x%X$$",tmpde->name,tmpde);
DocPrint(doc,"\n$$ID,+2$$");
if (tempde->sub)
DirFileDoc(doc,tempde->sub);
if (tmpde->sub)
DirFileDoc(doc,tmpde->sub);
DocPrint(doc,"$$ID,-2$$");
} else {
tempde->user_data=DocPrint(doc,"$$MU,\"%s\",U=0x%X$$",tempde->name,tempde);
tmpde->user_data=DocPrint(doc,"$$MU,\"%s\",U=0x%X$$",tmpde->name,tmpde);
DocPrint(doc,"\n");
}
tempde=tempde->next;
tmpde=tmpde->next;
}
}
@ -31,16 +31,16 @@ class CFMUncollapsedLst
CFMUncollapsedLst *FMCollectUncollapsedLst(CDoc *doc)
{
CDocEntry *doc_e=doc->head.next;
CFMUncollapsedLst *res=NULL,*tempc;
CDirEntry *tempde;
CFMUncollapsedLst *res=NULL,*tmpc;
CDirEntry *tmpde;
while (doc_e!=doc) {
if (doc_e->type_u8==DOCT_TREE) {
if (!(doc_e->de_flags&DOCEF_CHECKED_COLLAPSED)) {
if (tempde=doc_e->user_data) {
tempc=MAlloc(sizeof(CFMUncollapsedLst));
tempc->next=res;
res=tempc;
tempc->name=StrNew(tempde->full_name);
if (tmpde=doc_e->user_data) {
tmpc=MAlloc(sizeof(CFMUncollapsedLst));
tmpc->next=res;
res=tmpc;
tmpc->name=StrNew(tmpde->full_name);
}
}
}
@ -49,49 +49,49 @@ CFMUncollapsedLst *FMCollectUncollapsedLst(CDoc *doc)
return res;
}
U0 FMMarkUncollapsed(CDoc *doc,CFMUncollapsedLst *tempc,
U0 FMMarkUncollapsed(CDoc *doc,CFMUncollapsedLst *tmpc,
U8 *cur_entry,U8 *next_entry)
{
CDocEntry *doc_e=doc->head.next;
CFMUncollapsedLst *tempc1;
CDirEntry *tempde;
CFMUncollapsedLst *tmpc1;
CDirEntry *tmpde;
while (doc_e!=doc) {
if (doc_e->type_u8==DOCT_TREE) {
tempde=doc_e->user_data;
tempc1=tempc;
while (tempc1) {
if (!StrCmp(tempc1->name,tempde->full_name)) {
tmpde=doc_e->user_data;
tmpc1=tmpc;
while (tmpc1) {
if (!StrCmp(tmpc1->name,tmpde->full_name)) {
doc_e->de_flags&=~DOCEF_CHECKED_COLLAPSED;
break;
}
tempc1=tempc1->next;
tmpc1=tmpc1->next;
}
if (cur_entry) {
if (!StrNCmp(cur_entry,tempde->full_name,StrLen(tempde->full_name))) {
if (!StrNCmp(cur_entry,tmpde->full_name,StrLen(tmpde->full_name))) {
doc->cur_entry=doc_e;
if (StrLen(tempde->full_name)==StrLen(cur_entry))
if (StrLen(tmpde->full_name)==StrLen(cur_entry))
cur_entry=NULL;
} else if (next_entry) {
if (!StrNCmp(next_entry,
tempde->full_name,StrLen(tempde->full_name))) {
tmpde->full_name,StrLen(tmpde->full_name))) {
doc->cur_entry=doc_e;
if (StrLen(tempde->full_name)==StrLen(next_entry))
if (StrLen(tmpde->full_name)==StrLen(next_entry))
cur_entry=NULL;
}
}
}
} else if (doc_e->type_u8==DOCT_MENU_VAL) {
tempde=doc_e->user_data;
tmpde=doc_e->user_data;
if (cur_entry) {
if (!StrNCmp(cur_entry,tempde->full_name,StrLen(tempde->full_name))) {
if (!StrNCmp(cur_entry,tmpde->full_name,StrLen(tmpde->full_name))) {
doc->cur_entry=doc_e;
if (StrLen(tempde->full_name)==StrLen(cur_entry))
if (StrLen(tmpde->full_name)==StrLen(cur_entry))
cur_entry=NULL;
} else if (next_entry) {
if (!StrNCmp(next_entry,
tempde->full_name,StrLen(tempde->full_name))) {
tmpde->full_name,StrLen(tmpde->full_name))) {
doc->cur_entry=doc_e;
if (StrLen(tempde->full_name)==StrLen(next_entry))
if (StrLen(tmpde->full_name)==StrLen(next_entry))
cur_entry=NULL;
}
}
@ -101,44 +101,44 @@ U0 FMMarkUncollapsed(CDoc *doc,CFMUncollapsedLst *tempc,
}
}
U0 FMDelUncollapsedLst(CFMUncollapsedLst *tempc)
U0 FMDelUncollapsedLst(CFMUncollapsedLst *tmpc)
{
CFMUncollapsedLst *tempc1;
while (tempc) {
tempc1=tempc->next;
Free(tempc->name);
Free(tempc);
tempc=tempc1;
CFMUncollapsedLst *tmpc1;
while (tmpc) {
tmpc1=tmpc->next;
Free(tmpc->name);
Free(tmpc);
tmpc=tmpc1;
}
}
CDirEntry *FMRebuildDocDrv(U8 drv_let,CDoc *doc,CDirEntry **_head,Bool init)
{
CDirEntry *tempde,*tempde1;
CDirEntry *tmpde,*tmpde1;
U8 *st;
tempde=CAlloc(sizeof(CDirEntry));
tempde->full_name=MStrPrint("%C:/",drv_let);
tempde->attr=RS_ATTR_DIR;
tmpde=CAlloc(sizeof(CDirEntry));
tmpde->full_name=MStrPrint("%C:/",drv_let);
tmpde->attr=RS_ATTR_DIR;
st=MStrPrint("%c:/*",drv_let);
if (init)
tempde->sub=tempde1=FilesFind(st,FUF_RECURSE);
tmpde->sub=tmpde1=FilesFind(st,FUF_RECURSE);
else
tempde1=NULL;
tmpde1=NULL;
Free(st);
tempde->user_data=DocPrint(doc,"$$TR,\"%s\",U=0x%X$$",tempde->full_name,tempde);
tempde->next=*_head;
*_head=tempde;
tmpde->user_data=DocPrint(doc,"$$TR,\"%s\",U=0x%X$$",tmpde->full_name,tmpde);
tmpde->next=*_head;
*_head=tmpde;
DocPrint(doc,"\n$$ID,+2$$");
DocBottom(doc);
if (init) {
DirFileDoc(doc,tempde1);
while (tempde1) {
tempde1->parent=tempde;
tempde1=tempde1->next;
DirFileDoc(doc,tmpde1);
while (tmpde1) {
tmpde1->parent=tmpde;
tmpde1=tmpde1->next;
}
}
DocPrint(doc,"$$ID,-2$$");
return tempde;
return tmpde;
}
U0 FMRebuildDoc(CDoc **_doc,CDirEntry **_head,I64 mode)
@ -146,17 +146,17 @@ U0 FMRebuildDoc(CDoc **_doc,CDirEntry **_head,I64 mode)
CDrv *dv;
I64 i;
CDoc *doc=*_doc,*doc2=sys_clipboard_doc,*parent_doc;
CFMUncollapsedLst *tempc=NULL;
CFMUncollapsedLst *tmpc=NULL;
U8 *cur_entry=NULL,*next_entry=NULL;
CDocEntry *doc_ce;
CDirEntry *tempde,*tempde1,*cur_tree_entry;
CDirEntry *tmpde,*tmpde1,*cur_tree_entry;
if (!doc)
parent_doc=DocPut;
else {
parent_doc=doc->parent_doc;
Fs->put_doc=Fs->display_doc=NULL;
DocUnlock(doc);
WinMgrSync;
Refresh;
DocLock(doc);
cur_tree_entry=NULL;
doc_ce=doc->cur_entry;
@ -164,32 +164,32 @@ U0 FMRebuildDoc(CDoc **_doc,CDirEntry **_head,I64 mode)
cur_tree_entry=doc_ce->user_data;
if (cur_tree_entry)
cur_entry=StrNew(cur_tree_entry->full_name);
tempde=NULL;
tmpde=NULL;
if (doc_ce!=doc)
doc_ce=doc_ce->next;
while (doc_ce!=doc) {
if (doc_ce->type_u8==DOCT_TREE || doc_ce->type_u8==DOCT_MENU_VAL)
tempde=doc_ce->user_data;
tmpde=doc_ce->user_data;
else
tempde=NULL;
if (tempde) {
tempde1=tempde->parent;
while (tempde1) {
if (tempde1==cur_tree_entry) {
tempde=NULL;
tmpde=NULL;
if (tmpde) {
tmpde1=tmpde->parent;
while (tmpde1) {
if (tmpde1==cur_tree_entry) {
tmpde=NULL;
break;
} else
tempde1=tempde1->parent;
tmpde1=tmpde1->parent;
}
if (tempde)
if (tmpde)
break;
}
doc_ce=doc_ce->next;
}
if (tempde)
next_entry=StrNew(tempde->full_name);
if (tmpde)
next_entry=StrNew(tmpde->full_name);
tempc=FMCollectUncollapsedLst(doc);
tmpc=FMCollectUncollapsedLst(doc);
DocDel(doc);
}
if (*_head) {
@ -219,19 +219,19 @@ U0 FMRebuildDoc(CDoc **_doc,CDirEntry **_head,I64 mode)
dv=&blkdev.drvs[i];
if (dv->bd->type==BDT_ATAPI) {
if (dv->bd->flags&BDF_INITIALIZED)
tempde=FMRebuildDocDrv(Drv2Let(dv),doc,_head,TRUE);
tmpde=FMRebuildDocDrv(Drv2Let(dv),doc,_head,TRUE);
else {
tempde=FMRebuildDocDrv(Drv2Let(dv),doc,_head,FALSE);
tempde->flags|=DEF_NOT_INITIALIZED;
tmpde=FMRebuildDocDrv(Drv2Let(dv),doc,_head,FALSE);
tmpde->flags|=DEF_NOT_INITIALIZED;
}
} else if (dv->fs_type==FSt_REDSEA || dv->fs_type==FSt_FAT32)
FMRebuildDocDrv(Drv2Let(dv),doc,_head,TRUE);
}
DocTop(doc);
FMMarkUncollapsed(doc,tempc,cur_entry,next_entry);
FMMarkUncollapsed(doc,tmpc,cur_entry,next_entry);
DocCenter(doc);
DocRst(doc2,TRUE);
FMDelUncollapsedLst(tempc);
FMDelUncollapsedLst(tmpc);
Free(cur_entry);
Free(next_entry);
*_doc=doc;
@ -243,28 +243,28 @@ U0 FMRename(CDoc *doc)
{
CEdFileName fn;
CDocEntry *doc_e=doc->cur_entry;
CDirEntry *tempde=NULL,*parent;
CDirEntry *tmpde=NULL,*parent;
if (doc_e->type_u8==DOCT_MENU_VAL) {
tempde=doc_e->user_data;
if (parent=tempde->parent) {
tmpde=doc_e->user_data;
if (parent=tmpde->parent) {
Cd(parent->full_name);
StrCpy(fn.name,tempde->name);
StrCpy(fn.name,tmpde->name);
if (DocForm(&fn)) {
Silent;
Move(tempde->name,fn.name);
Move(tmpde->name,fn.name);
Silent(OFF);
}
}
} else if (doc_e->type_u8==DOCT_TREE) {
tempde=doc_e->user_data;
if (parent=tempde->parent) {
tmpde=doc_e->user_data;
if (parent=tmpde->parent) {
Cd(parent->full_name);
StrCpy(fn.name,tempde->name);
StrCpy(fn.name,tmpde->name);
if (DocForm(&fn)) {
if (StrCmp(tempde->name,fn.name)) {
if (StrCmp(tmpde->name,fn.name)) {
Silent;
if (CopyTree(tempde->name,fn.name))
DelTree(tempde->name);
if (CopyTree(tmpde->name,fn.name))
DelTree(tmpde->name);
Silent(OFF);
}
}
@ -276,11 +276,11 @@ U0 FMMkDir(CDoc *doc)
{
CEdFileName fn;
CDocEntry *doc_e=doc->cur_entry;
CDirEntry *tempde=NULL,*parent;
CDirEntry *tmpde=NULL,*parent;
*fn.name=0;
if (doc_e->type_u8==DOCT_MENU_VAL) {
tempde=doc_e->user_data;
if (parent=tempde->parent) {
tmpde=doc_e->user_data;
if (parent=tmpde->parent) {
Cd(parent->full_name);
if (DocForm(&fn)) {
Silent;
@ -289,8 +289,8 @@ U0 FMMkDir(CDoc *doc)
}
}
} else if (doc_e->type_u8==DOCT_TREE) {
tempde=doc_e->user_data;
Cd(tempde->full_name);
tmpde=doc_e->user_data;
Cd(tmpde->full_name);
if (DocForm(&fn)) {
Silent;
MkDir(fn.name);
@ -303,21 +303,21 @@ U0 FMDelete(CDoc *doc)
{
U8 *st;
CDocEntry *doc_ce=doc->cur_entry;
CDirEntry *tempde;
CDirEntry *tmpde;
if (doc_ce->type_u8==DOCT_MENU_VAL) {
tempde=doc_ce->user_data;
tmpde=doc_ce->user_data;
Silent;
st=MStrPrint("Delete: %s",tempde->full_name);
st=MStrPrint("Delete: %s",tmpde->full_name);
if (PopUpCancelOk(st))
Del(tempde->full_name);
Del(tmpde->full_name);
Free(st);
Silent(OFF);
} else if (doc_ce->type_u8==DOCT_TREE) {
tempde=doc_ce->user_data;
tmpde=doc_ce->user_data;
Silent;
st=MStrPrint("Delete: %s",tempde->full_name);
st=MStrPrint("Delete: %s",tmpde->full_name);
if (PopUpCancelOk(st))
DelTree(tempde->full_name);
DelTree(tmpde->full_name);
Free(st);
Silent(OFF);
}
@ -326,16 +326,16 @@ U0 FMDelete(CDoc *doc)
U0 FMChgDsk(CDoc *doc)
{
CDocEntry *doc_ce=doc->cur_entry;
CDirEntry *tempde;
CDirEntry *tmpde;
if (doc_ce->type_u8==DOCT_TREE || doc_ce->type_u8==DOCT_MENU_VAL)
tempde=doc_ce->user_data;
tmpde=doc_ce->user_data;
else
tempde=NULL;
if (tempde) {
while (tempde->parent)
tempde=tempde->parent;
tmpde=NULL;
if (tmpde) {
while (tmpde->parent)
tmpde=tmpde->parent;
Silent;
ChgDsk(*tempde->full_name);
ChgDsk(*tmpde->full_name);
Silent(OFF);
}
}
@ -343,24 +343,24 @@ U0 FMChgDsk(CDoc *doc)
U0 FMMountISO(CDoc *doc)
{
CDocEntry *doc_ce=doc->cur_entry;
CDirEntry *tempde;
if (doc_ce->type_u8==DOCT_MENU_VAL && (tempde=doc_ce->user_data))
MountFile(tempde->full_name);
CDirEntry *tmpde;
if (doc_ce->type_u8==DOCT_MENU_VAL && (tmpde=doc_ce->user_data))
MountFile(tmpde->full_name);
}
U0 FMUnmount(CDoc *doc)
{
CDocEntry *doc_ce=doc->cur_entry;
CDirEntry *tempde;
CDirEntry *tmpde;
I64 drv_let;
if (doc_ce->type_u8==DOCT_TREE || doc_ce->type_u8==DOCT_MENU_VAL)
tempde=doc_ce->user_data;
tmpde=doc_ce->user_data;
else
tempde=NULL;
if (tempde) {
while (tempde->parent)
tempde=tempde->parent;
drv_let=*tempde->full_name;
tmpde=NULL;
if (tmpde) {
while (tmpde->parent)
tmpde=tmpde->parent;
drv_let=*tmpde->full_name;
if (Let2BlkDev(drv_let)!=Let2BlkDev(':'))
Unmount(drv_let);
}
@ -369,19 +369,19 @@ U0 FMUnmount(CDoc *doc)
U0 FMFmtDrv(CDoc *doc)
{
CDocEntry *doc_ce=doc->cur_entry;
CDirEntry *tempde;
CDirEntry *tmpde;
U8 *st=NULL;
if (doc_ce->type_u8==DOCT_TREE || doc_ce->type_u8==DOCT_MENU_VAL)
tempde=doc_ce->user_data;
tmpde=doc_ce->user_data;
else
tempde=NULL;
if (tempde) {
while (tempde->parent)
tempde=tempde->parent;
st=MStrPrint("Format Drive '%c'?\nAre You Sure?\n",*tempde->full_name);
tmpde=NULL;
if (tmpde) {
while (tmpde->parent)
tmpde=tmpde->parent;
st=MStrPrint("Format Drive '%c'?\nAre You Sure?\n",*tmpde->full_name);
if (PopUpCancelOk(st)) {
Silent;
Fmt(*tempde->full_name,,FALSE);
Fmt(*tmpde->full_name,,FALSE);
Silent(OFF);
}
}
@ -391,21 +391,21 @@ U0 FMFmtDrv(CDoc *doc)
U0 FMMakeISO(CDoc *doc)
{
CDocEntry *doc_ce=doc->cur_entry;
CDirEntry *tempde;
CDirEntry *tmpde;
U8 *st;
if (doc_ce->type_u8==DOCT_TREE || doc_ce->type_u8==DOCT_MENU_VAL)
tempde=doc_ce->user_data;
tmpde=doc_ce->user_data;
else
tempde=NULL;
if (tempde) {
tmpde=NULL;
if (tmpde) {
if (doc_ce->type_u8==DOCT_MENU_VAL)
tempde=tempde->parent;
if (tempde && *tempde->full_name) {
tmpde=tmpde->parent;
if (tmpde && *tmpde->full_name) {
Silent;
if (tempde->full_name[StrLen(tempde->full_name)-1]=='/')
st=MStrPrint("%s*",tempde->full_name);
if (tmpde->full_name[StrLen(tmpde->full_name)-1]=='/')
st=MStrPrint("%s*",tmpde->full_name);
else
st=MStrPrint("%s/*",tempde->full_name);
st=MStrPrint("%s/*",tmpde->full_name);
ISO9660ISO(,st);
Free(st);
Silent(OFF);
@ -416,16 +416,16 @@ U0 FMMakeISO(CDoc *doc)
U0 FMBurnISO(CDoc *doc)
{
CDocEntry *doc_ce=doc->cur_entry;
CDirEntry *tempde;
CDirEntry *tmpde;
if (doc_ce->type_u8==DOCT_TREE || doc_ce->type_u8==DOCT_MENU_VAL)
tempde=doc_ce->user_data;
tmpde=doc_ce->user_data;
else
tempde=NULL;
if (tempde) {
while (tempde->parent)
tempde=tempde->parent;
tmpde=NULL;
if (tmpde) {
while (tmpde->parent)
tmpde=tmpde->parent;
Silent;
DVDImageWrite(*tempde->full_name);
DVDImageWrite(*tmpde->full_name);
Silent(OFF);
}
}
@ -435,37 +435,37 @@ U0 FMCopy(CDoc *doc)
CDoc *doc2=sys_clipboard_doc;
U8 *st;
CDocEntry *doc_ce=doc->cur_entry,*doc_e;
CDirEntry *tempde,*tempde1=NULL,*tempde2;
CDirEntry *tmpde,*tmpde1=NULL,*tmpde2;
Bool unlock_doc2=DocLock(doc2);
doc_e=doc2->head.next;
tempde1=doc_ce->user_data;
tmpde1=doc_ce->user_data;
if (doc_ce->type_u8==DOCT_MENU_VAL)
tempde1=tempde1->parent;
tmpde1=tmpde1->parent;
else if (doc_ce->type_u8!=DOCT_TREE)
tempde1=NULL;
if (tempde1) {
tmpde1=NULL;
if (tmpde1) {
while (doc_e!=doc2) {
if (doc_e->type_u8==DOCT_MENU_VAL) {
tempde=doc_e->user_data;
tempde->flags|=DEF_PROCESSED;
tempde2=tempde->parent;
if (!tempde2 || !(tempde2->flags&DEF_PROCESSED)) {
tmpde=doc_e->user_data;
tmpde->flags|=DEF_PROCESSED;
tmpde2=tmpde->parent;
if (!tmpde2 || !(tmpde2->flags&DEF_PROCESSED)) {
Silent;
Copy(tempde->full_name,tempde1->full_name);
Copy(tmpde->full_name,tmpde1->full_name);
Silent(OFF);
}
} else if (doc_e->type_u8==DOCT_TREE) {
tempde=doc_e->user_data;
tempde->flags|=DEF_PROCESSED;
tempde2=tempde->parent;
if (!tempde2 || !(tempde2->flags&DEF_PROCESSED)) {
tmpde=doc_e->user_data;
tmpde->flags|=DEF_PROCESSED;
tmpde2=tmpde->parent;
if (!tmpde2 || !(tmpde2->flags&DEF_PROCESSED)) {
Silent;
if (*tempde1->name)
st=MStrPrint("%s/%s",tempde1->full_name,tempde->name);
if (*tmpde1->name)
st=MStrPrint("%s/%s",tmpde1->full_name,tmpde->name);
else
st=MStrPrint("%s%s",tempde1->full_name,tempde->name);
CopyTree(tempde->full_name,st);
st=MStrPrint("%s%s",tmpde1->full_name,tmpde->name);
CopyTree(tmpde->full_name,st);
Free(st);
Silent(OFF);
}
@ -567,20 +567,20 @@ U0 FMRightClick()
}
U8 *fm_ip_str=NULL;
U0 (*fp_old_final_screen_update)(CDC *dc);
U0 (*fp_old_final_scrn_update)(CDC *dc);
U0 FMFinalScreenUpdate(CDC *dc)
U0 FMFinalScrnUpdate(CDC *dc)
{
if (fm_ip_str) {
dc->color=LTRED;
GrPrint(dc,ip.pos.x,ip.pos.y,"%s",fm_ip_str);
}
(*fp_old_final_screen_update)(dc);
(*fp_old_final_scrn_update)(dc);
}
public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
{//File manager. Also, used to choose files and dirs.
CDirEntry *head=NULL,*tempde,*tempde1,*tempde2;
CDirEntry *head=NULL,*tmpde,*tmpde1,*tmpde2;
I64 sc,ch,a1,a2,msg_code;
CDoc *doc=NULL,*old_put_doc=DocPut,*old_display_doc=DocDisplay;
U8 *res=NULL,*st,*st2,*old_cur_dir=CurDir;
@ -588,15 +588,15 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
Bool okay;
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
fp_old_final_screen_update=gr.fp_final_screen_update;
fp_old_final_scrn_update=gr.fp_final_scrn_update;
MenuFilePush("::/Doc/FileMgrPullDown.DD");
FMRebuildDoc(&doc,&head,mode);
if (tempde1=Cd2DirEntry(head,old_cur_dir))
doc->cur_entry=tempde1->user_data;
while (tempde1) {
if (tempde1->attr&RS_ATTR_DIR)
tempde1->user_data(CDocEntry *)->de_flags&=~DOCEF_CHECKED_COLLAPSED;
tempde1=tempde1->parent;
if (tmpde1=Cd2DirEntry(head,old_cur_dir))
doc->cur_entry=tmpde1->user_data;
while (tmpde1) {
if (tmpde1->attr&RS_ATTR_DIR)
tmpde1->user_data(CDocEntry *)->de_flags&=~DOCEF_CHECKED_COLLAPSED;
tmpde1=tmpde1->parent;
}
do {
DocUnlock(doc);
@ -613,51 +613,51 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
case MSG_IP_L_DOWN:
doc_ce=doc->cur_entry;
fm_ip_str=doc_ce->tag;
gr.fp_final_screen_update=&FMFinalScreenUpdate;
gr.fp_final_scrn_update=&FMFinalScrnUpdate;
break;
case MSG_IP_L_UP:
if (doc_ce) {
gr.fp_final_screen_update=fp_old_final_screen_update;
gr.fp_final_scrn_update=fp_old_final_scrn_update;
if (WinCursorPosSet(Fs,a1+Fs->pix_left+Fs->scroll_x,
a2+Fs->pix_top+Fs->scroll_y,TRUE)) {
doc_e=doc->cur_entry;
if (doc_e!=doc_ce) {
st2=NULL;
if (doc_e->type_u8==DOCT_MENU_VAL) {
tempde1=doc_e->user_data;
if (tempde1=tempde1->parent)
st2=StrNew(tempde1->full_name);
tmpde1=doc_e->user_data;
if (tmpde1=tmpde1->parent)
st2=StrNew(tmpde1->full_name);
} else if (doc_e->type_u8==DOCT_TREE) {
tempde1=doc_e->user_data;
st2=StrNew(tempde1->full_name);
tmpde1=doc_e->user_data;
st2=StrNew(tmpde1->full_name);
}
if (st2 && doc_ce->type_u8==DOCT_MENU_VAL) {
tempde=doc_ce->user_data;
tmpde=doc_ce->user_data;
Silent;
Move(tempde->full_name,st2);
Move(tmpde->full_name,st2);
Silent(OFF);
FMRebuildDoc(&doc,&head,mode);
} else if (st2 && doc_ce->type_u8==DOCT_TREE) {
tempde=doc_ce->user_data;
tmpde=doc_ce->user_data;
okay=TRUE;
tempde2=tempde1;
while (tempde2) {
if (tempde2!=tempde)
tempde2=tempde2->parent;
tmpde2=tmpde1;
while (tmpde2) {
if (tmpde2!=tmpde)
tmpde2=tmpde2->parent;
else {
okay=FALSE;
break;
}
}
if (okay) {
if (*tempde1->name)
st=MStrPrint("%s/%s",tempde1->full_name,tempde->name);
if (*tmpde1->name)
st=MStrPrint("%s/%s",tmpde1->full_name,tmpde->name);
else
st=MStrPrint("%s%s",tempde1->full_name,tempde->name);
if (StrCmp(tempde->full_name,st)) {
st=MStrPrint("%s%s",tmpde1->full_name,tmpde->name);
if (StrCmp(tmpde->full_name,st)) {
Silent;
CopyTree(tempde->full_name,st);
DelTree(tempde->full_name);
CopyTree(tmpde->full_name,st);
DelTree(tmpde->full_name);
Silent(OFF);
FMRebuildDoc(&doc,&head,mode);
}
@ -743,15 +743,15 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
break;
case CH_ESC:
doc_ce=doc->cur_entry;
tempde=doc_ce->user_data;
tmpde=doc_ce->user_data;
if (mode==FM_PICK_FILE && doc_ce->type_u8==DOCT_MENU_VAL)
res=StrNew(tempde->full_name,mem_task);
res=StrNew(tmpde->full_name,mem_task);
else if (mode==FM_PICK_DIR) {
if (doc_ce->type_u8==DOCT_TREE)
res=StrNew(tempde->full_name,mem_task);
res=StrNew(tmpde->full_name,mem_task);
else if (doc_ce->type_u8==DOCT_MENU_VAL &&
(tempde=tempde->parent))
res=StrNew(tempde->full_name,mem_task);
(tmpde=tmpde->parent))
res=StrNew(tmpde->full_name,mem_task);
}
break;
default:
@ -760,12 +760,12 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
FMRebuildDoc(&doc,&head,mode);
} else if (sc.u8[0]==SC_F5) {
if (doc->cur_entry->type_u8==DOCT_MENU_VAL) {
tempde=doc->cur_entry->user_data;
tmpde=doc->cur_entry->user_data;
DocUnlock(doc);
if (sc&SCF_SHIFT)
AdamFile(tempde->full_name);
AdamFile(tmpde->full_name);
else
PopUpFile(tempde->full_name);
PopUpFile(tmpde->full_name);
DocLock(doc);
}
} else {
@ -778,7 +778,7 @@ fm_regular_key:
break;
}
} while (ch!=CH_ESC && ch!=CH_SHIFT_ESC);
gr.fp_final_screen_update=fp_old_final_screen_update;
gr.fp_final_scrn_update=fp_old_final_scrn_update;
Fs->put_doc =old_put_doc;
Fs->display_doc=old_display_doc;
SettingsPop;

10
Adam/ABlkDev/Mount.HC

@ -4,7 +4,7 @@ I64 Mount2(U8 boot_drv_let,CDoc *_doc,Bool repartition)
I64 cnt,res=0,num_hints,drv_let,type,unit;
U8 blks_buf[STR_LEN],addr_buf[STR_LEN],base0_buf[STR_LEN],base1_buf[STR_LEN],
*filename=NULL,*filename2=NULL;
CATARep *head=NULL,*tempha;
CATARep *head=NULL,*tmpha;
Bool one_drv,make_free;
CDoc *doc;
boot_drv_let=ToUpper(boot_drv_let);
@ -57,10 +57,10 @@ I64 Mount2(U8 boot_drv_let,CDoc *_doc,Bool repartition)
GetS(base0_buf,STR_LEN);
} while (!Str2I64(base0_buf) && (type!=BDT_ATAPI || !boot_drv_let));
if (1<=Str2I64(base0_buf)<=num_hints) {
tempha=ATARepFind(head,Str2I64(base0_buf));
StrPrint(base0_buf,"0x%X",tempha->base0);
StrPrint(base1_buf,"0x%X",tempha->base1);
unit=tempha->unit;
tmpha=ATARepFind(head,Str2I64(base0_buf));
StrPrint(base0_buf,"0x%X",tmpha->base0);
StrPrint(base1_buf,"0x%X",tmpha->base1);
unit=tmpha->unit;
} else if (type!=BDT_ATAPI || *base0_buf) {
if (type==BDT_ATAPI)
StrCpy(base1_buf,"0");

56
Adam/ABlkDev/PrtDsk.HC

<
@ -18,7 +18,7 @@ public I64 PrtDsk(U8 drv_let=0)
//drv_let=0 means add new drive that
//is not already mounted.
CBlkDev *bd;
CPlannedDrv head,*temppp;
CPlannedDrv head,*tmppp;
CMasterBoot mbr;
Bool pri=TRUE;
I64 ext_base,drv_let2,pri_cnt=0,
@ -49,15 +49,15 @@ public I64 PrtDsk(U8 drv_let=0)
drv_let2=bd->first_drv_let;
remaining=FloorU64(bd->max_blk+1,ROUND_DRV_TO);
while (FloorU64(remaining,ROUND_DRV_TO)>=ROUND_DRV_TO) {
temppp=MAlloc(sizeof(CPlannedDrv));
tmppp=MAlloc(sizeof(CPlannedDrv));
do {
"$$RED$$Partition %C$$FG$$\n",drv_let2;
temppp->pri=FALSE;
tmppp->pri=FALSE;
if (pri) {
"Primary Partition";
if (YorN) {
pri_cnt++;
temppp->pri=TRUE;
tmppp->pri=TRUE;
if (pri_cnt==3)
pri=FALSE;
} else
@ -65,31 +65,31 @@ public I64 PrtDsk(U8 drv_let=0)
}
"Blocks Remaining:%d (0x%X)\n",
remaining-DRV_HEADER,remaining-DRV_HEADER;
temppp->size=CeilU64(GetI64("Size in Blocks :",
tmppp->size=CeilU64(GetI64("Size in Blocks :",
remaining-DRV_HEADER)+DRV_HEADER,ROUND_DRV_TO);
} while (!(ROUND_DRV_TO<=temppp->size<=FloorU64(remaining,ROUND_DRV_TO)));
QueIns(temppp,head.last);
remaining-=temppp->size;
} 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";
temppp=head.next;
tmppp=head.next;
drv_let2=bd->first_drv_let;
while (temppp!=&head) {
"Drive %C:%08X ",drv_let2,temppp->size;
if (temppp->pri)
while (tmppp!=&head) {
"Drive %C:%08X ",drv_let2,tmppp->size;
if (tmppp->pri)
"Primary\n";
else
"Logical\n";
temppp=temppp->next;
tmppp=tmppp->next;
drv_let2++;
}
if (!AreYouSure)
goto pd_done;
remaining=FloorU64(bd->max_blk+1,ROUND_DRV_TO)-ROUND_DRV_TO;
temppp=head.next;
tmppp=head.next;
MemSet(&mbr,0,BLK_SIZE);
mbr.signature=0xAA55;
offset=0;
@ -101,13 +101,13 @@ public I64 PrtDsk(U8 drv_let=0)
mbr.p[i].end_head=0xFE;
mbr.p[i].end_cyl=0xFFFF;
mbr.p[i].offset=DRV_HEADER+offset;
mbr.p[i].size=temppp->size-DRV_HEADER;
offset+=temppp->size;
remaining-=temppp->size;
temppp=temppp->next;
mbr.p[i].size=tmppp->size-DRV_HEADER;
offset+=tmppp->size;
remaining-=tmppp->size;
tmppp=tmppp->next;
}
if (!i) i++;
if (temppp!=&head) {
if (tmppp!=&head) {
mbr.p[i].active=0x80;
mbr.p[i].start_head=0;
mbr.p[i].start_cyl=0x101;
@ -120,7 +120,7 @@ public I64 PrtDsk(U8 drv_let=0)
}
ATAWriteBlks(bd,&mbr,0,1);
while (temppp!=&head) {
while (tmppp!=&head) {
start_offset=offset;
MemSet(&mbr,0,BLK_SIZE);
mbr.signature=0xAA55;
@ -132,10 +132,10 @@ public I64 PrtDsk(U8 drv_let=0)
mbr.p[0].end_head=0xFE;
mbr.p[0].end_cyl=0xFFFF;
mbr.p[0].offset=DRV_HEADER;
mbr.p[0].size=temppp->size-DRV_HEADER;
offset+=temppp->size;
temppp=temppp->next;
if (temppp!=&head) {
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;
@ -143,7 +143,7 @@ public I64 PrtDsk(U8 drv_let=0)
mbr.p[1].end_head=0xFE;
mbr.p[1].end_cyl=0xFFFF;
mbr.p[1].offset=offset-ext_base;
mbr.p[1].size=temppp->size;
mbr.p[1].size=tmppp->size;
}
ATAWriteBlks(bd,&mbr,start_offset,1);
}
@ -155,9 +155,9 @@ public I64 PrtDsk(U8 drv_let=0)
pd_done:
while (head.next!=&head) {
temppp=head.next;
QueRem(temppp);
Free(temppp);
tmppp=head.next;
QueRem(tmppp);
Free(tmppp);
}
return drv_dsk_dsk_size;