TempleOSCDV4.06.ISO
This commit is contained in:
1 parent
6fe38d2d9d
commit
b632ab9a4f
261 files changed
+6282
-5801
No files matched your search
Binary file not shown.
+24
-24
@@ -63,7 +63,7 @@ public Bool Copy(U8 *src_files_find_mask,U8 *dst_files_find_mask=".")
|
|||||||
//If the name ends in ".Z", it will
|
//If the name ends in ".Z", it will
|
||||||
//be stored compressed. If not ".Z"
|
//be stored compressed. If not ".Z"
|
||||||
//it will be stored uncompressed.
|
//it will be stored uncompressed.
|
||||||
Bool result=TRUE;
|
Bool res=TRUE;
|
||||||
CDirContext *dirc;
|
CDirContext *dirc;
|
||||||
CDirEntry *tempde,*tempde1;
|
CDirEntry *tempde,*tempde1;
|
||||||
U8 *st;
|
U8 *st;
|
||||||
@@ -76,7 +76,7 @@ public Bool Copy(U8 *src_files_find_mask,U8 *dst_files_find_mask=".")
|
|||||||
if (!(tempde->attr & RS_ATTR_DIR)) {
|
if (!(tempde->attr & RS_ATTR_DIR)) {
|
||||||
st=FileNameAbs(tempde->name);
|
st=FileNameAbs(tempde->name);
|
||||||
if (!CopySingle(tempde->full_name,st))
|
if (!CopySingle(tempde->full_name,st))
|
||||||
result=FALSE;
|
res=FALSE;
|
||||||
Free(st);
|
Free(st);
|
||||||
}
|
}
|
||||||
tempde=tempde->next;
|
tempde=tempde->next;
|
||||||
@@ -84,7 +84,7 @@ public Bool Copy(U8 *src_files_find_mask,U8 *dst_files_find_mask=".")
|
|||||||
DirContextDel(dirc);
|
DirContextDel(dirc);
|
||||||
}
|
}
|
||||||
DirTreeDel(tempde1);
|
DirTreeDel(tempde1);
|
||||||
return result;
|
return res;
|
||||||
} else {
|
} else {
|
||||||
DirTreeDel(tempde1);
|
DirTreeDel(tempde1);
|
||||||
return CopySingle(src_files_find_mask,dst_files_find_mask);
|
return CopySingle(src_files_find_mask,dst_files_find_mask);
|
||||||
@@ -103,21 +103,21 @@ public Bool Move(U8 *f1,U8 *f2)
|
|||||||
I64 CopyTree2(CDirEntry *tempde,I64 src_dir_len,I64 dst_dir_len,U8 *dst_dir)
|
I64 CopyTree2(CDirEntry *tempde,I64 src_dir_len,I64 dst_dir_len,U8 *dst_dir)
|
||||||
{
|
{
|
||||||
U8 *st;
|
U8 *st;
|
||||||
I64 result=1;
|
I64 res=1;
|
||||||
while (tempde) {
|
while (tempde) {
|
||||||
st=MAlloc(StrLen(tempde->full_name)+dst_dir_len+2);
|
st=MAlloc(StrLen(tempde->full_name)+dst_dir_len+2);
|
||||||
MemCpy(st,dst_dir,dst_dir_len);
|
MemCpy(st,dst_dir,dst_dir_len);
|
||||||
StrCpy(st+dst_dir_len,tempde->full_name+src_dir_len);
|
StrCpy(st+dst_dir_len,tempde->full_name+src_dir_len);
|
||||||
if (tempde->attr & RS_ATTR_DIR) {
|
if (tempde->attr & RS_ATTR_DIR) {
|
||||||
MkDir(st);
|
MkDir(st);
|
||||||
result+=CopyTree2(tempde->sub,src_dir_len,dst_dir_len,dst_dir);
|
res+=CopyTree2(tempde->sub,src_dir_len,dst_dir_len,dst_dir);
|
||||||
} else
|
} else
|
||||||
if (CopySingle(tempde->full_name,st))
|
if (CopySingle(tempde->full_name,st))
|
||||||
result++;
|
res++;
|
||||||
Free(st);
|
Free(st);
|
||||||
tempde=tempde->next;
|
tempde=tempde->next;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
public I64 CopyTree(U8 *src_files_find_mask,U8 *dst_files_find_mask,
|
public I64 CopyTree(U8 *src_files_find_mask,U8 *dst_files_find_mask,
|
||||||
Bool no_mask=TRUE)
|
Bool no_mask=TRUE)
|
||||||
@@ -125,7 +125,7 @@ public I64 CopyTree(U8 *src_files_find_mask,U8 *dst_files_find_mask,
|
|||||||
//Returns the count of copied files (not dirs).
|
//Returns the count of copied files (not dirs).
|
||||||
CDirContext *dirc;
|
CDirContext *dirc;
|
||||||
CDirEntry *tempde=NULL;
|
CDirEntry *tempde=NULL;
|
||||||
I64 result=0,i1,i2;
|
I64 res=0,i1,i2;
|
||||||
U8 *st1,*st2;
|
U8 *st1,*st2;
|
||||||
|
|
||||||
st1=DirNameAbs(src_files_find_mask);
|
st1=DirNameAbs(src_files_find_mask);
|
||||||
@@ -148,60 +148,60 @@ public I64 CopyTree(U8 *src_files_find_mask,U8 *dst_files_find_mask,
|
|||||||
st2=CurDir;
|
st2=CurDir;
|
||||||
i2=StrLen(st2);
|
i2=StrLen(st2);
|
||||||
if (i2==3) i2--;
|
if (i2==3) i2--;
|
||||||
result=CopyTree2(tempde,i1,i2,st2);
|
res=CopyTree2(tempde,i1,i2,st2);
|
||||||
DirContextDel(dirc);
|
DirContextDel(dirc);
|
||||||
Free(st2);
|
Free(st2);
|
||||||
}
|
}
|
||||||
DirTreeDel(tempde);
|
DirTreeDel(tempde);
|
||||||
Free(st1);
|
Free(st1);
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
I64 DelTreeDirs(CDirEntry *tempde1)
|
I64 DelTreeDirs(CDirEntry *tempde1)
|
||||||
{
|
{
|
||||||
I64 result=0;
|
I64 res=0;
|
||||||
CDirEntry *tempde2;
|
CDirEntry *tempde2;
|
||||||
while (tempde1) {
|
while (tempde1) {
|
||||||
tempde2=tempde1->next;
|
tempde2=tempde1->next;
|
||||||
if (tempde1->attr & RS_ATTR_DIR) {
|
if (tempde1->attr & RS_ATTR_DIR) {
|
||||||
if (tempde1->sub)
|
if (tempde1->sub)
|
||||||
result+=DelTreeDirs(tempde1->sub);
|
res+=DelTreeDirs(tempde1->sub);
|
||||||
result+=Del(tempde1->full_name,TRUE,TRUE);
|
res+=Del(tempde1->full_name,TRUE,TRUE);
|
||||||
}
|
}
|
||||||
DirEntryDel(tempde1);
|
DirEntryDel(tempde1);
|
||||||
tempde1=tempde2;
|
tempde1=tempde2;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
I64 DelTreeFiles(CDirEntry *tempde1)
|
I64 DelTreeFiles(CDirEntry *tempde1)
|
||||||
{
|
{
|
||||||
I64 result=0;
|
I64 res=0;
|
||||||
CDirEntry *tempde2;
|
CDirEntry *tempde2;
|
||||||
while (tempde1) {
|
while (tempde1) {
|
||||||
tempde2=tempde1->next;
|
tempde2=tempde1->next;
|
||||||
if (tempde1->attr & RS_ATTR_DIR) {
|
if (tempde1->attr & RS_ATTR_DIR) {
|
||||||
if (tempde1->sub)
|
if (tempde1->sub)
|
||||||
result+=DelTreeFiles(tempde1->sub);
|
res+=DelTreeFiles(tempde1->sub);
|
||||||
} else
|
} else
|
||||||
result+=Del(tempde1->full_name,FALSE,TRUE);
|
res+=Del(tempde1->full_name,FALSE,TRUE);
|
||||||
DirEntryDel(tempde1);
|
DirEntryDel(tempde1);
|
||||||
tempde1=tempde2;
|
tempde1=tempde2;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
public I64 DelTree(U8 *files_find_mask,U8 *fu_flags=NULL)
|
public I64 DelTree(U8 *files_find_mask,U8 *fu_flags=NULL)
|
||||||
{//Delete directory tree.
|
{//Delete directory tree.
|
||||||
I64 result=0,fuf_flags=0;
|
I64 res=0,fuf_flags=0;
|
||||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
|
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
|
||||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||||
if (IsDir(files_find_mask)) {
|
if (IsDir(files_find_mask)) {
|
||||||
result=DelTreeDirs(FilesFind(files_find_mask,fuf_flags));
|
res=DelTreeDirs(FilesFind(files_find_mask,fuf_flags));
|
||||||
result+=Del(files_find_mask,TRUE,TRUE);
|
res+=Del(files_find_mask,TRUE,TRUE);
|
||||||
result+=Del(files_find_mask,FALSE,TRUE);
|
res+=Del(files_find_mask,FALSE,TRUE);
|
||||||
} else
|
} else
|
||||||
result=DelTreeFiles(FilesFind(files_find_mask,fuf_flags));
|
res=DelTreeFiles(FilesFind(files_find_mask,fuf_flags));
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 TouchFile(U8 *filename,U8 *attr,CDate cdt=MIN_I64)
|
U0 TouchFile(U8 *filename,U8 *attr,CDate cdt=MIN_I64)
|
||||||
|
|||||||
+21
-21
@@ -1,33 +1,33 @@
|
|||||||
#help_index "File/Internal"
|
#help_index "File/Internal"
|
||||||
I64 DirTreeSerializeSize(CDirEntry *tempde)
|
I64 DirTreeSerializeSize(CDirEntry *tempde)
|
||||||
{
|
{
|
||||||
I64 result=0;
|
I64 res=0;
|
||||||
while (tempde) {
|
while (tempde) {
|
||||||
result+=CDIR_SIZE+1;
|
res+=CDIR_SIZE+1;
|
||||||
if (tempde->attr & RS_ATTR_DIR)
|
if (tempde->attr & RS_ATTR_DIR)
|
||||||
result+=DirTreeSerializeSize(tempde->sub);
|
res+=DirTreeSerializeSize(tempde->sub);
|
||||||
tempde=tempde->next;
|
tempde=tempde->next;
|
||||||
}
|
}
|
||||||
return result+1;
|
return res+1;
|
||||||
}
|
}
|
||||||
I64 DirTreeSerializeFill(CDirEntry *tempde,U8 *dst)
|
I64 DirTreeSerializeFill(CDirEntry *tempde,U8 *dst)
|
||||||
{
|
{
|
||||||
I64 result=0,i;
|
I64 res=0,i;
|
||||||
while (tempde) {
|
while (tempde) {
|
||||||
*dst++=1;
|
*dst++=1;
|
||||||
result++;
|
res++;
|
||||||
MemCpy(dst,&tempde->start,CDIR_SIZE);
|
MemCpy(dst,&tempde->start,CDIR_SIZE);
|
||||||
dst+=CDIR_SIZE;
|
dst+=CDIR_SIZE;
|
||||||
result+=CDIR_SIZE;
|
res+=CDIR_SIZE;
|
||||||
if (tempde->attr & RS_ATTR_DIR) {
|
if (tempde->attr & RS_ATTR_DIR) {
|
||||||
i=DirTreeSerializeFill(tempde->sub,dst);
|
i=DirTreeSerializeFill(tempde->sub,dst);
|
||||||
dst+=i;
|
dst+=i;
|
||||||
result+=i;
|
res+=i;
|
||||||
}
|
}
|
||||||
tempde=tempde->next;
|
tempde=tempde->next;
|
||||||
}
|
}
|
||||||
*dst=0;
|
*dst=0;
|
||||||
return result+1;
|
return res+1;
|
||||||
}
|
}
|
||||||
public U8 *DirTreeSerialize(CDirEntry *tempde,I64 *_size=NULL)
|
public U8 *DirTreeSerialize(CDirEntry *tempde,I64 *_size=NULL)
|
||||||
{//Serialize tree returned from $LK,"FilesFind",A="MN:FilesFind"$() into a one contiguous U8 array.
|
{//Serialize tree returned from $LK,"FilesFind",A="MN:FilesFind"$() into a one contiguous U8 array.
|
||||||
@@ -80,7 +80,7 @@ U0 FOFlatten(CDirEntry *tempde,CDirEntry **a,I64 *i)
|
|||||||
I64 Size1(CDirEntry *tempde,I64 *_fuf_flags,I64 round_to)
|
I64 Size1(CDirEntry *tempde,I64 *_fuf_flags,I64 round_to)
|
||||||
{
|
{
|
||||||
U8 buf[BLK_SIZE];
|
U8 buf[BLK_SIZE];
|
||||||
I64 result=0,i;
|
I64 res=0,i;
|
||||||
CDrv *dv;
|
CDrv *dv;
|
||||||
while (tempde) {
|
while (tempde) {
|
||||||
if ((i=tempde->size) && Bt(_fuf_flags,FUf_EXPAND) &&
|
if ((i=tempde->size) && Bt(_fuf_flags,FUf_EXPAND) &&
|
||||||
@@ -95,25 +95,25 @@ I64 Size1(CDirEntry *tempde,I64 *_fuf_flags,I64 round_to)
|
|||||||
if (tempde->attr&RS_ATTR_DIR)
|
if (tempde->attr&RS_ATTR_DIR)
|
||||||
i+=Size1(tempde->sub,_fuf_flags,round_to);
|
i+=Size1(tempde->sub,_fuf_flags,round_to);
|
||||||
tempde->user_data=i;
|
tempde->user_data=i;
|
||||||
result+=i;
|
res+=i;
|
||||||
tempde=tempde->next;
|
tempde=tempde->next;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
public I64 Size(U8 *files_find_mask="/*",U8 *fu_flags=NULL,I64 round_to=0)
|
public I64 Size(U8 *files_find_mask="/*",U8 *fu_flags=NULL,I64 round_to=0)
|
||||||
{//Total size of files in mask. "+x" for expanded size.
|
{//Total size of files in mask. "+x" for expanded size.
|
||||||
//Does not include directory size of base directory, but
|
//Does not include directory size of base directory, but
|
||||||
//does include size of sub directories.
|
//does include size of sub directories.
|
||||||
I64 fuf_flags=0,result=0;
|
I64 fuf_flags=0,res=0;
|
||||||
CDirEntry *tempde1=NULL;
|
CDirEntry *tempde1=NULL;
|
||||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
|
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
|
||||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||||
if (tempde1=FilesFind(files_find_mask,fuf_flags&FUG_FILES_FIND)) {
|
if (tempde1=FilesFind(files_find_mask,fuf_flags&FUG_FILES_FIND)) {
|
||||||
fuf_flags&=FUF_EXPAND;
|
fuf_flags&=FUF_EXPAND;
|
||||||
result=Size1(tempde1,&fuf_flags,round_to);
|
res=Size1(tempde1,&fuf_flags,round_to);
|
||||||
DirTreeDel(tempde1);
|
DirTreeDel(tempde1);
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public I64 FileCnt(CDirEntry *tempde)
|
public I64 FileCnt(CDirEntry *tempde)
|
||||||
@@ -151,20 +151,20 @@ public I64 Zip(U8 *files_find_mask="*",U8 *fu_flags=NULL)
|
|||||||
{//Compress files by moving to .Z filename.
|
{//Compress files by moving to .Z filename.
|
||||||
U8 *st;
|
U8 *st;
|
||||||
CDirEntry *tempde,*tempde1;
|
CDirEntry *tempde,*tempde1;
|
||||||
I64 result=0,fuf_flags=0;
|
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"),"+r+f+F+O");
|
||||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
||||||
while (tempde) {
|
while (tempde) {
|
||||||
if (!IsDotZ(tempde->full_name)) {
|
if (!IsDotZ(tempde->full_name)) {
|
||||||
st=MStrPrint("%s.Z",tempde->full_name);
|
st=MStrPrint("%s.Z",tempde->full_name);
|
||||||
result+=Move(tempde->full_name,st);
|
res+=Move(tempde->full_name,st);
|
||||||
Free(st);
|
Free(st);
|
||||||
}
|
}
|
||||||
tempde=tempde->next;
|
tempde=tempde->next;
|
||||||
}
|
}
|
||||||
DirTreeDel(tempde1);
|
DirTreeDel(tempde1);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public I64 Unzip(U8 *files_find_mask="*.Z",U8 *fu_flags=NULL)
|
public I64 Unzip(U8 *files_find_mask="*.Z",U8 *fu_flags=NULL)
|
||||||
@@ -173,7 +173,7 @@ public I64 Unzip(U8 *files_find_mask="*.Z",U8 *fu_flags=NULL)
|
|||||||
//It automatically unzips ".Z" files.
|
//It automatically unzips ".Z" files.
|
||||||
U8 *st;
|
U8 *st;
|
||||||
CDirEntry *tempde,*tempde1;
|
CDirEntry *tempde,*tempde1;
|
||||||
I64 result=0,fuf_flags=0;
|
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"),"+r+f+F+O");
|
||||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
||||||
@@ -181,11 +181,11 @@ public I64 Unzip(U8 *files_find_mask="*.Z",U8 *fu_flags=NULL)
|
|||||||
if (IsDotZ(tempde->full_name)) {
|
if (IsDotZ(tempde->full_name)) {
|
||||||
st=StrNew(tempde->full_name);
|
st=StrNew(tempde->full_name);
|
||||||
StrLastRem(st,".");
|
StrLastRem(st,".");
|
||||||
result+=Move(tempde->full_name,st);
|
res+=Move(tempde->full_name,st);
|
||||||
Free(st);
|
Free(st);
|
||||||
}
|
}
|
||||||
tempde=tempde->next;
|
tempde=tempde->next;
|
||||||
}
|
}
|
||||||
DirTreeDel(tempde1);
|
DirTreeDel(tempde1);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
+10
-10
@@ -389,7 +389,7 @@ public U0 DskView(U8 drv_let=0)
|
|||||||
I64 RedSeaUnusedDrvSpace(U8 drv_let=0)
|
I64 RedSeaUnusedDrvSpace(U8 drv_let=0)
|
||||||
{
|
{
|
||||||
CDrv *dv=Let2Drv(drv_let);
|
CDrv *dv=Let2Drv(drv_let);
|
||||||
I64 result=0,i,l;
|
I64 res=0,i,l;
|
||||||
U8 *bitmap;
|
U8 *bitmap;
|
||||||
try {
|
try {
|
||||||
l=(dv->size+dv->spc-1)/dv->spc;
|
l=(dv->size+dv->spc-1)/dv->spc;
|
||||||
@@ -398,16 +398,16 @@ I64 RedSeaUnusedDrvSpace(U8 drv_let=0)
|
|||||||
RBlks(dv,bitmap,dv->fat1,i);
|
RBlks(dv,bitmap,dv->fat1,i);
|
||||||
for (i=0;i<l;i++)
|
for (i=0;i<l;i++)
|
||||||
if (!Bt(bitmap,i))
|
if (!Bt(bitmap,i))
|
||||||
result++;
|
res++;
|
||||||
Free(bitmap);
|
Free(bitmap);
|
||||||
} catch
|
} catch
|
||||||
DrvUnlock(dv);
|
DrvUnlock(dv);
|
||||||
return result*BLK_SIZE*dv->spc;
|
return res*BLK_SIZE*dv->spc;
|
||||||
}
|
}
|
||||||
I64 FAT32UnusedDrvSpace(U8 drv_let=0)
|
I64 FAT32UnusedDrvSpace(U8 drv_let=0)
|
||||||
{
|
{
|
||||||
CDrv *dv=Let2Drv(drv_let);
|
CDrv *dv=Let2Drv(drv_let);
|
||||||
I64 result=0,i,l;
|
I64 res=0,i,l;
|
||||||
U32 *bitmap;
|
U32 *bitmap;
|
||||||
try {
|
try {
|
||||||
l=(dv->size+dv->spc-1)/dv->spc;
|
l=(dv->size+dv->spc-1)/dv->spc;
|
||||||
@@ -416,24 +416,24 @@ I64 FAT32UnusedDrvSpace(U8 drv_let=0)
|
|||||||
RBlks(dv,bitmap,dv->fat1,i);
|
RBlks(dv,bitmap,dv->fat1,i);
|
||||||
for (i=0;i<l;i++)
|
for (i=0;i<l;i++)
|
||||||
if (!bitmap[i])
|
if (!bitmap[i])
|
||||||
result++;
|
res++;
|
||||||
Free(bitmap);
|
Free(bitmap);
|
||||||
} catch
|
} catch
|
||||||
DrvUnlock(dv);
|
DrvUnlock(dv);
|
||||||
return result*BLK_SIZE*dv->spc;
|
return res*BLK_SIZE*dv->spc;
|
||||||
}
|
}
|
||||||
public I64 UnusedDrvSpace(U8 drv_let=0)
|
public I64 UnusedDrvSpace(U8 drv_let=0)
|
||||||
{//Returns unused size in bytes.
|
{//Returns unused size in bytes.
|
||||||
CDrv *dv=Let2Drv(drv_let),*old_dv=Fs->cur_dv;
|
CDrv *dv=Let2Drv(drv_let),*old_dv=Fs->cur_dv;
|
||||||
U8 *old_dir=StrNew(Fs->cur_dir);
|
U8 *old_dir=StrNew(Fs->cur_dir);
|
||||||
I64 result=0;
|
I64 res=0;
|
||||||
Drv(drv_let);
|
Drv(drv_let);
|
||||||
switch (dv->fs_type) {
|
switch (dv->fs_type) {
|
||||||
case FSt_REDSEA:
|
case FSt_REDSEA:
|
||||||
result=RedSeaUnusedDrvSpace(drv_let);
|
res=RedSeaUnusedDrvSpace(drv_let);
|
||||||
break;
|
break;
|
||||||
case FSt_FAT32:
|
case FSt_FAT32:
|
||||||
result=FAT32UnusedDrvSpace(drv_let);
|
res=FAT32UnusedDrvSpace(drv_let);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
PrintErr("File System Not Supported\n");
|
PrintErr("File System Not Supported\n");
|
||||||
@@ -441,5 +441,5 @@ public I64 UnusedDrvSpace(U8 drv_let=0)
|
|||||||
Drv(Drv2Let(old_dv));
|
Drv(Drv2Let(old_dv));
|
||||||
Cd(old_dir);
|
Cd(old_dir);
|
||||||
Free(old_dir);
|
Free(old_dir);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
+11
-11
@@ -31,22 +31,22 @@ class CFMUncollapsedLst
|
|||||||
CFMUncollapsedLst *FMCollectUncollapsedLst(CDoc *doc)
|
CFMUncollapsedLst *FMCollectUncollapsedLst(CDoc *doc)
|
||||||
{
|
{
|
||||||
CDocEntry *doc_e=doc->root.next;
|
CDocEntry *doc_e=doc->root.next;
|
||||||
CFMUncollapsedLst *result=NULL,*tempc;
|
CFMUncollapsedLst *res=NULL,*tempc;
|
||||||
CDirEntry *tempde;
|
CDirEntry *tempde;
|
||||||
while (doc_e!=doc) {
|
while (doc_e!=doc) {
|
||||||
if (doc_e->type_u8==DOCT_TREE) {
|
if (doc_e->type_u8==DOCT_TREE) {
|
||||||
if (!(doc_e->de_flags&DOCEF_CHECKED_COLLAPSED)) {
|
if (!(doc_e->de_flags&DOCEF_CHECKED_COLLAPSED)) {
|
||||||
if (tempde=doc_e->user_data) {
|
if (tempde=doc_e->user_data) {
|
||||||
tempc=MAlloc(sizeof(CFMUncollapsedLst));
|
tempc=MAlloc(sizeof(CFMUncollapsedLst));
|
||||||
tempc->next=result;
|
tempc->next=res;
|
||||||
result=tempc;
|
res=tempc;
|
||||||
tempc->name=StrNew(tempde->full_name);
|
tempc->name=StrNew(tempde->full_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
doc_e=doc_e->next;
|
doc_e=doc_e->next;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 FMMarkUncollapsed(CDoc *doc,CFMUncollapsedLst *tempc,
|
U0 FMMarkUncollapsed(CDoc *doc,CFMUncollapsedLst *tempc,
|
||||||
@@ -549,7 +549,7 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
|
|||||||
CDirEntry *root=NULL,*tempde,*tempde1,*tempde2;
|
CDirEntry *root=NULL,*tempde,*tempde1,*tempde2;
|
||||||
I64 sc,ch,a1,a2,msg_code;
|
I64 sc,ch,a1,a2,msg_code;
|
||||||
CDoc *doc=NULL,*old_put_doc=DocPut,*old_display_doc=DocDisplay;
|
CDoc *doc=NULL,*old_put_doc=DocPut,*old_display_doc=DocDisplay;
|
||||||
U8 *result=NULL,*st,*st2,*old_cur_dir=CurDir;
|
U8 *res=NULL,*st,*st2,*old_cur_dir=CurDir;
|
||||||
CDocEntry *doc_ce=NULL,*doc_e;
|
CDocEntry *doc_ce=NULL,*doc_e;
|
||||||
Bool okay;
|
Bool okay;
|
||||||
|
|
||||||
@@ -706,13 +706,13 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
|
|||||||
doc_ce=doc->cur_entry;
|
doc_ce=doc->cur_entry;
|
||||||
tempde=doc_ce->user_data;
|
tempde=doc_ce->user_data;
|
||||||
if (mode==FM_PICK_FILE && doc_ce->type_u8==DOCT_MENU_VAL)
|
if (mode==FM_PICK_FILE && doc_ce->type_u8==DOCT_MENU_VAL)
|
||||||
result=StrNew(tempde->full_name,mem_task);
|
res=StrNew(tempde->full_name,mem_task);
|
||||||
else if (mode==FM_PICK_DIR) {
|
else if (mode==FM_PICK_DIR) {
|
||||||
if (doc_ce->type_u8==DOCT_TREE)
|
if (doc_ce->type_u8==DOCT_TREE)
|
||||||
result=StrNew(tempde->full_name,mem_task);
|
res=StrNew(tempde->full_name,mem_task);
|
||||||
else if (doc_ce->type_u8==DOCT_MENU_VAL &&
|
else if (doc_ce->type_u8==DOCT_MENU_VAL &&
|
||||||
(tempde=tempde->parent))
|
(tempde=tempde->parent))
|
||||||
result=StrNew(tempde->full_name,mem_task);
|
res=StrNew(tempde->full_name,mem_task);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -747,8 +747,8 @@ fm_regular_key:
|
|||||||
DirTreeDel(root);
|
DirTreeDel(root);
|
||||||
Cd(old_cur_dir);
|
Cd(old_cur_dir);
|
||||||
Free(old_cur_dir);
|
Free(old_cur_dir);
|
||||||
if (mode!=FM_NORMAL && !result)
|
if (mode!=FM_NORMAL && !res)
|
||||||
result=StrNew("",mem_task);
|
res=StrNew("",mem_task);
|
||||||
MenuPop;
|
MenuPop;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#help_index "Install;File/Cmd Line (Typically);Cmd Line (Typically);"
|
#help_index "Install;File/Cmd Line (Typically);Cmd Line (Typically);"
|
||||||
I64 Mount2(U8 boot_drv_let,CDoc *_doc,Bool repartition)
|
I64 Mount2(U8 boot_drv_let,CDoc *_doc,Bool repartition)
|
||||||
{//If _doc, called by $LK,"::/Kernel/KCfg.CPP"$ else called by $LK,"Mount",A="MN:Mount"$().
|
{//If _doc, called by $LK,"::/Kernel/KCfg.CPP"$ else called by $LK,"Mount",A="MN:Mount"$().
|
||||||
I64 cnt,result=0,num_hints,drv_let,type,unit;
|
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];
|
U8 blks_buf[STR_LEN],addr_buf[STR_LEN],base0_buf[STR_LEN],base1_buf[STR_LEN];
|
||||||
CATARep *root=NULL,*tempha;
|
CATARep *root=NULL,*tempha;
|
||||||
Bool one_drv,make_free;
|
Bool one_drv,make_free;
|
||||||
@@ -103,9 +103,9 @@ I64 Mount2(U8 boot_drv_let,CDoc *_doc,Bool repartition)
|
|||||||
DocDel(doc);
|
DocDel(doc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result+=cnt;
|
res+=cnt;
|
||||||
} while (cnt || !result && _doc); //At least 1 if Called by $LK,"::/Kernel/KCfg.CPP"$
|
} while (cnt || !res && _doc); //At least 1 if Called by $LK,"::/Kernel/KCfg.CPP"$
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public I64 Mount(Bool repartition=FALSE)
|
public I64 Mount(Bool repartition=FALSE)
|
||||||
|
|||||||
+2
-3
@@ -11,13 +11,12 @@ U0 LoadDocDefines()
|
|||||||
//This is cut and replaced when I generate a distro.
|
//This is cut and replaced when I generate a distro.
|
||||||
//See $LK,"DD_TEMPLEOS_LOC",A="FF:::/Demo/AcctExample/TOSDistro.CPP,DD_TEMPLEOS_LOC"$.
|
//See $LK,"DD_TEMPLEOS_LOC",A="FF:::/Demo/AcctExample/TOSDistro.CPP,DD_TEMPLEOS_LOC"$.
|
||||||
$TR-C,"LineRep"$
|
$TR-C,"LineRep"$
|
||||||
$ID,4$DefinePrint("DD_TEMPLEOS_LOC","119,248");
|
$ID,4$DefinePrint("DD_TEMPLEOS_LOC","119,714");
|
||||||
DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","79,899");
|
DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","79,854");
|
||||||
$ID,-4$
|
$ID,-4$
|
||||||
DefinePrint("DD_KERNEL","%08X",bfh);
|
DefinePrint("DD_KERNEL","%08X",bfh);
|
||||||
bfh(I64)+=bfh->file_size-1;
|
bfh(I64)+=bfh->file_size-1;
|
||||||
DefinePrint("DD_KERNEL_END","%08X",bfh);
|
DefinePrint("DD_KERNEL_END","%08X",bfh);
|
||||||
DefinePrint("DD_PROTECTED_LOW","%08X",MEM_PROTECTED_LOW_LIMIT);
|
|
||||||
|
|
||||||
//$LK,"DD_BOOT_HIGH_LOC_DVD",A="FF:::/Adam/Opt/Boot/BootDVD.CPP,DD_BOOT_HIGH_LOC_DVD"$
|
//$LK,"DD_BOOT_HIGH_LOC_DVD",A="FF:::/Adam/Opt/Boot/BootDVD.CPP,DD_BOOT_HIGH_LOC_DVD"$
|
||||||
|
|
||||||
|
|||||||
+55
-55
@@ -2,7 +2,7 @@
|
|||||||
class CWho
|
class CWho
|
||||||
{
|
{
|
||||||
CHashGeneric *h;
|
CHashGeneric *h;
|
||||||
U8 *index;
|
U8 *idx;
|
||||||
};
|
};
|
||||||
|
|
||||||
I64 HashEntriesCompare(CWho *h1,CWho *h2)
|
I64 HashEntriesCompare(CWho *h1,CWho *h2)
|
||||||
@@ -28,11 +28,11 @@ I64 HashEntriesCompare2(CWho *h1,CWho *h2)
|
|||||||
return i1-i2;
|
return i1-i2;
|
||||||
}
|
}
|
||||||
|
|
||||||
I64 HelpIndexCnt(U8 *ptr,U8 *index)
|
I64 HelpIndexCnt(U8 *ptr,U8 *idx)
|
||||||
{
|
{
|
||||||
I64 cnt=0,ch,index_len=StrLen(index);
|
I64 cnt=0,ch,idx_len=StrLen(idx);
|
||||||
while (*ptr) {
|
while (*ptr) {
|
||||||
if (!StrNCmp(ptr,index,index_len))
|
if (!StrNCmp(ptr,idx,idx_len))
|
||||||
cnt++;
|
cnt++;
|
||||||
while (ch=*ptr++)
|
while (ch=*ptr++)
|
||||||
if (ch==';')
|
if (ch==';')
|
||||||
@@ -43,10 +43,10 @@ I64 HelpIndexCnt(U8 *ptr,U8 *index)
|
|||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
U8 *HelpIndexStr(U8 **_ptr,U8 *index)
|
U8 *HelpIndexStr(U8 **_ptr,U8 *idx)
|
||||||
{
|
{
|
||||||
U8 *ptr=*_ptr,*ptr2,*result;
|
U8 *ptr=*_ptr,*ptr2,*res;
|
||||||
I64 ch,index_len=StrLen(index);
|
I64 ch,idx_len=StrLen(idx);
|
||||||
while (*ptr) {
|
while (*ptr) {
|
||||||
ptr2=ptr;
|
ptr2=ptr;
|
||||||
while (ch=*ptr++)
|
while (ch=*ptr++)
|
||||||
@@ -55,13 +55,13 @@ U8 *HelpIndexStr(U8 **_ptr,U8 *index)
|
|||||||
if (!ch)
|
if (!ch)
|
||||||
ptr--;
|
ptr--;
|
||||||
*_ptr=ptr;
|
*_ptr=ptr;
|
||||||
if (!StrNCmp(ptr2,index,index_len)) {
|
if (!StrNCmp(ptr2,idx,idx_len)) {
|
||||||
if (ch==';')
|
if (ch==';')
|
||||||
ptr--;
|
ptr--;
|
||||||
*ptr=0;
|
*ptr=0;
|
||||||
result=StrNew(ptr2);
|
res=StrNew(ptr2);
|
||||||
*ptr=ch;
|
*ptr=ch;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -71,7 +71,7 @@ U8 *HelpComment(CTask *task,CHash *temph,U8 *_src_link)
|
|||||||
{
|
{
|
||||||
CDoc *doc;
|
CDoc *doc;
|
||||||
CDocEntry *doc_e;
|
CDocEntry *doc_e;
|
||||||
U8 *result=NULL,*ptr,*ptr2,*src_link=StrNew(_src_link);
|
U8 *res=NULL,*ptr,*ptr2,*src_link=StrNew(_src_link);
|
||||||
|
|
||||||
if (*src_link=='F' && src_link[2]==':')
|
if (*src_link=='F' && src_link[2]==':')
|
||||||
*src_link='P';
|
*src_link='P';
|
||||||
@@ -102,35 +102,35 @@ U8 *HelpComment(CTask *task,CHash *temph,U8 *_src_link)
|
|||||||
ptr+=6;
|
ptr+=6;
|
||||||
while (*ptr==CH_SPACE)
|
while (*ptr==CH_SPACE)
|
||||||
ptr++;
|
ptr++;
|
||||||
result=StrNew(ptr);
|
res=StrNew(ptr);
|
||||||
doc_e=doc_e->next;
|
doc_e=doc_e->next;
|
||||||
}
|
}
|
||||||
while (doc_e!=doc && doc_e->type_u8!=DOCT_NEW_LINE) {
|
while (doc_e!=doc && doc_e->type_u8!=DOCT_NEW_LINE) {
|
||||||
if (doc_e->type_u8==DOCT_TAB) {
|
if (doc_e->type_u8==DOCT_TAB) {
|
||||||
ptr=MStrPrint("%s ",result);
|
ptr=MStrPrint("%s ",res);
|
||||||
Free(result);
|
Free(res);
|
||||||
result=ptr;
|
res=ptr;
|
||||||
} else if (doc_e->de_flags&DOCEF_TAG) {
|
} else if (doc_e->de_flags&DOCEF_TAG) {
|
||||||
ptr=MStrPrint("%s%s",result,doc_e->tag);
|
ptr=MStrPrint("%s%s",res,doc_e->tag);
|
||||||
Free(result);
|
Free(res);
|
||||||
result=ptr;
|
res=ptr;
|
||||||
}
|
}
|
||||||
doc_e=doc_e->next;
|
doc_e=doc_e->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
XTalkWait(task,"%c",CH_SHIFT_ESC);
|
XTalkWait(task,"%c",CH_SHIFT_ESC);
|
||||||
if (result) {
|
if (res) {
|
||||||
ptr=MStrUtil(result,SUF_REM_TRAILING|SUF_REM_LEADING|SUF_SINGLE_SPACE);
|
ptr=MStrUtil(res,SUF_REM_TRAILING|SUF_REM_LEADING|SUF_SINGLE_SPACE);
|
||||||
Free(result);
|
Free(res);
|
||||||
result=ptr;
|
res=ptr;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
I64 HashEntriesCompare3(CWho *h1,CWho *h2)
|
I64 HashEntriesCompare3(CWho *h1,CWho *h2)
|
||||||
{
|
{
|
||||||
I64 i,i1=0,i2=0;
|
I64 i,i1=0,i2=0;
|
||||||
i=StrCmp(h1->index,h2->index);
|
i=StrCmp(h1->idx,h2->idx);
|
||||||
if (i)
|
if (i)
|
||||||
return i;
|
return i;
|
||||||
else {
|
else {
|
||||||
@@ -147,7 +147,7 @@ I64 HashEntriesCompare3(CWho *h1,CWho *h2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
public U0 Who(U8 *fu_flags=NULL,CHashTable *h=NULL,
|
public U0 Who(U8 *fu_flags=NULL,CHashTable *h=NULL,
|
||||||
U8 *index=NULL,CDoc *doc=NULL)
|
U8 *idx=NULL,CDoc *doc=NULL)
|
||||||
{//Dump hash symbol table.
|
{//Dump hash symbol table.
|
||||||
// "+p" for only public symbols
|
// "+p" for only public symbols
|
||||||
// "+m" to order by number (normally alphabetical)
|
// "+m" to order by number (normally alphabetical)
|
||||||
@@ -157,7 +157,7 @@ U8 *index=NULL,CDoc *doc=NULL)
|
|||||||
CHashGeneric *ptr;
|
CHashGeneric *ptr;
|
||||||
CWho *lst;
|
CWho *lst;
|
||||||
I64 cnt,i,j,k,f=0;
|
I64 cnt,i,j,k,f=0;
|
||||||
U8 buf[512],*st,*last_index=StrNew(""),*cur_index,*comment;
|
U8 buf[512],*st,*last_idx=StrNew(""),*cur_idx,*comment;
|
||||||
Bool recurse,publics,map;
|
Bool recurse,publics,map;
|
||||||
CTask *task;
|
CTask *task;
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ U8 *index=NULL,CDoc *doc=NULL)
|
|||||||
|
|
||||||
if (!h) h=Fs->hash_table;
|
if (!h) h=Fs->hash_table;
|
||||||
|
|
||||||
if (index) {
|
if (idx) {
|
||||||
task=User;
|
task=User;
|
||||||
TaskWait(task);
|
TaskWait(task);
|
||||||
LBtr(&task->display_flags,DISPLAYf_SHOW);
|
LBtr(&task->display_flags,DISPLAYf_SHOW);
|
||||||
@@ -186,10 +186,10 @@ U8 *index=NULL,CDoc *doc=NULL)
|
|||||||
while (temph) {
|
while (temph) {
|
||||||
if (!(temph->type & (HTF_IMPORT | HTF_PRIVATE)) &&
|
if (!(temph->type & (HTF_IMPORT | HTF_PRIVATE)) &&
|
||||||
(temph->type & HTF_PUBLIC || !publics)) {
|
(temph->type & HTF_PUBLIC || !publics)) {
|
||||||
if (!index)
|
if (!idx)
|
||||||
cnt++;
|
cnt++;
|
||||||
else if (temph->type&HTG_SRC_SYM && (cur_index=temph->index))
|
else if (temph->type&HTG_SRC_SYM && (cur_idx=temph->idx))
|
||||||
cnt+=HelpIndexCnt(cur_index,index);
|
cnt+=HelpIndexCnt(cur_idx,idx);
|
||||||
}
|
}
|
||||||
temph=temph->next;
|
temph=temph->next;
|
||||||
}
|
}
|
||||||
@@ -210,12 +210,12 @@ U8 *index=NULL,CDoc *doc=NULL)
|
|||||||
while (temph) {
|
while (temph) {
|
||||||
if (!(temph->type & (HTF_IMPORT | HTF_PRIVATE)) &&
|
if (!(temph->type & (HTF_IMPORT | HTF_PRIVATE)) &&
|
||||||
(temph->type & HTF_PUBLIC || !publics))
|
(temph->type & HTF_PUBLIC || !publics))
|
||||||
if (!index)
|
if (!idx)
|
||||||
lst[j++].h=temph;
|
lst[j++].h=temph;
|
||||||
else if (temph->type&HTG_SRC_SYM && (cur_index=temph->index) &&
|
else if (temph->type&HTG_SRC_SYM && (cur_idx=temph->idx) &&
|
||||||
(k=HelpIndexCnt(cur_index,index)))
|
(k=HelpIndexCnt(cur_idx,idx)))
|
||||||
while (k--) {
|
while (k--) {
|
||||||
lst[j].index=HelpIndexStr(&cur_index,index);
|
lst[j].idx=HelpIndexStr(&cur_idx,idx);
|
||||||
lst[j++].h=temph;
|
lst[j++].h=temph;
|
||||||
}
|
}
|
||||||
temph=temph->next;
|
temph=temph->next;
|
||||||
@@ -229,30 +229,30 @@ U8 *index=NULL,CDoc *doc=NULL)
|
|||||||
|
|
||||||
if (map)
|
if (map)
|
||||||
QSort(lst,cnt,sizeof(CWho),&HashEntriesCompare2);
|
QSort(lst,cnt,sizeof(CWho),&HashEntriesCompare2);
|
||||||
else if (index)
|
else if (idx)
|
||||||
QSort(lst,cnt,sizeof(CWho),&HashEntriesCompare3);
|
QSort(lst,cnt,sizeof(CWho),&HashEntriesCompare3);
|
||||||
else
|
else
|
||||||
QSort(lst,cnt,sizeof(CWho),&HashEntriesCompare);
|
QSort(lst,cnt,sizeof(CWho),&HashEntriesCompare);
|
||||||
|
|
||||||
if (index) {
|
if (idx) {
|
||||||
progress1_max=cnt;
|
progress1_max=cnt;
|
||||||
progress1=0;
|
progress1=0;
|
||||||
}
|
}
|
||||||
for (i=0;i<cnt;i++) {
|
for (i=0;i<cnt;i++) {
|
||||||
comment=NULL;
|
comment=NULL;
|
||||||
ptr=lst[i].h;
|
ptr=lst[i].h;
|
||||||
if (index)
|
if (idx)
|
||||||
if (cur_index=lst[i].index) {
|
if (cur_idx=lst[i].idx) {
|
||||||
if (StrCmp(cur_index,last_index)) {
|
if (StrCmp(cur_idx,last_idx)) {
|
||||||
Free(last_index);
|
Free(last_idx);
|
||||||
last_index=StrNew(cur_index);
|
last_idx=StrNew(cur_idx);
|
||||||
if (i)
|
if (i)
|
||||||
DocPrint(doc,"\n\n");
|
DocPrint(doc,"\n\n");
|
||||||
DocPrint(doc,"$$WW,0$$$$PURPLE$$$$TX+CX,\"%Q\"$$$$FG$$\n",cur_index);
|
DocPrint(doc,"$$WW,0$$$$PURPLE$$$$TX+CX,\"%Q\"$$$$FG$$\n",cur_idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index && ptr->type & HTT_HELP_FILE) {
|
if (idx && ptr->type & HTT_HELP_FILE) {
|
||||||
DocPrint(doc,"$$WW,1$$");
|
DocPrint(doc,"$$WW,1$$");
|
||||||
DocType(doc,ptr->str);
|
DocType(doc,ptr->str);
|
||||||
DocPrint(doc,"$$WW,0$$");
|
DocPrint(doc,"$$WW,0$$");
|
||||||
@@ -260,12 +260,12 @@ U8 *index=NULL,CDoc *doc=NULL)
|
|||||||
if (ptr->type&HTG_SRC_SYM && ptr(CHashSrcSym *)->src_link) {
|
if (ptr->type&HTG_SRC_SYM && ptr(CHashSrcSym *)->src_link) {
|
||||||
DocPrint(doc,"$$LK,\"%-20s\",A=\"%s\"$$",
|
DocPrint(doc,"$$LK,\"%-20s\",A=\"%s\"$$",
|
||||||
ptr->str,ptr(CHashSrcSym *)->src_link);
|
ptr->str,ptr(CHashSrcSym *)->src_link);
|
||||||
if (index)
|
if (idx)
|
||||||
comment=HelpComment(task,ptr,ptr(CHashSrcSym *)->src_link);
|
comment=HelpComment(task,ptr,ptr(CHashSrcSym *)->src_link);
|
||||||
} else
|
} else
|
||||||
DocPrint(doc,"%-20s",ptr->str);
|
DocPrint(doc,"%-20s",ptr->str);
|
||||||
|
|
||||||
if (!index) {
|
if (!idx) {
|
||||||
if (ptr->type & HTT_DEFINE_STR) {
|
if (ptr->type & HTT_DEFINE_STR) {
|
||||||
st=MStrUtil(ptr(CHashDefineStr *)->data,SUF_SAFE_DOLLAR);
|
st=MStrUtil(ptr(CHashDefineStr *)->data,SUF_SAFE_DOLLAR);
|
||||||
j=ptr(CHashDefineStr *)->cnt;
|
j=ptr(CHashDefineStr *)->cnt;
|
||||||
@@ -305,12 +305,12 @@ U8 *index=NULL,CDoc *doc=NULL)
|
|||||||
}
|
}
|
||||||
DocPrint(doc,"\n");
|
DocPrint(doc,"\n");
|
||||||
}
|
}
|
||||||
Free(lst[i].index);
|
Free(lst[i].idx);
|
||||||
if (index)
|
if (idx)
|
||||||
progress1++;
|
progress1++;
|
||||||
}
|
}
|
||||||
Free(lst);
|
Free(lst);
|
||||||
if (index)
|
if (idx)
|
||||||
progress1=progress1_max=0;
|
progress1=progress1_max=0;
|
||||||
|
|
||||||
wh_done:
|
wh_done:
|
||||||
@@ -320,7 +320,7 @@ wh_done:
|
|||||||
else
|
else
|
||||||
DocRecalc(doc);
|
DocRecalc(doc);
|
||||||
}
|
}
|
||||||
Free(last_index);
|
Free(last_idx);
|
||||||
Kill(task);
|
Kill(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,15 +357,15 @@ public I64 HashDepthRep(CHashTable *table=NULL)
|
|||||||
#help_index "Help System"
|
#help_index "Help System"
|
||||||
#help_file "::/Doc/HelpSystem"
|
#help_file "::/Doc/HelpSystem"
|
||||||
|
|
||||||
public U0 DocHelpIndex(CDoc *doc,U8 *index)
|
public U0 DocHelpIndex(CDoc *doc,U8 *idx)
|
||||||
{//Put to doc report for given help index.
|
{//Put to doc report for given help idx.
|
||||||
Who("+p",,index,doc);
|
Who("+p",,idx,doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public U0 PopUpHelpIndex(U8 *index,CTask *parent=NULL)
|
public U0 PopUpHelpIndex(U8 *idx,CTask *parent=NULL)
|
||||||
{//PopUp win report for given help index.
|
{//PopUp win report for given help idx.
|
||||||
U8 *buf;
|
U8 *buf;
|
||||||
buf=MStrPrint("DocHelpIndex(DocPut,\"%s\");View;",index);
|
buf=MStrPrint("DocHelpIndex(DocPut,\"%s\");View;",idx);
|
||||||
PopUp(buf,parent);
|
PopUp(buf,parent);
|
||||||
Free(buf);
|
Free(buf);
|
||||||
}
|
}
|
||||||
|
|||||||
+20
-21
@@ -18,12 +18,12 @@ public U0 P2R(F64 *_x=NULL,F64 *_y=NULL,F64 mag,F64 arg)
|
|||||||
|
|
||||||
public F64 Wrap(F64 é,F64 base=-ã)
|
public F64 Wrap(F64 é,F64 base=-ã)
|
||||||
{//Returns angle in range [base,base+2*ã)
|
{//Returns angle in range [base,base+2*ã)
|
||||||
F64 result=é%(2*ã);
|
F64 res=é%(2*ã);
|
||||||
if (result>=base+2*ã)
|
if (res>=base+2*ã)
|
||||||
result-=2*ã;
|
res-=2*ã;
|
||||||
else if (result<base)
|
else if (res<base)
|
||||||
result+=2*ã;
|
res+=2*ã;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public I64 DistSqrI64(I64 x1,I64 y1,I64 x2,I64 y2)
|
public I64 DistSqrI64(I64 x1,I64 y1,I64 x2,I64 y2)
|
||||||
@@ -65,29 +65,29 @@ public F64 Cosh(F64 x)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#help_index "Math/Complex;Data Types/Complex"
|
#help_index "Math/Complex;Data Types/Complex"
|
||||||
public Complex *CAdd(Complex *n1,Complex *n2,Complex *sum)
|
public Complex *CAdd(Complex *sum,Complex *n1,Complex *n2)
|
||||||
{//n1 + n2 -->sum
|
{//sum=n1+n2
|
||||||
sum->x=n1->x+n2->x;
|
sum->x=n1->x+n2->x;
|
||||||
sum->y=n1->y+n2->y;
|
sum->y=n1->y+n2->y;
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Complex *CSub(Complex *n1,Complex *n2,Complex *diff)
|
public Complex *CSub(Complex *diff,Complex *n1,Complex *n2)
|
||||||
{//n1 - n2 -->diff
|
{//diff=n1-n2
|
||||||
diff->x=n1->x-n2->x;
|
diff->x=n1->x-n2->x;
|
||||||
diff->y=n1->y-n2->y;
|
diff->y=n1->y-n2->y;
|
||||||
return diff;
|
return diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Complex *CMul(Complex *n1,Complex *n2,Complex *prod)
|
public Complex *CMul(Complex *prod,Complex *n1,Complex *n2)
|
||||||
{//n1 * n2 -->prod
|
{//prod=n1*n2
|
||||||
prod->x=n1->x*n2->x-n1->y*n2->y;
|
prod->x=n1->x*n2->x-n1->y*n2->y;
|
||||||
prod->y=n1->x*n2->y+n1->y*n2->x;
|
prod->y=n1->x*n2->y+n1->y*n2->x;
|
||||||
return prod;
|
return prod;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Complex *CDiv(Complex *n1,Complex *n2,Complex *quot)
|
public Complex *CDiv(Complex *quot,Complex *n1,Complex *n2)
|
||||||
{//n1 / n2 -->quot
|
{//quot=n1/n2
|
||||||
F64 m1,a1,m2,a2;
|
F64 m1,a1,m2,a2;
|
||||||
R2P(&m1,&a1,n1->x,n1->y);
|
R2P(&m1,&a1,n1->x,n1->y);
|
||||||
R2P(&m2,&a2,n2->x,n2->y);
|
R2P(&m2,&a2,n2->x,n2->y);
|
||||||
@@ -99,7 +99,7 @@ public Complex *CDiv(Complex *n1,Complex *n2,Complex *quot)
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Complex *CScale(Complex *dst,F64 s)
|
public Complex *CScale(Complex *dst,F64 s)
|
||||||
{//dst *= s
|
{//dst*=s
|
||||||
dst->x*=s;
|
dst->x*=s;
|
||||||
dst->y*=s;
|
dst->y*=s;
|
||||||
return dst;
|
return dst;
|
||||||
@@ -113,22 +113,21 @@ public Complex *CCopy(Complex *dst,Complex *src)
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Complex *CEqu(Complex *dst,F64 x,F64 y)
|
public Complex *CEqu(Complex *dst,F64 x,F64 y)
|
||||||
{//dst=x,y
|
{//dst=(x,y)
|
||||||
dst->x=x;
|
dst->x=x;
|
||||||
dst->y=y;
|
dst->y=y;
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Complex *CPoly(Complex *dst,Complex *x,Complex *zeros,I64 n)
|
public Complex *CPoly(Complex *dst,I64 n,Complex *zeros,Complex *x)
|
||||||
{//Eval complex polynomial.
|
{//Eval complex polynomial
|
||||||
I64 i;
|
I64 i;
|
||||||
Complex n1,n2;
|
Complex n1,n2;
|
||||||
if (n>0) {
|
if (n>0) {
|
||||||
CSub(x,&zeros[0],dst);
|
CSub(dst,x,&zeros[0]);
|
||||||
for (i=1;i<n;i++) {
|
for (i=1;i<n;i++) {
|
||||||
CCopy(&n1,dst);
|
CCopy(&n1,dst);
|
||||||
CSub(x,&zeros[i],&n2);
|
CMul(dst,&n1,CSub(&n2,x,&zeros[i]));
|
||||||
CMul(&n1,&n2,dst);
|
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
CEqu(dst,1.0,0.0);
|
CEqu(dst,1.0,0.0);
|
||||||
|
|||||||
+6
-6
@@ -190,7 +190,7 @@ public CSpring *SpringFind(CMathODE *ode,F64 x,F64 y,F64 z=0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
public U0 MassOrSpringFind(
|
public U0 MassOrSpringFind(
|
||||||
CMathODE *ode,CMass **result_mass,CSpring **result_spring,
|
CMathODE *ode,CMass **res_mass,CSpring **res_spring,
|
||||||
F64 x,F64 y,F64 z=0)
|
F64 x,F64 y,F64 z=0)
|
||||||
{//Find spring or mass nearest x,y,z.
|
{//Find spring or mass nearest x,y,z.
|
||||||
CMass *tempm,*best_mass=NULL;
|
CMass *tempm,*best_mass=NULL;
|
||||||
@@ -219,8 +219,8 @@ public U0 MassOrSpringFind(
|
|||||||
}
|
}
|
||||||
temps=temps->next;
|
temps=temps->next;
|
||||||
}
|
}
|
||||||
if (result_mass) *result_mass =best_mass;
|
if (res_mass) *res_mass =best_mass;
|
||||||
if (result_spring) *result_spring=best_spring;
|
if (res_spring) *res_spring=best_spring;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CMass *MassFindNum(CMathODE *ode,I64 num)
|
public CMass *MassFindNum(CMathODE *ode,I64 num)
|
||||||
@@ -263,7 +263,7 @@ U0 ODECalcSprings(CMathODE *ode)
|
|||||||
} else {
|
} else {
|
||||||
e1=temps->end1;
|
e1=temps->end1;
|
||||||
e2=temps->end2;
|
e2=temps->end2;
|
||||||
d=D3Norm(D3Sub(&e2->state->x,&e1->state->x,&p));
|
d=D3Norm(D3Sub(&p,&e2->state->x,&e1->state->x));
|
||||||
temps->displacement=d-temps->rest_len;
|
temps->displacement=d-temps->rest_len;
|
||||||
temps->f=temps->displacement*temps->const;
|
temps->f=temps->displacement*temps->const;
|
||||||
if (temps->f>0 && temps->flags&SSF_NO_TENSION)
|
if (temps->f>0 && temps->flags&SSF_NO_TENSION)
|
||||||
@@ -297,7 +297,7 @@ U0 ODECalcDrag(CMathODE *ode)
|
|||||||
if (ode->drag_v3)
|
if (ode->drag_v3)
|
||||||
d+=dd*ode->drag_v3;
|
d+=dd*ode->drag_v3;
|
||||||
D3SubEqu(&tempm->DstateDt->DxDt,
|
D3SubEqu(&tempm->DstateDt->DxDt,
|
||||||
D3Mul(d*tempm->drag_profile_factor,&tempm->state->DxDt,&p));
|
D3Mul(&p,d*tempm->drag_profile_factor,&tempm->state->DxDt));
|
||||||
}
|
}
|
||||||
tempm=tempm->next;
|
tempm=tempm->next;
|
||||||
}
|
}
|
||||||
@@ -501,7 +501,7 @@ F64 ode_alloced_factor=0.75;
|
|||||||
U0 ODEsUpdate(CTask *task)
|
U0 ODEsUpdate(CTask *task)
|
||||||
{/* This routine is called by the $LK,"window mgr",A="FF:::/Adam/Gr/GrScreen.CPP,ODEsUpdate"$ on a continuous
|
{/* This routine is called by the $LK,"window mgr",A="FF:::/Adam/Gr/GrScreen.CPP,ODEsUpdate"$ on a continuous
|
||||||
basis to allow real-time simulation. It is intended
|
basis to allow real-time simulation. It is intended
|
||||||
to provide results good enough for games. It uses a runge-kutta
|
to provide ress good enough for games. It uses a runge-kutta
|
||||||
integrator which is a better algorithm than doing it with Euler.
|
integrator which is a better algorithm than doing it with Euler.
|
||||||
|
|
||||||
It is adaptive step-sized, so it slows down when an important
|
It is adaptive step-sized, so it slows down when an important
|
||||||
|
|||||||
+11
-11
@@ -1,31 +1,31 @@
|
|||||||
#help_index "Memory/Task"
|
#help_index "Memory/Task"
|
||||||
public I64 TaskMemAlloced(CTask *task=NULL,Bool override_validate=FALSE)
|
public I64 TaskMemAlloced(CTask *task=NULL,Bool override_validate=FALSE)
|
||||||
{//Count of bytes alloced to a task, used+unused.
|
{//Count of bytes alloced to a task, used+unused.
|
||||||
I64 result;
|
I64 res;
|
||||||
if (!task) task=Fs;
|
if (!task) task=Fs;
|
||||||
if (override_validate || TaskValidate(task)) {
|
if (override_validate || TaskValidate(task)) {
|
||||||
result=task->code_heap->alloced_u8s;
|
res=task->code_heap->alloced_u8s;
|
||||||
if (task->code_heap!=task->data_heap)
|
if (task->code_heap!=task->data_heap)
|
||||||
result+=task->data_heap->alloced_u8s;
|
res+=task->data_heap->alloced_u8s;
|
||||||
return result;
|
return res;
|
||||||
} else
|
} else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public I64 TaskMemUsed(CTask *task=NULL,Bool override_validate=FALSE)
|
public I64 TaskMemUsed(CTask *task=NULL,Bool override_validate=FALSE)
|
||||||
{//Count of bytes alloced to a task and in use.
|
{//Count of bytes alloced to a task and in use.
|
||||||
I64 result;
|
I64 res;
|
||||||
if (!task) task=Fs;
|
if (!task) task=Fs;
|
||||||
if (override_validate || TaskValidate(task)) {
|
if (override_validate || TaskValidate(task)) {
|
||||||
result=task->code_heap->used_u8s;
|
res=task->code_heap->used_u8s;
|
||||||
if (task->data_heap!=task->code_heap)
|
if (task->data_heap!=task->code_heap)
|
||||||
result+=task->data_heap->used_u8s;
|
res+=task->data_heap->used_u8s;
|
||||||
return result;
|
return res;
|
||||||
} else
|
} else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#help_index "Memory/Task;Debugging/Heap"
|
#help_index "Memory/Task;Debugging/Heap;Memory/Debugging"
|
||||||
public Bool HeapRep(CTask *task)
|
public Bool HeapRep(CTask *task)
|
||||||
{//Report status of task's heap.
|
{//Report status of task's heap.
|
||||||
I64 i,cnt;
|
I64 i,cnt;
|
||||||
@@ -85,7 +85,7 @@ public Bool HeapRep(CTask *task)
|
|||||||
'\n';
|
'\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
#help_index "Memory/HeapCtrl;Debugging/Heap"
|
#help_index "Memory/HeapCtrl;Debugging/Heap;Memory/Debugging"
|
||||||
public Bool IsInHeapCtrl(U8 *a,CHeapCtrl *hc,Bool lock=TRUE)
|
public Bool IsInHeapCtrl(U8 *a,CHeapCtrl *hc,Bool lock=TRUE)
|
||||||
{//Check addr if in HeapCtrl.
|
{//Check addr if in HeapCtrl.
|
||||||
CMemBlk *m;
|
CMemBlk *m;
|
||||||
@@ -156,7 +156,7 @@ public Bool HeapCtrlWalk(CHeapCtrl *hc)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#help_index "Memory/Task;Debugging/Heap"
|
#help_index "Memory/Task;Debugging/Heap;Memory/Debugging"
|
||||||
public Bool IsInHeap(U8 *a,CTask *task=NULL,Bool lock=TRUE)
|
public Bool IsInHeap(U8 *a,CTask *task=NULL,Bool lock=TRUE)
|
||||||
{//Check addr if in task's heaps.
|
{//Check addr if in task's heaps.
|
||||||
if (!task) task=Fs;
|
if (!task) task=Fs;
|
||||||
|
|||||||
+10
-10
@@ -18,7 +18,7 @@ Bool RegCache()
|
|||||||
|
|
||||||
public Bool RegSetDftEntry(U8 *path,U8 *val,Bool is_adam_entry=FALSE)
|
public Bool RegSetDftEntry(U8 *path,U8 *val,Bool is_adam_entry=FALSE)
|
||||||
{//Add code doc tree branch to registry.
|
{//Add code doc tree branch to registry.
|
||||||
Bool result,unlock_doc;
|
Bool res,unlock_doc;
|
||||||
RegCache;
|
RegCache;
|
||||||
unlock_doc=DocLock(sys_registry_doc);
|
unlock_doc=DocLock(sys_registry_doc);
|
||||||
if (!DocTreeFind(sys_registry_doc,path)) {
|
if (!DocTreeFind(sys_registry_doc,path)) {
|
||||||
@@ -32,12 +32,12 @@ public Bool RegSetDftEntry(U8 *path,U8 *val,Bool is_adam_entry=FALSE)
|
|||||||
}
|
}
|
||||||
if (DrvIsWritable(':'))
|
if (DrvIsWritable(':'))
|
||||||
DocWrite(sys_registry_doc);
|
DocWrite(sys_registry_doc);
|
||||||
result=FALSE;
|
res=FALSE;
|
||||||
} else
|
} else
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
if (unlock_doc)
|
if (unlock_doc)
|
||||||
DocUnlock(sys_registry_doc);
|
DocUnlock(sys_registry_doc);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public I64 RegExeBranch(U8 *path)
|
public I64 RegExeBranch(U8 *path)
|
||||||
@@ -48,12 +48,12 @@ public I64 RegExeBranch(U8 *path)
|
|||||||
|
|
||||||
public Bool RegWriteBranch(U8 *path,U8 *fmt,...)
|
public Bool RegWriteBranch(U8 *path,U8 *fmt,...)
|
||||||
{//Rewrite doc tree branch in registry.
|
{//Rewrite doc tree branch in registry.
|
||||||
Bool result,unlock_doc;
|
Bool res,unlock_doc;
|
||||||
CDocEntry *tree_branch,*start_indent,*end_indent;
|
CDocEntry *tree_branch,*start_indent,*end_indent;
|
||||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
||||||
RegCache;
|
RegCache;
|
||||||
unlock_doc=DocLock(sys_registry_doc);
|
unlock_doc=DocLock(sys_registry_doc);
|
||||||
if (result=DocTreeFind(sys_registry_doc,path,
|
if (res=DocTreeFind(sys_registry_doc,path,
|
||||||
&tree_branch,&start_indent,&end_indent))
|
&tree_branch,&start_indent,&end_indent))
|
||||||
DocCut(sys_registry_doc,tree_branch,end_indent);
|
DocCut(sys_registry_doc,tree_branch,end_indent);
|
||||||
DocTreeMake(sys_registry_doc,path);
|
DocTreeMake(sys_registry_doc,path);
|
||||||
@@ -63,12 +63,12 @@ public Bool RegWriteBranch(U8 *path,U8 *fmt,...)
|
|||||||
if (unlock_doc)
|
if (unlock_doc)
|
||||||
DocUnlock(sys_registry_doc);
|
DocUnlock(sys_registry_doc);
|
||||||
Free(buf);
|
Free(buf);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bool OneTimePopUp(U8 *_flags,I64 flag_num,U8 *msg)
|
public Bool OneTimePopUp(U8 *_flags,I64 flag_num,U8 *msg)
|
||||||
{//See $LK,"::/Apps/X-Caliber/X-Caliber.CPP"$.
|
{//See $LK,"::/Apps/X-Caliber/X-Caliber.CPP"$.
|
||||||
Bool result=FALSE;
|
Bool res=FALSE;
|
||||||
CDoc *doc=DocNew;
|
CDoc *doc=DocNew;
|
||||||
CDocEntry *doc_e;
|
CDocEntry *doc_e;
|
||||||
if (!Bt(_flags,flag_num)) {
|
if (!Bt(_flags,flag_num)) {
|
||||||
@@ -77,11 +77,11 @@ public Bool OneTimePopUp(U8 *_flags,I64 flag_num,U8 *msg)
|
|||||||
DocPrint(doc,"$$CM+CX,0,4$$$$BT,\"OKAY\",LE=1$$\n");
|
DocPrint(doc,"$$CM+CX,0,4$$$$BT,\"OKAY\",LE=1$$\n");
|
||||||
if (PopUpMenu(doc)==1 && doc_e->de_flags&DOCEF_CHECKED_COLLAPSED) {
|
if (PopUpMenu(doc)==1 && doc_e->de_flags&DOCEF_CHECKED_COLLAPSED) {
|
||||||
LBts(_flags,flag_num);
|
LBts(_flags,flag_num);
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
}
|
}
|
||||||
DocDel(doc);
|
DocDel(doc);
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 RegOneTimePopUp(I64 flag_num,U8 *msg)
|
U0 RegOneTimePopUp(I64 flag_num,U8 *msg)
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ $$ --> $$$$
|
|||||||
I64 ACDNextCmd(U8 **_ptr)
|
I64 ACDNextCmd(U8 **_ptr)
|
||||||
{
|
{
|
||||||
U8 *ptr=*_ptr,*ptr2;
|
U8 *ptr=*_ptr,*ptr2;
|
||||||
I64 ch,result=-1;
|
I64 ch,res=-1;
|
||||||
do {
|
do {
|
||||||
do {
|
do {
|
||||||
if (!(ch=*ptr++)) goto ncmd_done;
|
if (!(ch=*ptr++)) goto ncmd_done;
|
||||||
@@ -67,22 +67,22 @@ I64 ACDNextCmd(U8 **_ptr)
|
|||||||
if (!(ch=*ptr2++)) goto ncmd_done;
|
if (!(ch=*ptr2++)) goto ncmd_done;
|
||||||
} while (ch!='>');
|
} while (ch!='>');
|
||||||
*--ptr2=0;
|
*--ptr2=0;
|
||||||
result=LstMatch(ptr,"h1\0/h1\0def\0/def\0hw\0/hw\0tt\0/tt\0"
|
res=LstMatch(ptr,"h1\0/h1\0def\0/def\0hw\0/hw\0tt\0/tt\0"
|
||||||
"ety\0@fld\0@cd\0@blockquote\0@wordforms\0@note\0@altname\0@chform\0"
|
"ety\0@fld\0@cd\0@blockquote\0@wordforms\0@note\0@altname\0@chform\0"
|
||||||
"@cref\0@syn\0/ety\0@/fld\0@/cd\0@/blockquote\0@/wordforms\0@/note\0"
|
"@cref\0@syn\0/ety\0@/fld\0@/cd\0@/blockquote\0@/wordforms\0@/note\0"
|
||||||
"@/altname\0@/chform\0@/cref\0@/syn\0");
|
"@/altname\0@/chform\0@/cref\0@/syn\0");
|
||||||
*ptr2++='>';
|
*ptr2++='>';
|
||||||
ptr=ptr2;
|
ptr=ptr2;
|
||||||
} while (result<0);
|
} while (res<0);
|
||||||
|
|
||||||
ncmd_done:
|
ncmd_done:
|
||||||
*_ptr=ptr;
|
*_ptr=ptr;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U8 *ACDNextEntry(U8 **_ptr)
|
U8 *ACDNextEntry(U8 **_ptr)
|
||||||
{
|
{
|
||||||
U8 *result,*ignore,*ptr=*_ptr,buf[ACD_BLK_SIZE],*out_ptr=buf;
|
U8 *res,*ignore,*ptr=*_ptr,buf[ACD_BLK_SIZE],*out_ptr=buf;
|
||||||
I64 ch,l;
|
I64 ch,l;
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
@@ -111,9 +111,9 @@ U8 *ACDNextEntry(U8 **_ptr)
|
|||||||
}
|
}
|
||||||
nentry_done:
|
nentry_done:
|
||||||
*out_ptr++=0;
|
*out_ptr++=0;
|
||||||
result=StrNew(buf);
|
res=StrNew(buf);
|
||||||
*_ptr=ptr-1;
|
*_ptr=ptr-1;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
I64 ACDCompareWords(U8 *e1,U8 *e2)
|
I64 ACDCompareWords(U8 *e1,U8 *e2)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ public U8 *ACDDefGet(U8 *st,I64 def_num=1)
|
|||||||
{//MAlloc str holding single dict definition of word.
|
{//MAlloc str holding single dict definition of word.
|
||||||
CFile *f;
|
CFile *f;
|
||||||
CHashGeneric *temph;
|
CHashGeneric *temph;
|
||||||
U8 *result=NULL,*buf,*in_ptr,
|
U8 *res=NULL,*buf,*in_ptr,
|
||||||
*st2=MStrUtil(st,SUF_TO_UPPER);
|
*st2=MStrUtil(st,SUF_TO_UPPER);
|
||||||
temph=HashFind(st2,ac.hash_table,HTT_DICT_WORD);
|
temph=HashFind(st2,ac.hash_table,HTT_DICT_WORD);
|
||||||
Free(st2);
|
Free(st2);
|
||||||
@@ -31,7 +31,7 @@ public U8 *ACDDefGet(U8 *st,I64 def_num=1)
|
|||||||
in_ptr++;
|
in_ptr++;
|
||||||
}
|
}
|
||||||
if (*in_ptr++==ACD_DEF_CHAR) {
|
if (*in_ptr++==ACD_DEF_CHAR) {
|
||||||
result=StrNew(in_ptr);
|
res=StrNew(in_ptr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,14 +40,14 @@ public U8 *ACDDefGet(U8 *st,I64 def_num=1)
|
|||||||
Free(buf);
|
Free(buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public U8 *ACDDefsGet(U8 *st)
|
public U8 *ACDDefsGet(U8 *st)
|
||||||
{//MAlloc str with all dict definitions of word.
|
{//MAlloc str with all dict definitions of word.
|
||||||
CFile *f;
|
CFile *f;
|
||||||
CHashGeneric *temph;
|
CHashGeneric *temph;
|
||||||
U8 *result=NULL,*buf,*in_ptr,*in_ptr2,
|
U8 *res=NULL,*buf,*in_ptr,*in_ptr2,
|
||||||
*st2=MStrUtil(st,SUF_TO_UPPER);
|
*st2=MStrUtil(st,SUF_TO_UPPER);
|
||||||
temph=HashFind(st2,ac.hash_table,HTT_DICT_WORD);
|
temph=HashFind(st2,ac.hash_table,HTT_DICT_WORD);
|
||||||
Free(st2);
|
Free(st2);
|
||||||
@@ -70,9 +70,9 @@ public U8 *ACDDefsGet(U8 *st)
|
|||||||
&& in_ptr2<buf+ACD_BLK_SIZE*2) {
|
&& in_ptr2<buf+ACD_BLK_SIZE*2) {
|
||||||
in_ptr2++;
|
in_ptr2++;
|
||||||
}
|
}
|
||||||
result=MAlloc(in_ptr2+1-in_ptr);
|
res=MAlloc(in_ptr2+1-in_ptr);
|
||||||
MemCpy(result,in_ptr,in_ptr2-in_ptr);
|
MemCpy(res,in_ptr,in_ptr2-in_ptr);
|
||||||
result[in_ptr2-in_ptr]=ACD_END_CHAR;
|
res[in_ptr2-in_ptr]=ACD_END_CHAR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,7 @@ public U8 *ACDDefsGet(U8 *st)
|
|||||||
Free(buf);
|
Free(buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Fmt of word lst entry:
|
/*Fmt of word lst entry:
|
||||||
|
|||||||
+2
-2
@@ -133,7 +133,7 @@ public U0 AFSetIP(I64 mS=7,I64 x=MAX_I64,I64 y=MAX_I64,I64 z=MAX_I64,
|
|||||||
|
|
||||||
public Bool AFView()
|
public Bool AFView()
|
||||||
{//Let user type until <ESC> or <SHIFT-ESC>.
|
{//Let user type until <ESC> or <SHIFT-ESC>.
|
||||||
Bool result=View;
|
Bool res=View;
|
||||||
DocBottom;
|
DocBottom;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
+14
-14
@@ -43,7 +43,7 @@ public CCtrl *CtrlButtonNew(I64 x,I64 y,I64 width=-1,I64 height=-1,
|
|||||||
I64 num_states=1,U8 *state_texts,
|
I64 num_states=1,U8 *state_texts,
|
||||||
I32 *state_colors,CCtrlButtonState *_s=NULL)
|
I32 *state_colors,CCtrlButtonState *_s=NULL)
|
||||||
{//Create button ctrl. See $LK,"::/Apps/Strut/Strut.CPP"$.
|
{//Create button ctrl. See $LK,"::/Apps/Strut/Strut.CPP"$.
|
||||||
CCtrl *result;
|
CCtrl *res;
|
||||||
CCtrlButtonState *s;
|
CCtrlButtonState *s;
|
||||||
I64 i,j,l;
|
I64 i,j,l;
|
||||||
U8 *st;
|
U8 *st;
|
||||||
@@ -57,7 +57,7 @@ public CCtrl *CtrlButtonNew(I64 x,I64 y,I64 width=-1,I64 height=-1,
|
|||||||
width=BUTTON_BORDER*4+l*FONT_WIDTH;
|
width=BUTTON_BORDER*4+l*FONT_WIDTH;
|
||||||
}
|
}
|
||||||
if (height<0) height=BUTTON_BORDER*4+FONT_HEIGHT;
|
if (height<0) height=BUTTON_BORDER*4+FONT_HEIGHT;
|
||||||
result=CAlloc(sizeof(CCtrl));
|
res=CAlloc(sizeof(CCtrl));
|
||||||
if (_s) {
|
if (_s) {
|
||||||
s=_s;
|
s=_s;
|
||||||
MemSet(s,0,sizeof(CCtrlButtonState));
|
MemSet(s,0,sizeof(CCtrlButtonState));
|
||||||
@@ -68,18 +68,18 @@ public CCtrl *CtrlButtonNew(I64 x,I64 y,I64 width=-1,I64 height=-1,
|
|||||||
s->num_states=num_states;
|
s->num_states=num_states;
|
||||||
s->state_texts=state_texts;
|
s->state_texts=state_texts;
|
||||||
s->state_colors=state_colors;
|
s->state_colors=state_colors;
|
||||||
result->win_task=Fs;
|
res->win_task=Fs;
|
||||||
result->flags=CTRLF_SHOW;
|
res->flags=CTRLF_SHOW;
|
||||||
result->type=CTRLT_GENERIC;
|
res->type=CTRLT_GENERIC;
|
||||||
result->state=s;
|
res->state=s;
|
||||||
result->draw_it=&DrawCtrlButton;
|
res->draw_it=&DrawCtrlButton;
|
||||||
result->left_click=&LeftClickCtrlButton;
|
res->left_click=&LeftClickCtrlButton;
|
||||||
result->left=x;
|
res->left=x;
|
||||||
result->top=y;
|
res->top=y;
|
||||||
result->right=result->left+width-1;
|
res->right=res->left+width-1;
|
||||||
result->bottom=result->top+height-1;
|
res->bottom=res->top+height-1;
|
||||||
QueIns(result,Fs->last_ctrl);
|
QueIns(res,Fs->last_ctrl);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public U0 CtrlButtonDel(CCtrl *c)
|
public U0 CtrlButtonDel(CCtrl *c)
|
||||||
|
|||||||
+10
-10
@@ -16,18 +16,18 @@ CTemplateCS *CtrlSliderGet()
|
|||||||
{
|
{
|
||||||
CTemplateCSSlider *temps;
|
CTemplateCSSlider *temps;
|
||||||
U8 *st,pmt[STR_LEN];
|
U8 *st,pmt[STR_LEN];
|
||||||
CTemplateCS *result=CAlloc(sizeof(CTemplateCS));
|
CTemplateCS *res=CAlloc(sizeof(CTemplateCS));
|
||||||
|
|
||||||
"$$PURPLE$$Ctrl Slider$$FG$$\n\n";
|
"$$PURPLE$$Ctrl Slider$$FG$$\n\n";
|
||||||
|
|
||||||
result->glbl_name=GetStr("Glbl Struct Name (ENTER for No Glbl):");
|
res->glbl_name=GetStr("Glbl Struct Name (ENTER for No Glbl):");
|
||||||
result->range=GetI64 ("Range (%4d):",30);
|
res->range=GetI64 ("Range (%4d):",30);
|
||||||
result->spacing=GetI64("Spacing (%4d):",20);
|
res->spacing=GetI64("Spacing (%4d):",20);
|
||||||
result->border=GetI64 ("Border (%4d):",2);
|
res->border=GetI64 ("Border (%4d):",2);
|
||||||
|
|
||||||
result->next_slider=result->last_slider=&result->next_slider;
|
res->next_slider=res->last_slider=&res->next_slider;
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
StrPrint(pmt,"Slider #%d Name:",result->num_sliders+1);
|
StrPrint(pmt,"Slider #%d Name:",res->num_sliders+1);
|
||||||
st=GetStr(pmt);
|
st=GetStr(pmt);
|
||||||
if (!*st) {
|
if (!*st) {
|
||||||
Free(st);
|
Free(st);
|
||||||
@@ -35,10 +35,10 @@ CTemplateCS *CtrlSliderGet()
|
|||||||
}
|
}
|
||||||
temps=CAlloc(sizeof(CTemplateCSSlider));
|
temps=CAlloc(sizeof(CTemplateCSSlider));
|
||||||
temps->name=st;
|
temps->name=st;
|
||||||
QueIns(temps,result->last_slider);
|
QueIns(temps,res->last_slider);
|
||||||
temps->num=result->num_sliders++;
|
temps->num=res->num_sliders++;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 TemplateCtrlSlider(CDoc *doc)
|
U0 TemplateCtrlSlider(CDoc *doc)
|
||||||
|
|||||||
@@ -119,9 +119,9 @@ I64 DocBinPtrRst(CDoc *doc,CDocEntry *doc_e)
|
|||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
bin_num=doc->cur_bin_num++;
|
bin_num=doc->cur_bin_num++;
|
||||||
tempb=MAllocIdentical(tempb2,doc->mem_task);
|
tempb=MAllocIdent(tempb2,doc->mem_task);
|
||||||
tempb->use_cnt=i;
|
tempb->use_cnt=i;
|
||||||
tempb->data=MAllocIdentical(tempb2->data,doc->mem_task);
|
tempb->data=MAllocIdent(tempb2->data,doc->mem_task);
|
||||||
tempb->num=bin_num;
|
tempb->num=bin_num;
|
||||||
doc_e->bin_data=tempb;
|
doc_e->bin_data=tempb;
|
||||||
if (doc_e->de_flags&DOCEF_TAG && doc_e->tag && *doc_e->tag)
|
if (doc_e->de_flags&DOCEF_TAG && doc_e->tag && *doc_e->tag)
|
||||||
|
|||||||
@@ -4,18 +4,18 @@ public I64 EdCurU8(CDoc *doc)
|
|||||||
{//Return cur U8. See $LK,"EdRenumAsm",A="MN:EdRenumAsm"$ for an example.
|
{//Return cur U8. See $LK,"EdRenumAsm",A="MN:EdRenumAsm"$ for an example.
|
||||||
Bool unlock=DocLock(doc);
|
Bool unlock=DocLock(doc);
|
||||||
CDocEntry *doc_ce=doc->cur_entry;
|
CDocEntry *doc_ce=doc->cur_entry;
|
||||||
I64 result=-1;
|
I64 res=-1;
|
||||||
if (doc_ce->type_u8==DOCT_TEXT &&
|
if (doc_ce->type_u8==DOCT_TEXT &&
|
||||||
doc_ce->min_col<=doc->cur_col<doc_ce->max_col)
|
doc_ce->min_col<=doc->cur_col<doc_ce->max_col)
|
||||||
result=doc_ce->tag[doc->cur_col];
|
res=doc_ce->tag[doc->cur_col];
|
||||||
else if (doc_ce->type_u8==DOCT_TAB)
|
else if (doc_ce->type_u8==DOCT_TAB)
|
||||||
result='\t';
|
res='\t';
|
||||||
else if (doc_ce->type_u8==DOCT_NEW_LINE ||
|
else if (doc_ce->type_u8==DOCT_NEW_LINE ||
|
||||||
doc_ce->type_u8==DOCT_SOFT_NEW_LINE)
|
doc_ce->type_u8==DOCT_SOFT_NEW_LINE)
|
||||||
result='\n';
|
res='\n';
|
||||||
if (unlock)
|
if (unlock)
|
||||||
DocUnlock(doc);
|
DocUnlock(doc);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public U0 EdCursorLeft(CDoc *doc,I64 sc=MIN_I64)
|
public U0 EdCursorLeft(CDoc *doc,I64 sc=MIN_I64)
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ U0 EdReplaceTroubleAll(CDoc *doc,Bool to_safe,Bool select)
|
|||||||
#define ASM_RENUM_SPACING 5
|
#define ASM_RENUM_SPACING 5
|
||||||
|
|
||||||
#define EF_REINDENT 0
|
#define EF_REINDENT 0
|
||||||
#define EF_CHK_COMPILE 1
|
#define EF_CMP_CHK 1
|
||||||
#define EF_RENUM_ASM 2
|
#define EF_RENUM_ASM 2
|
||||||
#define EF_CTRL_SLIDER 3
|
#define EF_CTRL_SLIDER 3
|
||||||
#define EF_CH_SC 4
|
#define EF_CH_SC 4
|
||||||
@@ -39,7 +39,7 @@ I64 PopUpEdFmt()
|
|||||||
{
|
{
|
||||||
I64 i;
|
I64 i;
|
||||||
CDoc *doc=DocNew;
|
CDoc *doc=DocNew;
|
||||||
DocPrint(doc,"$$LTBLUE$$$$MU,\"Check Compile\",LE=EF_CHK_COMPILE$$\n"
|
DocPrint(doc,"$$LTBLUE$$$$MU,\"Compile Check\",LE=EF_CMP_CHK$$\n"
|
||||||
"$$MU,\"Reindent CPP.Z Fun (Beware braces in strings.)\","
|
"$$MU,\"Reindent CPP.Z Fun (Beware braces in strings.)\","
|
||||||
"LE=EF_REINDENT$$\n"
|
"LE=EF_REINDENT$$\n"
|
||||||
"$$MU,\"Renum Asm Local @@ Labels for Fun\",LE=EF_RENUM_ASM$$\n"
|
"$$MU,\"Renum Asm Local @@ Labels for Fun\",LE=EF_RENUM_ASM$$\n"
|
||||||
@@ -48,7 +48,7 @@ I64 PopUpEdFmt()
|
|||||||
"LE=EF_CH_SC$$\n\n"
|
"LE=EF_CH_SC$$\n\n"
|
||||||
"$$MU,\"CANCEL\",LE=DOCM_CANCEL$$\n\n"
|
"$$MU,\"CANCEL\",LE=DOCM_CANCEL$$\n\n"
|
||||||
"$$GREEN$$<ALT-BACKSPACE>$$FG$$ to undo if not happy\n"
|
"$$GREEN$$<ALT-BACKSPACE>$$FG$$ to undo if not happy\n"
|
||||||
"with the results.\n");
|
"with the ress.\n");
|
||||||
i=PopUpMenu(doc);
|
i=PopUpMenu(doc);
|
||||||
DocDel(doc);
|
DocDel(doc);
|
||||||
return i;
|
return i;
|
||||||
@@ -243,7 +243,7 @@ U0 EdRIStmt(CRILex *rx,Bool indent)
|
|||||||
|
|
||||||
CQueVectU8 *EdRICode(CDoc *doc)
|
CQueVectU8 *EdRICode(CDoc *doc)
|
||||||
{
|
{
|
||||||
CQueVectU8 *result;
|
CQueVectU8 *res;
|
||||||
CRILex *rx=CAlloc(sizeof(CRILex));
|
CRILex *rx=CAlloc(sizeof(CRILex));
|
||||||
|
|
||||||
rx->cc1=CmpCtrlNew(,CCF_KEEP_NEW_LINES|CCF_DONT_FREE_BUF,doc->filename.name);
|
rx->cc1=CmpCtrlNew(,CCF_KEEP_NEW_LINES|CCF_DONT_FREE_BUF,doc->filename.name);
|
||||||
@@ -263,9 +263,9 @@ CQueVectU8 *EdRICode(CDoc *doc)
|
|||||||
|
|
||||||
CmpCtrlDel(rx->cc1);
|
CmpCtrlDel(rx->cc1);
|
||||||
CmpCtrlDel(rx->cc2);
|
CmpCtrlDel(rx->cc2);
|
||||||
result=rx->indent;
|
res=rx->indent;
|
||||||
Free(rx);
|
Free(rx);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 EdRemFunLeadingSpace(CDoc *doc)
|
U0 EdRemFunLeadingSpace(CDoc *doc)
|
||||||
@@ -334,13 +334,13 @@ class CRenum
|
|||||||
|
|
||||||
I64 EdRAGetU8(CDoc *doc)
|
I64 EdRAGetU8(CDoc *doc)
|
||||||
{
|
{
|
||||||
I64 result=-1;
|
I64 res=-1;
|
||||||
while (doc->cur_entry!=doc &&
|
while (doc->cur_entry!=doc &&
|
||||||
doc->cur_entry->type&DOCET_SELECTED && result<0) {
|
doc->cur_entry->type&DOCET_SELECTED && res<0) {
|
||||||
result=EdCurU8(doc);
|
res=EdCurU8(doc);
|
||||||
EdCursorRight(doc);
|
EdCursorRight(doc);
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 EdRACollect(CDoc *doc,CRenum *root)
|
U0 EdRACollect(CDoc *doc,CRenum *root)
|
||||||
@@ -434,7 +434,7 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action,Bool beep=TRUE)
|
|||||||
|
|
||||||
DocCaptureUndo(doc,TRUE);
|
DocCaptureUndo(doc,TRUE);
|
||||||
switch (tool_action) {
|
switch (tool_action) {
|
||||||
case EF_CHK_COMPILE:
|
case EF_CMP_CHK:
|
||||||
okay=FALSE;
|
okay=FALSE;
|
||||||
if (doc->flags&DOCF_PLAIN_TEXT)
|
if (doc->flags&DOCF_PLAIN_TEXT)
|
||||||
DocFlagsToggle(doc,DOCF_PLAIN_TEXT);
|
DocFlagsToggle(doc,DOCF_PLAIN_TEXT);
|
||||||
@@ -447,7 +447,7 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action,Bool beep=TRUE)
|
|||||||
Free(st);
|
Free(st);
|
||||||
WinHorz(Fs->win_left,Fs->win_right, task);
|
WinHorz(Fs->win_left,Fs->win_right, task);
|
||||||
WinVert(Fs->win_top, Fs->win_bottom,task);
|
WinVert(Fs->win_top, Fs->win_bottom,task);
|
||||||
if (JobResultScan(tempc,&r)) {
|
if (JobResScan(tempc,&r)) {
|
||||||
st=DirFile(doc->filename.name,,"PRJ.Z");
|
st=DirFile(doc->filename.name,,"PRJ.Z");
|
||||||
prj_file=FileNameAbs(st,FUF_Z_OR_NOT_Z);
|
prj_file=FileNameAbs(st,FUF_Z_OR_NOT_Z);
|
||||||
Free(st);
|
Free(st);
|
||||||
@@ -462,17 +462,17 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action,Bool beep=TRUE)
|
|||||||
prj_file);
|
prj_file);
|
||||||
tempc=TaskExe(task,Fs,st,1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
tempc=TaskExe(task,Fs,st,1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||||
Free(st);
|
Free(st);
|
||||||
if (JobResultScan(tempc,&r))
|
if (JobResScan(tempc,&r))
|
||||||
if (!r) {
|
if (!r) {
|
||||||
tempc=TaskExe(task,Fs,
|
tempc=TaskExe(task,Fs,
|
||||||
"Load(\"SysTemp\",LDF_JUST_LOAD);",
|
"Load(\"SysTemp\",LDF_JUST_LOAD);",
|
||||||
1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||||
if (JobResultScan(tempc,&r))
|
if (JobResScan(tempc,&r))
|
||||||
okay=TRUE;
|
okay=TRUE;
|
||||||
}
|
}
|
||||||
tempc=TaskExe(task,Fs,"Del(\"SysTemp.*\");",
|
tempc=TaskExe(task,Fs,"Del(\"SysTemp.*\");",
|
||||||
1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||||
JobResultScan(tempc,&r);
|
JobResScan(tempc,&r);
|
||||||
} else {
|
} else {
|
||||||
Free(prj_file);
|
Free(prj_file);
|
||||||
st=DirFile(doc->filename.name,"Load","CPP.Z");
|
st=DirFile(doc->filename.name,"Load","CPP.Z");
|
||||||
@@ -484,7 +484,7 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action,Bool beep=TRUE)
|
|||||||
st=MStrPrint("\"$$WW,1$$\";ExeFile(\"%s\",TRUE);",doc->filename.name);
|
st=MStrPrint("\"$$WW,1$$\";ExeFile(\"%s\",TRUE);",doc->filename.name);
|
||||||
tempc=TaskExe(task,Fs,st,1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
tempc=TaskExe(task,Fs,st,1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||||
Free(st);
|
Free(st);
|
||||||
if (JobResultScan(tempc,&r) && r)
|
if (JobResScan(tempc,&r) && r)
|
||||||
okay=TRUE;
|
okay=TRUE;
|
||||||
}
|
}
|
||||||
Free(prj_file);
|
Free(prj_file);
|
||||||
@@ -642,7 +642,7 @@ U0 EdCodeTools(CDoc *doc)
|
|||||||
{
|
{
|
||||||
I64 tool_action=PopUpEdFmt;
|
I64 tool_action=PopUpEdFmt;
|
||||||
switch (tool_action) {
|
switch (tool_action) {
|
||||||
case EF_CHK_COMPILE:
|
case EF_CMP_CHK:
|
||||||
case EF_REINDENT:
|
case EF_REINDENT:
|
||||||
case EF_RENUM_ASM:
|
case EF_RENUM_ASM:
|
||||||
EdCodeTools2(doc,tool_action);
|
EdCodeTools2(doc,tool_action);
|
||||||
|
|||||||
+33
-33
@@ -2,30 +2,30 @@
|
|||||||
public CDoc *DocPut(CTask *task=NULL)
|
public CDoc *DocPut(CTask *task=NULL)
|
||||||
{//Current document that StdOut Put() goes to.
|
{//Current document that StdOut Put() goes to.
|
||||||
//Basically, StdOut unless double buffering.
|
//Basically, StdOut unless double buffering.
|
||||||
CDoc *result;
|
CDoc *res;
|
||||||
if (!task) task=Fs;
|
if (!task) task=Fs;
|
||||||
if ((result=task->put_doc) && result->doc_signature==DOC_SIGNATURE_VAL)
|
if ((res=task->put_doc) && res->doc_signature==DOC_SIGNATURE_VAL)
|
||||||
return result;
|
return res;
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CDoc *DocDisplay(CTask *task=NULL)
|
public CDoc *DocDisplay(CTask *task=NULL)
|
||||||
{//StdOut displayed unless double buffering.
|
{//StdOut displayed unless double buffering.
|
||||||
CDoc *result;
|
CDoc *res;
|
||||||
if (!task) task=Fs;
|
if (!task) task=Fs;
|
||||||
if ((result=task->display_doc) && result->doc_signature==DOC_SIGNATURE_VAL)
|
if ((res=task->display_doc) && res->doc_signature==DOC_SIGNATURE_VAL)
|
||||||
return result;
|
return res;
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CDoc *DocBorder(CTask *task=NULL)
|
public CDoc *DocBorder(CTask *task=NULL)
|
||||||
{//Doc holding border of window text.
|
{//Doc holding border of window text.
|
||||||
CDoc *result;
|
CDoc *res;
|
||||||
if (!task) task=Fs;
|
if (!task) task=Fs;
|
||||||
if ((result=task->border_doc) && result->doc_signature==DOC_SIGNATURE_VAL)
|
if ((res=task->border_doc) && res->doc_signature==DOC_SIGNATURE_VAL)
|
||||||
return result;
|
return res;
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -33,36 +33,36 @@ public CDoc *DocBorder(CTask *task=NULL)
|
|||||||
public CDoc *DocDblBufStart(CTask *task=NULL)
|
public CDoc *DocDblBufStart(CTask *task=NULL)
|
||||||
{//See $LK,"::/Demo/Spy.CPP"$
|
{//See $LK,"::/Demo/Spy.CPP"$
|
||||||
Bool unlock_ddoc;
|
Bool unlock_ddoc;
|
||||||
CDoc *pdoc=DocPut(task),*ddoc=DocDisplay(task),*result;
|
CDoc *pdoc=DocPut(task),*ddoc=DocDisplay(task),*res;
|
||||||
if (!pdoc || !ddoc || pdoc!=ddoc)
|
if (!pdoc || !ddoc || pdoc!=ddoc)
|
||||||
result=NULL; //Already Double buffering
|
res=NULL; //Already Double buffering
|
||||||
else {
|
else {
|
||||||
if (!task) task=Fs;
|
if (!task) task=Fs;
|
||||||
unlock_ddoc=DocLock(ddoc); //dont change during winupdate, so lock DocPut$WW,0$
|
unlock_ddoc=DocLock(ddoc); //dont change during winupdate, so lock DocPut$WW,0$
|
||||||
result=DocNew(,task);
|
res=DocNew(,task);
|
||||||
result->win_task =ddoc->win_task;
|
res->win_task =ddoc->win_task;
|
||||||
result->max_entries =ddoc->max_entries;
|
res->max_entries =ddoc->max_entries;
|
||||||
MemCpy(result->find_replace,ddoc->find_replace,sizeof(CEdFindText));
|
MemCpy(res->find_replace,ddoc->find_replace,sizeof(CEdFindText));
|
||||||
MemCpy(&result->filename,&ddoc->filename,sizeof(CEdFileName));
|
MemCpy(&res->filename,&ddoc->filename,sizeof(CEdFileName));
|
||||||
result->left_click_link =ddoc->left_click_link;
|
res->left_click_link =ddoc->left_click_link;
|
||||||
result->right_click_link =ddoc->right_click_link;
|
res->right_click_link =ddoc->right_click_link;
|
||||||
result->user_put_data =ddoc->user_put_data;
|
res->user_put_data =ddoc->user_put_data;
|
||||||
result->user_put_key =ddoc->user_put_key;
|
res->user_put_key =ddoc->user_put_key;
|
||||||
result->user_put_s =ddoc->user_put_s;
|
res->user_put_s =ddoc->user_put_s;
|
||||||
result->parent_doc =ddoc->parent_doc;
|
res->parent_doc =ddoc->parent_doc;
|
||||||
result->desc =ddoc->desc;
|
res->desc =ddoc->desc;
|
||||||
result->user_data =ddoc->user_data;
|
res->user_data =ddoc->user_data;
|
||||||
result->flags|=ddoc->flags&DOCG_DBL_BUF_FLAGS | DOCF_DONT_SHOW;
|
res->flags|=ddoc->flags&DOCG_DBL_BUF_FLAGS | DOCF_DONT_SHOW;
|
||||||
task->put_doc=result;
|
task->put_doc=res;
|
||||||
if (unlock_ddoc)
|
if (unlock_ddoc)
|
||||||
DocUnlock(ddoc);
|
DocUnlock(ddoc);
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bool DocDblBufEnd(CTask *task=NULL)
|
public Bool DocDblBufEnd(CTask *task=NULL)
|
||||||
{//See $LK,"::/Demo/Spy.CPP"$
|
{//See $LK,"::/Demo/Spy.CPP"$
|
||||||
Bool result=FALSE;
|
Bool res=FALSE;
|
||||||
CDoc *pdoc=DocPut(task),*ddoc=DocDisplay(task);
|
CDoc *pdoc=DocPut(task),*ddoc=DocDisplay(task);
|
||||||
if (pdoc && ddoc && pdoc!=ddoc) {//Double buffering?
|
if (pdoc && ddoc && pdoc!=ddoc) {//Double buffering?
|
||||||
if (!task) task=Fs;
|
if (!task) task=Fs;
|
||||||
@@ -72,14 +72,14 @@ public Bool DocDblBufEnd(CTask *task=NULL)
|
|||||||
task->display_doc=pdoc;
|
task->display_doc=pdoc;
|
||||||
DocUnlock(ddoc);
|
DocUnlock(ddoc);
|
||||||
DocDel(ddoc);
|
DocDel(ddoc);
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bool DocDblBufSwap(CTask *task=NULL)
|
public Bool DocDblBufSwap(CTask *task=NULL)
|
||||||
{//See $LK,"::/Demo/Spy.CPP"$
|
{//See $LK,"::/Demo/Spy.CPP"$
|
||||||
Bool result=FALSE;
|
Bool res=FALSE;
|
||||||
CDoc *pdoc=DocPut(task),*ddoc=DocDisplay(task);
|
CDoc *pdoc=DocPut(task),*ddoc=DocDisplay(task);
|
||||||
if (pdoc && ddoc && pdoc!=ddoc) {//Double buffering?
|
if (pdoc && ddoc && pdoc!=ddoc) {//Double buffering?
|
||||||
if (!task) task=Fs;
|
if (!task) task=Fs;
|
||||||
@@ -102,7 +102,7 @@ public Bool DocDblBufSwap(CTask *task=NULL)
|
|||||||
ddoc->desc =pdoc->desc;
|
ddoc->desc =pdoc->desc;
|
||||||
ddoc->user_data =pdoc->user_data;
|
ddoc->user_data =pdoc->user_data;
|
||||||
task->put_doc=ddoc;
|
task->put_doc=ddoc;
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
+14
-14
@@ -79,7 +79,7 @@ public Bool DocEd(CDoc *doc,I64 dof_flags=0)
|
|||||||
old_top =Fs->win_top, old_bottom=Fs->win_bottom,
|
old_top =Fs->win_top, old_bottom=Fs->win_bottom,
|
||||||
old_left=Fs->win_left,old_right =Fs->win_right,
|
old_left=Fs->win_left,old_right =Fs->win_right,
|
||||||
old_title_src=Fs->title_src;
|
old_title_src=Fs->title_src;
|
||||||
Bool result,unlock;
|
Bool res,unlock;
|
||||||
U8 *old_task_title;
|
U8 *old_task_title;
|
||||||
if (dof_flags&DOF_WIN_MAX)
|
if (dof_flags&DOF_WIN_MAX)
|
||||||
WinMax;
|
WinMax;
|
||||||
@@ -155,10 +155,10 @@ public Bool DocEd(CDoc *doc,I64 dof_flags=0)
|
|||||||
if (doc->flags&DOCF_MIN_SIZE)
|
if (doc->flags&DOCF_MIN_SIZE)
|
||||||
WinMgrSync(2,TRUE);
|
WinMgrSync(2,TRUE);
|
||||||
}
|
}
|
||||||
result=View;
|
res=View;
|
||||||
|
|
||||||
DocLock(doc);
|
DocLock(doc);
|
||||||
if (result) {
|
if (res) {
|
||||||
doc_e=doc->root.next;
|
doc_e=doc->root.next;
|
||||||
while (doc_e!=doc) {
|
while (doc_e!=doc) {
|
||||||
if (doc_e->type_u8==DOCT_DATA || doc_e->type_u8==DOCT_CHECK_BOX)
|
if (doc_e->type_u8==DOCT_DATA || doc_e->type_u8==DOCT_CHECK_BOX)
|
||||||
@@ -182,7 +182,7 @@ public Bool DocEd(CDoc *doc,I64 dof_flags=0)
|
|||||||
WinHorz(old_left,old_right);
|
WinHorz(old_left,old_right);
|
||||||
WinVert(old_top,old_bottom);
|
WinVert(old_top,old_bottom);
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#help_index "DolDoc/Cmd Line (Typically);Cmd Line (Typically)"
|
#help_index "DolDoc/Cmd Line (Typically);Cmd Line (Typically)"
|
||||||
@@ -190,7 +190,7 @@ public Bool Ed(U8 *link_st,I64 edf_dof_flags=0)
|
|||||||
{//Invoke document editor.
|
{//Invoke document editor.
|
||||||
U8 *filename,*needle_str;
|
U8 *filename,*needle_str;
|
||||||
I64 i,num;
|
I64 i,num;
|
||||||
Bool cont,result=FALSE;
|
Bool cont,res=FALSE;
|
||||||
CDoc *doc;
|
CDoc *doc;
|
||||||
|
|
||||||
switch (i=EdLinkCvt(link_st,&filename,&needle_str,&num,edf_dof_flags)) {
|
switch (i=EdLinkCvt(link_st,&filename,&needle_str,&num,edf_dof_flags)) {
|
||||||
@@ -211,11 +211,11 @@ ej_doc:
|
|||||||
DocDel(doc);
|
DocDel(doc);
|
||||||
}
|
}
|
||||||
if (!(edf_dof_flags&EDF_WAS_WRITE))
|
if (!(edf_dof_flags&EDF_WAS_WRITE))
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (IsRaw)
|
if (IsRaw)
|
||||||
result=EdLite(filename,num,edf_dof_flags);
|
res=EdLite(filename,num,edf_dof_flags);
|
||||||
else {
|
else {
|
||||||
cont=TRUE;
|
cont=TRUE;
|
||||||
if (!(edf_dof_flags&EDF_BAIL) && !(LK_DOC<=i<=LK_DOC_LINE) &&
|
if (!(edf_dof_flags&EDF_BAIL) && !(LK_DOC<=i<=LK_DOC_LINE) &&
|
||||||
@@ -223,28 +223,28 @@ ej_doc:
|
|||||||
!PopUpCancelOk(ST_WARN_ST "Not Text File\n\n"))
|
!PopUpCancelOk(ST_WARN_ST "Not Text File\n\n"))
|
||||||
cont=FALSE;
|
cont=FALSE;
|
||||||
if (cont)
|
if (cont)
|
||||||
result=DocFileEd(i,filename,needle_str,&num,edf_dof_flags);
|
res=DocFileEd(i,filename,needle_str,&num,edf_dof_flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Free(filename);
|
Free(filename);
|
||||||
Free(needle_str);
|
Free(needle_str);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bool Plain(U8 *filename,I64 edf_dof_flags=0)
|
public Bool Plain(U8 *filename,I64 edf_dof_flags=0)
|
||||||
{//Edit document in plain text mode, so dollar signs are not special.
|
{//Edit document in plain text mode, so dollar signs are not special.
|
||||||
Bool result;
|
Bool res;
|
||||||
U8 *st=MStrPrint("PI:%s",filename);
|
U8 *st=MStrPrint("PI:%s",filename);
|
||||||
result=Ed(st,edf_dof_flags);
|
res=Ed(st,edf_dof_flags);
|
||||||
Free(st);
|
Free(st);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#help_index "DolDoc;Task/Srv/Exe"
|
#help_index "DolDoc;Task/Srv/Exe"
|
||||||
public I64 PopUpEd(U8 *filename,CTask *parent=NULL,CTask **_pu_task=NULL)
|
public I64 PopUpEd(U8 *filename,CTask *parent=NULL,CTask **_pu_task=NULL)
|
||||||
{//Create PopUp win task and edit a doc.
|
{//Create PopUp win task and edit a doc.
|
||||||
U8 *st=MStrPrint("Ed(\"%Q\");",filename);
|
U8 *st=MStrPrint("Ed(\"%Q\");",filename);
|
||||||
I64 result=PopUp(st,parent,_pu_task);
|
I64 res=PopUp(st,parent,_pu_task);
|
||||||
Free(st);
|
Free(st);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
+14
-14
@@ -56,7 +56,7 @@ public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
|
|||||||
CDocBin *b;
|
CDocBin *b;
|
||||||
Bool unlock=DocLock(doc);
|
Bool unlock=DocLock(doc);
|
||||||
I64 ch,cnt=1;//terminator
|
I64 ch,cnt=1;//terminator
|
||||||
U8 *st,*result,*dst,*src;
|
U8 *st,*res,*dst,*src;
|
||||||
|
|
||||||
if (!(doc->flags & (DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_TABS)))
|
if (!(doc->flags & (DOCF_PLAIN_TEXT|DOCF_PLAIN_TEXT_TABS)))
|
||||||
DocBinsValidate(doc);
|
DocBinsValidate(doc);
|
||||||
@@ -103,8 +103,8 @@ public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
|
|||||||
for (b=doc->bin_root.next;b!=&doc->bin_root;b=b->next)
|
for (b=doc->bin_root.next;b!=&doc->bin_root;b=b->next)
|
||||||
if (b->use_cnt>b->temp_use_cnt)
|
if (b->use_cnt>b->temp_use_cnt)
|
||||||
cnt+=offset(CDocBin.end)-offset(CDocBin.start)+b->size;
|
cnt+=offset(CDocBin.end)-offset(CDocBin.start)+b->size;
|
||||||
result=MAlloc(cnt);
|
res=MAlloc(cnt);
|
||||||
dst=result;
|
dst=res;
|
||||||
doc_e=doc->root.next;
|
doc_e=doc->root.next;
|
||||||
while (doc_e!=doc) {
|
while (doc_e!=doc) {
|
||||||
doc_e1=doc_e->next;
|
doc_e1=doc_e->next;
|
||||||
@@ -167,7 +167,7 @@ public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
|
|||||||
if (_size) *_size=cnt;
|
if (_size) *_size=cnt;
|
||||||
if (unlock)
|
if (unlock)
|
||||||
DocUnlock(doc);
|
DocUnlock(doc);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bool DocWrite(CDoc *doc,Bool prompt=FALSE)
|
public Bool DocWrite(CDoc *doc,Bool prompt=FALSE)
|
||||||
@@ -244,7 +244,7 @@ public U0 StreamDoc(CDoc *doc)
|
|||||||
#help_index "DolDoc"
|
#help_index "DolDoc"
|
||||||
Bool DocCaptureUndo(CDoc *doc,Bool force=FALSE)
|
Bool DocCaptureUndo(CDoc *doc,Bool force=FALSE)
|
||||||
{
|
{
|
||||||
Bool result=FALSE,unlock;
|
Bool res=FALSE,unlock;
|
||||||
I64 time_stamp,flags;
|
I64 time_stamp,flags;
|
||||||
CDocUndo *u;
|
CDocUndo *u;
|
||||||
if (doc->flags&DOCF_ALLOW_UNDO) {
|
if (doc->flags&DOCF_ALLOW_UNDO) {
|
||||||
@@ -263,12 +263,12 @@ Bool DocCaptureUndo(CDoc *doc,Bool force=FALSE)
|
|||||||
doc->flags&=~DOCF_UNDO_DIRTY;
|
doc->flags&=~DOCF_UNDO_DIRTY;
|
||||||
doc->undo_cnt++;
|
doc->undo_cnt++;
|
||||||
u->doc_flags=doc->flags;
|
u->doc_flags=doc->flags;
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
}
|
}
|
||||||
if (unlock)
|
if (unlock)
|
||||||
DocUnlock(doc);
|
DocUnlock(doc);
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 DocUndoRestore(CDoc *doc)
|
U0 DocUndoRestore(CDoc *doc)
|
||||||
@@ -298,7 +298,7 @@ U0 DocUndoRestore(CDoc *doc)
|
|||||||
"DolDoc/Output;StdOut/DolDoc"
|
"DolDoc/Output;StdOut/DolDoc"
|
||||||
public Bool DocType(CDoc *doc=NULL,U8 *filename,I64 trailing_new_lines=1)
|
public Bool DocType(CDoc *doc=NULL,U8 *filename,I64 trailing_new_lines=1)
|
||||||
{//Output txt or graphic file to document.
|
{//Output txt or graphic file to document.
|
||||||
Bool result=FALSE;
|
Bool res=FALSE;
|
||||||
CDoc *doc2;
|
CDoc *doc2;
|
||||||
if (!doc && !(doc=DocPut) || doc->doc_signature!=DOC_SIGNATURE_VAL)
|
if (!doc && !(doc=DocPut) || doc->doc_signature!=DOC_SIGNATURE_VAL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -308,20 +308,20 @@ public Bool DocType(CDoc *doc=NULL,U8 *filename,I64 trailing_new_lines=1)
|
|||||||
if (IsRaw)
|
if (IsRaw)
|
||||||
DocDump(doc2,100000);
|
DocDump(doc2,100000);
|
||||||
DocDel(doc2);
|
DocDel(doc2);
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
} else if (FilesFindMatch(filename,"*.BMP.Z")) {
|
} else if (FilesFindMatch(filename,"*.BMP.Z")) {
|
||||||
DocBMP(doc,filename,,FALSE);
|
DocBMP(doc,filename,,FALSE);
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
} else if (FilesFindMatch(filename,"*.BMP;*.bmp")) {
|
} else if (FilesFindMatch(filename,"*.BMP;*.bmp")) {
|
||||||
DocBMP(doc,filename,,TRUE);
|
DocBMP(doc,filename,,TRUE);
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
} else if (FilesFindMatch(filename,"*.GRA*")) {
|
} else if (FilesFindMatch(filename,"*.GRA*")) {
|
||||||
DocGRA(doc,filename);
|
DocGRA(doc,filename);
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
}
|
}
|
||||||
if (result)
|
if (res)
|
||||||
DocPrint(doc,"%h*c",trailing_new_lines,'\n');
|
DocPrint(doc,"%h*c",trailing_new_lines,'\n');
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#help_index "Graphics/Windows BMP Files;Graphics/GRA Files;"\
|
#help_index "Graphics/Windows BMP Files;Graphics/GRA Files;"\
|
||||||
|
|||||||
+35
-35
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
public Bool DocLineNumGoTo(CDoc *doc,I64 line_num) //one based
|
public Bool DocLineNumGoTo(CDoc *doc,I64 line_num) //one based
|
||||||
{//Nearest to specified line num. Move cur_entry & center.
|
{//Nearest to specified line num. Move cur_entry & center.
|
||||||
Bool result=FALSE,unlock;
|
Bool res=FALSE,unlock;
|
||||||
if (doc) {
|
if (doc) {
|
||||||
unlock=DocLock(doc);
|
unlock=DocLock(doc);
|
||||||
doc->x=0;
|
doc->x=0;
|
||||||
@@ -10,32 +10,32 @@ public Bool DocLineNumGoTo(CDoc *doc,I64 line_num) //one based
|
|||||||
DocRecalc(doc,RECALCt_FIND_CURSOR);
|
DocRecalc(doc,RECALCt_FIND_CURSOR);
|
||||||
DocCenter(doc);
|
DocCenter(doc);
|
||||||
if (doc->cur_entry->y==line_num-1)
|
if (doc->cur_entry->y==line_num-1)
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
if (unlock)
|
if (unlock)
|
||||||
DocUnlock(doc);
|
DocUnlock(doc);
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bool DocFind(CDoc *haystack_doc,I64 start_line_num=MIN_I64,
|
public Bool DocFind(CDoc *haystack_doc,I64 start_line_num=MIN_I64,
|
||||||
U8 *needle,I64 match=1)
|
U8 *needle,I64 match=1)
|
||||||
{//Find str by searching tags. Move cur_entry & center.
|
{//Find str by searching tags. Move cur_entry & center.
|
||||||
Bool result=FALSE,unlock;
|
Bool res=FALSE,unlock;
|
||||||
CDocEntry *doc_e;
|
CDocEntry *doc_e;
|
||||||
U8 *ptr;
|
U8 *ptr;
|
||||||
I64 i;
|
I64 i;
|
||||||
if (haystack_doc) {
|
if (haystack_doc) {
|
||||||
unlock=DocLock(haystack_doc);
|
unlock=DocLock(haystack_doc);
|
||||||
if (start_line_num==MIN_I64) {
|
if (start_line_num==MIN_I64) {
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
doc_e=haystack_doc->root.next;
|
doc_e=haystack_doc->root.next;
|
||||||
} else {
|
} else {
|
||||||
result=DocLineNumGoTo(haystack_doc,start_line_num);
|
res=DocLineNumGoTo(haystack_doc,start_line_num);
|
||||||
doc_e=haystack_doc->cur_entry;
|
doc_e=haystack_doc->cur_entry;
|
||||||
}
|
}
|
||||||
if (result) {
|
if (res) {
|
||||||
if (needle) {
|
if (needle) {
|
||||||
result=FALSE;
|
res=FALSE;
|
||||||
while (doc_e!=haystack_doc) {
|
while (doc_e!=haystack_doc) {
|
||||||
if (doc_e->de_flags&DOCEF_TAG && doc_e->tag &&
|
if (doc_e->de_flags&DOCEF_TAG && doc_e->tag &&
|
||||||
//TODO: handle multi-DocEntry strs
|
//TODO: handle multi-DocEntry strs
|
||||||
@@ -46,26 +46,26 @@ U8 *needle,I64 match=1)
|
|||||||
if (i<doc_e->min_col) i=doc_e->min_col;
|
if (i<doc_e->min_col) i=doc_e->min_col;
|
||||||
if (i>doc_e->max_col) i=doc_e->max_col;
|
if (i>doc_e->max_col) i=doc_e->max_col;
|
||||||
haystack_doc->cur_col=i;
|
haystack_doc->cur_col=i;
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
doc_e=doc_e->next;
|
doc_e=doc_e->next;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
result=FALSE;
|
res=FALSE;
|
||||||
}
|
}
|
||||||
if (!result) DocBottom(haystack_doc);
|
if (!res) DocBottom(haystack_doc);
|
||||||
DocCenter(haystack_doc);
|
DocCenter(haystack_doc);
|
||||||
if (unlock)
|
if (unlock)
|
||||||
DocUnlock(haystack_doc);
|
DocUnlock(haystack_doc);
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bool DocAnchorFind(CDoc *haystack_doc,U8 *needle_str)
|
public Bool DocAnchorFind(CDoc *haystack_doc,U8 *needle_str)
|
||||||
{//Find named anchor. Move cur_entry & center.
|
{//Find named anchor. Move cur_entry & center.
|
||||||
Bool result=FALSE,unlock;
|
Bool res=FALSE,unlock;
|
||||||
CDocEntry *doc_e;
|
CDocEntry *doc_e;
|
||||||
if (haystack_doc) {
|
if (haystack_doc) {
|
||||||
unlock=DocLock(haystack_doc);
|
unlock=DocLock(haystack_doc);
|
||||||
@@ -76,18 +76,18 @@ public Bool DocAnchorFind(CDoc *haystack_doc,U8 *needle_str)
|
|||||||
if (!StrCmp(needle_str,doc_e->aux_str)) {
|
if (!StrCmp(needle_str,doc_e->aux_str)) {
|
||||||
haystack_doc->cur_entry=doc_e;
|
haystack_doc->cur_entry=doc_e;
|
||||||
haystack_doc->cur_col=doc_e->min_col;
|
haystack_doc->cur_col=doc_e->min_col;
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
doc_e=doc_e->next;
|
doc_e=doc_e->next;
|
||||||
}
|
}
|
||||||
if (!result) DocBottom(haystack_doc);
|
if (!res) DocBottom(haystack_doc);
|
||||||
DocCenter(haystack_doc);
|
DocCenter(haystack_doc);
|
||||||
if (unlock)
|
if (unlock)
|
||||||
DocUnlock(haystack_doc);
|
DocUnlock(haystack_doc);
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public U0 EdFindNext(CDoc *doc)
|
public U0 EdFindNext(CDoc *doc)
|
||||||
@@ -182,7 +182,7 @@ public U0 EdSelectAll(CDoc *doc,Bool select)
|
|||||||
public Bool EdFindPaired(CDoc *doc,U8 plus,U8 minus,
|
public Bool EdFindPaired(CDoc *doc,U8 plus,U8 minus,
|
||||||
Bool fwd,Bool abort_on_dbl_colon=FALSE)
|
Bool fwd,Bool abort_on_dbl_colon=FALSE)
|
||||||
{//Find { } or ( ) pair. Move cur_entry & center.
|
{//Find { } or ( ) pair. Move cur_entry & center.
|
||||||
Bool unlock=DocLock(doc),result=FALSE;
|
Bool unlock=DocLock(doc),res=FALSE;
|
||||||
U8 *ptr;
|
U8 *ptr;
|
||||||
I64 ch,levels=0,colons=0,original_col=doc->cur_col;
|
I64 ch,levels=0,colons=0,original_col=doc->cur_col;
|
||||||
CDocEntry *doc_ce=doc->cur_entry,*doc_e=doc_ce,*original_ce=doc_ce;
|
CDocEntry *doc_ce=doc->cur_entry,*doc_e=doc_ce,*original_ce=doc_ce;
|
||||||
@@ -209,7 +209,7 @@ Bool fwd,Bool abort_on_dbl_colon=FALSE)
|
|||||||
doc->cur_entry=doc_e;
|
doc->cur_entry=doc_e;
|
||||||
doc->cur_col=ptr-doc_e->tag-1;
|
doc->cur_col=ptr-doc_e->tag-1;
|
||||||
EdCursorLeft(doc);
|
EdCursorLeft(doc);
|
||||||
result=FALSE;
|
res=FALSE;
|
||||||
goto pa_done;
|
goto pa_done;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -220,7 +220,7 @@ Bool fwd,Bool abort_on_dbl_colon=FALSE)
|
|||||||
if (!levels--) {
|
if (!levels--) {
|
||||||
doc->cur_entry=doc_e;
|
doc->cur_entry=doc_e;
|
||||||
doc->cur_col=ptr-doc_e->tag-1;
|
doc->cur_col=ptr-doc_e->tag-1;
|
||||||
result=doc->cur_entry!=original_ce ||
|
res=doc->cur_entry!=original_ce ||
|
||||||
doc->cur_col!=original_col;
|
doc->cur_col!=original_col;
|
||||||
goto pa_done;
|
goto pa_done;
|
||||||
}
|
}
|
||||||
@@ -241,7 +241,7 @@ Bool fwd,Bool abort_on_dbl_colon=FALSE)
|
|||||||
if (++colons==2) {
|
if (++colons==2) {
|
||||||
doc->cur_entry=doc_e;
|
doc->cur_entry=doc_e;
|
||||||
doc->cur_col=ptr-doc_e->tag+1;
|
doc->cur_col=ptr-doc_e->tag+1;
|
||||||
result=FALSE;
|
res=FALSE;
|
||||||
goto pa_done;
|
goto pa_done;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -252,7 +252,7 @@ Bool fwd,Bool abort_on_dbl_colon=FALSE)
|
|||||||
if (!levels--) {
|
if (!levels--) {
|
||||||
doc->cur_entry=doc_e;
|
doc->cur_entry=doc_e;
|
||||||
doc->cur_col=ptr-doc_e->tag+1;
|
doc->cur_col=ptr-doc_e->tag+1;
|
||||||
result=doc->cur_entry!=original_ce ||
|
res=doc->cur_entry!=original_ce ||
|
||||||
doc->cur_col!=original_col;
|
doc->cur_col!=original_col;
|
||||||
goto pa_done;
|
goto pa_done;
|
||||||
}
|
}
|
||||||
@@ -273,12 +273,12 @@ pa_done:
|
|||||||
DocCenter(doc);
|
DocCenter(doc);
|
||||||
if (unlock)
|
if (unlock)
|
||||||
DocUnlock(doc);
|
DocUnlock(doc);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bool EdGoToFun(CDoc *doc,Bool fwd,Bool abort_on_dbl_colon)
|
public Bool EdGoToFun(CDoc *doc,Bool fwd,Bool abort_on_dbl_colon)
|
||||||
{//Move cur_entry to start of cur fun and center.(Shoddy)
|
{//Move cur_entry to start of cur fun and center.(Shoddy)
|
||||||
Bool unlock=DocLock(doc),result=FALSE;
|
Bool unlock=DocLock(doc),res=FALSE;
|
||||||
I64 ch,levels,colons;
|
I64 ch,levels,colons;
|
||||||
if (fwd) {
|
if (fwd) {
|
||||||
levels=0;
|
levels=0;
|
||||||
@@ -301,22 +301,22 @@ public Bool EdGoToFun(CDoc *doc,Bool fwd,Bool abort_on_dbl_colon)
|
|||||||
}
|
}
|
||||||
DocRecalc(doc);
|
DocRecalc(doc);
|
||||||
if (doc->cur_entry!=doc)
|
if (doc->cur_entry!=doc)
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
} else {
|
} else {
|
||||||
while (EdFindPaired(doc,'}','{',FALSE,abort_on_dbl_colon));
|
while (EdFindPaired(doc,'}','{',FALSE,abort_on_dbl_colon));
|
||||||
if (doc->cur_entry!=doc) {
|
if (doc->cur_entry!=doc) {
|
||||||
ch=EdCurU8(doc);
|
ch=EdCurU8(doc);
|
||||||
if (abort_on_dbl_colon && ch==':')
|
if (abort_on_dbl_colon && ch==':')
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
else {
|
else {
|
||||||
if (ch=='{')
|
if (ch=='{')
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (unlock)
|
if (unlock)
|
||||||
DocUnlock(doc);
|
DocUnlock(doc);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public U0 EdSelectFun(CDoc *doc,Bool abort_on_dbl_colon=FALSE)
|
public U0 EdSelectFun(CDoc *doc,Bool abort_on_dbl_colon=FALSE)
|
||||||
@@ -383,7 +383,7 @@ I64 PopUpReplaceSkipAllCancel(U8 *header=NULL,U8 *footer=NULL)
|
|||||||
I64 EdFindReplace(CDoc *doc)
|
I64 EdFindReplace(CDoc *doc)
|
||||||
{
|
{
|
||||||
Bool found,unlock;
|
Bool found,unlock;
|
||||||
I64 cmd,i,j,plen,rlen,dlen,result=-1,sf_flags;
|
I64 cmd,i,j,plen,rlen,dlen,res=-1,sf_flags;
|
||||||
U8 *src,*dst,*dst2;
|
U8 *src,*dst,*dst2;
|
||||||
CDocEntry *doc_ce,*doc_e,*doc_marker=NULL;
|
CDocEntry *doc_ce,*doc_e,*doc_marker=NULL;
|
||||||
if (doc->find_replace->pmt)
|
if (doc->find_replace->pmt)
|
||||||
@@ -391,7 +391,7 @@ I64 EdFindReplace(CDoc *doc)
|
|||||||
else
|
else
|
||||||
cmd=RSAC_ALL;
|
cmd=RSAC_ALL;
|
||||||
if (!doc->find_replace->pmt || DocForm(doc->find_replace)) {
|
if (!doc->find_replace->pmt || DocForm(doc->find_replace)) {
|
||||||
result=0;
|
res=0;
|
||||||
unlock=DocLock(doc);
|
unlock=DocLock(doc);
|
||||||
if (doc->find_replace->match_case || doc->find_replace->local_var)
|
if (doc->find_replace->match_case || doc->find_replace->local_var)
|
||||||
sf_flags=0;
|
sf_flags=0;
|
||||||
@@ -407,7 +407,7 @@ I64 EdFindReplace(CDoc *doc)
|
|||||||
!(doc_ce->de_flags&DOCEF_FILTER_SKIP) &&
|
!(doc_ce->de_flags&DOCEF_FILTER_SKIP) &&
|
||||||
StrFind(doc->find_replace->find_text,doc_ce->tag,sf_flags)) {
|
StrFind(doc->find_replace->find_text,doc_ce->tag,sf_flags)) {
|
||||||
doc_ce->type|=DOCET_SELECTED;
|
doc_ce->type|=DOCET_SELECTED;
|
||||||
result++;
|
res++;
|
||||||
} else
|
} else
|
||||||
doc_ce->type&=~DOCET_SELECTED;
|
doc_ce->type&=~DOCET_SELECTED;
|
||||||
doc_ce=doc_ce->next;
|
doc_ce=doc_ce->next;
|
||||||
@@ -516,7 +516,7 @@ I64 EdFindReplace(CDoc *doc)
|
|||||||
}
|
}
|
||||||
doc_e=doc->cur_entry;
|
doc_e=doc->cur_entry;
|
||||||
src=doc->cur_col+doc_e->tag;
|
src=doc->cur_col+doc_e->tag;
|
||||||
result++;
|
res++;
|
||||||
} else
|
} else
|
||||||
src++;
|
src++;
|
||||||
}
|
}
|
||||||
@@ -537,7 +537,7 @@ fr_unlock_done:
|
|||||||
if (unlock)
|
if (unlock)
|
||||||
DocUnlock(doc);
|
DocUnlock(doc);
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public I64 EdReplace(CDoc *doc,U8 *find,U8 *replace,
|
public I64 EdReplace(CDoc *doc,U8 *find,U8 *replace,
|
||||||
@@ -545,7 +545,7 @@ Bool selected=TRUE,Bool match_case=TRUE,Bool whole_labels=FALSE)
|
|||||||
{//Find & replace using editor's cmd.
|
{//Find & replace using editor's cmd.
|
||||||
CEdFindText old_find_replace;
|
CEdFindText old_find_replace;
|
||||||
Bool unlock;
|
Bool unlock;
|
||||||
I64 i,result=-1;
|
I64 i,res=-1;
|
||||||
if (!doc) return -1;
|
if (!doc) return -1;
|
||||||
unlock=DocLock(doc);
|
unlock=DocLock(doc);
|
||||||
MemCpy(&old_find_replace,doc->find_replace,sizeof(CEdFindText));
|
MemCpy(&old_find_replace,doc->find_replace,sizeof(CEdFindText));
|
||||||
@@ -561,13 +561,13 @@ Bool selected=TRUE,Bool match_case=TRUE,Bool whole_labels=FALSE)
|
|||||||
doc->find_replace->match_case=match_case;
|
doc->find_replace->match_case=match_case;
|
||||||
doc->find_replace->whole_labels=whole_labels;
|
doc->find_replace->whole_labels=whole_labels;
|
||||||
doc->find_replace->pmt=FALSE;
|
doc->find_replace->pmt=FALSE;
|
||||||
result=EdFindReplace(doc);
|
res=EdFindReplace(doc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MemCpy(doc->find_replace,&old_find_replace,sizeof(CEdFindText));
|
MemCpy(doc->find_replace,&old_find_replace,sizeof(CEdFindText));
|
||||||
if (unlock)
|
if (unlock)
|
||||||
DocUnlock(doc);
|
DocUnlock(doc);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CEdLineGoTo
|
class CEdLineGoTo
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ U0 DocDataFmt(CDoc *doc,CDocEntry *doc_e,I64 d=DOCM_CANCEL)
|
|||||||
} else if (doc_e->de_flags & DOCEF_LST) {
|
} else if (doc_e->de_flags & DOCEF_LST) {
|
||||||
if (doc_e->de_flags & DOCEF_DEFINE && (temph=HashFind(doc_e->define_str,
|
if (doc_e->de_flags & DOCEF_DEFINE && (temph=HashFind(doc_e->define_str,
|
||||||
doc->win_task->hash_table,HTT_DEFINE_STR)) && 0<=d<temph->cnt) {
|
doc->win_task->hash_table,HTT_DEFINE_STR)) && 0<=d<temph->cnt) {
|
||||||
ptr=MStrPrint("[%s]",temph->sub_lst[d]);
|
ptr=MStrPrint("[%s]",temph->sub_idx[d]);
|
||||||
Free(doc_e->tag);
|
Free(doc_e->tag);
|
||||||
doc_e->tag=StrNew(ptr,doc->mem_task);
|
doc_e->tag=StrNew(ptr,doc->mem_task);
|
||||||
Free(ptr);
|
Free(ptr);
|
||||||
@@ -215,7 +215,7 @@ public Bool DocForm(U8 *_d,U8 *class_name=lastclass,
|
|||||||
U8 *fmtstr;
|
U8 *fmtstr;
|
||||||
CHashClass *tempc,*tempc2;
|
CHashClass *tempc,*tempc2;
|
||||||
CDoc *doc;
|
CDoc *doc;
|
||||||
Bool result=FALSE;
|
Bool res=FALSE;
|
||||||
I64 old_border_src=Fs->border_src,has_action;
|
I64 old_border_src=Fs->border_src,has_action;
|
||||||
if (!(tempc=HashFind(class_name,Fs->hash_table,HTT_CLASS)))
|
if (!(tempc=HashFind(class_name,Fs->hash_table,HTT_CLASS)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -265,10 +265,10 @@ public Bool DocForm(U8 *_d,U8 *class_name=lastclass,
|
|||||||
DocRecalc(doc);
|
DocRecalc(doc);
|
||||||
if (DocEd(doc,dof_flags)) {
|
if (DocEd(doc,dof_flags)) {
|
||||||
doc_e=doc->cur_entry;
|
doc_e=doc->cur_entry;
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
if (doc_e!=doc) {
|
if (doc_e!=doc) {
|
||||||
if (DocEntryRun(doc,doc_e,TRUE,&has_action)==DOCM_CANCEL && has_action)
|
if (DocEntryRun(doc,doc_e,TRUE,&has_action)==DOCM_CANCEL && has_action)
|
||||||
result=FALSE;
|
res=FALSE;
|
||||||
DocUnlock(doc);
|
DocUnlock(doc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -283,7 +283,7 @@ public Bool DocForm(U8 *_d,U8 *class_name=lastclass,
|
|||||||
}
|
}
|
||||||
DocDel(doc);
|
DocDel(doc);
|
||||||
Fs->border_src=old_border_src;
|
Fs->border_src=old_border_src;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 DocMenuEndTaskCB()
|
U0 DocMenuEndTaskCB()
|
||||||
@@ -297,7 +297,7 @@ public I64 DocMenu(CDoc *m,I64 dof_flags=0)
|
|||||||
U8 *old_end_cb=Fs->task_end_cb;
|
U8 *old_end_cb=Fs->task_end_cb;
|
||||||
Bool old_break_shift_esc=LBts(&Fs->task_flags,TASKf_BREAK_TO_SHIFT_ESC);
|
Bool old_break_shift_esc=LBts(&Fs->task_flags,TASKf_BREAK_TO_SHIFT_ESC);
|
||||||
CDocEntry *doc_e;
|
CDocEntry *doc_e;
|
||||||
I64 old_border_src=Fs->border_src,result=DOCM_CANCEL,has_action;
|
I64 old_border_src=Fs->border_src,res=DOCM_CANCEL,has_action;
|
||||||
Fs->task_end_cb=&DocMenuEndTaskCB;
|
Fs->task_end_cb=&DocMenuEndTaskCB;
|
||||||
try {
|
try {
|
||||||
if (m) {
|
if (m) {
|
||||||
@@ -307,10 +307,10 @@ dm_restart:
|
|||||||
if (DocEd(m,dof_flags)) {
|
if (DocEd(m,dof_flags)) {
|
||||||
doc_e=m->cur_entry;
|
doc_e=m->cur_entry;
|
||||||
if (doc_e!=m) {
|
if (doc_e!=m) {
|
||||||
result=DocEntryRun(m,doc_e,TRUE,&has_action);
|
res=DocEntryRun(m,doc_e,TRUE,&has_action);
|
||||||
DocUnlock(m);
|
DocUnlock(m);
|
||||||
if (!has_action) {
|
if (!has_action) {
|
||||||
result=DOCM_CANCEL;
|
res=DOCM_CANCEL;
|
||||||
dof_flags|=DOF_DONT_HOME;
|
dof_flags|=DOF_DONT_HOME;
|
||||||
goto dm_restart;
|
goto dm_restart;
|
||||||
}
|
}
|
||||||
@@ -327,7 +327,7 @@ dm_restart:
|
|||||||
LBEqu(&Fs->task_flags,TASKf_BREAK_TO_SHIFT_ESC,old_break_shift_esc);
|
LBEqu(&Fs->task_flags,TASKf_BREAK_TO_SHIFT_ESC,old_break_shift_esc);
|
||||||
Fs->border_src=old_border_src;
|
Fs->border_src=old_border_src;
|
||||||
Fs->task_end_cb=old_end_cb;
|
Fs->task_end_cb=old_end_cb;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public I64 PopUpMenu(CDoc *doc,I64 dof_flags=0)
|
public I64 PopUpMenu(CDoc *doc,I64 dof_flags=0)
|
||||||
|
|||||||
+29
-29
@@ -41,7 +41,7 @@ public U8 *DocScanLine(CDoc *doc,CDocEntry *doc_e,
|
|||||||
{//Start at entry in doc,make and return one line as str.
|
{//Start at entry in doc,make and return one line as str.
|
||||||
CDocEntry *doc_e2=doc_e;
|
CDocEntry *doc_e2=doc_e;
|
||||||
Bool unlock=DocLock(doc);
|
Bool unlock=DocLock(doc);
|
||||||
U8 *dst,*src,*start,*result;
|
U8 *dst,*src,*start,*res;
|
||||||
I64 i=0;
|
I64 i=0;
|
||||||
if (cur_col)
|
if (cur_col)
|
||||||
*cur_col=-1;
|
*cur_col=-1;
|
||||||
@@ -53,8 +53,8 @@ public U8 *DocScanLine(CDoc *doc,CDocEntry *doc_e,
|
|||||||
i++;
|
i++;
|
||||||
doc_e2=doc_e2->next;
|
doc_e2=doc_e2->next;
|
||||||
}
|
}
|
||||||
result=MAlloc(i+1);
|
res=MAlloc(i+1);
|
||||||
dst=result;
|
dst=res;
|
||||||
while (doc_e!=doc && doc_e->type_u8!=DOCT_NEW_LINE) {
|
while (doc_e!=doc && doc_e->type_u8!=DOCT_NEW_LINE) {
|
||||||
start=dst;
|
start=dst;
|
||||||
if (doc_e->de_flags&DOCEF_TAG && doc_e->tag) {
|
if (doc_e->de_flags&DOCEF_TAG && doc_e->tag) {
|
||||||
@@ -64,23 +64,23 @@ public U8 *DocScanLine(CDoc *doc,CDocEntry *doc_e,
|
|||||||
} else if (doc_e->type_u8==DOCT_TAB)
|
} else if (doc_e->type_u8==DOCT_TAB)
|
||||||
*dst++='\t';
|
*dst++='\t';
|
||||||
if (doc_e==doc->cur_entry && cur_col)
|
if (doc_e==doc->cur_entry && cur_col)
|
||||||
*cur_col=start-result+doc->cur_col;
|
*cur_col=start-res+doc->cur_col;
|
||||||
doc_e=doc_e->next;
|
doc_e=doc_e->next;
|
||||||
}
|
}
|
||||||
if (_do_e_end) *_do_e_end=doc_e;
|
if (_do_e_end) *_do_e_end=doc_e;
|
||||||
*dst=0;
|
*dst=0;
|
||||||
if (doc_e==doc->cur_entry && cur_col && !doc->cur_col)
|
if (doc_e==doc->cur_entry && cur_col && !doc->cur_col)
|
||||||
*cur_col=dst-result;
|
*cur_col=dst-res;
|
||||||
if (unlock)
|
if (unlock)
|
||||||
DocUnlock(doc);
|
DocUnlock(doc);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U8 *DocGetStr2(I64 flags=0)
|
U8 *DocGetStr2(I64 flags=0)
|
||||||
{//$LK,"Flags",A="MN:GSF_SHIFT_ESC_EXIT"$
|
{//$LK,"Flags",A="MN:GSF_SHIFT_ESC_EXIT"$
|
||||||
CDoc *doc;
|
CDoc *doc;
|
||||||
CDocEntry *doc_e,*doc_e_end;
|
CDocEntry *doc_e,*doc_e_end;
|
||||||
U8 *st,*st2,*result;
|
U8 *st,*st2,*res;
|
||||||
I64 ch,sc;
|
I64 ch,sc;
|
||||||
"$$PT$$";
|
"$$PT$$";
|
||||||
do {
|
do {
|
||||||
@@ -102,7 +102,7 @@ U8 *DocGetStr2(I64 flags=0)
|
|||||||
if (flags&GSF_SHIFT_ESC_EXIT)
|
if (flags&GSF_SHIFT_ESC_EXIT)
|
||||||
Exit;
|
Exit;
|
||||||
else {
|
else {
|
||||||
result=StrNew("");
|
res=StrNew("");
|
||||||
goto gs_done;
|
goto gs_done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -117,16 +117,16 @@ U8 *DocGetStr2(I64 flags=0)
|
|||||||
do doc_e=doc_e->last;
|
do doc_e=doc_e->last;
|
||||||
while (doc_e!=doc && doc_e->type_u8!=DOCT_PMT);
|
while (doc_e!=doc && doc_e->type_u8!=DOCT_PMT);
|
||||||
doc_e=doc_e->next;
|
doc_e=doc_e->next;
|
||||||
if (result=DocScanLine(doc,doc_e,NULL,&doc_e_end)) {
|
if (res=DocScanLine(doc,doc_e,NULL,&doc_e_end)) {
|
||||||
while (doc_e_end!=doc && doc_e_end->type_u8==DOCT_NEW_LINE) {
|
while (doc_e_end!=doc && doc_e_end->type_u8==DOCT_NEW_LINE) {
|
||||||
st2=MStrPrint("%s\n",result);
|
st2=MStrPrint("%s\n",res);
|
||||||
Free(result);
|
Free(res);
|
||||||
result=st2;
|
res=st2;
|
||||||
if (st=DocScanLine(doc,doc_e_end->next,NULL,&doc_e_end)) {
|
if (st=DocScanLine(doc,doc_e_end->next,NULL,&doc_e_end)) {
|
||||||
st2=MStrPrint("%s%s",result,st);
|
st2=MStrPrint("%s%s",res,st);
|
||||||
Free(st);
|
Free(st);
|
||||||
Free(result);
|
Free(res);
|
||||||
result=st2;
|
res=st2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -141,12 +141,12 @@ U8 *DocGetStr2(I64 flags=0)
|
|||||||
doc_e->type_u8!=DOCT_PMT);
|
doc_e->type_u8!=DOCT_PMT);
|
||||||
}
|
}
|
||||||
doc_e=doc_e->next;
|
doc_e=doc_e->next;
|
||||||
result=DocScanLine(doc,doc_e,NULL);
|
res=DocScanLine(doc,doc_e,NULL);
|
||||||
}
|
}
|
||||||
DocUnlock(doc);
|
DocUnlock(doc);
|
||||||
gs_done:
|
gs_done:
|
||||||
"$$PT$$$$FG$$$$BG$$";
|
"$$PT$$$$FG$$$$BG$$";
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#help_index "Keyboard Devices;Char/Input;StdIn"
|
#help_index "Keyboard Devices;Char/Input;StdIn"
|
||||||
@@ -154,7 +154,7 @@ public I64 GetI64(U8 *msg=NULL,I64 dft=0,I64 lo=MIN_I64,I64 hi=MAX_I64)
|
|||||||
{//Prompt user for I64 expression.
|
{//Prompt user for I64 expression.
|
||||||
Bool okay;
|
Bool okay;
|
||||||
U8 *st;
|
U8 *st;
|
||||||
I64 result;
|
I64 res;
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
if (msg)
|
if (msg)
|
||||||
"" msg,dft;
|
"" msg,dft;
|
||||||
@@ -164,15 +164,15 @@ public I64 GetI64(U8 *msg=NULL,I64 dft=0,I64 lo=MIN_I64,I64 hi=MAX_I64)
|
|||||||
return dft;
|
return dft;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
result=ExePrint2("ToI64(%s);",st);
|
res=ExePrint2("ToI64(%s);",st);
|
||||||
okay=TRUE;
|
okay=TRUE;
|
||||||
} catch {
|
} catch {
|
||||||
Fs->catch_except=TRUE;
|
Fs->catch_except=TRUE;
|
||||||
okay=FALSE;
|
okay=FALSE;
|
||||||
}
|
}
|
||||||
Free(st);
|
Free(st);
|
||||||
if (okay && lo<=result<=hi)
|
if (okay && lo<=res<=hi)
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,7 +180,7 @@ public F64 GetF64(U8 *msg=NULL,F64 dft=0,F64 lo=MIN_F64,F64 hi=MAX_F64)
|
|||||||
{//Prompt user for F64 expression.
|
{//Prompt user for F64 expression.
|
||||||
Bool okay;
|
Bool okay;
|
||||||
U8 *st;
|
U8 *st;
|
||||||
F64 result;
|
F64 res;
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
if (msg)
|
if (msg)
|
||||||
"" msg,dft;
|
"" msg,dft;
|
||||||
@@ -190,15 +190,15 @@ public F64 GetF64(U8 *msg=NULL,F64 dft=0,F64 lo=MIN_F64,F64 hi=MAX_F64)
|
|||||||
return dft;
|
return dft;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
result=ExePrint2("ToF64(%s);",st)(F64);
|
res=ExePrint2("ToF64(%s);",st)(F64);
|
||||||
okay=TRUE;
|
okay=TRUE;
|
||||||
} catch {
|
} catch {
|
||||||
Fs->catch_except=TRUE;
|
Fs->catch_except=TRUE;
|
||||||
okay=FALSE;
|
okay=FALSE;
|
||||||
}
|
}
|
||||||
Free(st);
|
Free(st);
|
||||||
if (okay && lo<=result<=hi)
|
if (okay && lo<=res<=hi)
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,7 +206,7 @@ public CDate GetDate(U8 *msg=NULL,CDate dft=MIN_I64,
|
|||||||
CDate lo=MIN_I64,CDate hi=MAX_I64)
|
CDate lo=MIN_I64,CDate hi=MAX_I64)
|
||||||
{//Prompt user for date expression. (Use $LK,"Now",A="MN:Now"$() if you want current time.)
|
{//Prompt user for date expression. (Use $LK,"Now",A="MN:Now"$() if you want current time.)
|
||||||
U8 *st;
|
U8 *st;
|
||||||
CDate result;
|
CDate res;
|
||||||
if (dft==MIN_I64) dft=Now;
|
if (dft==MIN_I64) dft=Now;
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
if (msg)
|
if (msg)
|
||||||
@@ -216,9 +216,9 @@ public CDate GetDate(U8 *msg=NULL,CDate dft=MIN_I64,
|
|||||||
Free(st);
|
Free(st);
|
||||||
return dft;
|
return dft;
|
||||||
}
|
}
|
||||||
result=Str2Date(st);
|
res=Str2Date(st);
|
||||||
Free(st);
|
Free(st);
|
||||||
if (result>=lo && result<=hi)
|
if (res>=lo && res<=hi)
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
|||||||
|
|
||||||
I64 DitherColor2(U8 *header=NULL)
|
I64 DitherColor2(U8 *header=NULL)
|
||||||
{
|
{
|
||||||
I64 msg_code,a1,a2,result=-1,i,j;
|
I64 msg_code,a1,a2,res=-1,i,j;
|
||||||
DocClear;
|
DocClear;
|
||||||
"%s",header;
|
"%s",header;
|
||||||
DocRecalc(DocPut);
|
DocRecalc(DocPut);
|
||||||
@@ -140,7 +140,7 @@ I64 DitherColor2(U8 *header=NULL)
|
|||||||
if (a1>=0 && a2>=0 && 0<=j<17 && 0<=i<17) {
|
if (a1>=0 && a2>=0 && 0<=j<17 && 0<=i<17) {
|
||||||
if (j==16) j=TRANSPARENT;
|
if (j==16) j=TRANSPARENT;
|
||||||
if (i==16) i=TRANSPARENT;
|
if (i==16) i=TRANSPARENT;
|
||||||
result=j+i<<16+ROPF_DITHER;
|
res=j+i<<16+ROPF_DITHER;
|
||||||
goto dc_done;
|
goto dc_done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -150,7 +150,7 @@ I64 DitherColor2(U8 *header=NULL)
|
|||||||
dc_done:
|
dc_done:
|
||||||
SettingsPop;
|
SettingsPop;
|
||||||
FramePtrDel("DitherFrame");
|
FramePtrDel("DitherFrame");
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public I64 PopUpColorDither(U8 *header=NULL)
|
public I64 PopUpColorDither(U8 *header=NULL)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
U32 *DocHighlight(CDocEntry *doc_e,U8 *src,I64 len,I64 _temp_u32_attr)
|
U32 *DocHighlight(CDocEntry *doc_e,U8 *src,I64 len,I64 _temp_u32_attr)
|
||||||
{//Be aware of $LK,"::/Demo/ToHtmlToTXTExample/ToHtml.CPP"$.
|
{//Be aware of $LK,"::/Demo/ToHtmlToTXTExample/ToHtml.CPP"$.
|
||||||
U32 *result=MAlloc((len+1)*sizeof(U32)),*dst=result;
|
U32 *res=MAlloc((len+1)*sizeof(U32)),*dst=res;
|
||||||
U8 *ptr;
|
U8 *ptr;
|
||||||
CDocSettings *s=&doc_e->settings;
|
CDocSettings *s=&doc_e->settings;
|
||||||
I64 ch,ch1,last_ch,temp_u32_attr,mask_temp_u32_attr=_temp_u32_attr&0xFFFFF000,
|
I64 ch,ch1,last_ch,temp_u32_attr,mask_temp_u32_attr=_temp_u32_attr&0xFFFFF000,
|
||||||
@@ -151,5 +151,5 @@ hl_cpp_comment:
|
|||||||
s->paren_depth=paren_depth;
|
s->paren_depth=paren_depth;
|
||||||
s->brace_depth=brace_depth;
|
s->brace_depth=brace_depth;
|
||||||
*dst=0;
|
*dst=0;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
+41
-35
@@ -62,7 +62,7 @@ Bool DocFileEd(I64 _type,U8 *filename,
|
|||||||
CDocEntry *doc_e;
|
CDocEntry *doc_e;
|
||||||
CDoc *doc;
|
CDoc *doc;
|
||||||
Bool old_silent=Bt(&Fs->display_flags,DISPLAYf_SILENT),
|
Bool old_silent=Bt(&Fs->display_flags,DISPLAYf_SILENT),
|
||||||
result=FALSE,other_found=FALSE;
|
res=FALSE,other_found=FALSE;
|
||||||
U8 *st1,*st2;
|
U8 *st1,*st2;
|
||||||
try {
|
try {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@@ -93,7 +93,7 @@ Bool DocFileEd(I64 _type,U8 *filename,
|
|||||||
|
|
||||||
if (LK_DOC<=_type<=LK_DOC_LINE) {
|
if (LK_DOC<=_type<=LK_DOC_LINE) {
|
||||||
doc=Str2I64(filename);//See $LK,"SpriteEdText",A="MN:SpriteEdText"$()
|
doc=Str2I64(filename);//See $LK,"SpriteEdText",A="MN:SpriteEdText"$()
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
st1=StrNew(filename);
|
st1=StrNew(filename);
|
||||||
@@ -105,9 +105,9 @@ Bool DocFileEd(I64 _type,U8 *filename,
|
|||||||
else {
|
else {
|
||||||
Silent;
|
Silent;
|
||||||
if (Bt(&edf_dof_flags,EDf_BAIL)) //if bail, scan parents
|
if (Bt(&edf_dof_flags,EDf_BAIL)) //if bail, scan parents
|
||||||
result=FileFind(filename,,
|
res=FileFind(filename,,
|
||||||
FUF_JUST_FILES|FUF_Z_OR_NOT_Z|FUF_SCAN_PARENTS);
|
FUF_JUST_FILES|FUF_Z_OR_NOT_Z|FUF_SCAN_PARENTS);
|
||||||
else if (!(result=FileFind(filename,,
|
else if (!(res=FileFind(filename,,
|
||||||
FUF_JUST_FILES)))
|
FUF_JUST_FILES)))
|
||||||
other_found=FileFind(filename,,
|
other_found=FileFind(filename,,
|
||||||
FUF_JUST_FILES|FUF_Z_OR_NOT_Z|FUF_SCAN_PARENTS);
|
FUF_JUST_FILES|FUF_Z_OR_NOT_Z|FUF_SCAN_PARENTS);
|
||||||
@@ -121,26 +121,26 @@ Bool DocFileEd(I64 _type,U8 *filename,
|
|||||||
Free(st2);
|
Free(st2);
|
||||||
}
|
}
|
||||||
if (!doc||doc->doc_signature!=DOC_SIGNATURE_VAL)
|
if (!doc||doc->doc_signature!=DOC_SIGNATURE_VAL)
|
||||||
result=FALSE;
|
res=FALSE;
|
||||||
else {
|
else {
|
||||||
if (Bt(&edf_dof_flags,EDf_COLLAPSE))
|
if (Bt(&edf_dof_flags,EDf_COLLAPSE))
|
||||||
DocCollapse(TRUE,doc);
|
DocCollapse(TRUE,doc);
|
||||||
else if (Bt(&edf_dof_flags,EDf_UNCOLLAPSE))
|
else if (Bt(&edf_dof_flags,EDf_UNCOLLAPSE))
|
||||||
DocCollapse(FALSE,doc);
|
DocCollapse(FALSE,doc);
|
||||||
|
|
||||||
if (result || other_found)
|
if (res || other_found)
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case LK_FILE_LINE:
|
case LK_FILE_LINE:
|
||||||
result=DocLineNumGoTo(doc,*_num);
|
res=DocLineNumGoTo(doc,*_num);
|
||||||
break;
|
break;
|
||||||
case LK_FILE_ANCHOR:
|
case LK_FILE_ANCHOR:
|
||||||
result=DocAnchorFind(doc,needle_str);
|
res=DocAnchorFind(doc,needle_str);
|
||||||
break;
|
break;
|
||||||
case LK_FILE_FIND:
|
case LK_FILE_FIND:
|
||||||
result=DocFind(doc,,needle_str,*_num);
|
res=DocFind(doc,,needle_str,*_num);
|
||||||
break;
|
break;
|
||||||
case LK_BIBLE_FIND:
|
case LK_BIBLE_FIND:
|
||||||
result=DocFind(doc,*_num,needle_str);
|
res=DocFind(doc,*_num,needle_str);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DocCenter(doc);
|
DocCenter(doc);
|
||||||
@@ -148,7 +148,7 @@ Bool DocFileEd(I64 _type,U8 *filename,
|
|||||||
*_num=doc->cur_entry->y+1;
|
*_num=doc->cur_entry->y+1;
|
||||||
|
|
||||||
if (edf_dof_flags&EDF_WAS_WRITE)
|
if (edf_dof_flags&EDF_WAS_WRITE)
|
||||||
result=FALSE;
|
res=FALSE;
|
||||||
if (!(edf_dof_flags&EDF_BAIL) && DocEd(doc,edf_dof_flags|DOF_DONT_HOME)) {
|
if (!(edf_dof_flags&EDF_BAIL) && DocEd(doc,edf_dof_flags|DOF_DONT_HOME)) {
|
||||||
DocLock(doc);
|
DocLock(doc);
|
||||||
doc_e=doc->cur_entry;
|
doc_e=doc->cur_entry;
|
||||||
@@ -158,7 +158,7 @@ Bool DocFileEd(I64 _type,U8 *filename,
|
|||||||
if (!(LK_DOC<=_type<=LK_DOC_LINE)) {
|
if (!(LK_DOC<=_type<=LK_DOC_LINE)) {
|
||||||
DocWrite(doc);
|
DocWrite(doc);
|
||||||
if (edf_dof_flags&EDF_WAS_WRITE)
|
if (edf_dof_flags&EDF_WAS_WRITE)
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!(LK_DOC<=_type<=LK_DOC_LINE))
|
if (!(LK_DOC<=_type<=LK_DOC_LINE))
|
||||||
@@ -166,10 +166,10 @@ Bool DocFileEd(I64 _type,U8 *filename,
|
|||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
Silent(old_silent);
|
Silent(old_silent);
|
||||||
result=FALSE;
|
res=FALSE;
|
||||||
}
|
}
|
||||||
Fs->border_src=old_border_src;
|
Fs->border_src=old_border_src;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DFT_ADDR_LINK_BIN_SIZE 64
|
#define DFT_ADDR_LINK_BIN_SIZE 64
|
||||||
@@ -177,8 +177,8 @@ Bool DocFileEd(I64 _type,U8 *filename,
|
|||||||
public I64 EdLinkCvt(U8 *link_st,U8 **_filename=NULL,U8 **_needle_str=NULL,
|
public I64 EdLinkCvt(U8 *link_st,U8 **_filename=NULL,U8 **_needle_str=NULL,
|
||||||
I64 *_num=NULL,I64 edf_dof_flags=0)
|
I64 *_num=NULL,I64 edf_dof_flags=0)
|
||||||
{//$LK,"Editor Link",A="MN:LK_FILE"$--> filename, needle_str and line number.
|
{//$LK,"Editor Link",A="MN:LK_FILE"$--> filename, needle_str and line number.
|
||||||
U8 *st,*ptr,*filename=NULL,*needle_str=NULL,*filename2;
|
U8 *st,*ptr,*src,*filename=NULL,*needle_str=NULL,*filename2;
|
||||||
I64 result,i,num=1;
|
I64 res,i,num=1;
|
||||||
CHashSrcSym *temph;
|
CHashSrcSym *temph;
|
||||||
if (!link_st||!*link_st) {
|
if (!link_st||!*link_st) {
|
||||||
if (edf_dof_flags&EDF_BAIL)
|
if (edf_dof_flags&EDF_BAIL)
|
||||||
@@ -186,17 +186,17 @@ public I64 EdLinkCvt(U8 *link_st,U8 **_filename=NULL,U8 **_needle_str=NULL,
|
|||||||
link_st=blkdev.temp_filename;
|
link_st=blkdev.temp_filename;
|
||||||
}
|
}
|
||||||
st=StrNew(link_st);
|
st=StrNew(link_st);
|
||||||
result=LK_FILE;
|
res=LK_FILE;
|
||||||
if (StrLen(st)>3 && st[2]==':') {
|
if (StrLen(st)>3 && st[2]==':') {
|
||||||
st[2]=0;
|
st[2]=0;
|
||||||
filename2=st+3;
|
filename2=st+3;
|
||||||
switch (result=DefineMatch(st,"ST_LINK_TYPES",LMF_IGNORE_CASE)) {
|
switch (res=DefineMatch(st,"ST_LINK_TYPES",LMF_IGNORE_CASE)) {
|
||||||
case LK_MAN_PAGE:
|
case LK_MAN_PAGE:
|
||||||
if (temph=HashFind(filename2,Fs->hash_table,HTG_SRC_SYM))
|
if (temph=HashFind(filename2,Fs->hash_table,HTG_SRC_SYM))
|
||||||
result=EdLinkCvt(temph->src_link,&filename,
|
res=EdLinkCvt(temph->src_link,&filename,
|
||||||
&needle_str,&num,edf_dof_flags);
|
&needle_str,&num,edf_dof_flags);
|
||||||
else
|
else
|
||||||
result=-1;
|
res=-1;
|
||||||
goto lc_done;
|
goto lc_done;
|
||||||
case LK_ADDR:
|
case LK_ADDR:
|
||||||
if (ptr=StrLastOcc(filename2,",")) {
|
if (ptr=StrLastOcc(filename2,",")) {
|
||||||
@@ -205,10 +205,10 @@ public I64 EdLinkCvt(U8 *link_st,U8 **_filename=NULL,U8 **_needle_str=NULL,
|
|||||||
} else
|
} else
|
||||||
i=DFT_ADDR_LINK_BIN_SIZE;
|
i=DFT_ADDR_LINK_BIN_SIZE;
|
||||||
if (ptr=SrcEdLink(ExePrint("%s;",filename2),i)) {
|
if (ptr=SrcEdLink(ExePrint("%s;",filename2),i)) {
|
||||||
result=EdLinkCvt(ptr,&filename,&needle_str,&num,edf_dof_flags);
|
res=EdLinkCvt(ptr,&filename,&needle_str,&num,edf_dof_flags);
|
||||||
Free(ptr);
|
Free(ptr);
|
||||||
} else
|
} else
|
||||||
result=-1;
|
res=-1;
|
||||||
goto lc_done;
|
goto lc_done;
|
||||||
case LK_DEF:
|
case LK_DEF:
|
||||||
if (ptr=StrLastOcc(filename2,",")) {
|
if (ptr=StrLastOcc(filename2,",")) {
|
||||||
@@ -225,11 +225,17 @@ public I64 EdLinkCvt(U8 *link_st,U8 **_filename=NULL,U8 **_needle_str=NULL,
|
|||||||
case LK_BIBLE_FIND:
|
case LK_BIBLE_FIND:
|
||||||
if (ptr=StrLastOcc(filename2,",")) {
|
if (ptr=StrLastOcc(filename2,",")) {
|
||||||
*ptr=0;
|
*ptr=0;
|
||||||
|
src=ptr+1;
|
||||||
|
while (*src) { //We do not allow ending verse
|
||||||
|
if (*src=='-')
|
||||||
|
*src=0;
|
||||||
|
src++;
|
||||||
|
}
|
||||||
needle_str=StrNew(ptr+1);
|
needle_str=StrNew(ptr+1);
|
||||||
}
|
}
|
||||||
i=DefineMatch(filename2,"ST_BIBLE_BOOKS",LMF_IGNORE_CASE);
|
i=DefineMatch(filename2,"ST_BIBLE_BOOKS",LMF_IGNORE_CASE);
|
||||||
if (i<0)
|
if (i<0)
|
||||||
result=-1;
|
res=-1;
|
||||||
else {
|
else {
|
||||||
num=Str2I64(DefineSub(i,"ST_BIBLE_BOOK_LINES"));
|
num=Str2I64(DefineSub(i,"ST_BIBLE_BOOK_LINES"));
|
||||||
filename2=BIBLE_FILENAME;
|
filename2=BIBLE_FILENAME;
|
||||||
@@ -265,8 +271,8 @@ public I64 EdLinkCvt(U8 *link_st,U8 **_filename=NULL,U8 **_needle_str=NULL,
|
|||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
filename2=st;
|
filename2=st;
|
||||||
if (result>=0) {
|
if (res>=0) {
|
||||||
if (LK_DOC<=result<=LK_DOC_LINE)
|
if (LK_DOC<=res<=LK_DOC_LINE)
|
||||||
filename=StrNew(filename2); //Holds document address as number.
|
filename=StrNew(filename2); //Holds document address as number.
|
||||||
else
|
else
|
||||||
filename=FileNameAbs(filename2,FUF_Z_OR_NOT_Z);
|
filename=FileNameAbs(filename2,FUF_Z_OR_NOT_Z);
|
||||||
@@ -283,13 +289,13 @@ lc_done:
|
|||||||
Free(needle_str);
|
Free(needle_str);
|
||||||
if (_num)
|
if (_num)
|
||||||
*_num=num;
|
*_num=num;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bool DocLinkChk(U8 *link_st)
|
public Bool DocLinkChk(U8 *link_st)
|
||||||
{//Check for bad $LK,"Editor Link",A="MN:LK_FILE"$.
|
{//Check for bad $LK,"Editor Link",A="MN:LK_FILE"$.
|
||||||
U8 *filename,*st;
|
U8 *filename,*st;
|
||||||
Bool result=FALSE;
|
Bool res=FALSE;
|
||||||
if (link_st) {
|
if (link_st) {
|
||||||
switch (EdLinkCvt(link_st,&filename)) {
|
switch (EdLinkCvt(link_st,&filename)) {
|
||||||
case -1:
|
case -1:
|
||||||
@@ -298,7 +304,7 @@ public Bool DocLinkChk(U8 *link_st)
|
|||||||
case LK_PLAIN_LINE:
|
case LK_PLAIN_LINE:
|
||||||
case LK_FILE:
|
case LK_FILE:
|
||||||
//We don't check line number
|
//We don't check line number
|
||||||
result=FileFind(filename,,
|
res=FileFind(filename,,
|
||||||
FUF_JUST_FILES|FUF_Z_OR_NOT_Z|FUF_SCAN_PARENTS);
|
FUF_JUST_FILES|FUF_Z_OR_NOT_Z|FUF_SCAN_PARENTS);
|
||||||
break;
|
break;
|
||||||
case LK_BIBLE_FIND:
|
case LK_BIBLE_FIND:
|
||||||
@@ -306,21 +312,21 @@ public Bool DocLinkChk(U8 *link_st)
|
|||||||
if (StrOcc(st,','))
|
if (StrOcc(st,','))
|
||||||
StrLastRem(st,",");
|
StrLastRem(st,",");
|
||||||
if (DefineMatch(st,"ST_BIBLE_BOOKS",LMF_IGNORE_CASE)>=0)
|
if (DefineMatch(st,"ST_BIBLE_BOOKS",LMF_IGNORE_CASE)>=0)
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
Free(st);
|
Free(st);
|
||||||
break;
|
break;
|
||||||
default://TODO: Need to validate HI: and DN:
|
default://TODO: Need to validate HI: and DN:
|
||||||
if (Ed(link_st,EDF_BAIL))
|
if (Ed(link_st,EDF_BAIL))
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
}
|
}
|
||||||
Free(filename);
|
Free(filename);
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public U8 *DocLinkFile(U8 *link_st,CTask *mem_task=NULL)
|
public U8 *DocLinkFile(U8 *link_st,CTask *mem_task=NULL)
|
||||||
{//Return the file for an $LK,"Editor Link Types",A="MN:LK_FILE"$.
|
{//Return the file for an $LK,"Editor Link Types",A="MN:LK_FILE"$.
|
||||||
U8 *filename=NULL,*st,*result=NULL;
|
U8 *filename=NULL,*st,*res=NULL;
|
||||||
if (link_st) {
|
if (link_st) {
|
||||||
switch (EdLinkCvt(link_st,&filename)) {
|
switch (EdLinkCvt(link_st,&filename)) {
|
||||||
case LK_FILE:
|
case LK_FILE:
|
||||||
@@ -331,14 +337,14 @@ public U8 *DocLinkFile(U8 *link_st,CTask *mem_task=NULL)
|
|||||||
case LK_PLAIN_FIND:
|
case LK_PLAIN_FIND:
|
||||||
case LK_PLAIN_LINE:
|
case LK_PLAIN_LINE:
|
||||||
st=FileNameAbs(filename,FUF_Z_OR_NOT_Z|FUF_SCAN_PARENTS);
|
st=FileNameAbs(filename,FUF_Z_OR_NOT_Z|FUF_SCAN_PARENTS);
|
||||||
result=StrNew(st);
|
res=StrNew(st);
|
||||||
Free(st);
|
Free(st);
|
||||||
break;
|
break;
|
||||||
case LK_BIBLE_FIND:
|
case LK_BIBLE_FIND:
|
||||||
result=StrNew(BIBLE_FILENAME,mem_task);
|
res=StrNew(BIBLE_FILENAME,mem_task);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Free(filename);
|
Free(filename);
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -137,7 +137,7 @@ U0 EdInsCapturedMacro()
|
|||||||
|
|
||||||
I64 PopUpMacroMenu()
|
I64 PopUpMacroMenu()
|
||||||
{
|
{
|
||||||
I64 result=0;
|
I64 res=0;
|
||||||
U8 buf[STR_LEN];
|
U8 buf[STR_LEN];
|
||||||
CSrvCmd *tempc;
|
CSrvCmd *tempc;
|
||||||
CDoc *doc=DocNew;
|
CDoc *doc=DocNew;
|
||||||
@@ -164,13 +164,13 @@ I64 PopUpMacroMenu()
|
|||||||
LBts(&sys_macro_task->display_flags,DISPLAYf_WIN_ON_TOP);
|
LBts(&sys_macro_task->display_flags,DISPLAYf_WIN_ON_TOP);
|
||||||
tempc=TaskExe(sys_macro_task,Fs,buf,
|
tempc=TaskExe(sys_macro_task,Fs,buf,
|
||||||
1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||||
JobResultScan(tempc,&result);
|
JobResScan(tempc,&res);
|
||||||
Fs->popup_task=NULL;
|
Fs->popup_task=NULL;
|
||||||
Kill(sys_macro_task);
|
Kill(sys_macro_task);
|
||||||
sys_macro_task=NULL;
|
sys_macro_task=NULL;
|
||||||
DocDataScan(doc,doc_e);
|
DocDataScan(doc,doc_e);
|
||||||
DocDel(doc);
|
DocDel(doc);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 MacroTask(I64)
|
U0 MacroTask(I64)
|
||||||
|
|||||||
+47
-47
@@ -37,27 +37,27 @@ Bool IsEditableText(CDocEntry *doc_e)
|
|||||||
|
|
||||||
CDocEntry *DocEntryNewBase(CDoc *doc,I64 type,I64 de_flags=0,
|
CDocEntry *DocEntryNewBase(CDoc *doc,I64 type,I64 de_flags=0,
|
||||||
I64 x=0,I64 y=0,I64 page_line_num=0)
|
I64 x=0,I64 y=0,I64 page_line_num=0)
|
||||||
{//See also $LK,"MAllocIdentical",A="FF:::/Adam/DolDoc/DocRecalc.CPP,MAllocIdentical"$ and $MA-X+PU,"CDocEntry",LM="F(\"sizeof(CDocEntry)\");View;"$.
|
{//See also $LK,"MAllocIdent",A="FF:::/Adam/DolDoc/DocRecalc.CPP,MAllocIdent"$ and $MA-X+PU,"CDocEntry",LM="F(\"sizeof(CDocEntry)\");View;"$.
|
||||||
CDocEntry *result=CAlloc(sizeof(CDocEntryBase),doc->mem_task);
|
CDocEntry *res=CAlloc(sizeof(CDocEntryBase),doc->mem_task);
|
||||||
result->type=type;
|
res->type=type;
|
||||||
result->de_flags=de_flags|doldoc.dft_de_flags[type.u8[0]];
|
res->de_flags=de_flags|doldoc.dft_de_flags[type.u8[0]];
|
||||||
result->x=x;
|
res->x=x;
|
||||||
result->y=y;
|
res->y=y;
|
||||||
result->page_line_num=page_line_num;
|
res->page_line_num=page_line_num;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
CDocEntry *DocEntryNewTag(CDoc *doc,CDocEntry *doc_ce,U8 *tag)
|
CDocEntry *DocEntryNewTag(CDoc *doc,CDocEntry *doc_ce,U8 *tag)
|
||||||
{
|
{
|
||||||
I64 l=StrLen(tag);
|
I64 l=StrLen(tag);
|
||||||
CDocEntry *result=DocEntryNewBase(doc,doc_ce->type,doc_ce->de_flags,
|
CDocEntry *res=DocEntryNewBase(doc,doc_ce->type,doc_ce->de_flags,
|
||||||
doc_ce->x,doc_ce->y,doc_ce->page_line_num);
|
doc_ce->x,doc_ce->y,doc_ce->page_line_num);
|
||||||
result->de_flags=doc_ce->de_flags; //Override
|
res->de_flags=doc_ce->de_flags; //Override
|
||||||
result->max_col=l;
|
res->max_col=l;
|
||||||
result->tag=MAlloc(l+1,doc->mem_task);
|
res->tag=MAlloc(l+1,doc->mem_task);
|
||||||
MemCpy(result->tag,tag,l+1);
|
MemCpy(res->tag,tag,l+1);
|
||||||
MemCpy(&result->settings,&doc_ce->settings,sizeof(CDocSettings));
|
MemCpy(&res->settings,&doc_ce->settings,sizeof(CDocSettings));
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public U0 DocEntryDel(CDoc *doc,CDocEntry *doc_e)
|
public U0 DocEntryDel(CDoc *doc,CDocEntry *doc_e)
|
||||||
@@ -92,26 +92,26 @@ public U0 DocEntryDel(CDoc *doc,CDocEntry *doc_e)
|
|||||||
|
|
||||||
public I64 DocEntrySize(CDoc *,CDocEntry *doc_e)
|
public I64 DocEntrySize(CDoc *,CDocEntry *doc_e)
|
||||||
{//Mem size of entry and all parts.
|
{//Mem size of entry and all parts.
|
||||||
I64 result;
|
I64 res;
|
||||||
if (!doc_e) return 0;
|
if (!doc_e) return 0;
|
||||||
result=MSize2(doc_e);
|
res=MSize2(doc_e);
|
||||||
if (doc_e->de_flags & DOCEF_TAG)
|
if (doc_e->de_flags & DOCEF_TAG)
|
||||||
result+=MSize2(doc_e->tag);
|
res+=MSize2(doc_e->tag);
|
||||||
if (doc_e->de_flags & DOCEF_AUX_STR)
|
if (doc_e->de_flags & DOCEF_AUX_STR)
|
||||||
result+=MSize2(doc_e->aux_str);
|
res+=MSize2(doc_e->aux_str);
|
||||||
if (doc_e->de_flags & DOCEF_DEFINE)
|
if (doc_e->de_flags & DOCEF_DEFINE)
|
||||||
result+=MSize2(doc_e->define_str);
|
res+=MSize2(doc_e->define_str);
|
||||||
if (doc_e->de_flags & DOCEF_HTML_LINK)
|
if (doc_e->de_flags & DOCEF_HTML_LINK)
|
||||||
result+=MSize2(doc_e->html_link);
|
res+=MSize2(doc_e->html_link);
|
||||||
if (doc_e->de_flags & DOCEF_LEFT_MACRO)
|
if (doc_e->de_flags & DOCEF_LEFT_MACRO)
|
||||||
result+=MSize2(doc_e->left_macro);
|
res+=MSize2(doc_e->left_macro);
|
||||||
if (doc_e->de_flags & DOCEF_RIGHT_MACRO)
|
if (doc_e->de_flags & DOCEF_RIGHT_MACRO)
|
||||||
result+=MSize2(doc_e->right_macro);
|
res+=MSize2(doc_e->right_macro);
|
||||||
if (doc_e->de_flags & DOCEF_BIN_PTR_LINK)
|
if (doc_e->de_flags & DOCEF_BIN_PTR_LINK)
|
||||||
result+=MSize2(doc_e->bin_ptr_link);
|
res+=MSize2(doc_e->bin_ptr_link);
|
||||||
if (doc_e->de_flags & DOCEF_REMALLOC_DATA)
|
if (doc_e->de_flags & DOCEF_REMALLOC_DATA)
|
||||||
result+=MSize2(doc_e->data);
|
res+=MSize2(doc_e->data);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 DocUndoDel(CDoc *,CDocUndo *u)
|
U0 DocUndoDel(CDoc *,CDocUndo *u)
|
||||||
@@ -138,26 +138,26 @@ public CDocEntry *DocEntryCopy(CDoc *doc,CDocEntry *doc_e)
|
|||||||
CDocEntry *doc_ne;
|
CDocEntry *doc_ne;
|
||||||
CDocBin *tempb;
|
CDocBin *tempb;
|
||||||
CTask *task=doc->mem_task;
|
CTask *task=doc->mem_task;
|
||||||
doc_ne=MAllocIdentical(doc_e,task);
|
doc_ne=MAllocIdent(doc_e,task);
|
||||||
doc_ne->next=doc_ne;
|
doc_ne->next=doc_ne;
|
||||||
doc_ne->last=doc_ne;
|
doc_ne->last=doc_ne;
|
||||||
if (doc_e->de_flags & DOCEF_TAG)
|
if (doc_e->de_flags & DOCEF_TAG)
|
||||||
doc_ne->tag=MAllocIdentical(doc_e->tag,task);
|
doc_ne->tag=MAllocIdent(doc_e->tag,task);
|
||||||
if (doc_e->de_flags & DOCEF_AUX_STR)
|
if (doc_e->de_flags & DOCEF_AUX_STR)
|
||||||
doc_ne->aux_str=MAllocIdentical(doc_e->aux_str,task);
|
doc_ne->aux_str=MAllocIdent(doc_e->aux_str,task);
|
||||||
if (doc_e->de_flags & DOCEF_DEFINE)
|
if (doc_e->de_flags & DOCEF_DEFINE)
|
||||||
doc_ne->define_str=MAllocIdentical(doc_e->define_str,task);
|
doc_ne->define_str=MAllocIdent(doc_e->define_str,task);
|
||||||
if (doc_e->de_flags & DOCEF_HTML_LINK)
|
if (doc_e->de_flags & DOCEF_HTML_LINK)
|
||||||
doc_ne->html_link=MAllocIdentical(doc_e->html_link,task);
|
doc_ne->html_link=MAllocIdent(doc_e->html_link,task);
|
||||||
if (doc_e->de_flags & DOCEF_LEFT_MACRO)
|
if (doc_e->de_flags & DOCEF_LEFT_MACRO)
|
||||||
doc_ne->left_macro=MAllocIdentical(doc_e->left_macro,task);
|
doc_ne->left_macro=MAllocIdent(doc_e->left_macro,task);
|
||||||
if (doc_e->de_flags & DOCEF_RIGHT_MACRO)
|
if (doc_e->de_flags & DOCEF_RIGHT_MACRO)
|
||||||
doc_ne->right_macro=MAllocIdentical(doc_e->right_macro,task);
|
doc_ne->right_macro=MAllocIdent(doc_e->right_macro,task);
|
||||||
if (doc_e->de_flags & DOCEF_BIN_PTR_LINK)
|
if (doc_e->de_flags & DOCEF_BIN_PTR_LINK)
|
||||||
doc_ne->bin_ptr_link=MAllocIdentical(doc_e->bin_ptr_link,task);
|
doc_ne->bin_ptr_link=MAllocIdent(doc_e->bin_ptr_link,task);
|
||||||
if (doc_e->de_flags & DOCEF_HAS_BIN) {
|
if (doc_e->de_flags & DOCEF_HAS_BIN) {
|
||||||
tempb=MAllocIdentical(doc_e->bin_data,task);
|
tempb=MAllocIdent(doc_e->bin_data,task);
|
||||||
tempb->data=MAllocIdentical(doc_e->bin_data->data,task);
|
tempb->data=MAllocIdent(doc_e->bin_data->data,task);
|
||||||
doc_ne->bin_num=doc->cur_bin_num;
|
doc_ne->bin_num=doc->cur_bin_num;
|
||||||
tempb->num=doc->cur_bin_num++;
|
tempb->num=doc->cur_bin_num++;
|
||||||
doc_ne->bin_data=tempb;
|
doc_ne->bin_data=tempb;
|
||||||
@@ -168,7 +168,7 @@ public CDocEntry *DocEntryCopy(CDoc *doc,CDocEntry *doc_e)
|
|||||||
QueIns(tempb,doc->bin_root.last);
|
QueIns(tempb,doc->bin_root.last);
|
||||||
}
|
}
|
||||||
if (doc_e->de_flags & DOCEF_REMALLOC_DATA)
|
if (doc_e->de_flags & DOCEF_REMALLOC_DATA)
|
||||||
doc_ne->data=MAllocIdentical(doc_e->data,task);
|
doc_ne->data=MAllocIdent(doc_e->data,task);
|
||||||
return doc_ne;
|
return doc_ne;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,37 +326,37 @@ public I64 DocSize(CDoc *doc)
|
|||||||
CDocEntry *doc_e;
|
CDocEntry *doc_e;
|
||||||
CDocUndo *u;
|
CDocUndo *u;
|
||||||
CDocBin *b;
|
CDocBin *b;
|
||||||
I64 result=0;
|
I64 res=0;
|
||||||
|
|
||||||
if (!doc || doc->doc_signature!=DOC_SIGNATURE_VAL) return 0;
|
if (!doc || doc->doc_signature!=DOC_SIGNATURE_VAL) return 0;
|
||||||
unlock=DocLock(doc);
|
unlock=DocLock(doc);
|
||||||
|
|
||||||
doc_e=doc->root.next;
|
doc_e=doc->root.next;
|
||||||
while (doc_e!=doc) {
|
while (doc_e!=doc) {
|
||||||
result+=DocEntrySize(doc,doc_e);
|
res+=DocEntrySize(doc,doc_e);
|
||||||
doc_e=doc_e->next;
|
doc_e=doc_e->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
u=doc->undo_root.next;
|
u=doc->undo_root.next;
|
||||||
while (u!=&doc->undo_root) {
|
while (u!=&doc->undo_root) {
|
||||||
result+=MSize2(u->body);
|
res+=MSize2(u->body);
|
||||||
result+=MSize2(u);
|
res+=MSize2(u);
|
||||||
u=u->next;
|
u=u->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
b=doc->bin_root.next;
|
b=doc->bin_root.next;
|
||||||
while (b!=&doc->bin_root) {
|
while (b!=&doc->bin_root) {
|
||||||
result+=MSize2(b->data);
|
res+=MSize2(b->data);
|
||||||
result+=MSize2(b);
|
res+=MSize2(b);
|
||||||
b=b->next;
|
b=b->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
result+=MSize2(doc->find_replace);
|
res+=MSize2(doc->find_replace);
|
||||||
result+=MSize2(doc->dollar_buf);
|
res+=MSize2(doc->dollar_buf);
|
||||||
result+=MSize2(doc);
|
res+=MSize2(doc);
|
||||||
if (unlock)
|
if (unlock)
|
||||||
DocUnlock(doc);
|
DocUnlock(doc);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#help_index "DolDoc"
|
#help_index "DolDoc"
|
||||||
|
|||||||
+18
-18
@@ -3,7 +3,7 @@
|
|||||||
I64 DocOptEntry(CDoc *,CDocEntry *doc_e,I64 fuf_flags)
|
I64 DocOptEntry(CDoc *,CDocEntry *doc_e,I64 fuf_flags)
|
||||||
{
|
{
|
||||||
U8 *st,*st2,**_dst;
|
U8 *st,*st2,**_dst;
|
||||||
I64 i,result=0;
|
I64 i,res=0;
|
||||||
|
|
||||||
if (doc_e->de_flags&DOCEF_LINK && doc_e->de_flags&(DOCEF_AUX_STR|DOCEF_TAG)) {
|
if (doc_e->de_flags&DOCEF_LINK && doc_e->de_flags&(DOCEF_AUX_STR|DOCEF_TAG)) {
|
||||||
if (doc_e->de_flags & DOCEF_AUX_STR && doc_e->de_flags & DOCEF_TAG &&
|
if (doc_e->de_flags & DOCEF_AUX_STR && doc_e->de_flags & DOCEF_TAG &&
|
||||||
@@ -12,7 +12,7 @@ I64 DocOptEntry(CDoc *,CDocEntry *doc_e,I64 fuf_flags)
|
|||||||
Free(doc_e->aux_str);
|
Free(doc_e->aux_str);
|
||||||
doc_e->aux_str=NULL;
|
doc_e->aux_str=NULL;
|
||||||
doc_e->de_flags&=~DOCEF_AUX_STR;
|
doc_e->de_flags&=~DOCEF_AUX_STR;
|
||||||
result++;
|
res++;
|
||||||
}
|
}
|
||||||
if (doc_e->de_flags & DOCEF_AUX_STR)
|
if (doc_e->de_flags & DOCEF_AUX_STR)
|
||||||
_dst=&doc_e->aux_str;
|
_dst=&doc_e->aux_str;
|
||||||
@@ -26,7 +26,7 @@ I64 DocOptEntry(CDoc *,CDocEntry *doc_e,I64 fuf_flags)
|
|||||||
i=StrLen(st);
|
i=StrLen(st);
|
||||||
if ((st2=StrMatch(st,*_dst)) && st2[i]=='.' && st2[i+1]=='Z') {
|
if ((st2=StrMatch(st,*_dst)) && st2[i]=='.' && st2[i+1]=='Z') {
|
||||||
StrCpy(st2+i,st2+i+2);
|
StrCpy(st2+i,st2+i+2);
|
||||||
result++;
|
res++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Free(st);
|
Free(st);
|
||||||
@@ -35,66 +35,66 @@ I64 DocOptEntry(CDoc *,CDocEntry *doc_e,I64 fuf_flags)
|
|||||||
if (doc_e->de_flags & DOCEF_AUX_STR) {
|
if (doc_e->de_flags & DOCEF_AUX_STR) {
|
||||||
if (st=StrMatch(".Z",doc_e->aux_str)) {
|
if (st=StrMatch(".Z",doc_e->aux_str)) {
|
||||||
StrCpy(st,st+2);
|
StrCpy(st,st+2);
|
||||||
result++;
|
res++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (doc_e->de_flags&DOCEF_TAG) {
|
if (doc_e->de_flags&DOCEF_TAG) {
|
||||||
if (st=StrMatch(".Z",doc_e->tag)) {
|
if (st=StrMatch(".Z",doc_e->tag)) {
|
||||||
StrCpy(st,st+2);
|
StrCpy(st,st+2);
|
||||||
result++;
|
res++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
I64 DocOptDoc(CDoc *doc,I64 fuf_flags)
|
I64 DocOptDoc(CDoc *doc,I64 fuf_flags)
|
||||||
{//Optimize Doc.
|
{//Optimize Doc.
|
||||||
Bool unlock=DocLock(doc);
|
Bool unlock=DocLock(doc);
|
||||||
I64 result=0;
|
I64 res=0;
|
||||||
CDocEntry *doc_e;
|
CDocEntry *doc_e;
|
||||||
DocRecalc(doc);
|
DocRecalc(doc);
|
||||||
doc_e=doc->root.next;
|
doc_e=doc->root.next;
|
||||||
while (doc_e!=doc) {
|
while (doc_e!=doc) {
|
||||||
if (result+=DocOptEntry(doc,doc_e,fuf_flags))
|
if (res+=DocOptEntry(doc,doc_e,fuf_flags))
|
||||||
result+=DocOptEntry(doc,doc_e,fuf_flags);
|
res+=DocOptEntry(doc,doc_e,fuf_flags);
|
||||||
doc_e=doc_e->next;
|
doc_e=doc_e->next;
|
||||||
}
|
}
|
||||||
DocRecalc(doc);
|
DocRecalc(doc);
|
||||||
if (unlock)
|
if (unlock)
|
||||||
DocUnlock(doc);
|
DocUnlock(doc);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
I64 DocOptFile(U8 *filename,I64 fuf_flags)
|
I64 DocOptFile(U8 *filename,I64 fuf_flags)
|
||||||
{//Optimize File.
|
{//Optimize File.
|
||||||
I64 result;
|
I64 res;
|
||||||
CDoc *doc=DocRead(filename);
|
CDoc *doc=DocRead(filename);
|
||||||
if (result=DocOptDoc(doc,fuf_flags)) {
|
if (res=DocOptDoc(doc,fuf_flags)) {
|
||||||
"-%d:%s\n",result,doc->filename.name;
|
"-%d:%s\n",res,doc->filename.name;
|
||||||
DocWrite(doc);
|
DocWrite(doc);
|
||||||
}
|
}
|
||||||
DocDel(doc);
|
DocDel(doc);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
I64 DocOptLst(CDirEntry *tempde,I64 fuf_flags)
|
I64 DocOptLst(CDirEntry *tempde,I64 fuf_flags)
|
||||||
{
|
{
|
||||||
I64 result=0;
|
I64 res=0;
|
||||||
CDirEntry *tempde1;
|
CDirEntry *tempde1;
|
||||||
while (tempde) {
|
while (tempde) {
|
||||||
tempde1=tempde->next;
|
tempde1=tempde->next;
|
||||||
if (tempde->attr & RS_ATTR_DIR) {
|
if (tempde->attr & RS_ATTR_DIR) {
|
||||||
if (tempde->sub) {
|
if (tempde->sub) {
|
||||||
"Scanning Directory: %s\n",tempde->full_name;
|
"Scanning Directory: %s\n",tempde->full_name;
|
||||||
result+=DocOptLst(tempde->sub,fuf_flags);
|
res+=DocOptLst(tempde->sub,fuf_flags);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
result+=DocOptFile(tempde->full_name,fuf_flags);
|
res+=DocOptFile(tempde->full_name,fuf_flags);
|
||||||
DirEntryDel(tempde);
|
DirEntryDel(tempde);
|
||||||
tempde=tempde1;
|
tempde=tempde1;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
public I64 DocOpt(U8 *files_find_mask="*",U8 *fu_flags=NULL)
|
public I64 DocOpt(U8 *files_find_mask="*",U8 *fu_flags=NULL)
|
||||||
{//Optimize $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.TXT"$ Files, eliminating aux_str's and .Z's.
|
{//Optimize $LK,"DolDoc",A="FI:::/Doc/DolDocOverview.TXT"$ Files, eliminating aux_str's and .Z's.
|
||||||
|
|||||||
+10
-10
@@ -2,30 +2,30 @@
|
|||||||
|
|
||||||
I64 PrsDocFlagSingle(CCmpCtrl *cc,I64 *_de_flags,U32 *_type,Bool turn_on)
|
I64 PrsDocFlagSingle(CCmpCtrl *cc,I64 *_de_flags,U32 *_type,Bool turn_on)
|
||||||
{
|
{
|
||||||
I64 result=-1;
|
I64 res=-1;
|
||||||
CHashGeneric *temph;
|
CHashGeneric *temph;
|
||||||
if (cc->token==TK_IDENT &&
|
if (cc->token==TK_IDENT &&
|
||||||
(temph=HashFind(cc->cur_str,doldoc.hash,DHT_DOC_FLAG))) {
|
(temph=HashFind(cc->cur_str,doldoc.hash,DHT_DOC_FLAG))) {
|
||||||
result=temph->user_data0;
|
res=temph->user_data0;
|
||||||
if (result<64) {
|
if (res<64) {
|
||||||
BEqu(_de_flags,result,turn_on);
|
BEqu(_de_flags,res,turn_on);
|
||||||
switch (result) {
|
switch (res) {
|
||||||
case DOCEf_SELECTED:
|
case DOCEf_SELECTED:
|
||||||
case DOCEf_UNDERLINE:
|
case DOCEf_UNDERLINE:
|
||||||
case DOCEf_INVERT:
|
case DOCEf_INVERT:
|
||||||
case DOCEf_BLINK:
|
case DOCEf_BLINK:
|
||||||
BEqu(_type,result,turn_on);
|
BEqu(_type,res,turn_on);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Lex(cc); //skip flag
|
Lex(cc); //skip flag
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
I64 PrsDocFlags(CCmpCtrl *cc,I64 *_de_flags,U32 *_type)
|
I64 PrsDocFlags(CCmpCtrl *cc,I64 *_de_flags,U32 *_type)
|
||||||
{
|
{
|
||||||
I64 result=-1;
|
I64 res=-1;
|
||||||
Bool turn_on;
|
Bool turn_on;
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
if (cc->token=='+')
|
if (cc->token=='+')
|
||||||
@@ -35,9 +35,9 @@ I64 PrsDocFlags(CCmpCtrl *cc,I64 *_de_flags,U32 *_type)
|
|||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
Lex(cc);
|
Lex(cc);
|
||||||
result=PrsDocFlagSingle(cc,_de_flags,_type,turn_on);
|
res=PrsDocFlagSingle(cc,_de_flags,_type,turn_on);
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U8 *Doc2PlainText(CDoc *doc,CDocEntry *doc_e)
|
U8 *Doc2PlainText(CDoc *doc,CDocEntry *doc_e)
|
||||||
|
|||||||
+29
-29
@@ -30,7 +30,7 @@ public CTask *PopUpViewPrint(U8 *fmt,...)
|
|||||||
#help_index "DolDoc/Input;File/FileNames;StdIn/DolDoc"
|
#help_index "DolDoc/Input;File/FileNames;StdIn/DolDoc"
|
||||||
public U8 *PopUpPickFile(U8 *dir=NULL)
|
public U8 *PopUpPickFile(U8 *dir=NULL)
|
||||||
{//Filename chooser. Uses $LK,"FileMgr",A="MN:FileMgr"$().
|
{//Filename chooser. Uses $LK,"FileMgr",A="MN:FileMgr"$().
|
||||||
U8 *result,*st,*st2;
|
U8 *res,*st,*st2;
|
||||||
if (dir)
|
if (dir)
|
||||||
st=MStrPrint("Cd(\"%Q\");FileMgr(FM_PICK_FILE,Fs->parent_task);",dir);
|
st=MStrPrint("Cd(\"%Q\");FileMgr(FM_PICK_FILE,Fs->parent_task);",dir);
|
||||||
else {
|
else {
|
||||||
@@ -38,14 +38,14 @@ public U8 *PopUpPickFile(U8 *dir=NULL)
|
|||||||
st=MStrPrint("Cd(\"%Q\");FileMgr(FM_PICK_FILE,Fs->parent_task);",st2);
|
st=MStrPrint("Cd(\"%Q\");FileMgr(FM_PICK_FILE,Fs->parent_task);",st2);
|
||||||
Free(st2);
|
Free(st2);
|
||||||
}
|
}
|
||||||
result=PopUp(st,Fs);
|
res=PopUp(st,Fs);
|
||||||
Free(st);
|
Free(st);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public U8 *PopUpPickDir(U8 *dir=NULL)
|
public U8 *PopUpPickDir(U8 *dir=NULL)
|
||||||
{//File dir name chooser. Uses $LK,"FileMgr",A="MN:FileMgr"$().
|
{//File dir name chooser. Uses $LK,"FileMgr",A="MN:FileMgr"$().
|
||||||
U8 *result,*st,*st2;
|
U8 *res,*st,*st2;
|
||||||
if (dir)
|
if (dir)
|
||||||
st=MStrPrint("Cd(\"%Q\");FileMgr(FM_PICK_DIR,Fs->parent_task);",dir);
|
st=MStrPrint("Cd(\"%Q\");FileMgr(FM_PICK_DIR,Fs->parent_task);",dir);
|
||||||
else {
|
else {
|
||||||
@@ -53,9 +53,9 @@ public U8 *PopUpPickDir(U8 *dir=NULL)
|
|||||||
st=MStrPrint("Cd(\"%Q\");FileMgr(FM_PICK_DIR,Fs->parent_task);",st2);
|
st=MStrPrint("Cd(\"%Q\");FileMgr(FM_PICK_DIR,Fs->parent_task);",st2);
|
||||||
Free(st2);
|
Free(st2);
|
||||||
}
|
}
|
||||||
result=PopUp(st,Fs);
|
res=PopUp(st,Fs);
|
||||||
Free(st);
|
Free(st);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public U8 *FileNameForm(U8 *dft=NULL,I64 dof_flags=0,CTask *mem_task=NULL)
|
public U8 *FileNameForm(U8 *dft=NULL,I64 dof_flags=0,CTask *mem_task=NULL)
|
||||||
@@ -74,22 +74,22 @@ public U8 *FileNameForm(U8 *dft=NULL,I64 dof_flags=0,CTask *mem_task=NULL)
|
|||||||
public U8 *PopUpFileName(U8 *dft=NULL,I64 dof_flags=0)
|
public U8 *PopUpFileName(U8 *dft=NULL,I64 dof_flags=0)
|
||||||
{//Filename chooser. Uses form, not $LK,"FileMgr",A="MN:FileMgr"$().
|
{//Filename chooser. Uses form, not $LK,"FileMgr",A="MN:FileMgr"$().
|
||||||
U8 *st=MStrPrint("FileNameForm(\"%Q\",0x%X,Fs->parent_task);",
|
U8 *st=MStrPrint("FileNameForm(\"%Q\",0x%X,Fs->parent_task);",
|
||||||
dft,dof_flags|DOF_MIN_SIZE),*result=PopUp(st,Fs);
|
dft,dof_flags|DOF_MIN_SIZE),*res=PopUp(st,Fs);
|
||||||
Free(st);
|
Free(st);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#help_index "DolDoc"
|
#help_index "DolDoc"
|
||||||
Bool PopUpCd()
|
Bool PopUpCd()
|
||||||
{
|
{
|
||||||
Bool result;
|
Bool res;
|
||||||
U8 *st=PopUpPickDir;
|
U8 *st=PopUpPickDir;
|
||||||
if (st) {
|
if (st) {
|
||||||
result=Cd(st);
|
res=Cd(st);
|
||||||
Free(st);
|
Free(st);
|
||||||
} else
|
} else
|
||||||
result=FALSE;
|
res=FALSE;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#help_index "DolDoc/Input;Char/Lists;StdIn/DolDoc"
|
#help_index "DolDoc/Input;Char/Lists;StdIn/DolDoc"
|
||||||
@@ -112,9 +112,9 @@ public U8 *PopUpPickLst(U8 *lst)
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
public U8 *PopUpPickDefineSub(U8 *st)
|
public U8 *PopUpPickDefineSub(U8 *dname)
|
||||||
{//Prompt for $LK,"Define",A="HI:Define"$ lst entry in PopUp win task.
|
{//Prompt for $LK,"Define",A="HI:Define"$ lst entry in PopUp win task.
|
||||||
return PopUpPickLst(Define(st));
|
return PopUpPickLst(Define(dname));
|
||||||
}
|
}
|
||||||
|
|
||||||
#help_index "DolDoc/Input;StdIn/DolDoc"
|
#help_index "DolDoc/Input;StdIn/DolDoc"
|
||||||
@@ -166,37 +166,37 @@ public Bool PopUpCancelOk(U8 *header=NULL,U8 *footer=NULL)
|
|||||||
|
|
||||||
U8 *PopUpGetStr2(U8 *header,CTask *mem_task)
|
U8 *PopUpGetStr2(U8 *header,CTask *mem_task)
|
||||||
{
|
{
|
||||||
U8 *result,*st;
|
U8 *res,*st;
|
||||||
if (header)
|
if (header)
|
||||||
"%s",header;
|
"%s",header;
|
||||||
st=GetStr(,,GSF_WITH_NEW_LINE);
|
st=GetStr(,,GSF_WITH_NEW_LINE);
|
||||||
result=StrNew(st,mem_task);
|
res=StrNew(st,mem_task);
|
||||||
Free(st);
|
Free(st);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public U8 *PopUpGetStr(U8 *header=NULL)
|
public U8 *PopUpGetStr(U8 *header=NULL)
|
||||||
{//Prompt for text str in PopUp win task.
|
{//Prompt for text str in PopUp win task.
|
||||||
U8 *st=MStrPrint("PopUpGetStr2(0x%X,0x%X);",header,Fs),
|
U8 *st=MStrPrint("PopUpGetStr2(0x%X,0x%X);",header,Fs),
|
||||||
*result=PopUp(st,Fs);
|
*res=PopUp(st,Fs);
|
||||||
Free(st);
|
Free(st);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public I64 PopUpGetI64(U8 *msg,I64 dft,I64 lo=MIN_I64,I64 hi=MAX_I64)
|
public I64 PopUpGetI64(U8 *msg,I64 dft,I64 lo=MIN_I64,I64 hi=MAX_I64)
|
||||||
{//Prompt for I64 text expression in PopUp win task.
|
{//Prompt for I64 text expression in PopUp win task.
|
||||||
U8 *st=MStrPrint("GetI64(0x%X,0x%X,0x%X,0x%X);",msg,dft,lo,hi);
|
U8 *st=MStrPrint("GetI64(0x%X,0x%X,0x%X,0x%X);",msg,dft,lo,hi);
|
||||||
I64 result=PopUp(st,Fs);
|
I64 res=PopUp(st,Fs);
|
||||||
Free(st);
|
Free(st);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public F64 PopUpGetF64(U8 *msg,F64 dft,F64 lo=MIN_F64,F64 hi=MAX_F64)
|
public F64 PopUpGetF64(U8 *msg,F64 dft,F64 lo=MIN_F64,F64 hi=MAX_F64)
|
||||||
{//Prompt for F64 text expression in PopUp win task.
|
{//Prompt for F64 text expression in PopUp win task.
|
||||||
U8 *st=MStrPrint("GetF64(0x%X,0x%X(F64),0x%X(F64),0x%X(F64));",msg,dft,lo,hi);
|
U8 *st=MStrPrint("GetF64(0x%X,0x%X(F64),0x%X(F64),0x%X(F64));",msg,dft,lo,hi);
|
||||||
F64 result=PopUp(st,Fs)(F64);
|
F64 res=PopUp(st,Fs)(F64);
|
||||||
Free(st);
|
Free(st);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public I64 PopUpRangeI64(I64 lo,I64 hi,I64 step=1,
|
public I64 PopUpRangeI64(I64 lo,I64 hi,I64 step=1,
|
||||||
@@ -270,16 +270,16 @@ public I64 AdamFile(U8 *filename,Bool warn_ext=TRUE)
|
|||||||
Bool okay=TRUE;
|
Bool okay=TRUE;
|
||||||
U8 *name=FileNameAbs(filename),
|
U8 *name=FileNameAbs(filename),
|
||||||
*name2=DftExt(name,"CPP.Z");
|
*name2=DftExt(name,"CPP.Z");
|
||||||
I64 result=0;
|
I64 res=0;
|
||||||
if (warn_ext &&
|
if (warn_ext &&
|
||||||
!FilesFindMatch(name2,FILEMASK_JIT) &&
|
!FilesFindMatch(name2,FILEMASK_JIT) &&
|
||||||
!PopUpCancelOk(ST_WARN_ST "Not .CPP File\n\n"))
|
!PopUpCancelOk(ST_WARN_ST "Not .CPP File\n\n"))
|
||||||
okay=FALSE;
|
okay=FALSE;
|
||||||
if (okay)
|
if (okay)
|
||||||
result=Adam("#include \"%s\";",name2);
|
res=Adam("#include \"%s\";",name2);
|
||||||
Free(name2);
|
Free(name2);
|
||||||
Free(name);
|
Free(name);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public I64 PopUpFile(U8 *filename,Bool warn_ext=TRUE,
|
public I64 PopUpFile(U8 *filename,Bool warn_ext=TRUE,
|
||||||
@@ -288,7 +288,7 @@ public I64 PopUpFile(U8 *filename,Bool warn_ext=TRUE,
|
|||||||
Bool okay=TRUE;
|
Bool okay=TRUE;
|
||||||
U8 *st,*name=FileNameAbs(filename),
|
U8 *st,*name=FileNameAbs(filename),
|
||||||
*name2=DftExt(name,"CPP.Z");
|
*name2=DftExt(name,"CPP.Z");
|
||||||
I64 result=0;
|
I64 res=0;
|
||||||
if (warn_ext &&
|
if (warn_ext &&
|
||||||
!FilesFindMatch(name2,FILEMASK_JIT) &&
|
!FilesFindMatch(name2,FILEMASK_JIT) &&
|
||||||
!PopUpCancelOk(ST_WARN_ST "Not .CPP File\n\n"))
|
!PopUpCancelOk(ST_WARN_ST "Not .CPP File\n\n"))
|
||||||
@@ -297,10 +297,10 @@ public I64 PopUpFile(U8 *filename,Bool warn_ext=TRUE,
|
|||||||
st=MStrPrint(
|
st=MStrPrint(
|
||||||
"\"$$$$WW+H,1$$$$\";Auto(\"ExeFile2(\\\"%s\\\");\\n\");UserTaskCont;",
|
"\"$$$$WW+H,1$$$$\";Auto(\"ExeFile2(\\\"%s\\\");\\n\");UserTaskCont;",
|
||||||
name2);
|
name2);
|
||||||
result=PopUp(st,parent,_pu_task);
|
res=PopUp(st,parent,_pu_task);
|
||||||
Free(st);
|
Free(st);
|
||||||
}
|
}
|
||||||
Free(name2);
|
Free(name2);
|
||||||
Free(name);
|
Free(name);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -485,8 +485,11 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
|
|||||||
if (sc&SCF_SHIFT) {
|
if (sc&SCF_SHIFT) {
|
||||||
if (sc&SCF_KEY_DESC)
|
if (sc&SCF_KEY_DESC)
|
||||||
KeyDescSet("Cmd /Code Tools");
|
KeyDescSet("Cmd /Code Tools");
|
||||||
else
|
else {
|
||||||
|
DocUnlock(doc);
|
||||||
EdCodeTools(doc);
|
EdCodeTools(doc);
|
||||||
|
DocLock(doc);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (sc&SCF_KEY_DESC)
|
if (sc&SCF_KEY_DESC)
|
||||||
KeyDescSet("Cmd /Insert Text Widgets Wizard");
|
KeyDescSet("Cmd /Insert Text Widgets Wizard");
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ CDocEntry *DocPutS(CDoc *doc,U8 *st)
|
|||||||
*char_bitmap;
|
*char_bitmap;
|
||||||
Bool unlock;
|
Bool unlock;
|
||||||
I64 ch,j;
|
I64 ch,j;
|
||||||
CDocEntry *doc_e=NULL,*result=NULL,*doc_ce;
|
CDocEntry *doc_e=NULL,*res=NULL,*doc_ce;
|
||||||
if (!st || !doc && !(doc=DocPut) || doc->doc_signature!=DOC_SIGNATURE_VAL)
|
if (!st || !doc && !(doc=DocPut) || doc->doc_signature!=DOC_SIGNATURE_VAL)
|
||||||
return NULL;
|
return NULL;
|
||||||
unlock=DocLock(doc);
|
unlock=DocLock(doc);
|
||||||
@@ -128,7 +128,7 @@ CDocEntry *DocPutS(CDoc *doc,U8 *st)
|
|||||||
}
|
}
|
||||||
*ptr4=0;
|
*ptr4=0;
|
||||||
if (doc_e=PrsDollarCmd(doc,st2)) {
|
if (doc_e=PrsDollarCmd(doc,st2)) {
|
||||||
result=doc_e;
|
res=doc_e;
|
||||||
DocInsEntry(doc,doc_e);
|
DocInsEntry(doc,doc_e);
|
||||||
}
|
}
|
||||||
Free(st2);
|
Free(st2);
|
||||||
@@ -152,16 +152,16 @@ CDocEntry *DocPutS(CDoc *doc,U8 *st)
|
|||||||
}
|
}
|
||||||
if (unlock)
|
if (unlock)
|
||||||
DocUnlock(doc);
|
DocUnlock(doc);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CDocEntry *DocPrint(CDoc *doc=NULL,U8 *fmt,...)
|
public CDocEntry *DocPrint(CDoc *doc=NULL,U8 *fmt,...)
|
||||||
{//You must not print partial doc cmds.
|
{//You must not print partial doc cmds.
|
||||||
//Returns last newly created dollar-sign CDocEntry or NULL.
|
//Returns last newly created dollar-sign CDocEntry or NULL.
|
||||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
||||||
CDocEntry *result=DocPutS(doc,buf);
|
CDocEntry *res=DocPutS(doc,buf);
|
||||||
Free(buf);
|
Free(buf);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public U0 DocPrintPartial(CDoc *doc=NULL,U8 *fmt,...)
|
public U0 DocPrintPartial(CDoc *doc=NULL,U8 *fmt,...)
|
||||||
|
|||||||
+16
-16
@@ -134,7 +134,7 @@ CDocEntry *DocSplitTag(CDoc *doc,CDocEntry *doc_e,I64 i,I64 x,I64 y,I64 type_u8)
|
|||||||
CDocEntry *doc_e2;
|
CDocEntry *doc_e2;
|
||||||
if (doc_e->type_u8==DOCT_TEXT && i) {
|
if (doc_e->type_u8==DOCT_TEXT && i) {
|
||||||
if (i<StrLen(doc_e->tag)) {
|
if (i<StrLen(doc_e->tag)) {
|
||||||
doc_e2=MAllocIdentical(doc_e,doc->mem_task);
|
doc_e2=MAllocIdent(doc_e,doc->mem_task);
|
||||||
doc_e2->tag=StrNew(doc_e->tag+i,doc->mem_task);
|
doc_e2->tag=StrNew(doc_e->tag+i,doc->mem_task);
|
||||||
doc_e2->de_flags=doc_e->de_flags&~DOCEG_HAS_ALLOC|DOCEF_TAG;
|
doc_e2->de_flags=doc_e->de_flags&~DOCEG_HAS_ALLOC|DOCEF_TAG;
|
||||||
QueIns(doc_e2,doc_e);
|
QueIns(doc_e2,doc_e);
|
||||||
@@ -256,14 +256,14 @@ I64 DocTempAttr(CDoc *doc,CDocEntry *doc_e,I64 cur_u8_attr)
|
|||||||
public Bool DocRecalc(CDoc *doc,I64 recalc_flags=RECALCt_NORMAL)
|
public Bool DocRecalc(CDoc *doc,I64 recalc_flags=RECALCt_NORMAL)
|
||||||
{//Recalc and fmt. Also used by WinMgr to draw on screen.
|
{//Recalc and fmt. Also used by WinMgr to draw on screen.
|
||||||
I64 i,ii,j,k,x,x0,y,y0,D,d2,col,col2,best_col=0,best_d=MAX_I64,xx,yy,zz,
|
I64 i,ii,j,k,x,x0,y,y0,D,d2,col,col2,best_col=0,best_d=MAX_I64,xx,yy,zz,
|
||||||
num_entries=0,ijif,cur_u8_attr,temp_u32_attr,
|
num_entries=0,i_jif,cur_u8_attr,temp_u32_attr,
|
||||||
cursor_y=MIN_I64,left_margin,right_margin,y_plot_top,y_plot_bottom,
|
cursor_y=MIN_I64,left_margin,right_margin,y_plot_top,y_plot_bottom,
|
||||||
top,left,bottom,right,width,height,scroll_x,scroll_y,pix_top,pix_left;
|
top,left,bottom,right,width,height,scroll_x,scroll_y,pix_top,pix_left;
|
||||||
CDocEntry reg *doc_e,reg *doc_e2,*best_doc_e,*next_clear_found=NULL,
|
CDocEntry reg *doc_e,reg *doc_e2,*best_doc_e,*next_clear_found=NULL,
|
||||||
*added_cursor=NULL;
|
*added_cursor=NULL;
|
||||||
CDocBin *tempb;
|
CDocBin *tempb;
|
||||||
CDocSettings *s;
|
CDocSettings *s;
|
||||||
Bool del_cl,skipped_update,tree_collapsed,same_win,more=FALSE,
|
Bool del_doc_e,skipped_update,tree_collapsed,same_win,more=FALSE,
|
||||||
find_cursor=FALSE,blink_flag,full_refresh=TRUE,unlock,clear_holds;
|
find_cursor=FALSE,blink_flag,full_refresh=TRUE,unlock,clear_holds;
|
||||||
CTask *win_task,*mem_task;
|
CTask *win_task,*mem_task;
|
||||||
CDC *dc;
|
CDC *dc;
|
||||||
@@ -276,11 +276,12 @@ public Bool DocRecalc(CDoc *doc,I64 recalc_flags=RECALCt_NORMAL)
|
|||||||
|
|
||||||
if (!doc || doc->doc_signature!=DOC_SIGNATURE_VAL) return FALSE;
|
if (!doc || doc->doc_signature!=DOC_SIGNATURE_VAL) return FALSE;
|
||||||
|
|
||||||
|
//WinMgr updates all wins $TX,"30",D="WINMGR_FPS"$, 33.33333mS
|
||||||
if (recalc_flags&RECALCG_MASK==RECALCt_TO_SCREEN && doc->owning_task!=Fs) {
|
if (recalc_flags&RECALCG_MASK==RECALCt_TO_SCREEN && doc->owning_task!=Fs) {
|
||||||
ijif=cnts.jiffies+JIFFY_FREQ/240;
|
i_jif=cnts.jiffies+JIFFY_FREQ/250; //4 mS
|
||||||
while (Bt(&doc->locked_flags,DOClf_LOCKED)) {
|
while (Bt(&doc->locked_flags,DOClf_LOCKED)) {
|
||||||
if (cnts.jiffies>=ijif)
|
if (cnts.jiffies>=i_jif)
|
||||||
return FALSE;
|
return FALSE; //Bail-out if doc locked.
|
||||||
Yield;
|
Yield;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -426,7 +427,7 @@ public Bool DocRecalc(CDoc *doc,I64 recalc_flags=RECALCt_NORMAL)
|
|||||||
}
|
}
|
||||||
while (doc_e!=doc) {
|
while (doc_e!=doc) {
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
del_cl=FALSE;
|
del_doc_e=FALSE;
|
||||||
if (doc_e->de_flags & (DOCEF_SKIP|DOCEF_FILTER_SKIP)) {
|
if (doc_e->de_flags & (DOCEF_SKIP|DOCEF_FILTER_SKIP)) {
|
||||||
doc_e2=doc_e;
|
doc_e2=doc_e;
|
||||||
goto rc_skip;
|
goto rc_skip;
|
||||||
@@ -485,7 +486,7 @@ public Bool DocRecalc(CDoc *doc,I64 recalc_flags=RECALCt_NORMAL)
|
|||||||
temp_u32_attr=DocTempAttr(doc,doc_e,cur_u8_attr);
|
temp_u32_attr=DocTempAttr(doc,doc_e,cur_u8_attr);
|
||||||
if (doc_e==doc->cur_entry) {
|
if (doc_e==doc->cur_entry) {
|
||||||
cursor_y=doc_e->y;
|
cursor_y=doc_e->y;
|
||||||
if (recalc_flags&RECALCF_ADD_CURSOR && doc_e!=added_cursor) {
|
if (recalc_flags&RECALCF_ADD_CURSOR && !added_cursor) {
|
||||||
if (doc_e->type_u8==DOCT_TEXT && 0<doc->cur_col<k &&
|
if (doc_e->type_u8==DOCT_TEXT && 0<doc->cur_col<k &&
|
||||||
!(doc_e->de_flags & ~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|
|
!(doc_e->de_flags & ~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|
|
||||||
DOCEF_HIGHLIGHT|DOCEF_SKIP|DOCEF_FILTER_SKIP)) &&
|
DOCEF_HIGHLIGHT|DOCEF_SKIP|DOCEF_FILTER_SKIP)) &&
|
||||||
@@ -545,14 +546,13 @@ public Bool DocRecalc(CDoc *doc,I64 recalc_flags=RECALCt_NORMAL)
|
|||||||
if (doc_e->de_flags & DOCEF_SCROLLING_X) {
|
if (doc_e->de_flags & DOCEF_SCROLLING_X) {
|
||||||
j=StrLen(doc_e->tag);
|
j=StrLen(doc_e->tag);
|
||||||
if (j && doc_e->scroll_len) {
|
if (j && doc_e->scroll_len) {
|
||||||
ijif=cur_time*FONT_WIDTH*DOC_SCROLL_SPEED;
|
i_jif=ToI64(cur_time*FONT_WIDTH*DOC_SCROLL_SPEED)%(j*FONT_WIDTH);
|
||||||
ijif%=j*FONT_WIDTH;
|
|
||||||
temp_u32_attr=temp_u32_attr & 0xFFE0FF00|
|
temp_u32_attr=temp_u32_attr & 0xFFE0FF00|
|
||||||
(FONT_WIDTH-1-ijif&(FONT_WIDTH-1))<<16;
|
(FONT_WIDTH-1-i_jif&(FONT_WIDTH-1))<<16;
|
||||||
#assert FONT_WIDTH==8
|
#assert FONT_WIDTH==8
|
||||||
ijif>>=3;
|
i_jif>>=3;
|
||||||
for (k=0;k<doc_e->scroll_len;k++) {
|
for (k=0;k<doc_e->scroll_len;k++) {
|
||||||
ch=ptr[(ijif+k)%j];
|
ch=ptr[(i_jif+k)%j];
|
||||||
if (!Bt(chars_bmp_displayable,ch)) ch='.';
|
if (!Bt(chars_bmp_displayable,ch)) ch='.';
|
||||||
if (recalc_flags&RECALCG_MASK==RECALCt_TO_SCREEN &&
|
if (recalc_flags&RECALCG_MASK==RECALCt_TO_SCREEN &&
|
||||||
!(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
!(doc_e->de_flags&DOCEF_DONT_DRAW)) {
|
||||||
@@ -631,7 +631,7 @@ public Bool DocRecalc(CDoc *doc,I64 recalc_flags=RECALCt_NORMAL)
|
|||||||
if (!col2 && !(doc_e->de_flags
|
if (!col2 && !(doc_e->de_flags
|
||||||
&(DOCEF_TREE|DOCEF_LST|DOCEF_TAG_CB|DOCEF_DEFINE|
|
&(DOCEF_TREE|DOCEF_LST|DOCEF_TAG_CB|DOCEF_DEFINE|
|
||||||
DOCEF_AUX_STR|DOCEF_HTML_LINK|DOCEF_BIN_PTR_LINK)))
|
DOCEF_AUX_STR|DOCEF_HTML_LINK|DOCEF_BIN_PTR_LINK)))
|
||||||
del_cl=TRUE;
|
del_doc_e=TRUE;
|
||||||
break;
|
break;
|
||||||
case DOCT_HEX_ED:
|
case DOCT_HEX_ED:
|
||||||
if (doc_e->de_flags&DOCEF_DEREF_DATA &&
|
if (doc_e->de_flags&DOCEF_DEREF_DATA &&
|
||||||
@@ -944,7 +944,7 @@ rc_adjust_xy:
|
|||||||
doc->cur_col=doc->cur_entry->min_col;
|
doc->cur_col=doc->cur_entry->min_col;
|
||||||
}
|
}
|
||||||
if (doc_e!=added_cursor)
|
if (doc_e!=added_cursor)
|
||||||
del_cl=TRUE;
|
del_doc_e=TRUE;
|
||||||
break;
|
break;
|
||||||
case DOCT_SPRITE:
|
case DOCT_SPRITE:
|
||||||
if (!doc_e->bin_data && doc->flags&DOCEF_HAS_BIN)
|
if (!doc_e->bin_data && doc->flags&DOCEF_HAS_BIN)
|
||||||
@@ -1136,7 +1136,7 @@ rc_skip:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (full_refresh) {
|
if (full_refresh) {
|
||||||
if (del_cl) {
|
if (del_doc_e) {
|
||||||
if (!(doc_e->de_flags & (DOCEF_HOLD|DOCEF_FILTER_SKIP))) {
|
if (!(doc_e->de_flags & (DOCEF_HOLD|DOCEF_FILTER_SKIP))) {
|
||||||
if (doc_e==doc->cur_entry) {
|
if (doc_e==doc->cur_entry) {
|
||||||
doc->cur_entry=doc_e2;
|
doc->cur_entry=doc_e2;
|
||||||
|
|||||||
@@ -179,12 +179,12 @@ public I64 DocMax(I64 i=MAX_I64)
|
|||||||
//Normally, the cmd line deletes entries
|
//Normally, the cmd line deletes entries
|
||||||
//when more are added and the old scroll up.
|
//when more are added and the old scroll up.
|
||||||
//See $LK,"max_entries",A="FF:::/Adam/DolDoc/DocTerm.CPP,max_entries"$.
|
//See $LK,"max_entries",A="FF:::/Adam/DolDoc/DocTerm.CPP,max_entries"$.
|
||||||
I64 result;
|
I64 res;
|
||||||
CDoc *doc;
|
CDoc *doc;
|
||||||
if (doc=DocPut) {
|
if (doc=DocPut) {
|
||||||
result=doc->max_entries;
|
res=doc->max_entries;
|
||||||
doc->max_entries=i;
|
doc->max_entries=i;
|
||||||
return result;
|
return res;
|
||||||
} else
|
} else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-14
@@ -5,7 +5,7 @@ public I64 DocEntryRun(CDoc *doc,CDocEntry *doc_e,
|
|||||||
{//Do action on final entry selected by user.
|
{//Do action on final entry selected by user.
|
||||||
//Sometimes returns locked, sometimes unlocked
|
//Sometimes returns locked, sometimes unlocked
|
||||||
U8 ch=doc->cmd_U8,*st;
|
U8 ch=doc->cmd_U8,*st;
|
||||||
I64 result=DOCM_CANCEL,has_action=FALSE;
|
I64 res=DOCM_CANCEL,has_action=FALSE;
|
||||||
CHashDefineStr *temph;
|
CHashDefineStr *temph;
|
||||||
DocLock(doc);
|
DocLock(doc);
|
||||||
if (!exited) {
|
if (!exited) {
|
||||||
@@ -25,19 +25,19 @@ public I64 DocEntryRun(CDoc *doc,CDocEntry *doc_e,
|
|||||||
try {
|
try {
|
||||||
if (ch==CH_SPACE) {
|
if (ch==CH_SPACE) {
|
||||||
if (doc_e->de_flags & DOCEF_LINK && doc->left_click_link) {
|
if (doc_e->de_flags & DOCEF_LINK && doc->left_click_link) {
|
||||||
result=(*doc->left_click_link)(doc,doc_e);
|
res=(*doc->left_click_link)(doc,doc_e);
|
||||||
has_action=TRUE;
|
has_action=TRUE;
|
||||||
}
|
}
|
||||||
if (doc_e->de_flags & DOCEF_LEFT_EXP) {
|
if (doc_e->de_flags & DOCEF_LEFT_EXP) {
|
||||||
result=doc_e->left_exp;
|
res=doc_e->left_exp;
|
||||||
has_action=TRUE;
|
has_action=TRUE;
|
||||||
Msg(MSG_CMD,result,0,1<<SVCf_DONT_FILTER);
|
Msg(MSG_CMD,res,0,1<<SVCf_DONT_FILTER);
|
||||||
}
|
}
|
||||||
if (doc_e->de_flags & DOCEF_LEFT_CB && doc_e->left_cb) {
|
if (doc_e->de_flags & DOCEF_LEFT_CB && doc_e->left_cb) {
|
||||||
DocUnlock(doc);
|
DocUnlock(doc);
|
||||||
result=(*doc_e->left_cb)(doc,doc_e);
|
res=(*doc_e->left_cb)(doc,doc_e);
|
||||||
has_action=TRUE;
|
has_action=TRUE;
|
||||||
Msg(MSG_CMD,result,0,1<<SVCf_DONT_FILTER);
|
Msg(MSG_CMD,res,0,1<<SVCf_DONT_FILTER);
|
||||||
}
|
}
|
||||||
if (doc_e->de_flags & DOCEF_LEFT_MACRO) {
|
if (doc_e->de_flags & DOCEF_LEFT_MACRO) {
|
||||||
if (doc_e->de_flags & DOCEF_POPUP) {
|
if (doc_e->de_flags & DOCEF_POPUP) {
|
||||||
@@ -57,26 +57,26 @@ public I64 DocEntryRun(CDoc *doc,CDocEntry *doc_e,
|
|||||||
doc_e->de_flags & DOCEF_DEFINE &&
|
doc_e->de_flags & DOCEF_DEFINE &&
|
||||||
(temph=HashFind(doc_e->define_str,
|
(temph=HashFind(doc_e->define_str,
|
||||||
doc->win_task->hash_table,HTT_DEFINE_STR)) &&
|
doc->win_task->hash_table,HTT_DEFINE_STR)) &&
|
||||||
(result=PopUpPickLst(temph->data))!=DOCM_CANCEL) {
|
(res=PopUpPickLst(temph->data))!=DOCM_CANCEL) {
|
||||||
DocDataFmt(doc,doc_e,result);
|
DocDataFmt(doc,doc_e,res);
|
||||||
DocDataScan(doc,doc_e);
|
DocDataScan(doc,doc_e);
|
||||||
has_action=TRUE;
|
has_action=TRUE;
|
||||||
}
|
}
|
||||||
} else if (ch=='\n') {
|
} else if (ch=='\n') {
|
||||||
if (doc_e->de_flags & DOCEF_LINK && doc->right_click_link) {
|
if (doc_e->de_flags & DOCEF_LINK && doc->right_click_link) {
|
||||||
result=(*doc->right_click_link)(doc,doc_e);
|
res=(*doc->right_click_link)(doc,doc_e);
|
||||||
has_action=TRUE;
|
has_action=TRUE;
|
||||||
}
|
}
|
||||||
if (doc_e->de_flags & DOCEF_RIGHT_EXP) {
|
if (doc_e->de_flags & DOCEF_RIGHT_EXP) {
|
||||||
result=doc_e->right_exp;
|
res=doc_e->right_exp;
|
||||||
has_action=TRUE;
|
has_action=TRUE;
|
||||||
Msg(MSG_CMD,result,0,1<<SVCf_DONT_FILTER);
|
Msg(MSG_CMD,res,0,1<<SVCf_DONT_FILTER);
|
||||||
}
|
}
|
||||||
if (doc_e->de_flags & DOCEF_RIGHT_CB && doc_e->right_cb) {
|
if (doc_e->de_flags & DOCEF_RIGHT_CB && doc_e->right_cb) {
|
||||||
DocUnlock(doc);
|
DocUnlock(doc);
|
||||||
result=(*doc_e->right_cb)(doc,doc_e);
|
res=(*doc_e->right_cb)(doc,doc_e);
|
||||||
has_action=TRUE;
|
has_action=TRUE;
|
||||||
Msg(MSG_CMD,result,0,1<<SVCf_DONT_FILTER);
|
Msg(MSG_CMD,res,0,1<<SVCf_DONT_FILTER);
|
||||||
}
|
}
|
||||||
if (doc_e->de_flags & DOCEF_RIGHT_MACRO) {
|
if (doc_e->de_flags & DOCEF_RIGHT_MACRO) {
|
||||||
if (doc_e->de_flags & DOCEF_POPUP) {
|
if (doc_e->de_flags & DOCEF_POPUP) {
|
||||||
@@ -99,5 +99,5 @@ public I64 DocEntryRun(CDoc *doc,CDocEntry *doc_e,
|
|||||||
doc->cmd_U8=CH_SPACE;
|
doc->cmd_U8=CH_SPACE;
|
||||||
er_done:
|
er_done:
|
||||||
if (_has_action) *_has_action=has_action;
|
if (_has_action) *_has_action=has_action;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
+15
-15
@@ -87,22 +87,22 @@ I64 PopUpTermRight(U8 *header)
|
|||||||
|
|
||||||
I64 EdLeftClickLink(CDoc *doc,CDocEntry *doc_e)
|
I64 EdLeftClickLink(CDoc *doc,CDocEntry *doc_e)
|
||||||
{//Called with doc locked, exit unlocked
|
{//Called with doc locked, exit unlocked
|
||||||
Bool result;
|
Bool res;
|
||||||
U8 *st;
|
U8 *st;
|
||||||
if (st=DocEntryLink(doc,doc_e)) {
|
if (st=DocEntryLink(doc,doc_e)) {
|
||||||
DocUnlock(doc);
|
DocUnlock(doc);
|
||||||
if (doc_e->de_flags & DOCEF_POPUP)
|
if (doc_e->de_flags & DOCEF_POPUP)
|
||||||
result=PopUpEd(st);
|
res=PopUpEd(st);
|
||||||
else
|
else
|
||||||
result=Ed(st);
|
res=Ed(st);
|
||||||
Free(st);
|
Free(st);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
I64 TermRightClickLink(CDoc *doc,CDocEntry *doc_e)
|
I64 TermRightClickLink(CDoc *doc,CDocEntry *doc_e)
|
||||||
{//Called with doc locked, exit unlocked
|
{//Called with doc locked, exit unlocked
|
||||||
Bool send_new_line=FALSE,result=FALSE;
|
Bool send_new_line=FALSE,res=FALSE;
|
||||||
U8 *st,*st2;
|
U8 *st,*st2;
|
||||||
I64 i;
|
I64 i;
|
||||||
CEdFileName fn;
|
CEdFileName fn;
|
||||||
@@ -122,7 +122,7 @@ I64 TermRightClickLink(CDoc *doc,CDocEntry *doc_e)
|
|||||||
"#include \"%s\";\n$$PT$$$$FG$$$$BG$$",st;
|
"#include \"%s\";\n$$PT$$$$FG$$$$BG$$",st;
|
||||||
WinZBufUpdate;
|
WinZBufUpdate;
|
||||||
ExeFile(st);
|
ExeFile(st);
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
break;
|
break;
|
||||||
case RIGHT_AINCLUDE:
|
case RIGHT_AINCLUDE:
|
||||||
if (FileExtDot(st) && !FilesFindMatch(st,FILEMASK_JIT)) {
|
if (FileExtDot(st) && !FilesFindMatch(st,FILEMASK_JIT)) {
|
||||||
@@ -134,35 +134,35 @@ I64 TermRightClickLink(CDoc *doc,CDocEntry *doc_e)
|
|||||||
"Adam(\"#include \\\"%s\\\"\" );\n$$PT$$$$FG$$$$BG$$",st;
|
"Adam(\"#include \\\"%s\\\"\" );\n$$PT$$$$FG$$$$BG$$",st;
|
||||||
WinZBufUpdate;
|
WinZBufUpdate;
|
||||||
AdamFile(st,FALSE);
|
AdamFile(st,FALSE);
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
break;
|
break;
|
||||||
case RIGHT_COPY:
|
case RIGHT_COPY:
|
||||||
StrCpy(fn.name,st);
|
StrCpy(fn.name,st);
|
||||||
if (DocForm(&fn)) {
|
if (DocForm(&fn)) {
|
||||||
result=ToBool(Copy(st,fn.name));
|
res=ToBool(Copy(st,fn.name));
|
||||||
} else
|
} else
|
||||||
send_new_line=TRUE;
|
send_new_line=TRUE;
|
||||||
break;
|
break;
|
||||||
case RIGHT_MOVE:
|
case RIGHT_MOVE:
|
||||||
StrCpy(fn.name,st);
|
StrCpy(fn.name,st);
|
||||||
if (DocForm(&fn))
|
if (DocForm(&fn))
|
||||||
result=Move(st,fn.name);
|
res=Move(st,fn.name);
|
||||||
else
|
else
|
||||||
send_new_line=TRUE;
|
send_new_line=TRUE;
|
||||||
break;
|
break;
|
||||||
case RIGHT_DELETE:
|
case RIGHT_DELETE:
|
||||||
result=ToBool(Del(st));
|
res=ToBool(Del(st));
|
||||||
break;
|
break;
|
||||||
case RIGHT_TYPE:
|
case RIGHT_TYPE:
|
||||||
result=Type(st);
|
res=Type(st);
|
||||||
break;
|
break;
|
||||||
case RIGHT_ED:
|
case RIGHT_ED:
|
||||||
"Ed(\"%s\");\n$$PT$$$$FG$$$$BG$$",st;
|
"Ed(\"%s\");\n$$PT$$$$FG$$$$BG$$",st;
|
||||||
result=Ed(st);
|
res=Ed(st);
|
||||||
break;
|
break;
|
||||||
case RIGHT_PLAIN:
|
case RIGHT_PLAIN:
|
||||||
"Plain(\"%s\");\n$$PT$$$$FG$$$$BG$$",st;
|
"Plain(\"%s\");\n$$PT$$$$FG$$$$BG$$",st;
|
||||||
result=Plain(st);
|
res=Plain(st);
|
||||||
break;
|
break;
|
||||||
case RIGHT_AUTOFILE:
|
case RIGHT_AUTOFILE:
|
||||||
if (FileExtDot(st) && !FilesFindMatch(st,"*.AUT*")) {
|
if (FileExtDot(st) && !FilesFindMatch(st,"*.AUT*")) {
|
||||||
@@ -174,7 +174,7 @@ I64 TermRightClickLink(CDoc *doc,CDocEntry *doc_e)
|
|||||||
"AutoFile(\"%s\");\n$$PT$$$$FG$$$$BG$$",st;
|
"AutoFile(\"%s\");\n$$PT$$$$FG$$$$BG$$",st;
|
||||||
WinZBufUpdate;
|
WinZBufUpdate;
|
||||||
AutoFile(st);
|
AutoFile(st);
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
@@ -189,5 +189,5 @@ I64 TermRightClickLink(CDoc *doc,CDocEntry *doc_e)
|
|||||||
"$$PT$$$$FG$$$$BG$$";
|
"$$PT$$$$FG$$$$BG$$";
|
||||||
if (send_new_line)
|
if (send_new_line)
|
||||||
'\n';
|
'\n';
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
+17
-17
@@ -6,7 +6,7 @@ public Bool DocTreeFind(CDoc *haystack_doc,U8 *needle_path,
|
|||||||
{//Find registry-like tree widget start and end.
|
{//Find registry-like tree widget start and end.
|
||||||
I64 i=0,k=0;
|
I64 i=0,k=0;
|
||||||
U8 *st1=StrNew(needle_path),*st2=MAlloc(StrLen(needle_path)+1);
|
U8 *st1=StrNew(needle_path),*st2=MAlloc(StrLen(needle_path)+1);
|
||||||
Bool result=FALSE,unlock_doc=DocLock(haystack_doc);
|
Bool res=FALSE,unlock_doc=DocLock(haystack_doc);
|
||||||
CDocEntry *doc_e=haystack_doc->root.next;
|
CDocEntry *doc_e=haystack_doc->root.next;
|
||||||
if (_tree_entry) *_tree_entry=haystack_doc;
|
if (_tree_entry) *_tree_entry=haystack_doc;
|
||||||
if (_start_indent) *_start_indent=haystack_doc;
|
if (_start_indent) *_start_indent=haystack_doc;
|
||||||
@@ -35,7 +35,7 @@ public Bool DocTreeFind(CDoc *haystack_doc,U8 *needle_path,
|
|||||||
i+=doc_e->attr;
|
i+=doc_e->attr;
|
||||||
if (i<=0) {
|
if (i<=0) {
|
||||||
if (_end_indent) *_end_indent=doc_e;
|
if (_end_indent) *_end_indent=doc_e;
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -55,7 +55,7 @@ ft_done:
|
|||||||
DocUnlock(haystack_doc);
|
DocUnlock(haystack_doc);
|
||||||
Free(st1);
|
Free(st1);
|
||||||
Free(st2);
|
Free(st2);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bool DocTreeMake(CDoc *doc,U8 *path)
|
public Bool DocTreeMake(CDoc *doc,U8 *path)
|
||||||
@@ -64,7 +64,7 @@ public Bool DocTreeMake(CDoc *doc,U8 *path)
|
|||||||
U8 *st1=StrNew(path),
|
U8 *st1=StrNew(path),
|
||||||
*st2=MAlloc(StrLen(path)+1),
|
*st2=MAlloc(StrLen(path)+1),
|
||||||
*st3=StrNew(path);
|
*st3=StrNew(path);
|
||||||
Bool result=TRUE,unlock_doc=DocLock(doc);
|
Bool res=TRUE,unlock_doc=DocLock(doc);
|
||||||
CDocEntry *doc_e=doc->root.next;
|
CDocEntry *doc_e=doc->root.next;
|
||||||
doc->cur_entry=doc;
|
doc->cur_entry=doc;
|
||||||
doc->cur_col=0;
|
doc->cur_col=0;
|
||||||
@@ -85,7 +85,7 @@ public Bool DocTreeMake(CDoc *doc,U8 *path)
|
|||||||
st3=StrNew(st1);
|
st3=StrNew(st1);
|
||||||
j=i;
|
j=i;
|
||||||
if (!*st1)
|
if (!*st1)
|
||||||
result=FALSE;
|
res=FALSE;
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -95,7 +95,7 @@ public Bool DocTreeMake(CDoc *doc,U8 *path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
mt_done:
|
mt_done:
|
||||||
if (result) {
|
if (res) {
|
||||||
while (*st3) {
|
while (*st3) {
|
||||||
StrFirstRem(st3,"/",st2);
|
StrFirstRem(st3,"/",st2);
|
||||||
if (*st2) {
|
if (*st2) {
|
||||||
@@ -110,13 +110,13 @@ mt_done:
|
|||||||
Free(st1);
|
Free(st1);
|
||||||
Free(st2);
|
Free(st2);
|
||||||
Free(st3);
|
Free(st3);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#help_index "DolDoc/Compiler;Compiler"
|
#help_index "DolDoc/Compiler;Compiler"
|
||||||
public I64 ExeDoc(CDoc *doc,Bool just_load=FALSE)
|
public I64 ExeDoc(CDoc *doc,Bool just_load=FALSE)
|
||||||
{//JIT Compile and execute a document.
|
{//JIT Compile and execute a document.
|
||||||
I64 result;
|
I64 res;
|
||||||
Bool okay=TRUE,unlock_doc=DocLock(doc);
|
Bool okay=TRUE,unlock_doc=DocLock(doc);
|
||||||
CCmpCtrl *cc=CmpCtrlNew(,CCF_DONT_FREE_BUF);
|
CCmpCtrl *cc=CmpCtrlNew(,CCF_DONT_FREE_BUF);
|
||||||
if (just_load)
|
if (just_load)
|
||||||
@@ -127,12 +127,12 @@ public I64 ExeDoc(CDoc *doc,Bool just_load=FALSE)
|
|||||||
LexAttachDoc(cc,,doc);
|
LexAttachDoc(cc,,doc);
|
||||||
try {
|
try {
|
||||||
Lex(cc);
|
Lex(cc);
|
||||||
result=ExeCmdLine(cc);
|
res=ExeCmdLine(cc);
|
||||||
} catch {
|
} catch {
|
||||||
if (Fs->except_ch=='Compiler' || Fs->except_ch=='Break') {
|
if (Fs->except_ch=='Compiler' || Fs->except_ch=='Break') {
|
||||||
Fs->catch_except=TRUE;
|
Fs->catch_except=TRUE;
|
||||||
okay=FALSE;
|
okay=FALSE;
|
||||||
result=0;
|
res=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QueRem(cc);
|
QueRem(cc);
|
||||||
@@ -140,7 +140,7 @@ public I64 ExeDoc(CDoc *doc,Bool just_load=FALSE)
|
|||||||
CmpCtrlDel(cc); //TODO: can crash
|
CmpCtrlDel(cc); //TODO: can crash
|
||||||
if (unlock_doc)
|
if (unlock_doc)
|
||||||
DocUnlock(doc);
|
DocUnlock(doc);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public I64 DocTreeBranchExe(CDoc *doc,U8 *path)
|
public I64 DocTreeBranchExe(CDoc *doc,U8 *path)
|
||||||
@@ -148,22 +148,22 @@ public I64 DocTreeBranchExe(CDoc *doc,U8 *path)
|
|||||||
CDoc *doc2;
|
CDoc *doc2;
|
||||||
Bool unlock_doc=DocLock(doc);
|
Bool unlock_doc=DocLock(doc);
|
||||||
CDocEntry *tree_branch,*start_indent,*end_indent;
|
CDocEntry *tree_branch,*start_indent,*end_indent;
|
||||||
I64 result=0;
|
I64 res=0;
|
||||||
if (DocTreeFind(doc,path,&tree_branch,&start_indent,&end_indent)) {
|
if (DocTreeFind(doc,path,&tree_branch,&start_indent,&end_indent)) {
|
||||||
doc2=DocCopy(doc,tree_branch,end_indent);
|
doc2=DocCopy(doc,tree_branch,end_indent);
|
||||||
result=ExeDoc(doc2);
|
res=ExeDoc(doc2);
|
||||||
DocDel(doc2);
|
DocDel(doc2);
|
||||||
}
|
}
|
||||||
if (unlock_doc)
|
if (unlock_doc)
|
||||||
DocUnlock(doc);
|
DocUnlock(doc);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public I64 ExeTreeBranch(U8 *registry_file,U8 *path)
|
public I64 ExeTreeBranch(U8 *registry_file,U8 *path)
|
||||||
{//JIT Compile and execute a specified branch in a specified file.
|
{//JIT Compile and execute a specified branch in a specified file.
|
||||||
I64 result;
|
I64 res;
|
||||||
CDoc *doc=DocRead(registry_file);
|
CDoc *doc=DocRead(registry_file);
|
||||||
result=DocTreeBranchExe(doc,path);
|
res=DocTreeBranchExe(doc,path);
|
||||||
DocDel(doc);
|
DocDel(doc);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -164,13 +164,13 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
|||||||
Bool *_quote,U8 **_html_link)
|
Bool *_quote,U8 **_html_link)
|
||||||
{
|
{
|
||||||
CEdFileLink *e=CAlloc(sizeof(CEdFileLink));
|
CEdFileLink *e=CAlloc(sizeof(CEdFileLink));
|
||||||
Bool result=FALSE;
|
Bool res=FALSE;
|
||||||
if (type>=0) {
|
if (type>=0) {
|
||||||
e->num=1;
|
e->num=1;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case LK_FILE:
|
case LK_FILE:
|
||||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
if (!*e->tag)
|
if (!*e->tag)
|
||||||
*_tag=StrNew(e->file);
|
*_tag=StrNew(e->file);
|
||||||
else
|
else
|
||||||
@@ -180,7 +180,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
|||||||
break;
|
break;
|
||||||
case LK_PLAIN:
|
case LK_PLAIN:
|
||||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
if (!*e->tag)
|
if (!*e->tag)
|
||||||
*_tag=StrNew(e->file);
|
*_tag=StrNew(e->file);
|
||||||
else
|
else
|
||||||
@@ -190,7 +190,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
|||||||
break;
|
break;
|
||||||
case LK_FILE_ANCHOR:
|
case LK_FILE_ANCHOR:
|
||||||
if (DocForm(e,"CEdFileAnchorLink",,,ctrl_L_footer)) {
|
if (DocForm(e,"CEdFileAnchorLink",,,ctrl_L_footer)) {
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
if (!*e->tag)
|
if (!*e->tag)
|
||||||
*_tag=StrNew(e->aux);
|
*_tag=StrNew(e->aux);
|
||||||
else
|
else
|
||||||
@@ -200,7 +200,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
|||||||
break;
|
break;
|
||||||
case LK_FILE_FIND:
|
case LK_FILE_FIND:
|
||||||
if (DocForm(e,"CEdFileFindLink",,,ctrl_L_footer)) {
|
if (DocForm(e,"CEdFileFindLink",,,ctrl_L_footer)) {
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
if (e->num==1) {
|
if (e->num==1) {
|
||||||
if (!*e->tag)
|
if (!*e->tag)
|
||||||
*_tag=StrNew(e->aux);
|
*_tag=StrNew(e->aux);
|
||||||
@@ -218,7 +218,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
|||||||
break;
|
break;
|
||||||
case LK_PLAIN_FIND:
|
case LK_PLAIN_FIND:
|
||||||
if (DocForm(e,"CEdFileFindLink",,,ctrl_L_footer)) {
|
if (DocForm(e,"CEdFileFindLink",,,ctrl_L_footer)) {
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
if (e->num==1) {
|
if (e->num==1) {
|
||||||
if (!*e->tag)
|
if (!*e->tag)
|
||||||
*_tag=StrNew(e->aux);
|
*_tag=StrNew(e->aux);
|
||||||
@@ -236,7 +236,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
|||||||
break;
|
break;
|
||||||
case LK_FILE_LINE:
|
case LK_FILE_LINE:
|
||||||
if (DocForm(e,"CEdFileLineLink",,,ctrl_L_footer)) {
|
if (DocForm(e,"CEdFileLineLink",,,ctrl_L_footer)) {
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
if (!*e->tag)
|
if (!*e->tag)
|
||||||
*_tag=StrNew(e->file);
|
*_tag=StrNew(e->file);
|
||||||
else
|
else
|
||||||
@@ -246,7 +246,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
|||||||
break;
|
break;
|
||||||
case LK_PLAIN_LINE:
|
case LK_PLAIN_LINE:
|
||||||
if (DocForm(e,"CEdFileLineLink",,,ctrl_L_footer)) {
|
if (DocForm(e,"CEdFileLineLink",,,ctrl_L_footer)) {
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
if (!*e->tag)
|
if (!*e->tag)
|
||||||
*_tag=StrNew(e->file);
|
*_tag=StrNew(e->file);
|
||||||
else
|
else
|
||||||
@@ -256,7 +256,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
|||||||
break;
|
break;
|
||||||
case LK_MAN_PAGE:
|
case LK_MAN_PAGE:
|
||||||
if (DocForm(e,"CEdManPageLink",,,ctrl_L_footer)) {
|
if (DocForm(e,"CEdManPageLink",,,ctrl_L_footer)) {
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
if (!*e->tag)
|
if (!*e->tag)
|
||||||
*_tag=StrNew(e->aux);
|
*_tag=StrNew(e->aux);
|
||||||
else
|
else
|
||||||
@@ -266,7 +266,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
|||||||
break;
|
break;
|
||||||
case LK_PLACE_ANCHOR:
|
case LK_PLACE_ANCHOR:
|
||||||
if (DocForm(e,"CEdPlaceAnchor",,,ctrl_L_footer)) {
|
if (DocForm(e,"CEdPlaceAnchor",,,ctrl_L_footer)) {
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
if (!*e->tag) {
|
if (!*e->tag) {
|
||||||
if (e->hide)
|
if (e->hide)
|
||||||
*_tag=StrNew("");
|
*_tag=StrNew("");
|
||||||
@@ -279,7 +279,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
|||||||
break;
|
break;
|
||||||
case LK_BIBLE_FIND:
|
case LK_BIBLE_FIND:
|
||||||
if (DocForm(e,"CEdBibleLink",,,ctrl_L_footer)) {
|
if (DocForm(e,"CEdBibleLink",,,ctrl_L_footer)) {
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
if (!*e->tag)
|
if (!*e->tag)
|
||||||
*_tag=MStrPrint("%Z,%s",e->book,"ST_BIBLE_BOOKS",e->aux);
|
*_tag=MStrPrint("%Z,%s",e->book,"ST_BIBLE_BOOKS",e->aux);
|
||||||
else
|
else
|
||||||
@@ -290,7 +290,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
|||||||
case LK_DEF:
|
case LK_DEF:
|
||||||
e->num=-1;
|
e->num=-1;
|
||||||
if (DocForm(e,"CEdDefLink",,,ctrl_L_footer)) {
|
if (DocForm(e,"CEdDefLink",,,ctrl_L_footer)) {
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
if (!*e->tag)
|
if (!*e->tag)
|
||||||
*_tag=StrNew(e->aux);
|
*_tag=StrNew(e->aux);
|
||||||
else
|
else
|
||||||
@@ -304,7 +304,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
|||||||
break;
|
break;
|
||||||
case LK_HELP_INDEX:
|
case LK_HELP_INDEX:
|
||||||
if (DocForm(e,"CEdManPageLink",,,ctrl_L_footer)) {
|
if (DocForm(e,"CEdManPageLink",,,ctrl_L_footer)) {
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
if (!*e->tag)
|
if (!*e->tag)
|
||||||
*_tag=StrNew(e->aux);
|
*_tag=StrNew(e->aux);
|
||||||
else
|
else
|
||||||
@@ -315,7 +315,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
|||||||
case LK_ADDR:
|
case LK_ADDR:
|
||||||
e->num=DFT_ADDR_LINK_BIN_SIZE;
|
e->num=DFT_ADDR_LINK_BIN_SIZE;
|
||||||
if (DocForm(e,"CEdAddrLink",,,ctrl_L_footer)) {
|
if (DocForm(e,"CEdAddrLink",,,ctrl_L_footer)) {
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
if (e->num==DFT_ADDR_LINK_BIN_SIZE) {
|
if (e->num==DFT_ADDR_LINK_BIN_SIZE) {
|
||||||
if (!*e->tag)
|
if (!*e->tag)
|
||||||
*_tag=StrNew(e->aux);
|
*_tag=StrNew(e->aux);
|
||||||
@@ -346,7 +346,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
|||||||
else
|
else
|
||||||
*_quote=FALSE;
|
*_quote=FALSE;
|
||||||
Free(e);
|
Free(e);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 EdInsLink()
|
U0 EdInsLink()
|
||||||
@@ -1092,15 +1092,15 @@ class CEdMenuSprite
|
|||||||
|
|
||||||
U8 *EdSpriteLink(Bool *_pop_up,U8 **_html_link)
|
U8 *EdSpriteLink(Bool *_pop_up,U8 **_html_link)
|
||||||
{
|
{
|
||||||
U8 *result=NULL,*tag=NULL,*link=NULL;
|
U8 *res=NULL,*tag=NULL,*link=NULL;
|
||||||
Bool quote=FALSE;
|
Bool quote=FALSE;
|
||||||
I64 type=PopUpLinkType(FALSE);
|
I64 type=PopUpLinkType(FALSE);
|
||||||
*_html_link=NULL;
|
*_html_link=NULL;
|
||||||
if (type>=0 && GetLink(type,&tag,&link,_pop_up,"e,_html_link))
|
if (type>=0 && GetLink(type,&tag,&link,_pop_up,"e,_html_link))
|
||||||
result=MStrPrint("\"%Q\",A=\"%Q\"",tag,link);
|
res=MStrPrint("\"%Q\",A=\"%Q\"",tag,link);
|
||||||
Free(tag);
|
Free(tag);
|
||||||
Free(link);
|
Free(link);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U8 *EdSprite(I64 bin_num)
|
U8 *EdSprite(I64 bin_num)
|
||||||
|
|||||||
+27
-21
@@ -143,7 +143,7 @@ U0 BibleInit()
|
|||||||
|
|
||||||
public U8 *BibleLine2Verse(I64 line,I64 separate_ch=CH_SPACE)
|
public U8 *BibleLine2Verse(I64 line,I64 separate_ch=CH_SPACE)
|
||||||
{//Line number to verse str, Malloc()ed.
|
{//Line number to verse str, Malloc()ed.
|
||||||
//Separate with <SPACE> or ','.
|
//Separate with <SPACE> or ','. If you pass '%', it uses "%20".
|
||||||
CDoc *doc;
|
CDoc *doc;
|
||||||
CDocEntry *doc_e;
|
CDocEntry *doc_e;
|
||||||
I64 i=0,cnt=DefineCnt("ST_BIBLE_BOOKS"),start=0,last_start=0;
|
I64 i=0,cnt=DefineCnt("ST_BIBLE_BOOKS"),start=0,last_start=0;
|
||||||
@@ -167,7 +167,10 @@ public U8 *BibleLine2Verse(I64 line,I64 separate_ch=CH_SPACE)
|
|||||||
while ('0'<=*ptr2<='9' || *ptr2==':')
|
while ('0'<=*ptr2<='9' || *ptr2==':')
|
||||||
ptr2++;
|
ptr2++;
|
||||||
*ptr2=0;
|
*ptr2=0;
|
||||||
ptr=MStrPrint("%Z%c%s",i,"ST_BIBLE_BOOKS",separate_ch,ptr);
|
if (separate_ch=='%')
|
||||||
|
ptr=MStrPrint("%Z%%20%s",i,"ST_BIBLE_BOOKS",ptr);
|
||||||
|
else
|
||||||
|
ptr=MStrPrint("%Z%c%s",i,"ST_BIBLE_BOOKS",separate_ch,ptr);
|
||||||
} else {
|
} else {
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
doc_e=doc_e->last;
|
doc_e=doc_e->last;
|
||||||
@@ -195,7 +198,10 @@ public U8 *BibleLine2Verse(I64 line,I64 separate_ch=CH_SPACE)
|
|||||||
while ('0'<=*ptr2<='9')
|
while ('0'<=*ptr2<='9')
|
||||||
ptr2++;
|
ptr2++;
|
||||||
*ptr2=0;
|
*ptr2=0;
|
||||||
ptr=MStrPrint("%Z%c%s",i,"ST_BIBLE_BOOKS",separate_ch,ptr);
|
if (separate_ch=='%')
|
||||||
|
ptr=MStrPrint("%Z%%20%s",i,"ST_BIBLE_BOOKS",ptr);
|
||||||
|
else
|
||||||
|
ptr=MStrPrint("%Z%c%s",i,"ST_BIBLE_BOOKS",separate_ch,ptr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -272,8 +278,8 @@ public U0 BibleVerse(CDoc *doc_out=NULL,U8 *verse,I64 lines)
|
|||||||
|
|
||||||
public CDoc *BibleDoc()
|
public CDoc *BibleDoc()
|
||||||
{//Return Bible as DolDoc with trees.
|
{//Return Bible as DolDoc with trees.
|
||||||
CDoc *result=DocRead(BIBLE_FILENAME);
|
CDoc *res=DocRead(BIBLE_FILENAME);
|
||||||
CDocEntry *doc_e=result->root.next,*doc_e1;
|
CDocEntry *doc_e=res->root.next,*doc_e1;
|
||||||
Bool open_chapter=FALSE;
|
Bool open_chapter=FALSE;
|
||||||
U8 *ptr=Define("ST_BIBLE_BOOK_LINES");
|
U8 *ptr=Define("ST_BIBLE_BOOK_LINES");
|
||||||
I64 book,book_cnt=DefineCnt("ST_BIBLE_BOOK_LINES")-1,
|
I64 book,book_cnt=DefineCnt("ST_BIBLE_BOOK_LINES")-1,
|
||||||
@@ -283,47 +289,47 @@ public CDoc *BibleDoc()
|
|||||||
for (book=0;book<book_cnt;book++) {
|
for (book=0;book<book_cnt;book++) {
|
||||||
while (doc_e->y+1<line) {
|
while (doc_e->y+1<line) {
|
||||||
doc_e1=doc_e->next;
|
doc_e1=doc_e->next;
|
||||||
DocEntryDel(result,doc_e);
|
DocEntryDel(res,doc_e);
|
||||||
doc_e=doc_e1;
|
doc_e=doc_e1;
|
||||||
}
|
}
|
||||||
result->cur_entry=doc_e;
|
res->cur_entry=doc_e;
|
||||||
result->cur_col=0;
|
res->cur_col=0;
|
||||||
DocPrint(result,"$$TR,\"%Z\"$$\n$$ID,2$$",book,"ST_BIBLE_BOOKS");
|
DocPrint(res,"$$TR,\"%Z\"$$\n$$ID,2$$",book,"ST_BIBLE_BOOKS");
|
||||||
line=Str2I64(ptr,,&ptr);
|
line=Str2I64(ptr,,&ptr);
|
||||||
ptr++;
|
ptr++;
|
||||||
chapter=1;
|
chapter=1;
|
||||||
while (doc_e->y+1<line) {
|
while (doc_e->y+1<line) {
|
||||||
doc_e1=doc_e->next;
|
doc_e1=doc_e->next;
|
||||||
if (doc_e->type_u8==DOCT_TEXT && StrMatch(":1 ",doc_e->tag)) {
|
if (doc_e->type_u8==DOCT_TEXT && StrMatch(":1 ",doc_e->tag)) {
|
||||||
result->cur_entry=doc_e;
|
res->cur_entry=doc_e;
|
||||||
result->cur_col=0;
|
res->cur_col=0;
|
||||||
if (open_chapter) {
|
if (open_chapter) {
|
||||||
DocPrint(result,"$$ID,-2$$");
|
DocPrint(res,"$$ID,-2$$");
|
||||||
open_chapter=FALSE;
|
open_chapter=FALSE;
|
||||||
}
|
}
|
||||||
DocPrint(result,"$$TR,\"%d\"$$\n$$ID,2$$",chapter++);
|
DocPrint(res,"$$TR,\"%d\"$$\n$$ID,2$$",chapter++);
|
||||||
open_chapter=TRUE;
|
open_chapter=TRUE;
|
||||||
} else if (chapter==1) {
|
} else if (chapter==1) {
|
||||||
doc_e1=doc_e->next;
|
doc_e1=doc_e->next;
|
||||||
DocEntryDel(result,doc_e);
|
DocEntryDel(res,doc_e);
|
||||||
doc_e=doc_e1;
|
doc_e=doc_e1;
|
||||||
}
|
}
|
||||||
doc_e=doc_e1;
|
doc_e=doc_e1;
|
||||||
}
|
}
|
||||||
result->cur_entry=doc_e;
|
res->cur_entry=doc_e;
|
||||||
result->cur_col=0;
|
res->cur_col=0;
|
||||||
if (open_chapter) {
|
if (open_chapter) {
|
||||||
DocPrint(result,"$$ID,-2$$");
|
DocPrint(res,"$$ID,-2$$");
|
||||||
open_chapter=FALSE;
|
open_chapter=FALSE;
|
||||||
}
|
}
|
||||||
DocPrint(result,"$$ID,-2$$");
|
DocPrint(res,"$$ID,-2$$");
|
||||||
}
|
}
|
||||||
while (doc_e!=result) {
|
while (doc_e!=res) {
|
||||||
doc_e1=doc_e->next;
|
doc_e1=doc_e->next;
|
||||||
DocEntryDel(result,doc_e);
|
DocEntryDel(res,doc_e);
|
||||||
doc_e=doc_e1;
|
doc_e=doc_e1;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public U0 BibleView()
|
public U0 BibleView()
|
||||||
|
|||||||
@@ -72,10 +72,10 @@ U0 GodDoodleHexIns(U8 *st)
|
|||||||
I64 GodDoodleBits(I64 num_bits)
|
I64 GodDoodleBits(I64 num_bits)
|
||||||
{
|
{
|
||||||
U8 b;
|
U8 b;
|
||||||
I64 result=0;
|
I64 res=0;
|
||||||
while (num_bits) {
|
while (num_bits) {
|
||||||
if (FifoU8Rem(god.doodle_fifo,&b)) {
|
if (FifoU8Rem(god.doodle_fifo,&b)) {
|
||||||
result=result<<1+b;
|
res=res<<1+b;
|
||||||
num_bits--;
|
num_bits--;
|
||||||
} else {
|
} else {
|
||||||
god.doodle_ch=GetChar(,FALSE);
|
god.doodle_ch=GetChar(,FALSE);
|
||||||
@@ -90,7 +90,7 @@ I64 GodDoodleBits(I64 num_bits)
|
|||||||
GodDoodleBitsIns(GOD_GOOD_BITS,KbdMouseEvtTime>>GOD_BAD_BITS);
|
GodDoodleBitsIns(GOD_GOOD_BITS,KbdMouseEvtTime>>GOD_BAD_BITS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public U8 *GodDoodleSprite(U8 *hex=NULL)
|
public U8 *GodDoodleSprite(U8 *hex=NULL)
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
$FG,5$$TX+CX,"The Purpose of Life"$$FG$
|
$FG,5$$TX+CX,"The Purpose of Life"$$FG$
|
||||||
|
|
||||||
$WW,1$The Catholic purpose of life is to know God, love God and obey God.$FG$ Pope Francis said it was "to serve the other." I am High Priest of God's official temple and I say the purpose of life is to do continual offerings to God like Cain and Abel and enjoy God's response. Francis has a charity; I have a church. Jesus said loving God was more important than loving neighbor. $LK,"Matthew,22:36",A="BF:Matthew,22:36"$ And, He did not say with half your brain behind your back.
|
$WW,1$The Catholic purpose of life is to know God, love God and obey God.$FG$ Pope Francis said it was "to serve the other." I am High Priest of God's official temple and I say the purpose of life is to do continual offerings to God like Cain and Abel and enjoy God's response. Francis has a charity; I have a church. Jesus said loving God was more important than loving neighbor. $LK,"Matthew,22:35-40",A="BF:Matthew,22:35-40"$ And, He did not say with half your brain behind your back.
|
||||||
|
|
||||||
You don't know God. $LK,"1 Chronicles,28:9",A="BF:1 Chronicles,28:9"$, $LK,"Matthew,11:27",A="BF:Matthew,11:27"$, $LK,"Luke,13:25",A="BF:Luke,13:25"$, $LK,"1 Samuel,3:7",A="BF:1 Samuel,3:7"$ You must talk with God to know Him. $LK,"Matthew,6:6",A="BF:Matthew,6:6"$ Seek Him by taking the initiative. $LK,"Luke,11:9",A="BF:Luke,11:9"$, $LK,"Isaiah,30:2",A="BF:Isaiah,30:2"$
|
You don't know God. $LK,"1 Chronicles,28:9-9",A="BF:1 Chronicles,28:9-9"$, $LK,"Matthew,11:27-27",A="BF:Matthew,11:27-27"$, $LK,"Luke,13:25-27",A="BF:Luke,13:25-27"$, $LK,"1 Samuel,3:6-8",A="BF:1 Samuel,3:6-8"$ You must talk with God to know Him. With Samuel, supposedly, God took the initiative, but I think that is the exception. Seek the Lord by taking the initiative. $LK,"Luke,11:9-10",A="BF:Luke,11:9-10"$, $LK,"Isaiah,30:1-2",A="BF:Isaiah,30:1-2"$
|
||||||
|
|
||||||
There's something obviously different about people in the Bible compared to people today -- God talked! Also, the people in the Bible were obsessed with doing offerings all the time. It is required that you do offerings before God will talk. Did the people in the Bible hear voices? Maybe. More likely, they used occult techniques such as an oracle. $LK,"1 Kings,6:20",A="BF:1 Kings,6:20"$ Have you heard of "tongues?" $LK,"1 Corinthians,14:1",A="BF:1 Corinthians,14:1"$ The idea is, you let yourself be puppeted by a spirit, so you say things. You try to get a spirit -- the Holy Spirit -- to talk. You might as well use a Ouija board. However, it turns-out that a Ouija board is bad for technical reasons. A really good technique is just randomly opening a book. God told me in an oracle that it is a covenant that you hold-up your end of the conversation.
|
There's something obviously different about people in the Bible compared to people today -- God talked! Also, the people in the Bible were obsessed with doing offerings all the time. It is required that you do offerings before God will talk. Did the people in the Bible hear voices? Maybe. More likely, they used occult techniques such as an oracle. $LK,"1 Kings,6:20-23",A="BF:1 Kings,6:20-23"$ Have you heard of "tongues?" $LK,"1 Corinthians,14:1-40",A="BF:1 Corinthians,14:1-40"$ The idea is, you let yourself be puppeted by a spirit, so you say things. You try to get a spirit -- the Holy Spirit -- to talk. You might as well use a Ouija board. However, it turns-out that a Ouija board is bad for technical reasons. A really good technique is just randomly opening a book. God told me in an oracle that it is a covenant that you hold-up your end of the conversation.
|
||||||
|
|
||||||
You can't tell if God's talking unless you have a context of conversation, but, more importantly, you are commanded to do an offering of love, like communion preparation. $LK,"1 Corinthians,11:27",A="BF:1 Corinthians,11:27"$ When you pick a greeting card for someone, that is love effort. If you expect God to put effort toward you, you must put effort toward Him. God said, "honest measures" applies between your offering of love and His response, like a fair barter. You get out of prayer what you put into it. God wants praise, hymns, or whatever you think He might want. Try and see, like Cain and Abel. $LK,"Genesis,4:1",A="BF:Genesis,4:1"$, $LK,"Ephesians,5:10",A="BF:Ephesians,5:10"$ God told Cain his offering was not good and told him to try again. Cain really loved God! Can you imagine being so heart-broken?
|
You can't tell if God's talking unless you have a context of conversation, but, more importantly, you are commanded to do an offering of love, like communion preparation. $LK,"1 Corinthians,11:27",A="BF:1 Corinthians,11:27"$ When you pick a greeting card for someone, that is love effort. If you expect God to put effort toward you, you must put effort toward Him. God said, "honest measures" applies between your offering of love and His response, like a fair barter. You get out of prayer what you put into it. God wants praise, hymns, or whatever you think He might want. Try and see, like Cain and Abel. $LK,"Genesis,4:1",A="BF:Genesis,4:1"$, $LK,"Ephesians,5:10",A="BF:Ephesians,5:10"$ God told Cain his offering was not good and told him to try again. Cain really loved God! Can you imagine being so heart-broken?
|
||||||
|
|
||||||
|
|||||||
@@ -62,15 +62,15 @@ public U0 GodHexIns(U8 *st)
|
|||||||
public I64 GodBits(I64 num_bits,U8 *msg=NULL)
|
public I64 GodBits(I64 num_bits,U8 *msg=NULL)
|
||||||
{//Return N bits. If low on entropy pop-up okay.
|
{//Return N bits. If low on entropy pop-up okay.
|
||||||
U8 b;
|
U8 b;
|
||||||
I64 result=0;
|
I64 res=0;
|
||||||
while (num_bits) {
|
while (num_bits) {
|
||||||
if (FifoU8Rem(god.fifo,&b)) {
|
if (FifoU8Rem(god.fifo,&b)) {
|
||||||
result=result<<1+b;
|
res=res<<1+b;
|
||||||
num_bits--;
|
num_bits--;
|
||||||
} else
|
} else
|
||||||
GodBitsIns(GOD_GOOD_BITS,GodPick(msg));
|
GodBitsIns(GOD_GOOD_BITS,GodPick(msg));
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public I64 GodInit(U8 *files_find_mask="/Adam/God/Vocab.TXT*",U8 *fu_flags=NULL)
|
public I64 GodInit(U8 *files_find_mask="/Adam/God/Vocab.TXT*",U8 *fu_flags=NULL)
|
||||||
|
|||||||
+65
-65
@@ -619,7 +619,7 @@ U8 *GrBitMap1ToBitMap8(U8 *dst,U8 *src,I64 src_size,I64 bkcolor)
|
|||||||
public CDC *DCExtract(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2,
|
public CDC *DCExtract(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2,
|
||||||
CTask *task=NULL)
|
CTask *task=NULL)
|
||||||
{//Extract new device context rect from device context.
|
{//Extract new device context rect from device context.
|
||||||
CDC *result;
|
CDC *res;
|
||||||
CTask *win_task;
|
CTask *win_task;
|
||||||
if (x1>x2) SwapI64(&x1,&x2);
|
if (x1>x2) SwapI64(&x1,&x2);
|
||||||
if (y1>y2) SwapI64(&y1,&y2);
|
if (y1>y2) SwapI64(&y1,&y2);
|
||||||
@@ -630,10 +630,10 @@ public CDC *DCExtract(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2,
|
|||||||
x2+=win_task->pix_left+win_task->scroll_x;
|
x2+=win_task->pix_left+win_task->scroll_x;
|
||||||
y2+=win_task->pix_top +win_task->scroll_y;
|
y2+=win_task->pix_top +win_task->scroll_y;
|
||||||
}
|
}
|
||||||
result=DCNew(x2-x1+1,y2-y1+1,task);
|
res=DCNew(x2-x1+1,y2-y1+1,task);
|
||||||
DCFill(result);
|
DCFill(res);
|
||||||
GrBlot(result,-x1,-y1,dc);
|
GrBlot(res,-x1,-y1,dc);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#help_index "Graphics/Char;Char/Graphics"
|
#help_index "Graphics/Char;Char/Graphics"
|
||||||
@@ -862,10 +862,10 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
|||||||
|
|
||||||
I64 GrPutS(CDC *dc=gr.dc,I64 x,I64 y,U8 *_s)
|
I64 GrPutS(CDC *dc=gr.dc,I64 x,I64 y,U8 *_s)
|
||||||
{//Use $LK,"GrPrint",A="MN:GrPrint"$()
|
{//Use $LK,"GrPrint",A="MN:GrPrint"$()
|
||||||
I64 x0,ch,result;
|
I64 x0,ch,res;
|
||||||
if (!_s) return 0;
|
if (!_s) return 0;
|
||||||
x0=x;
|
x0=x;
|
||||||
result=0;
|
res=0;
|
||||||
while (ch=*_s++) {
|
while (ch=*_s++) {
|
||||||
if (ch=='\n') {
|
if (ch=='\n') {
|
||||||
x=x0;
|
x=x0;
|
||||||
@@ -873,20 +873,20 @@ I64 GrPutS(CDC *dc=gr.dc,I64 x,I64 y,U8 *_s)
|
|||||||
} else if (ch=='\t')
|
} else if (ch=='\t')
|
||||||
x=x0+CeilU64(x-x0+FONT_WIDTH,8*FONT_WIDTH);
|
x=x0+CeilU64(x-x0+FONT_WIDTH,8*FONT_WIDTH);
|
||||||
else {
|
else {
|
||||||
result+=GrPutChar(dc,x,y,ch);
|
res+=GrPutChar(dc,x,y,ch);
|
||||||
x+=FONT_WIDTH;
|
x+=FONT_WIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
I64 GrVPutS(CDC *dc=gr.dc,I64 x,I64 y,U8 *_s)
|
I64 GrVPutS(CDC *dc=gr.dc,I64 x,I64 y,U8 *_s)
|
||||||
{//Vertical Text. Use $LK,"GrVPrint",A="MN:GrVPrint"$()
|
{//Vertical Text. Use $LK,"GrVPrint",A="MN:GrVPrint"$()
|
||||||
I64 y0,result;
|
I64 y0,res;
|
||||||
U8 buf[2];
|
U8 buf[2];
|
||||||
if (!_s) return 0;
|
if (!_s) return 0;
|
||||||
y0=y;
|
y0=y;
|
||||||
result=0;
|
res=0;
|
||||||
|
|
||||||
buf[1]=0;
|
buf[1]=0;
|
||||||
while (*buf=*_s++) {
|
while (*buf=*_s++) {
|
||||||
@@ -896,36 +896,36 @@ I64 GrVPutS(CDC *dc=gr.dc,I64 x,I64 y,U8 *_s)
|
|||||||
} else if (*buf=='\t')
|
} else if (*buf=='\t')
|
||||||
y=y0+CeilU64(y-y0+FONT_HEIGHT,8*FONT_HEIGHT);
|
y=y0+CeilU64(y-y0+FONT_HEIGHT,8*FONT_HEIGHT);
|
||||||
else {
|
else {
|
||||||
result+=GrPutS(dc,x,y,buf);
|
res+=GrPutS(dc,x,y,buf);
|
||||||
y+=FONT_HEIGHT;
|
y+=FONT_HEIGHT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public I64 GrPrint(CDC *dc=gr.dc,I64 x,I64 y,U8 *fmt,...)
|
public I64 GrPrint(CDC *dc=gr.dc,I64 x,I64 y,U8 *fmt,...)
|
||||||
{//2D. Clipping but not transformation.
|
{//2D. Clipping but not transformation.
|
||||||
I64 result;
|
I64 res;
|
||||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
||||||
result=GrPutS(dc,x,y,buf);
|
res=GrPutS(dc,x,y,buf);
|
||||||
Free(buf);
|
Free(buf);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public I64 GrVPrint(CDC *dc=gr.dc,I64 x,I64 y,U8 *fmt,...)
|
public I64 GrVPrint(CDC *dc=gr.dc,I64 x,I64 y,U8 *fmt,...)
|
||||||
{//2D. Vertical text. Clipping but not transformation.
|
{//2D. Vertical text. Clipping but not transformation.
|
||||||
I64 result;
|
I64 res;
|
||||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
||||||
result=GrVPutS(dc,x,y,buf);
|
res=GrVPutS(dc,x,y,buf);
|
||||||
Free(buf);
|
Free(buf);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#help_index "Graphics"
|
#help_index "Graphics"
|
||||||
public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||||
{//2D. Width Height. Clipping but not transformation.
|
{//2D. Width Height. Clipping but not transformation.
|
||||||
//Returns cnt of pixs changed.
|
//Returns cnt of pixs changed.
|
||||||
I64 i,result=0,j,k1,kk1,w1,h1,w2,h2,dist,
|
I64 i,res=0,j,k1,kk1,w1,h1,w2,h2,dist,
|
||||||
leading_pixels,original_leading_pixels,whole_I64s,
|
leading_pixels,original_leading_pixels,whole_I64s,
|
||||||
trailing_pixels,leading_pixel_mask,trailing_pixel_mask,
|
trailing_pixels,leading_pixel_mask,trailing_pixel_mask,
|
||||||
win_z_buf_line_inc,win_z_buf_line_dec,win_z_num,color_mask;
|
win_z_buf_line_inc,win_z_buf_line_dec,win_z_num,color_mask;
|
||||||
@@ -1009,13 +1009,13 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
|||||||
trailing_pixel_mask=gr.to_8_bits[0xFF<<trailing_pixels&0xFF];
|
trailing_pixel_mask=gr.to_8_bits[0xFF<<trailing_pixels&0xFF];
|
||||||
if (leading_pixels+trailing_pixels>w2-w1) {
|
if (leading_pixels+trailing_pixels>w2-w1) {
|
||||||
leading_pixel_mask|=trailing_pixel_mask;
|
leading_pixel_mask|=trailing_pixel_mask;
|
||||||
leading_pixels=w2-w1; //Correct so it's right for result.
|
leading_pixels=w2-w1; //Correct so it's right for res.
|
||||||
trailing_pixels=0;
|
trailing_pixels=0;
|
||||||
}
|
}
|
||||||
if (color.c0.rop==ROPB_COLLISION) {//TODO: Might want to check win_z_buf
|
if (color.c0.rop==ROPB_COLLISION) {//TODO: Might want to check win_z_buf
|
||||||
color =dc->bkcolor.c0.color;
|
color =dc->bkcolor.c0.color;
|
||||||
k1=(h1+y)*dc->width_internal+x;
|
k1=(h1+y)*dc->width_internal+x;
|
||||||
result=-dc->collision_cnt;
|
res=-dc->collision_cnt;
|
||||||
for (j=h2-h1;j;j--) {
|
for (j=h2-h1;j;j--) {
|
||||||
for (i=w1;i<w2;i++) {
|
for (i=w1;i<w2;i++) {
|
||||||
c=dc->body[k1+i];
|
c=dc->body[k1+i];
|
||||||
@@ -1024,7 +1024,7 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
|||||||
}
|
}
|
||||||
k1+=dc->width_internal;
|
k1+=dc->width_internal;
|
||||||
}
|
}
|
||||||
result+=dc->collision_cnt;
|
res+=dc->collision_cnt;
|
||||||
} else {
|
} else {
|
||||||
if (!(dc->flags & DCF_SCREEN_BITMAP) || dc->flags&DCF_ON_TOP)
|
if (!(dc->flags & DCF_SCREEN_BITMAP) || dc->flags&DCF_ON_TOP)
|
||||||
win_z_buf_ptr=NULL;
|
win_z_buf_ptr=NULL;
|
||||||
@@ -1051,7 +1051,7 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
|||||||
case ROPB_EQU:
|
case ROPB_EQU:
|
||||||
case ROPB_MONO:
|
case ROPB_MONO:
|
||||||
if (win_z_buf_ptr) {
|
if (win_z_buf_ptr) {
|
||||||
result=0;
|
res=0;
|
||||||
for (j=h1;j<h2;j++) {
|
for (j=h1;j<h2;j++) {
|
||||||
color_mask=gr.to_8_colors[color.c0.color];
|
color_mask=gr.to_8_colors[color.c0.color];
|
||||||
dst=dc->body+kk1&~7;
|
dst=dc->body+kk1&~7;
|
||||||
@@ -1059,19 +1059,19 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
|||||||
if (win_z_num>=*win_z_buf_ptr++) {
|
if (win_z_num>=*win_z_buf_ptr++) {
|
||||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||||
color_mask&~leading_pixel_mask;
|
color_mask&~leading_pixel_mask;
|
||||||
result+=leading_pixels;
|
res+=leading_pixels;
|
||||||
}
|
}
|
||||||
dst(I64 *)++;
|
dst(I64 *)++;
|
||||||
}
|
}
|
||||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||||
if (win_z_num>=*win_z_buf_ptr++) {
|
if (win_z_num>=*win_z_buf_ptr++) {
|
||||||
*dst(I64 *)=color_mask;
|
*dst(I64 *)=color_mask;
|
||||||
result+=8;
|
res+=8;
|
||||||
}
|
}
|
||||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||||
color_mask&~trailing_pixel_mask;
|
color_mask&~trailing_pixel_mask;
|
||||||
result+=trailing_pixels;
|
res+=trailing_pixels;
|
||||||
}
|
}
|
||||||
if ((j+y)&7==7)
|
if ((j+y)&7==7)
|
||||||
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
||||||
@@ -1101,12 +1101,12 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
|||||||
else
|
else
|
||||||
color.c0=dither_colors.c0;
|
color.c0=dither_colors.c0;
|
||||||
}
|
}
|
||||||
result=(h2-h1)*(w2-w1);
|
res=(h2-h1)*(w2-w1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ROPB_XOR:
|
case ROPB_XOR:
|
||||||
if (win_z_buf_ptr) {
|
if (win_z_buf_ptr) {
|
||||||
result=0;
|
res=0;
|
||||||
for (j=h1;j<h2;j++) {
|
for (j=h1;j<h2;j++) {
|
||||||
color_mask=gr.to_8_colors[color.c0.color];
|
color_mask=gr.to_8_colors[color.c0.color];
|
||||||
dst=dc->body+kk1&~7;
|
dst=dc->body+kk1&~7;
|
||||||
@@ -1114,19 +1114,19 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
|||||||
if (win_z_num>=*win_z_buf_ptr++) {
|
if (win_z_num>=*win_z_buf_ptr++) {
|
||||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||||
*dst(I64 *)^color_mask&~leading_pixel_mask;
|
*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||||
result+=leading_pixels;
|
res+=leading_pixels;
|
||||||
}
|
}
|
||||||
dst(I64 *)++;
|
dst(I64 *)++;
|
||||||
}
|
}
|
||||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||||
if (win_z_num>=*win_z_buf_ptr++) {
|
if (win_z_num>=*win_z_buf_ptr++) {
|
||||||
*dst(I64 *)^=color_mask;
|
*dst(I64 *)^=color_mask;
|
||||||
result+=8;
|
res+=8;
|
||||||
}
|
}
|
||||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||||
*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||||
result+=trailing_pixels;
|
res+=trailing_pixels;
|
||||||
}
|
}
|
||||||
if ((j+y)&7==7)
|
if ((j+y)&7==7)
|
||||||
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
||||||
@@ -1156,7 +1156,7 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
|||||||
else
|
else
|
||||||
color.c0=dither_colors.c0;
|
color.c0=dither_colors.c0;
|
||||||
}
|
}
|
||||||
result=(h2-h1)*(w2-w1);
|
res=(h2-h1)*(w2-w1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1167,7 +1167,7 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
|||||||
case ROPB_EQU:
|
case ROPB_EQU:
|
||||||
case ROPB_MONO:
|
case ROPB_MONO:
|
||||||
if (win_z_buf_ptr) {
|
if (win_z_buf_ptr) {
|
||||||
result=0;
|
res=0;
|
||||||
for (j=h1;j<h2;j++) {
|
for (j=h1;j<h2;j++) {
|
||||||
color_mask=gr.to_8_bits[0x55]&gr.to_8_colors[color.c0.color]|
|
color_mask=gr.to_8_bits[0x55]&gr.to_8_colors[color.c0.color]|
|
||||||
gr.to_8_bits[0xAA]&gr.to_8_colors[color.c1.color];
|
gr.to_8_bits[0xAA]&gr.to_8_colors[color.c1.color];
|
||||||
@@ -1176,19 +1176,19 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
|||||||
if (win_z_num>=*win_z_buf_ptr++) {
|
if (win_z_num>=*win_z_buf_ptr++) {
|
||||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||||
color_mask&~leading_pixel_mask;
|
color_mask&~leading_pixel_mask;
|
||||||
result+=leading_pixels;
|
res+=leading_pixels;
|
||||||
}
|
}
|
||||||
dst(I64 *)++;
|
dst(I64 *)++;
|
||||||
}
|
}
|
||||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||||
if (win_z_num>=*win_z_buf_ptr++) {
|
if (win_z_num>=*win_z_buf_ptr++) {
|
||||||
*dst(I64 *)=color_mask;
|
*dst(I64 *)=color_mask;
|
||||||
result+=8;
|
res+=8;
|
||||||
}
|
}
|
||||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||||
color_mask&~trailing_pixel_mask;
|
color_mask&~trailing_pixel_mask;
|
||||||
result+=trailing_pixels;
|
res+=trailing_pixels;
|
||||||
}
|
}
|
||||||
if ((j+y)&7==7)
|
if ((j+y)&7==7)
|
||||||
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
||||||
@@ -1213,12 +1213,12 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
|||||||
kk1+=dc->width_internal;
|
kk1+=dc->width_internal;
|
||||||
SwapU16(&color.c0,&color.c1);
|
SwapU16(&color.c0,&color.c1);
|
||||||
}
|
}
|
||||||
result=(h2-h1)*(w2-w1);
|
res=(h2-h1)*(w2-w1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ROPB_XOR:
|
case ROPB_XOR:
|
||||||
if (win_z_buf_ptr) {
|
if (win_z_buf_ptr) {
|
||||||
result=0;
|
res=0;
|
||||||
for (j=h1;j<h2;j++) {
|
for (j=h1;j<h2;j++) {
|
||||||
color_mask=gr.to_8_bits[0x55]&gr.to_8_colors[color.c0.color]|
|
color_mask=gr.to_8_bits[0x55]&gr.to_8_colors[color.c0.color]|
|
||||||
gr.to_8_bits[0xAA]&gr.to_8_colors[color.c1.color];
|
gr.to_8_bits[0xAA]&gr.to_8_colors[color.c1.color];
|
||||||
@@ -1227,19 +1227,19 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
|||||||
if (win_z_num>=*win_z_buf_ptr++) {
|
if (win_z_num>=*win_z_buf_ptr++) {
|
||||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||||
*dst(I64 *)^color_mask&~leading_pixel_mask;
|
*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||||
result+=leading_pixels;
|
res+=leading_pixels;
|
||||||
}
|
}
|
||||||
dst(I64 *)++;
|
dst(I64 *)++;
|
||||||
}
|
}
|
||||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||||
if (win_z_num>=*win_z_buf_ptr++) {
|
if (win_z_num>=*win_z_buf_ptr++) {
|
||||||
*dst(I64 *)^=color_mask;
|
*dst(I64 *)^=color_mask;
|
||||||
result+=8;
|
res+=8;
|
||||||
}
|
}
|
||||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||||
*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||||
result+=trailing_pixels;
|
res+=trailing_pixels;
|
||||||
}
|
}
|
||||||
if ((j+y)&7==7)
|
if ((j+y)&7==7)
|
||||||
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
||||||
@@ -1264,7 +1264,7 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
|||||||
kk1+=dc->width_internal;
|
kk1+=dc->width_internal;
|
||||||
SwapU16(&color.c0,&color.c1);
|
SwapU16(&color.c0,&color.c1);
|
||||||
}
|
}
|
||||||
result=(h2-h1)*(w2-w1);
|
res=(h2-h1)*(w2-w1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1275,26 +1275,26 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
|||||||
case ROPB_EQU:
|
case ROPB_EQU:
|
||||||
case ROPB_MONO:
|
case ROPB_MONO:
|
||||||
if (win_z_buf_ptr) {
|
if (win_z_buf_ptr) {
|
||||||
result=0;
|
res=0;
|
||||||
for (j=h1;j<h2;j++) {
|
for (j=h1;j<h2;j++) {
|
||||||
dst=dc->body+kk1&~7;
|
dst=dc->body+kk1&~7;
|
||||||
if (leading_pixels) {
|
if (leading_pixels) {
|
||||||
if (win_z_num>=*win_z_buf_ptr++) {
|
if (win_z_num>=*win_z_buf_ptr++) {
|
||||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||||
color_mask&~leading_pixel_mask;
|
color_mask&~leading_pixel_mask;
|
||||||
result+=leading_pixels;
|
res+=leading_pixels;
|
||||||
}
|
}
|
||||||
dst(I64 *)++;
|
dst(I64 *)++;
|
||||||
}
|
}
|
||||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||||
if (win_z_num>=*win_z_buf_ptr++) {
|
if (win_z_num>=*win_z_buf_ptr++) {
|
||||||
*dst(I64 *)=color_mask;
|
*dst(I64 *)=color_mask;
|
||||||
result+=8;
|
res+=8;
|
||||||
}
|
}
|
||||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||||
color_mask&~trailing_pixel_mask;
|
color_mask&~trailing_pixel_mask;
|
||||||
result+=trailing_pixels;
|
res+=trailing_pixels;
|
||||||
}
|
}
|
||||||
if ((j+y)&7==7)
|
if ((j+y)&7==7)
|
||||||
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
||||||
@@ -1315,31 +1315,31 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
|||||||
color_mask&~trailing_pixel_mask;
|
color_mask&~trailing_pixel_mask;
|
||||||
kk1+=dc->width_internal;
|
kk1+=dc->width_internal;
|
||||||
}
|
}
|
||||||
result=(h2-h1)*(w2-w1);
|
res=(h2-h1)*(w2-w1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ROPB_XOR:
|
case ROPB_XOR:
|
||||||
if (win_z_buf_ptr) {
|
if (win_z_buf_ptr) {
|
||||||
result=0;
|
res=0;
|
||||||
for (j=h1;j<h2;j++) {
|
for (j=h1;j<h2;j++) {
|
||||||
dst=dc->body+kk1&~7;
|
dst=dc->body+kk1&~7;
|
||||||
if (leading_pixels) {
|
if (leading_pixels) {
|
||||||
if (win_z_num>=*win_z_buf_ptr++) {
|
if (win_z_num>=*win_z_buf_ptr++) {
|
||||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||||
*dst(I64 *)^color_mask&~leading_pixel_mask;
|
*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||||
result+=leading_pixels;
|
res+=leading_pixels;
|
||||||
}
|
}
|
||||||
dst(I64 *)++;
|
dst(I64 *)++;
|
||||||
}
|
}
|
||||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||||
if (win_z_num>=*win_z_buf_ptr++) {
|
if (win_z_num>=*win_z_buf_ptr++) {
|
||||||
*dst(I64 *)^=color_mask;
|
*dst(I64 *)^=color_mask;
|
||||||
result+=8;
|
res+=8;
|
||||||
}
|
}
|
||||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||||
*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||||
result+=trailing_pixels;
|
res+=trailing_pixels;
|
||||||
}
|
}
|
||||||
if ((j+y)&7==7)
|
if ((j+y)&7==7)
|
||||||
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
||||||
@@ -1360,20 +1360,20 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
|||||||
*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||||
kk1+=dc->width_internal;
|
kk1+=dc->width_internal;
|
||||||
}
|
}
|
||||||
result=(h2-h1)*(w2-w1);
|
res=(h2-h1)*(w2-w1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
I64 GrRayLenMinus(CDC *dc,I64 x,I64 y)
|
I64 GrRayLenMinus(CDC *dc,I64 x,I64 y)
|
||||||
{
|
{
|
||||||
//Returns cnt of pixs changed
|
//Returns cnt of pixs changed
|
||||||
I64 result=0,c,x3,y3,d;
|
I64 res=0,c,x3,y3,d;
|
||||||
U8 *dst,*dst2;
|
U8 *dst,*dst2;
|
||||||
Bool not_color=ToBool(dc->flags&DCF_FILL_NOT_COLOR);
|
Bool not_color=ToBool(dc->flags&DCF_FILL_NOT_COLOR);
|
||||||
CTask *win_task;
|
CTask *win_task;
|
||||||
@@ -1417,19 +1417,19 @@ I64 GrRayLenMinus(CDC *dc,I64 x,I64 y)
|
|||||||
c=*dst;
|
c=*dst;
|
||||||
if (not_color) {
|
if (not_color) {
|
||||||
if (c!=dc->color2) {
|
if (c!=dc->color2) {
|
||||||
result++;
|
res++;
|
||||||
x--;
|
x--;
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
if (c==dc->color2) {
|
if (c==dc->color2) {
|
||||||
result++;
|
res++;
|
||||||
x--;
|
x--;
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
gr_done:
|
gr_done:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1437,7 +1437,7 @@ gr_done:
|
|||||||
I64 GrRayLen(CDC *dc,I64 *x1,I64 y,I64 z=0,I32 *db=NULL)
|
I64 GrRayLen(CDC *dc,I64 *x1,I64 y,I64 z=0,I32 *db=NULL)
|
||||||
{
|
{
|
||||||
//Returns cnt of pixs changed
|
//Returns cnt of pixs changed
|
||||||
I64 result=0,d,x=*x1,x2,x3,y3,dist;
|
I64 res=0,d,x=*x1,x2,x3,y3,dist;
|
||||||
Bool plot,dither,probability_dither,
|
Bool plot,dither,probability_dither,
|
||||||
not_color=ToBool(dc->flags&DCF_FILL_NOT_COLOR);
|
not_color=ToBool(dc->flags&DCF_FILL_NOT_COLOR);
|
||||||
U8 *dst,*dst2;
|
U8 *dst,*dst2;
|
||||||
@@ -1551,7 +1551,7 @@ I64 GrRayLen(CDC *dc,I64 *x1,I64 y,I64 z=0,I32 *db=NULL)
|
|||||||
*dst^=c;
|
*dst^=c;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
result++;
|
res++;
|
||||||
x++;
|
x++;
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
@@ -1628,12 +1628,12 @@ I64 GrRayLen(CDC *dc,I64 *x1,I64 y,I64 z=0,I32 *db=NULL)
|
|||||||
*dst^=c;
|
*dst^=c;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
result++;
|
res++;
|
||||||
x--;
|
x--;
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
gr_done:
|
gr_done:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -1642,7 +1642,7 @@ public I64 GrHLine(CDC *dc=gr.dc,I64 x1,I64 x2,I64 y,I64 z1=0,I64 z2=0)
|
|||||||
{//3D. No transformation or pen width.
|
{//3D. No transformation or pen width.
|
||||||
//Returns cnt of pixs changed
|
//Returns cnt of pixs changed
|
||||||
//Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
//Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||||
I64 dist,dx,dz,z,result=0,i,j,d;
|
I64 dist,dx,dz,z,res=0,i,j,d;
|
||||||
U8 *dst;
|
U8 *dst;
|
||||||
CColorROPU32 c,c2,color=dc->color,bkcolor=dc->bkcolor,dither_colors;
|
CColorROPU32 c,c2,color=dc->color,bkcolor=dc->bkcolor,dither_colors;
|
||||||
I32 *db;
|
I32 *db;
|
||||||
@@ -1779,7 +1779,7 @@ public I64 GrHLine(CDC *dc=gr.dc,I64 x1,I64 x2,I64 y,I64 z1=0,I64 z2=0)
|
|||||||
*dst^=c;
|
*dst^=c;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
result++;
|
res++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dither) {
|
if (dither) {
|
||||||
@@ -1806,5 +1806,5 @@ public I64 GrHLine(CDC *dc=gr.dc,I64 x1,I64 x2,I64 y,I64 z1=0,I64 z2=0)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
gr_done:
|
gr_done:
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
+32
-32
@@ -3,7 +3,7 @@ public I64 GrFillPoly3(CDC *dc=gr.dc,I64 n,CD3I32 *poly)
|
|||||||
{//3D. Must be convex.
|
{//3D. Must be convex.
|
||||||
//Returns cnt of pixs changed
|
//Returns cnt of pixs changed
|
||||||
CD3I32 tri[3];
|
CD3I32 tri[3];
|
||||||
I64 i,j,x,y,z,result=0;
|
I64 i,j,x,y,z,res=0;
|
||||||
if (n<3) return 0;
|
if (n<3) return 0;
|
||||||
if (dc->flags & DCF_SYMMETRY) {
|
if (dc->flags & DCF_SYMMETRY) {
|
||||||
for (i=1;i<n-1;i++) {
|
for (i=1;i<n-1;i++) {
|
||||||
@@ -32,11 +32,11 @@ public I64 GrFillPoly3(CDC *dc=gr.dc,I64 n,CD3I32 *poly)
|
|||||||
DCReflect(dc,&x,&y,&z);
|
DCReflect(dc,&x,&y,&z);
|
||||||
tri[2].x=x; tri[2].y=y; tri[2].z=z;
|
tri[2].x=x; tri[2].y=y; tri[2].z=z;
|
||||||
|
|
||||||
result+=GrFillTri0(dc,&tri[0],&tri[1],&tri[2]);
|
res+=GrFillTri0(dc,&tri[0],&tri[1],&tri[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dc->flags&DCF_JUST_MIRROR)
|
if (dc->flags&DCF_JUST_MIRROR)
|
||||||
return result;
|
return res;
|
||||||
for (i=1;i<n-1;i++) {
|
for (i=1;i<n-1;i++) {
|
||||||
j=i-1;
|
j=i-1;
|
||||||
if (i==1) {
|
if (i==1) {
|
||||||
@@ -60,9 +60,9 @@ public I64 GrFillPoly3(CDC *dc=gr.dc,I64 n,CD3I32 *poly)
|
|||||||
(*dc->transform)(dc,&x,&y,&z);
|
(*dc->transform)(dc,&x,&y,&z);
|
||||||
tri[2].x=x; tri[2].y=y; tri[2].z=z;
|
tri[2].x=x; tri[2].y=y; tri[2].z=z;
|
||||||
|
|
||||||
result+=GrFillTri0(dc,&tri[0],&tri[1],&tri[2]);
|
res+=GrFillTri0(dc,&tri[0],&tri[1],&tri[2]);
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public I64 GrRectB(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2)
|
public I64 GrRectB(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2)
|
||||||
@@ -105,7 +105,7 @@ public Bool GrArrow3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,
|
|||||||
{//3D. Transformation with pen width.
|
{//3D. Transformation with pen width.
|
||||||
I64 _x1,_y1,_z1,_x2,_y2,_z2,dx,dy;
|
I64 _x1,_y1,_z1,_x2,_y2,_z2,dx,dy;
|
||||||
F64 d;
|
F64 d;
|
||||||
Bool result=FALSE,was_transform=FALSE,was_symmetry=FALSE;
|
Bool res=FALSE,was_transform=FALSE,was_symmetry=FALSE;
|
||||||
if (dc->flags & DCF_TRANSFORMATION) {
|
if (dc->flags & DCF_TRANSFORMATION) {
|
||||||
(*dc->transform)(dc,&x1,&y1,&z1);
|
(*dc->transform)(dc,&x1,&y1,&z1);
|
||||||
(*dc->transform)(dc,&x2,&y2,&z2);
|
(*dc->transform)(dc,&x2,&y2,&z2);
|
||||||
@@ -118,26 +118,26 @@ public Bool GrArrow3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,
|
|||||||
_x2=x2; _y2=y2; _z2=z2;
|
_x2=x2; _y2=y2; _z2=z2;
|
||||||
DCReflect(dc,&_x2,&_y2,&_z2);
|
DCReflect(dc,&_x2,&_y2,&_z2);
|
||||||
dc->flags&=~DCF_SYMMETRY;
|
dc->flags&=~DCF_SYMMETRY;
|
||||||
result=Line(dc,_x1,_y1,_z1,_x2,_y2,_z2,&GrPlot3,step,start);
|
res=Line(dc,_x1,_y1,_z1,_x2,_y2,_z2,&GrPlot3,step,start);
|
||||||
dx=_x2-_x1; dy=_y2-_y1;
|
dx=_x2-_x1; dy=_y2-_y1;
|
||||||
if (d=Sqrt(dx*dx+dy*dy)) {
|
if (d=Sqrt(dx*dx+dy*dy)) {
|
||||||
d=w*dc->pen_width/d;
|
d=w*dc->pen_width/d;
|
||||||
result|=Line(dc,_x2-dx*d+dy*d+0.5,_y2-dy*d-dx*d+0.5,_z2,
|
res|=Line(dc,_x2-dx*d+dy*d+0.5,_y2-dy*d-dx*d+0.5,_z2,
|
||||||
_x2,_y2,_z2,&GrPlot3,step);
|
_x2,_y2,_z2,&GrPlot3,step);
|
||||||
result|=Line(dc,_x2-dx*d-dy*d+0.5,_y2-dy*d+dx*d+0.5,_z2,
|
res|=Line(dc,_x2-dx*d-dy*d+0.5,_y2-dy*d+dx*d+0.5,_z2,
|
||||||
_x2,_y2,_z2,&GrPlot3,step);
|
_x2,_y2,_z2,&GrPlot3,step);
|
||||||
}
|
}
|
||||||
was_symmetry=TRUE;
|
was_symmetry=TRUE;
|
||||||
if (dc->flags&DCF_JUST_MIRROR)
|
if (dc->flags&DCF_JUST_MIRROR)
|
||||||
goto gr_done;
|
goto gr_done;
|
||||||
}
|
}
|
||||||
result|=Line(dc,x1,y1,z1,x2,y2,z2,&GrPlot3,step,start);
|
res|=Line(dc,x1,y1,z1,x2,y2,z2,&GrPlot3,step,start);
|
||||||
dx=x2-x1; dy=y2-y1;
|
dx=x2-x1; dy=y2-y1;
|
||||||
if (d=Sqrt(dx*dx+dy*dy)) {
|
if (d=Sqrt(dx*dx+dy*dy)) {
|
||||||
d=w*dc->pen_width/d;
|
d=w*dc->pen_width/d;
|
||||||
result|=Line(dc,x2-dx*d+dy*d+0.5,y2-dy*d-dx*d+0.5,z2,
|
res|=Line(dc,x2-dx*d+dy*d+0.5,y2-dy*d-dx*d+0.5,z2,
|
||||||
x2,y2,z2,&GrPlot3,step);
|
x2,y2,z2,&GrPlot3,step);
|
||||||
result|=Line(dc,x2-dx*d-dy*d+0.5,y2-dy*d+dx*d+0.5,z2,
|
res|=Line(dc,x2-dx*d-dy*d+0.5,y2-dy*d+dx*d+0.5,z2,
|
||||||
x2,y2,z2,&GrPlot3,step);
|
x2,y2,z2,&GrPlot3,step);
|
||||||
}
|
}
|
||||||
gr_done:
|
gr_done:
|
||||||
@@ -145,14 +145,14 @@ gr_done:
|
|||||||
dc->flags|=DCF_TRANSFORMATION;
|
dc->flags|=DCF_TRANSFORMATION;
|
||||||
if (was_symmetry)
|
if (was_symmetry)
|
||||||
dc->flags|=DCF_SYMMETRY;
|
dc->flags|=DCF_SYMMETRY;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#help_index "Graphics/Char;Char/Graphics"
|
#help_index "Graphics/Char;Char/Graphics"
|
||||||
public Bool GrTextBox3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,U8 *s,I64 border=2)
|
public Bool GrTextBox3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,U8 *s,I64 border=2)
|
||||||
{//3D. Transformation. DCF_SYMMETRY is silly.
|
{//3D. Transformation. DCF_SYMMETRY is silly.
|
||||||
U8 *ptr;
|
U8 *ptr;
|
||||||
I64 ch,result,w,w_max,h;
|
I64 ch,res,w,w_max,h;
|
||||||
if (!s) return FALSE;
|
if (!s) return FALSE;
|
||||||
ptr=s;
|
ptr=s;
|
||||||
w=0; w_max=0; h=FONT_HEIGHT;
|
w=0; w_max=0; h=FONT_HEIGHT;
|
||||||
@@ -170,12 +170,12 @@ public Bool GrTextBox3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,U8 *s,I64 border=2)
|
|||||||
w+=FONT_WIDTH;
|
w+=FONT_WIDTH;
|
||||||
}
|
}
|
||||||
if (w>w_max) w_max=w;
|
if (w>w_max) w_max=w;
|
||||||
result=GrPrint(dc,x1,y1,"%s",s);
|
res=GrPrint(dc,x1,y1,"%s",s);
|
||||||
result|=GrLine(dc,x1-border ,y1-border ,x1+w_max+border,y1-border);
|
res|=GrLine(dc,x1-border ,y1-border ,x1+w_max+border,y1-border);
|
||||||
result|=GrLine(dc,x1-border ,y1+h+border,x1+w_max+border,y1+h+border);
|
res|=GrLine(dc,x1-border ,y1+h+border,x1+w_max+border,y1+h+border);
|
||||||
result|=GrLine(dc,x1-border ,y1-border ,x1-border,y1+h+border);
|
res|=GrLine(dc,x1-border ,y1-border ,x1-border,y1+h+border);
|
||||||
result|=GrLine(dc,x1+w_max+border,y1-border ,x1+w_max+border,y1+h+border);
|
res|=GrLine(dc,x1+w_max+border,y1-border ,x1+w_max+border,y1+h+border);
|
||||||
return ToBool(result);
|
return ToBool(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAX_DIAMOND_SLOPE 2.75
|
#define MAX_DIAMOND_SLOPE 2.75
|
||||||
@@ -185,7 +185,7 @@ public Bool GrTextDiamond3(CDC *dc=gr.dc,
|
|||||||
{//3D. Transformation. DCF_SYMMETRY is silly.
|
{//3D. Transformation. DCF_SYMMETRY is silly.
|
||||||
Bool first=TRUE;
|
Bool first=TRUE;
|
||||||
U8 ch,*ptr,*ptr_end,*st,*s;
|
U8 ch,*ptr,*ptr_end,*st,*s;
|
||||||
I64 result=0,y,dx,dy,dx_old,dy_old,w,h=FONT_HEIGHT;
|
I64 res=0,y,dx,dy,dx_old,dy_old,w,h=FONT_HEIGHT;
|
||||||
F64 m;
|
F64 m;
|
||||||
if (!_s) return FALSE;
|
if (!_s) return FALSE;
|
||||||
if (dc->flags & DCF_TRANSFORMATION)
|
if (dc->flags & DCF_TRANSFORMATION)
|
||||||
@@ -214,10 +214,10 @@ public Bool GrTextDiamond3(CDC *dc=gr.dc,
|
|||||||
|
|
||||||
w=(StrLen(st)*FONT_WIDTH)>>1;
|
w=(StrLen(st)*FONT_WIDTH)>>1;
|
||||||
if (first) {
|
if (first) {
|
||||||
result|=GrPrint(dc,x1-w,y,"%s",st);
|
res|=GrPrint(dc,x1-w,y,"%s",st);
|
||||||
first=FALSE;
|
first=FALSE;
|
||||||
} else
|
} else
|
||||||
result|=GrPrint(dc,x1-w,y,"%s",st);
|
res|=GrPrint(dc,x1-w,y,"%s",st);
|
||||||
if (w) {
|
if (w) {
|
||||||
w+=border;
|
w+=border;
|
||||||
do {
|
do {
|
||||||
@@ -238,11 +238,11 @@ public Bool GrTextDiamond3(CDC *dc=gr.dc,
|
|||||||
}
|
}
|
||||||
Free(s);
|
Free(s);
|
||||||
|
|
||||||
result|=GrLine(dc,x1,y1-dy,x1+dx,y1);
|
res|=GrLine(dc,x1,y1-dy,x1+dx,y1);
|
||||||
result|=GrLine(dc,x1+dx,y1,x1,y1+dy);
|
res|=GrLine(dc,x1+dx,y1,x1,y1+dy);
|
||||||
result|=GrLine(dc,x1,y1+dy,x1-dx,y1);
|
res|=GrLine(dc,x1,y1+dy,x1-dx,y1);
|
||||||
result|=GrLine(dc,x1-dx,y1,x1,y1-dy);
|
res|=GrLine(dc,x1-dx,y1,x1,y1-dy);
|
||||||
return ToBool(result);
|
return ToBool(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
#help_index "Graphics/Mesh"
|
#help_index "Graphics/Mesh"
|
||||||
@@ -250,7 +250,7 @@ public I64 Gr3Mesh(CDC *dc=gr.dc,I64 vertex_cnt,CD3I32 *p,
|
|||||||
I64 tri_cnt,CMeshTri *tri)
|
I64 tri_cnt,CMeshTri *tri)
|
||||||
{//Returns cnt of pixs changed.
|
{//Returns cnt of pixs changed.
|
||||||
CColorROPU32 old_color=dc->color;
|
CColorROPU32 old_color=dc->color;
|
||||||
I64 i,x,y,z,result=0;
|
I64 i,x,y,z,res=0;
|
||||||
CD3I32 *pt,*pt_sym,*p_sym,*dst;
|
CD3I32 *pt,*pt_sym,*p_sym,*dst;
|
||||||
CMeshTri *tri_sym=tri;
|
CMeshTri *tri_sym=tri;
|
||||||
if (dc->flags&DCF_TRANSFORMATION) {
|
if (dc->flags&DCF_TRANSFORMATION) {
|
||||||
@@ -276,7 +276,7 @@ public I64 Gr3Mesh(CDC *dc=gr.dc,I64 vertex_cnt,CD3I32 *p,
|
|||||||
for (i=0;i<tri_cnt;i++,tri_sym++) {
|
for (i=0;i<tri_cnt;i++,tri_sym++) {
|
||||||
(*dc->lighting)(dc,&p_sym[tri_sym->nums[0]],&p_sym[tri_sym->nums[2]],
|
(*dc->lighting)(dc,&p_sym[tri_sym->nums[0]],&p_sym[tri_sym->nums[2]],
|
||||||
&p_sym[tri_sym->nums[1]],tri_sym->color);
|
&p_sym[tri_sym->nums[1]],tri_sym->color);
|
||||||
result+=GrFillTri0(dc,&p_sym[tri_sym->nums[0]],&p_sym[tri_sym->nums[2]],
|
res+=GrFillTri0(dc,&p_sym[tri_sym->nums[0]],&p_sym[tri_sym->nums[2]],
|
||||||
&p_sym[tri_sym->nums[1]]);
|
&p_sym[tri_sym->nums[1]]);
|
||||||
}
|
}
|
||||||
Free(pt_sym);
|
Free(pt_sym);
|
||||||
@@ -286,12 +286,12 @@ public I64 Gr3Mesh(CDC *dc=gr.dc,I64 vertex_cnt,CD3I32 *p,
|
|||||||
for (i=0;i<tri_cnt;i++,tri++) {
|
for (i=0;i<tri_cnt;i++,tri++) {
|
||||||
(*dc->lighting)(dc,&p[tri->nums[0]],&p[tri->nums[1]],
|
(*dc->lighting)(dc,&p[tri->nums[0]],&p[tri->nums[1]],
|
||||||
&p[tri->nums[2]],tri->color);
|
&p[tri->nums[2]],tri->color);
|
||||||
result+=GrFillTri0(dc,&p[tri->nums[0]],&p[tri->nums[1]],&p[tri->nums[2]]);
|
res+=GrFillTri0(dc,&p[tri->nums[0]],&p[tri->nums[1]],&p[tri->nums[2]]);
|
||||||
}
|
}
|
||||||
mesh_done:
|
mesh_done:
|
||||||
dc->color=old_color;
|
dc->color=old_color;
|
||||||
Free(pt);
|
Free(pt);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#help_index "Graphics/Misc;Input Pointer/Displayed Image"
|
#help_index "Graphics/Misc;Input Pointer/Displayed Image"
|
||||||
|
|||||||
+54
-54
@@ -168,41 +168,41 @@ public U0 DCExtentsInit(CDC *dc=NULL)
|
|||||||
public CDC *DCAlias(CDC *dc=NULL,CTask *task=NULL)
|
public CDC *DCAlias(CDC *dc=NULL,CTask *task=NULL)
|
||||||
{//Create alias of dc, so can change pen, color, etc.
|
{//Create alias of dc, so can change pen, color, etc.
|
||||||
//NULL means gr.dc
|
//NULL means gr.dc
|
||||||
CDC *result;
|
CDC *res;
|
||||||
if (!dc) dc=gr.dc;
|
if (!dc) dc=gr.dc;
|
||||||
if (!task) task=Fs;
|
if (!task) task=Fs;
|
||||||
if (dc->dc_signature!=DCS_SIGNATURE_VAL)
|
if (dc->dc_signature!=DCS_SIGNATURE_VAL)
|
||||||
throw('Graphics');
|
throw('Graphics');
|
||||||
result=MAlloc(sizeof(CDC),task);
|
res=MAlloc(sizeof(CDC),task);
|
||||||
MemCpy(result,dc,sizeof(CDC));
|
MemCpy(res,dc,sizeof(CDC));
|
||||||
result->win_task=result->mem_task=task;
|
res->win_task=res->mem_task=task;
|
||||||
result->r=MAlloc(16*sizeof(I64),task);
|
res->r=MAlloc(16*sizeof(I64),task);
|
||||||
DCRst(result);
|
DCRst(res);
|
||||||
result->flags|=DCF_ALIAS;
|
res->flags|=DCF_ALIAS;
|
||||||
result->alias=dc;
|
res->alias=dc;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CDC *DCNew(I64 width,I64 height,CTask *task=NULL,Bool null_bitmap=FALSE)
|
public CDC *DCNew(I64 width,I64 height,CTask *task=NULL,Bool null_bitmap=FALSE)
|
||||||
{//Create new width x height device context.
|
{//Create new width x height device context.
|
||||||
//Internally only allows widths which are divisible by 8.
|
//Internally only allows widths which are divisible by 8.
|
||||||
//Don't forget these $MA-X+PU,"sizeof(CDC)",LM="Find(\"sizeof(CDC)\",\"/*\");View;"$.
|
//Don't forget these $MA-X+PU,"sizeof(CDC)",LM="Find(\"sizeof(CDC)\",\"/*\");View;"$.
|
||||||
CDC *result;
|
CDC *res;
|
||||||
if (!task) task=Fs;
|
if (!task) task=Fs;
|
||||||
result=CAlloc(sizeof(CDC),task);
|
res=CAlloc(sizeof(CDC),task);
|
||||||
result->win_task=task;
|
res->win_task=task;
|
||||||
result->mem_task=task;
|
res->mem_task=task;
|
||||||
result->width=width;
|
res->width=width;
|
||||||
result->width_internal=(width+7)&~7;
|
res->width_internal=(width+7)&~7;
|
||||||
result->height=height;
|
res->height=height;
|
||||||
if (null_bitmap)
|
if (null_bitmap)
|
||||||
result->flags|=DCF_DONT_DRAW;
|
res->flags|=DCF_DONT_DRAW;
|
||||||
else
|
else
|
||||||
result->body=CAlloc(result->width_internal*result->height,task);
|
res->body=CAlloc(res->width_internal*res->height,task);
|
||||||
result->r=MAlloc(16*sizeof(I64),task);
|
res->r=MAlloc(16*sizeof(I64),task);
|
||||||
DCRst(result);
|
DCRst(res);
|
||||||
result->dc_signature=DCS_SIGNATURE_VAL;
|
res->dc_signature=DCS_SIGNATURE_VAL;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public U0 DCDel(CDC *dc)
|
public U0 DCDel(CDC *dc)
|
||||||
@@ -241,16 +241,16 @@ public U0 DCDepthBufAlloc(CDC *dc)
|
|||||||
|
|
||||||
public CDC *DCCopy(CDC *dc,CTask *task=NULL)
|
public CDC *DCCopy(CDC *dc,CTask *task=NULL)
|
||||||
{//Alloc copy of dc, including image body, rot mat and depth buf.
|
{//Alloc copy of dc, including image body, rot mat and depth buf.
|
||||||
CDC *result;
|
CDC *res;
|
||||||
if (!dc) return NULL;
|
if (!dc) return NULL;
|
||||||
if (dc->dc_signature!=DCS_SIGNATURE_VAL)
|
if (dc->dc_signature!=DCS_SIGNATURE_VAL)
|
||||||
throw('Graphics');
|
throw('Graphics');
|
||||||
result=MAllocIdentical(dc,task);
|
res=MAllocIdent(dc,task);
|
||||||
DCMat4x4Set(result,Mat4x4New(dc->r,task));
|
DCMat4x4Set(res,Mat4x4New(dc->r,task));
|
||||||
result->mem_task=task;
|
res->mem_task=task;
|
||||||
result->body=MAllocIdentical(dc->body,task);
|
res->body=MAllocIdent(dc->body,task);
|
||||||
result->depth_buf=MAllocIdentical(dc->depth_buf,task);
|
res->depth_buf=MAllocIdent(dc->depth_buf,task);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public U0 DCMono(CDC *dc,
|
public U0 DCMono(CDC *dc,
|
||||||
@@ -269,22 +269,22 @@ public U0 DCMono(CDC *dc,
|
|||||||
|
|
||||||
public I64 DCColorChg(CDC *dc,I64 src_color,I64 dst_color=TRANSPARENT)
|
public I64 DCColorChg(CDC *dc,I64 src_color,I64 dst_color=TRANSPARENT)
|
||||||
{//Find and replace src color with dst in device context.
|
{//Find and replace src color with dst in device context.
|
||||||
I64 i,result=0;
|
I64 i,res=0;
|
||||||
U8 *dst;
|
U8 *dst;
|
||||||
dst=dc->body;
|
dst=dc->body;
|
||||||
i=dc->width_internal*dc->height;
|
i=dc->width_internal*dc->height;
|
||||||
while (i--)
|
while (i--)
|
||||||
if (*dst==src_color) {
|
if (*dst==src_color) {
|
||||||
*dst++=dst_color;
|
*dst++=dst_color;
|
||||||
result++;
|
res++;
|
||||||
} else
|
} else
|
||||||
dst++;
|
dst++;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public U8 *DCSave(CDC *dc,I64 *_size=NULL,I64 dcsf_flags=DCSF_COMPRESSED)
|
public U8 *DCSave(CDC *dc,I64 *_size=NULL,I64 dcsf_flags=DCSF_COMPRESSED)
|
||||||
{//Stores device context to mem, perhaps, with compression.
|
{//Stores device context to mem, perhaps, with compression.
|
||||||
U8 *result,*ptr,*body;
|
U8 *res,*ptr,*body;
|
||||||
CArcCompress *arc;
|
CArcCompress *arc;
|
||||||
I64 body_size=dc->width_internal*dc->height,total_size,flags;
|
I64 body_size=dc->width_internal*dc->height,total_size,flags;
|
||||||
CBGR48 palette[NUM_COLORS];
|
CBGR48 palette[NUM_COLORS];
|
||||||
@@ -313,7 +313,7 @@ public U8 *DCSave(CDC *dc,I64 *_size=NULL,I64 dcsf_flags=DCSF_COMPRESSED)
|
|||||||
total_size+=NUM_COLORS*sizeof(CBGR48);
|
total_size+=NUM_COLORS*sizeof(CBGR48);
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr=result=MAlloc(total_size);
|
ptr=res=MAlloc(total_size);
|
||||||
|
|
||||||
#assert !offset(CDC.start)
|
#assert !offset(CDC.start)
|
||||||
MemCpy(ptr,&dc->start,offset(CDC.end)-offset(CDC.start));
|
MemCpy(ptr,&dc->start,offset(CDC.end)-offset(CDC.start));
|
||||||
@@ -331,45 +331,45 @@ public U8 *DCSave(CDC *dc,I64 *_size=NULL,I64 dcsf_flags=DCSF_COMPRESSED)
|
|||||||
|
|
||||||
Free(arc);
|
Free(arc);
|
||||||
if (_size) *_size=total_size;
|
if (_size) *_size=total_size;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CDC *DCLoad(U8 *src,I64 *_size=NULL,CTask *task=NULL)
|
public CDC *DCLoad(U8 *src,I64 *_size=NULL,CTask *task=NULL)
|
||||||
{//Loads device context from mem.
|
{//Loads device context from mem.
|
||||||
CDC *result;
|
CDC *res;
|
||||||
U8 *ptr=src;
|
U8 *ptr=src;
|
||||||
CArcCompress *arc;
|
CArcCompress *arc;
|
||||||
I64 body_size;
|
I64 body_size;
|
||||||
if (!task) task=Fs;
|
if (!task) task=Fs;
|
||||||
result=CAlloc(sizeof(CDC),task);
|
res=CAlloc(sizeof(CDC),task);
|
||||||
result->win_task=task;
|
res->win_task=task;
|
||||||
result->mem_task=task;
|
res->mem_task=task;
|
||||||
MemCpy(&result->start,ptr,offset(CDC.end)-offset(CDC.start));
|
MemCpy(&res->start,ptr,offset(CDC.end)-offset(CDC.start));
|
||||||
ptr+=offset(CDC.end)-offset(CDC.start);
|
ptr+=offset(CDC.end)-offset(CDC.start);
|
||||||
|
|
||||||
if (result->flags&DCF_PALETTE) {
|
if (res->flags&DCF_PALETTE) {
|
||||||
MemCpy(&result->palette,ptr,NUM_COLORS*sizeof(CBGR48));
|
MemCpy(&res->palette,ptr,NUM_COLORS*sizeof(CBGR48));
|
||||||
ptr+=NUM_COLORS*sizeof(CBGR48);
|
ptr+=NUM_COLORS*sizeof(CBGR48);
|
||||||
} else
|
} else
|
||||||
MemCpy(&result->palette,gr_palette_std,NUM_COLORS*sizeof(CBGR48));
|
MemCpy(&res->palette,gr_palette_std,NUM_COLORS*sizeof(CBGR48));
|
||||||
|
|
||||||
body_size=result->width_internal*result->height;
|
body_size=res->width_internal*res->height;
|
||||||
if (result->flags&DCF_COMPRESSED) {
|
if (res->flags&DCF_COMPRESSED) {
|
||||||
result->flags&=~DCF_COMPRESSED;
|
res->flags&=~DCF_COMPRESSED;
|
||||||
arc=ptr;
|
arc=ptr;
|
||||||
result->body=ExpandBuf(arc,task);
|
res->body=ExpandBuf(arc,task);
|
||||||
ptr+=arc->compressed_size;
|
ptr+=arc->compressed_size;
|
||||||
} else {
|
} else {
|
||||||
result->body=MAlloc(body_size,task);
|
res->body=MAlloc(body_size,task);
|
||||||
MemCpy(result->body,ptr,body_size);
|
MemCpy(res->body,ptr,body_size);
|
||||||
ptr+=body_size;
|
ptr+=body_size;
|
||||||
}
|
}
|
||||||
result->pen_width=1;
|
res->pen_width=1;
|
||||||
result->r=Mat4x4IdentNew(task);
|
res->r=Mat4x4IdentNew(task);
|
||||||
result->r_norm.u32[1]=1;
|
res->r_norm.u32[1]=1;
|
||||||
result->dc_signature=DCS_SIGNATURE_VAL;
|
res->dc_signature=DCS_SIGNATURE_VAL;
|
||||||
if (_size) *_size=ptr-src;
|
if (_size) *_size=ptr-src;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#help_index "Graphics/GRA Files"
|
#help_index "Graphics/GRA Files"
|
||||||
|
|||||||
+2
-2
@@ -60,10 +60,10 @@ U0 GrSetUpTables()
|
|||||||
MemSet(VGAM_TEXT,0,TEXT_ROWS*TEXT_COLS*sizeof(U16));
|
MemSet(VGAM_TEXT,0,TEXT_ROWS*TEXT_COLS*sizeof(U16));
|
||||||
MemSet(gr.vga_text_cache,0,TEXT_ROWS*TEXT_COLS*sizeof(U16));
|
MemSet(gr.vga_text_cache,0,TEXT_ROWS*TEXT_COLS*sizeof(U16));
|
||||||
} else {
|
} else {
|
||||||
OutU8(VGAP_INDEX,VGAR_MAP_MASK);
|
OutU8(VGAP_IDX,VGAR_MAP_MASK);
|
||||||
OutU8(VGAP_DATA,0x0F);
|
OutU8(VGAP_DATA,0x0F);
|
||||||
//Virtual Box crashes on the following for some reason.
|
//Virtual Box crashes on the following for some reason.
|
||||||
// MemSet(VGAM_GRAPHICS,0,GR_HEIGHT*GR_WIDTH>>3);
|
// MemSet(text.vga_alias,0,GR_HEIGHT*GR_WIDTH>>3);
|
||||||
MemSet(gr.screen_image->body,0,GR_WIDTH*GR_HEIGHT>>1);
|
MemSet(gr.screen_image->body,0,GR_WIDTH*GR_HEIGHT>>1);
|
||||||
}
|
}
|
||||||
for (i=1;i<=GR_MAX_SCREEN_ZOOM;i++) {
|
for (i=1;i<=GR_MAX_SCREEN_ZOOM;i++) {
|
||||||
|
|||||||
+4
-4
@@ -465,22 +465,22 @@ public Bool RegPoly(U8 *aux_data,
|
|||||||
|
|
||||||
#help_index "Graphics/Data Types/D3I32;Math/Data Types/D3I32;Data Types/D3I32"
|
#help_index "Graphics/Data Types/D3I32;Math/Data Types/D3I32;Data Types/D3I32"
|
||||||
public F64 D3I32Dist(CD3I32 *p1,CD3I32 *p2)
|
public F64 D3I32Dist(CD3I32 *p1,CD3I32 *p2)
|
||||||
{//Dist between p1 and p2.
|
{//Distance
|
||||||
return Sqrt(SqrI64(p1->x-p2->x)+SqrI64(p1->y-p2->y)+SqrI64(p1->z-p2->z));
|
return Sqrt(SqrI64(p1->x-p2->x)+SqrI64(p1->y-p2->y)+SqrI64(p1->z-p2->z));
|
||||||
}
|
}
|
||||||
|
|
||||||
public I64 D3I32DistSqr(CD3I32 *p1,CD3I32 *p2)
|
public I64 D3I32DistSqr(CD3I32 *p1,CD3I32 *p2)
|
||||||
{//Dist Squared between p1 and p2.
|
{//Distance Squared
|
||||||
return SqrI64(p1->x-p2->x)+SqrI64(p1->y-p2->y)+SqrI64(p1->z-p2->z);
|
return SqrI64(p1->x-p2->x)+SqrI64(p1->y-p2->y)+SqrI64(p1->z-p2->z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public F64 D3I32Norm(CD3I32 *p)
|
public F64 D3I32Norm(CD3I32 *p)
|
||||||
{//Norm of p.
|
{//Norm
|
||||||
return Sqrt(SqrI64(p->x)+SqrI64(p->y)+SqrI64(p->z));
|
return Sqrt(SqrI64(p->x)+SqrI64(p->y)+SqrI64(p->z));
|
||||||
}
|
}
|
||||||
|
|
||||||
public I64 D3I32NormSqr(CD3I32 *p)
|
public I64 D3I32NormSqr(CD3I32 *p)
|
||||||
{//Norm Squared of p.
|
{//Norm Squared
|
||||||
return SqrI64(p->x)+SqrI64(p->y)+SqrI64(p->z);
|
return SqrI64(p->x)+SqrI64(p->y)+SqrI64(p->z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public U0 GrPaletteColorSet(I64 color_num,CBGR48 bgr48)
|
|||||||
|
|
||||||
public CBGR48 GrPaletteColorGet(I64 color_num)
|
public CBGR48 GrPaletteColorGet(I64 color_num)
|
||||||
{//VGA has 6-bits for blue, for green, and for red.
|
{//VGA has 6-bits for blue, for green, and for red.
|
||||||
CBGR48 result=0;
|
CBGR48 res=0;
|
||||||
if (!Bt(&sys_run_level,RLf_VGA)) return 0;
|
if (!Bt(&sys_run_level,RLf_VGA)) return 0;
|
||||||
PUSHFD
|
PUSHFD
|
||||||
CLI
|
CLI
|
||||||
@@ -53,12 +53,12 @@ public CBGR48 GrPaletteColorGet(I64 color_num)
|
|||||||
Yield;
|
Yield;
|
||||||
OutU8(VGAP_PALETTE_MASK,0xFF);
|
OutU8(VGAP_PALETTE_MASK,0xFF);
|
||||||
OutU8(VGAP_REG_READ,color_num);
|
OutU8(VGAP_REG_READ,color_num);
|
||||||
result.r=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
res.r=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
||||||
result.g=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
res.g=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
||||||
result.b=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
res.b=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
||||||
LBtr(&sys_semas[SYS_SEMA_VGA],0);
|
LBtr(&sys_semas[SYS_SEMA_VGA],0);
|
||||||
POPFD
|
POPFD
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CBGR48 gr_palette_std[NUM_COLORS]={
|
public CBGR48 gr_palette_std[NUM_COLORS]={
|
||||||
|
|||||||
+77
-77
@@ -135,18 +135,18 @@ This is an easier to understand
|
|||||||
version of the nonrecursive routine below.
|
version of the nonrecursive routine below.
|
||||||
I64 GrFloodFillRay(CDC *dc,I64 x,I64 y,I64 z,I32 *db)
|
I64 GrFloodFillRay(CDC *dc,I64 x,I64 y,I64 z,I32 *db)
|
||||||
{
|
{
|
||||||
I64 result,j,x1,ray_len,ray_len2;
|
I64 res,j,x1,ray_len,ray_len2;
|
||||||
|
|
||||||
if (UnusedStk<0x80)
|
if (UnusedStk<0x80)
|
||||||
Dbg("Stk Overflow",Fs);
|
Dbg("Stk Overflow",Fs);
|
||||||
|
|
||||||
result=ray_len=GrRayLen(dc,&x,y,z,db);
|
res=ray_len=GrRayLen(dc,&x,y,z,db);
|
||||||
y--;
|
y--;
|
||||||
j=ray_len;
|
j=ray_len;
|
||||||
x1=x;
|
x1=x;
|
||||||
while (j>0) {
|
while (j>0) {
|
||||||
if (ray_len2=GrRayLenMinus(dc,x1,y))
|
if (ray_len2=GrRayLenMinus(dc,x1,y))
|
||||||
result+=GrFloodFillRay(dc,x1,y,z,db);
|
res+=GrFloodFillRay(dc,x1,y,z,db);
|
||||||
j-=ray_len2+1;
|
j-=ray_len2+1;
|
||||||
x1-=ray_len2+1;
|
x1-=ray_len2+1;
|
||||||
}
|
}
|
||||||
@@ -155,11 +155,11 @@ I64 GrFloodFillRay(CDC *dc,I64 x,I64 y,I64 z,I32 *db)
|
|||||||
x1=x;
|
x1=x;
|
||||||
while (j>0) {
|
while (j>0) {
|
||||||
if (ray_len2=GrRayLenMinus(dc,x1,y))
|
if (ray_len2=GrRayLenMinus(dc,x1,y))
|
||||||
result+=GrFloodFillRay(dc,x1,y,z,db);
|
res+=GrFloodFillRay(dc,x1,y,z,db);
|
||||||
j-=ray_len2+1;
|
j-=ray_len2+1;
|
||||||
x1-=ray_len2+1;
|
x1-=ray_len2+1;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ class CFFRay
|
|||||||
I64 GrFloodFillRay(CDC *dc,I64 x,I64 y,I64 z,I32 *db)
|
I64 GrFloodFillRay(CDC *dc,I64 x,I64 y,I64 z,I32 *db)
|
||||||
{//See the above commented-out routine for an easier to understand version.
|
{//See the above commented-out routine for an easier to understand version.
|
||||||
//Returns cnt of pixs changed
|
//Returns cnt of pixs changed
|
||||||
I64 result=0;
|
I64 res=0;
|
||||||
//We don't dynamically calculate the size to avoid
|
//We don't dynamically calculate the size to avoid
|
||||||
//fragmentation of memory.
|
//fragmentation of memory.
|
||||||
CFFRay *f_dc=MAlloc(sizeof(CFFRay)*0x80000),*f=f_dc;
|
CFFRay *f_dc=MAlloc(sizeof(CFFRay)*0x80000),*f=f_dc;
|
||||||
@@ -182,7 +182,7 @@ I64 GrFloodFillRay(CDC *dc,I64 x,I64 y,I64 z,I32 *db)
|
|||||||
switch [f->state] {
|
switch [f->state] {
|
||||||
case 0:
|
case 0:
|
||||||
f->state++;
|
f->state++;
|
||||||
result+=f->ray_len=GrRayLen(dc,&f->x,f->y,z,db);
|
res+=f->ray_len=GrRayLen(dc,&f->x,f->y,z,db);
|
||||||
f->y--;
|
f->y--;
|
||||||
f->j=f->ray_len;
|
f->j=f->ray_len;
|
||||||
f->x1=f->x;
|
f->x1=f->x;
|
||||||
@@ -233,7 +233,7 @@ I64 GrFloodFillRay(CDC *dc,I64 x,I64 y,I64 z,I32 *db)
|
|||||||
}
|
}
|
||||||
} while (f>=f_dc);
|
} while (f>=f_dc);
|
||||||
Free(f_dc);
|
Free(f_dc);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public I64 GrFloodFill(CDC *dc=gr.dc,I64 x,I64 y,
|
public I64 GrFloodFill(CDC *dc=gr.dc,I64 x,I64 y,
|
||||||
@@ -242,7 +242,7 @@ public I64 GrFloodFill(CDC *dc=gr.dc,I64 x,I64 y,
|
|||||||
//not_color=TRUE means fill up to everything which is not the current color.
|
//not_color=TRUE means fill up to everything which is not the current color.
|
||||||
//not_color=FALSE means fill all parts equ to the color under the point.
|
//not_color=FALSE means fill all parts equ to the color under the point.
|
||||||
//Returns cnt of pixs changed
|
//Returns cnt of pixs changed
|
||||||
I64 result=0,j,old_flags=dc->flags;
|
I64 res=0,j,old_flags=dc->flags;
|
||||||
CColorROPU32 old_color2=dc->color2;
|
CColorROPU32 old_color2=dc->color2;
|
||||||
CDC *old_brush;
|
CDC *old_brush;
|
||||||
if (dc->flags & DCF_DONT_DRAW) //TODO
|
if (dc->flags & DCF_DONT_DRAW) //TODO
|
||||||
@@ -265,13 +265,13 @@ public I64 GrFloodFill(CDC *dc=gr.dc,I64 x,I64 y,
|
|||||||
}
|
}
|
||||||
if (not_color && j!=dc->color2 ||
|
if (not_color && j!=dc->color2 ||
|
||||||
!not_color)
|
!not_color)
|
||||||
result=GrFloodFillRay(dc,x,y,z,db);
|
res=GrFloodFillRay(dc,x,y,z,db);
|
||||||
}
|
}
|
||||||
ff_done:
|
ff_done:
|
||||||
dc->brush=old_brush;
|
dc->brush=old_brush;
|
||||||
dc->flags=old_flags;
|
dc->flags=old_flags;
|
||||||
dc->color2=old_color2;
|
dc->color2=old_color2;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bool GrPlot3B(CDC *dc=gr.dc,I64 x,I64 y,I64 z)
|
public Bool GrPlot3B(CDC *dc=gr.dc,I64 x,I64 y,I64 z)
|
||||||
@@ -442,27 +442,27 @@ Bool GrLinePlot(CDC *dc,I64 x,I64 y,I64 z)
|
|||||||
public Bool GrLine(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2,
|
public Bool GrLine(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2,
|
||||||
I64 step=1,I64 start=0)
|
I64 step=1,I64 start=0)
|
||||||
{//2D. Clipping but not transformation.
|
{//2D. Clipping but not transformation.
|
||||||
Bool result=FALSE;
|
Bool res=FALSE;
|
||||||
I32 *db=dc->depth_buf;
|
I32 *db=dc->depth_buf;
|
||||||
dc->depth_buf=NULL;
|
dc->depth_buf=NULL;
|
||||||
if (step==1 && !start && !dc->brush && !dc->depth_buf) {
|
if (step==1 && !start && !dc->brush && !dc->depth_buf) {
|
||||||
if (DCClipLine(dc,&x1,&y1,&x2,&y2))
|
if (DCClipLine(dc,&x1,&y1,&x2,&y2))
|
||||||
result=Line(dc,x1,y1,0,x2,y2,0,&GrLinePlot0,step,start);
|
res=Line(dc,x1,y1,0,x2,y2,0,&GrLinePlot0,step,start);
|
||||||
} else
|
} else
|
||||||
result=Line(dc,x1,y1,0,x2,y2,0,&GrLinePlot,step,start);
|
res=Line(dc,x1,y1,0,x2,y2,0,&GrLinePlot,step,start);
|
||||||
dc->depth_buf=db;
|
dc->depth_buf=db;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bool GrCircle(CDC *dc=gr.dc,I64 cx,I64 cy,I64 radius,
|
public Bool GrCircle(CDC *dc=gr.dc,I64 cx,I64 cy,I64 radius,
|
||||||
I64 step=1,F64 start_radians=0,F64 len_radians=2*ã)
|
I64 step=1,F64 start_radians=0,F64 len_radians=2*ã)
|
||||||
{//2D. Clipping but not transformation.
|
{//2D. Clipping but not transformation.
|
||||||
Bool result;
|
Bool res;
|
||||||
I32 *db=dc->depth_buf;
|
I32 *db=dc->depth_buf;
|
||||||
dc->depth_buf=NULL;
|
dc->depth_buf=NULL;
|
||||||
result=Circle(dc,cx,cy,0,radius,&GrLinePlot,step,start_radians,len_radians);
|
res=Circle(dc,cx,cy,0,radius,&GrLinePlot,step,start_radians,len_radians);
|
||||||
dc->depth_buf=db;
|
dc->depth_buf=db;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bool GrEllipse(CDC *dc=gr.dc,
|
public Bool GrEllipse(CDC *dc=gr.dc,
|
||||||
@@ -473,13 +473,13 @@ public Bool GrEllipse(CDC *dc=gr.dc,
|
|||||||
F64 start_radians=0,
|
F64 start_radians=0,
|
||||||
F64 len_radians=2*ã)
|
F64 len_radians=2*ã)
|
||||||
{//2D. Clipping but not transformation.
|
{//2D. Clipping but not transformation.
|
||||||
Bool result;
|
Bool res;
|
||||||
I32 *db=dc->depth_buf;
|
I32 *db=dc->depth_buf;
|
||||||
dc->depth_buf=NULL;
|
dc->depth_buf=NULL;
|
||||||
result=Ellipse(dc,cx,cy,0,x_radius,y_radius,&GrLinePlot,
|
res=Ellipse(dc,cx,cy,0,x_radius,y_radius,&GrLinePlot,
|
||||||
rot_angle,step,start_radians,len_radians);
|
rot_angle,step,start_radians,len_radians);
|
||||||
dc->depth_buf=db;
|
dc->depth_buf=db;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bool GrRegPoly(CDC *dc=gr.dc,
|
public Bool GrRegPoly(CDC *dc=gr.dc,
|
||||||
@@ -490,13 +490,13 @@ public Bool GrRegPoly(CDC *dc=gr.dc,
|
|||||||
F64 start_radians=0,
|
F64 start_radians=0,
|
||||||
F64 len_radians=2*ã)
|
F64 len_radians=2*ã)
|
||||||
{//2D. Clipping but no transform or pen width.
|
{//2D. Clipping but no transform or pen width.
|
||||||
Bool result;
|
Bool res;
|
||||||
I32 *db=dc->depth_buf;
|
I32 *db=dc->depth_buf;
|
||||||
dc->depth_buf=NULL;
|
dc->depth_buf=NULL;
|
||||||
result=RegPoly(dc,cx,cy,0,x_radius,y_radius,sides,
|
res=RegPoly(dc,cx,cy,0,x_radius,y_radius,sides,
|
||||||
&GrLinePlot,rot_angle,step,start_radians,len_radians);
|
&GrLinePlot,rot_angle,step,start_radians,len_radians);
|
||||||
dc->depth_buf=db;
|
dc->depth_buf=db;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bool Gr2Bezier(CDC *dc=gr.dc,CD3I32 *ctrl)
|
public Bool Gr2Bezier(CDC *dc=gr.dc,CD3I32 *ctrl)
|
||||||
@@ -523,7 +523,7 @@ public Bool GrLine3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,I64 x2,I64 y2,I64 z2,
|
|||||||
I64 step=1,I64 start=0)
|
I64 step=1,I64 start=0)
|
||||||
{//3D. Transformation with pen width.
|
{//3D. Transformation with pen width.
|
||||||
I64 _x1,_y1,_z1,_x2,_y2,_z2;
|
I64 _x1,_y1,_z1,_x2,_y2,_z2;
|
||||||
Bool result=FALSE,was_transform=FALSE,was_symmetry=FALSE;
|
Bool res=FALSE,was_transform=FALSE,was_symmetry=FALSE;
|
||||||
if (dc->flags & DCF_TRANSFORMATION) {
|
if (dc->flags & DCF_TRANSFORMATION) {
|
||||||
(*dc->transform)(dc,&x1,&y1,&z1);
|
(*dc->transform)(dc,&x1,&y1,&z1);
|
||||||
(*dc->transform)(dc,&x2,&y2,&z2);
|
(*dc->transform)(dc,&x2,&y2,&z2);
|
||||||
@@ -539,9 +539,9 @@ public Bool GrLine3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,I64 x2,I64 y2,I64 z2,
|
|||||||
if (step==1 && !start && !dc->brush && dc->pen_width<2 &&
|
if (step==1 && !start && !dc->brush && dc->pen_width<2 &&
|
||||||
!dc->depth_buf) {//TODO: clip z for depth buf
|
!dc->depth_buf) {//TODO: clip z for depth buf
|
||||||
if (DCClipLine(dc,&_x1,&_y1,&_x2,&_y2))
|
if (DCClipLine(dc,&_x1,&_y1,&_x2,&_y2))
|
||||||
result=Line(dc,_x1,_y1,0,_x2,_y2,0,&GrLinePlot0,step,start);
|
res=Line(dc,_x1,_y1,0,_x2,_y2,0,&GrLinePlot0,step,start);
|
||||||
} else
|
} else
|
||||||
result=Line(dc,_x1,_y1,_z1,_x2,_y2,_z2,&GrPlot3,step,start);
|
res=Line(dc,_x1,_y1,_z1,_x2,_y2,_z2,&GrPlot3,step,start);
|
||||||
was_symmetry=TRUE;
|
was_symmetry=TRUE;
|
||||||
if (dc->flags&DCF_JUST_MIRROR)
|
if (dc->flags&DCF_JUST_MIRROR)
|
||||||
goto gr_done;
|
goto gr_done;
|
||||||
@@ -549,15 +549,15 @@ public Bool GrLine3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,I64 x2,I64 y2,I64 z2,
|
|||||||
if (step==1 && !start && !dc->brush && dc->pen_width<2 &&
|
if (step==1 && !start && !dc->brush && dc->pen_width<2 &&
|
||||||
!dc->depth_buf) {//TODO: clip z for depth buf
|
!dc->depth_buf) {//TODO: clip z for depth buf
|
||||||
if (DCClipLine(dc,&x1,&y1,&x2,&y2))
|
if (DCClipLine(dc,&x1,&y1,&x2,&y2))
|
||||||
result|=Line(dc,x1,y1,0,x2,y2,0,&GrLinePlot0,step,start);
|
res|=Line(dc,x1,y1,0,x2,y2,0,&GrLinePlot0,step,start);
|
||||||
} else
|
} else
|
||||||
result|=Line(dc,x1,y1,z1,x2,y2,z2,&GrPlot3,step,start);
|
res|=Line(dc,x1,y1,z1,x2,y2,z2,&GrPlot3,step,start);
|
||||||
gr_done:
|
gr_done:
|
||||||
if (was_transform)
|
if (was_transform)
|
||||||
dc->flags|=DCF_TRANSFORMATION;
|
dc->flags|=DCF_TRANSFORMATION;
|
||||||
if (was_symmetry)
|
if (was_symmetry)
|
||||||
dc->flags|=DCF_SYMMETRY;
|
dc->flags|=DCF_SYMMETRY;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#help_index "Graphics/Char;Char/Graphics"
|
#help_index "Graphics/Char;Char/Graphics"
|
||||||
@@ -572,23 +572,23 @@ public Bool GrPutChar3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 ch)
|
|||||||
public I64 GrPrint3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *fmt,...)
|
public I64 GrPrint3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *fmt,...)
|
||||||
{//3D. Transformation. DCF_SYMMETRY is silly.
|
{//3D. Transformation. DCF_SYMMETRY is silly.
|
||||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
||||||
I64 result;
|
I64 res;
|
||||||
if (dc->flags & DCF_TRANSFORMATION)
|
if (dc->flags & DCF_TRANSFORMATION)
|
||||||
(*dc->transform)(dc,&x,&y,&z);
|
(*dc->transform)(dc,&x,&y,&z);
|
||||||
result=GrPrint(dc,x,y,"%s",buf);
|
res=GrPrint(dc,x,y,"%s",buf);
|
||||||
Free(buf);
|
Free(buf);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public I64 GrVPrint3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *fmt,...)
|
public I64 GrVPrint3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *fmt,...)
|
||||||
{//3D. Vertical text. Transformation. DCF_SYMMETRY is silly.
|
{//3D. Vertical text. Transformation. DCF_SYMMETRY is silly.
|
||||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
||||||
I64 result;
|
I64 res;
|
||||||
if (dc->flags & DCF_TRANSFORMATION)
|
if (dc->flags & DCF_TRANSFORMATION)
|
||||||
(*dc->transform)(dc,&x,&y,&z);
|
(*dc->transform)(dc,&x,&y,&z);
|
||||||
result=GrVPrint(dc,x,y,"%s",buf);
|
res=GrVPrint(dc,x,y,"%s",buf);
|
||||||
Free(buf);
|
Free(buf);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#help_index "Graphics"
|
#help_index "Graphics"
|
||||||
@@ -601,7 +601,7 @@ public Bool GrEllipse3(CDC *dc=gr.dc,
|
|||||||
F64 start_radians=0,
|
F64 start_radians=0,
|
||||||
F64 len_radians=2*ã)
|
F64 len_radians=2*ã)
|
||||||
{//3D. Transformation with pen width.
|
{//3D. Transformation with pen width.
|
||||||
Bool result;
|
Bool res;
|
||||||
I64 x,y,z,xx,yy,zz;
|
I64 x,y,z,xx,yy,zz;
|
||||||
F64 m1,a1,m2,a2,s,c;
|
F64 m1,a1,m2,a2,s,c;
|
||||||
if (dc->flags & DCF_TRANSFORMATION) {
|
if (dc->flags & DCF_TRANSFORMATION) {
|
||||||
@@ -638,13 +638,13 @@ public Bool GrEllipse3(CDC *dc=gr.dc,
|
|||||||
R2P(&m2,&a2,x,y);
|
R2P(&m2,&a2,x,y);
|
||||||
m2*=Abs(Sin(a2-a1));
|
m2*=Abs(Sin(a2-a1));
|
||||||
|
|
||||||
result=Ellipse(dc,cx,cy,cz,
|
res=Ellipse(dc,cx,cy,cz,
|
||||||
m1/0x10000,m2/0x10000,&GrPlot3,-a1,step,start_radians,len_radians);
|
m1/0x10000,m2/0x10000,&GrPlot3,-a1,step,start_radians,len_radians);
|
||||||
dc->flags|=DCF_TRANSFORMATION;
|
dc->flags|=DCF_TRANSFORMATION;
|
||||||
} else
|
} else
|
||||||
result=Ellipse(dc,cx,cy,cz,x_radius,y_radius,&GrPlot3,
|
res=Ellipse(dc,cx,cy,cz,x_radius,y_radius,&GrPlot3,
|
||||||
rot_angle,step,start_radians,len_radians);
|
rot_angle,step,start_radians,len_radians);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bool GrCircle3(CDC *dc=gr.dc,I64 cx,I64 cy,I64 cz,I64 radius,
|
public Bool GrCircle3(CDC *dc=gr.dc,I64 cx,I64 cy,I64 cz,I64 radius,
|
||||||
@@ -666,7 +666,7 @@ public Bool GrRegPoly3(CDC *dc=gr.dc,
|
|||||||
F64 start_radians=0,
|
F64 start_radians=0,
|
||||||
F64 len_radians=2*ã)
|
F64 len_radians=2*ã)
|
||||||
{//3D. Clipping and transform and pen width.
|
{//3D. Clipping and transform and pen width.
|
||||||
Bool result;
|
Bool res;
|
||||||
I64 x,y,z,xx,yy,zz;
|
I64 x,y,z,xx,yy,zz;
|
||||||
F64 m1,a1,m2,a2,s,c;
|
F64 m1,a1,m2,a2,s,c;
|
||||||
if (dc->flags & DCF_TRANSFORMATION) {
|
if (dc->flags & DCF_TRANSFORMATION) {
|
||||||
@@ -703,14 +703,14 @@ public Bool GrRegPoly3(CDC *dc=gr.dc,
|
|||||||
R2P(&m2,&a2,x,y);
|
R2P(&m2,&a2,x,y);
|
||||||
m2*=Abs(Sin(a2-a1));
|
m2*=Abs(Sin(a2-a1));
|
||||||
|
|
||||||
result=RegPoly(dc,cx,cy,cz,
|
res=RegPoly(dc,cx,cy,cz,
|
||||||
m1/0x10000,m2/0x10000,sides,&GrPlot3,-a1,
|
m1/0x10000,m2/0x10000,sides,&GrPlot3,-a1,
|
||||||
step,start_radians,len_radians);
|
step,start_radians,len_radians);
|
||||||
dc->flags|=DCF_TRANSFORMATION;
|
dc->flags|=DCF_TRANSFORMATION;
|
||||||
} else
|
} else
|
||||||
result=RegPoly(dc,cx,cy,cz,x_radius,y_radius,sides,&GrPlot3,
|
res=RegPoly(dc,cx,cy,cz,x_radius,y_radius,sides,&GrPlot3,
|
||||||
rot_angle,step,start_radians,len_radians);
|
rot_angle,step,start_radians,len_radians);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public I64 GrFloodFill3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,Bool not_color=FALSE)
|
public I64 GrFloodFill3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,Bool not_color=FALSE)
|
||||||
@@ -718,7 +718,7 @@ public I64 GrFloodFill3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,Bool not_color=FALSE)
|
|||||||
//not_color=TRUE means fill up to everything which is not the current color.
|
//not_color=TRUE means fill up to everything which is not the current color.
|
||||||
//not_color=FALSE means fill all parts equ to the color under the point.
|
//not_color=FALSE means fill all parts equ to the color under the point.
|
||||||
//Returns cnt of pixs changed
|
//Returns cnt of pixs changed
|
||||||
I64 result,old_flags=dc->flags,
|
I64 res,old_flags=dc->flags,
|
||||||
_x,_y,_z;
|
_x,_y,_z;
|
||||||
if (dc->flags & DCF_TRANSFORMATION) {
|
if (dc->flags & DCF_TRANSFORMATION) {
|
||||||
(*dc->transform)(dc,&x1,&y1,&z1);
|
(*dc->transform)(dc,&x1,&y1,&z1);
|
||||||
@@ -728,14 +728,14 @@ public I64 GrFloodFill3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,Bool not_color=FALSE)
|
|||||||
_x=x1; _y=y1; _z=z1;
|
_x=x1; _y=y1; _z=z1;
|
||||||
DCReflect(dc,&_x,&_y,&_z);
|
DCReflect(dc,&_x,&_y,&_z);
|
||||||
dc->flags&=~DCF_SYMMETRY;
|
dc->flags&=~DCF_SYMMETRY;
|
||||||
result=GrFloodFill(dc,_x,_y,not_color,_z,dc->depth_buf);
|
res=GrFloodFill(dc,_x,_y,not_color,_z,dc->depth_buf);
|
||||||
if (dc->flags&DCF_JUST_MIRROR)
|
if (dc->flags&DCF_JUST_MIRROR)
|
||||||
goto gr_done;
|
goto gr_done;
|
||||||
}
|
}
|
||||||
result=GrFloodFill(dc,x1,y1,not_color,z1,dc->depth_buf);
|
res=GrFloodFill(dc,x1,y1,not_color,z1,dc->depth_buf);
|
||||||
gr_done:
|
gr_done:
|
||||||
dc->flags=old_flags;
|
dc->flags=old_flags;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#help_index "Graphics;Graphics/Device Contexts"
|
#help_index "Graphics;Graphics/Device Contexts"
|
||||||
@@ -750,7 +750,7 @@ public I64 GrBlot3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,CDC *img)
|
|||||||
adx2,ady2,adz2,
|
adx2,ady2,adz2,
|
||||||
x2,y2,z2,x3,y3,z3,
|
x2,y2,z2,x3,y3,z3,
|
||||||
dw,reg dh,x,y,_x1,_y1,_z1,_x2,_y2,_z2,_x3,_y3,_z3,
|
dw,reg dh,x,y,_x1,_y1,_z1,_x2,_y2,_z2,_x3,_y3,_z3,
|
||||||
last_x,last_y,result=0;
|
last_x,last_y,res=0;
|
||||||
Bool first;
|
Bool first;
|
||||||
CDC *old_brush=dc->brush;
|
CDC *old_brush=dc->brush;
|
||||||
|
|
||||||
@@ -855,7 +855,7 @@ public I64 GrBlot3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,CDC *img)
|
|||||||
_x1+=dx1; _y1+=dy1; _z1+=dz1;
|
_x1+=dx1; _y1+=dy1; _z1+=dz1;
|
||||||
x+=dw;
|
x+=dw;
|
||||||
}
|
}
|
||||||
result=1;
|
res=1;
|
||||||
normal_image:
|
normal_image:
|
||||||
if (dc->flags&DCF_JUST_MIRROR)
|
if (dc->flags&DCF_JUST_MIRROR)
|
||||||
goto gr_done;
|
goto gr_done;
|
||||||
@@ -945,20 +945,20 @@ normal_image:
|
|||||||
x1+=dx1; y1+=dy1; z1+=dz1;
|
x1+=dx1; y1+=dy1; z1+=dz1;
|
||||||
x+=dw;
|
x+=dw;
|
||||||
}
|
}
|
||||||
result=1; //TODO: check off screen
|
res=1; //TODO: check off screen
|
||||||
} else
|
} else
|
||||||
result=GrBlot(dc,x1,y1,img);
|
res=GrBlot(dc,x1,y1,img);
|
||||||
gr_done:
|
gr_done:
|
||||||
dc->color=old_color;
|
dc->color=old_color;
|
||||||
dc->brush=old_brush;
|
dc->brush=old_brush;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#help_index "Graphics"
|
#help_index "Graphics"
|
||||||
|
|
||||||
public Bool Gr2Bezier3(CDC *dc=gr.dc,CD3I32 *ctrl)
|
public Bool Gr2Bezier3(CDC *dc=gr.dc,CD3I32 *ctrl)
|
||||||
{//2nd order. Clipping and transform and pen width.
|
{//2nd order. Clipping and transform and pen width.
|
||||||
Bool result=FALSE;
|
Bool res=FALSE;
|
||||||
I64 i,x,y,z,
|
I64 i,x,y,z,
|
||||||
old_flags=dc->flags;
|
old_flags=dc->flags;
|
||||||
CD3I32 *ctrl2=NULL,*ctrl3=NULL;
|
CD3I32 *ctrl2=NULL,*ctrl3=NULL;
|
||||||
@@ -988,22 +988,22 @@ public Bool Gr2Bezier3(CDC *dc=gr.dc,CD3I32 *ctrl)
|
|||||||
ctrl3[i].z=z;
|
ctrl3[i].z=z;
|
||||||
}
|
}
|
||||||
dc->flags&=~DCF_SYMMETRY;
|
dc->flags&=~DCF_SYMMETRY;
|
||||||
result=Bezier2(dc,ctrl3,&GrPlot3);
|
res=Bezier2(dc,ctrl3,&GrPlot3);
|
||||||
if (dc->flags & DCF_JUST_MIRROR)
|
if (dc->flags & DCF_JUST_MIRROR)
|
||||||
goto gr_done;
|
goto gr_done;
|
||||||
}
|
}
|
||||||
|
|
||||||
result|=Bezier2(dc,ctrl,&GrPlot3);
|
res|=Bezier2(dc,ctrl,&GrPlot3);
|
||||||
gr_done:
|
gr_done:
|
||||||
Free(ctrl2);
|
Free(ctrl2);
|
||||||
Free(ctrl3);
|
Free(ctrl3);
|
||||||
dc->flags=old_flags;
|
dc->flags=old_flags;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bool Gr3Bezier3(CDC *dc=gr.dc,CD3I32 *ctrl)
|
public Bool Gr3Bezier3(CDC *dc=gr.dc,CD3I32 *ctrl)
|
||||||
{//3rd order. Clipping and transform and pen width.
|
{//3rd order. Clipping and transform and pen width.
|
||||||
Bool result=FALSE;
|
Bool res=FALSE;
|
||||||
I64 i,x,y,z,
|
I64 i,x,y,z,
|
||||||
old_flags=dc->flags;
|
old_flags=dc->flags;
|
||||||
CD3I32 *ctrl2=NULL,*ctrl3=NULL;
|
CD3I32 *ctrl2=NULL,*ctrl3=NULL;
|
||||||
@@ -1033,22 +1033,22 @@ public Bool Gr3Bezier3(CDC *dc=gr.dc,CD3I32 *ctrl)
|
|||||||
ctrl3[i].z=z;
|
ctrl3[i].z=z;
|
||||||
}
|
}
|
||||||
dc->flags&=~DCF_SYMMETRY;
|
dc->flags&=~DCF_SYMMETRY;
|
||||||
result=Bezier3(dc,ctrl3,&GrPlot3);
|
res=Bezier3(dc,ctrl3,&GrPlot3);
|
||||||
if (dc->flags & DCF_JUST_MIRROR)
|
if (dc->flags & DCF_JUST_MIRROR)
|
||||||
goto gr_done;
|
goto gr_done;
|
||||||
}
|
}
|
||||||
|
|
||||||
result|=Bezier3(dc,ctrl,&GrPlot3);
|
res|=Bezier3(dc,ctrl,&GrPlot3);
|
||||||
gr_done:
|
gr_done:
|
||||||
Free(ctrl2);
|
Free(ctrl2);
|
||||||
Free(ctrl3);
|
Free(ctrl3);
|
||||||
dc->flags=old_flags;
|
dc->flags=old_flags;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public I64 Gr2BSpline3(CDC *dc=gr.dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
public I64 Gr2BSpline3(CDC *dc=gr.dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
||||||
{//2nd order. Clipping and transform and pen width.
|
{//2nd order. Clipping and transform and pen width.
|
||||||
Bool result=FALSE;
|
Bool res=FALSE;
|
||||||
I64 i,x,y,z,
|
I64 i,x,y,z,
|
||||||
old_flags=dc->flags;
|
old_flags=dc->flags;
|
||||||
CD3I32 *ctrl2=NULL,*ctrl3=NULL;
|
CD3I32 *ctrl2=NULL,*ctrl3=NULL;
|
||||||
@@ -1078,22 +1078,22 @@ public I64 Gr2BSpline3(CDC *dc=gr.dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
|||||||
ctrl3[i].z=z;
|
ctrl3[i].z=z;
|
||||||
}
|
}
|
||||||
dc->flags&=~DCF_SYMMETRY;
|
dc->flags&=~DCF_SYMMETRY;
|
||||||
result=BSpline2(dc,ctrl3,cnt,&GrPlot3,closed);
|
res=BSpline2(dc,ctrl3,cnt,&GrPlot3,closed);
|
||||||
if (dc->flags & DCF_JUST_MIRROR)
|
if (dc->flags & DCF_JUST_MIRROR)
|
||||||
goto gr_done;
|
goto gr_done;
|
||||||
}
|
}
|
||||||
|
|
||||||
result|=BSpline2(dc,ctrl,cnt,&GrPlot3,closed);
|
res|=BSpline2(dc,ctrl,cnt,&GrPlot3,closed);
|
||||||
gr_done:
|
gr_done:
|
||||||
Free(ctrl2);
|
Free(ctrl2);
|
||||||
Free(ctrl3);
|
Free(ctrl3);
|
||||||
dc->flags=old_flags;
|
dc->flags=old_flags;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bool Gr3BSpline3(CDC *dc=gr.dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
public Bool Gr3BSpline3(CDC *dc=gr.dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
||||||
{//3rd order. Clipping and transform and pen width.
|
{//3rd order. Clipping and transform and pen width.
|
||||||
Bool result=FALSE;
|
Bool res=FALSE;
|
||||||
I64 i,x,y,z,
|
I64 i,x,y,z,
|
||||||
old_flags=dc->flags;
|
old_flags=dc->flags;
|
||||||
CD3I32 *ctrl2=NULL,*ctrl3=NULL;
|
CD3I32 *ctrl2=NULL,*ctrl3=NULL;
|
||||||
@@ -1123,22 +1123,22 @@ public Bool Gr3BSpline3(CDC *dc=gr.dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
|||||||
ctrl3[i].z=z;
|
ctrl3[i].z=z;
|
||||||
}
|
}
|
||||||
dc->flags&=~DCF_SYMMETRY;
|
dc->flags&=~DCF_SYMMETRY;
|
||||||
result=BSpline3(dc,ctrl3,cnt,&GrPlot3,closed);
|
res=BSpline3(dc,ctrl3,cnt,&GrPlot3,closed);
|
||||||
if (dc->flags & DCF_JUST_MIRROR)
|
if (dc->flags & DCF_JUST_MIRROR)
|
||||||
goto gr_done;
|
goto gr_done;
|
||||||
}
|
}
|
||||||
|
|
||||||
result|=BSpline3(dc,ctrl,cnt,&GrPlot3,closed);
|
res|=BSpline3(dc,ctrl,cnt,&GrPlot3,closed);
|
||||||
gr_done:
|
gr_done:
|
||||||
Free(ctrl2);
|
Free(ctrl2);
|
||||||
Free(ctrl3);
|
Free(ctrl3);
|
||||||
dc->flags=old_flags;
|
dc->flags=old_flags;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public I64 GrFillTri0(CDC *dc=gr.dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p4)
|
public I64 GrFillTri0(CDC *dc=gr.dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p4)
|
||||||
{//3D. Returns cnt of pixs changed
|
{//3D. Returns cnt of pixs changed
|
||||||
I64 x1,x2,y,z1,z2,dx1,dy1,dz1,dx2,dy2,dz2,result=0,i,y_min,y_max;
|
I64 x1,x2,y,z1,z2,dx1,dy1,dz1,dx2,dy2,dz2,res=0,i,y_min,y_max;
|
||||||
CTask *win_task;
|
CTask *win_task;
|
||||||
//p1 is min x
|
//p1 is min x
|
||||||
if (p4->x<p2->x)
|
if (p4->x<p2->x)
|
||||||
@@ -1219,7 +1219,7 @@ p1y
|
|||||||
z2+=dz2*i;
|
z2+=dz2*i;
|
||||||
}
|
}
|
||||||
while (dy2++) {
|
while (dy2++) {
|
||||||
result+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
|
res+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
|
||||||
y--;
|
y--;
|
||||||
x1+=dx1;
|
x1+=dx1;
|
||||||
x2+=dx2;
|
x2+=dx2;
|
||||||
@@ -1246,7 +1246,7 @@ p1y
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (dy2++<=0) {
|
while (dy2++<=0) {
|
||||||
result+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
|
res+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
|
||||||
y--;
|
y--;
|
||||||
x1+=dx1;
|
x1+=dx1;
|
||||||
x2+=dx2;
|
x2+=dx2;
|
||||||
@@ -1304,7 +1304,7 @@ p4y
|
|||||||
z2+=dz2*i;
|
z2+=dz2*i;
|
||||||
}
|
}
|
||||||
while (dy2--) {
|
while (dy2--) {
|
||||||
result+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
|
res+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
|
||||||
y++;
|
y++;
|
||||||
x1+=dx1;
|
x1+=dx1;
|
||||||
x2+=dx2;
|
x2+=dx2;
|
||||||
@@ -1331,7 +1331,7 @@ p4y
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (dy2-->=0) {
|
while (dy2-->=0) {
|
||||||
result+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
|
res+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
|
||||||
y++;
|
y++;
|
||||||
x1+=dx1;
|
x1+=dx1;
|
||||||
x2+=dx2;
|
x2+=dx2;
|
||||||
@@ -1403,7 +1403,7 @@ p4y
|
|||||||
}
|
}
|
||||||
while (dy1++<=0) {
|
while (dy1++<=0) {
|
||||||
if (y<y_max)
|
if (y<y_max)
|
||||||
result+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
|
res+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
|
||||||
y++;
|
y++;
|
||||||
x1+=dx1;
|
x1+=dx1;
|
||||||
x2+=dx2;
|
x2+=dx2;
|
||||||
@@ -1438,7 +1438,7 @@ p4y
|
|||||||
z2+=dz2*i;
|
z2+=dz2*i;
|
||||||
}
|
}
|
||||||
while (dy1-->=0) {
|
while (dy1-->=0) {
|
||||||
result+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
|
res+=GrHLine(dc,x1.i32[1],x2.i32[1],y,z1.i32[1],z2.i32[1]);
|
||||||
y--;
|
y--;
|
||||||
x1+=dx1;
|
x1+=dx1;
|
||||||
x2+=dx2;
|
x2+=dx2;
|
||||||
@@ -1448,5 +1448,5 @@ p4y
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ft_done:
|
ft_done:
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -379,18 +379,18 @@ U0 GrUpdateVGAGraphics()
|
|||||||
dst=gr.screen_image->body;
|
dst=gr.screen_image->body;
|
||||||
if (LBtr(&sys_semas[SYS_SEMA_FLUSH_VGA_IMAGE],0)) {
|
if (LBtr(&sys_semas[SYS_SEMA_FLUSH_VGA_IMAGE],0)) {
|
||||||
for (plane=1;plane<0x10;plane<<=1) {
|
for (plane=1;plane<0x10;plane<<=1) {
|
||||||
OutU8(VGAP_INDEX,VGAR_MAP_MASK);
|
OutU8(VGAP_IDX,VGAR_MAP_MASK);
|
||||||
OutU8(VGAP_DATA,plane);
|
OutU8(VGAP_DATA,plane);
|
||||||
vga=VGAM_GRAPHICS;
|
vga=text.vga_alias;
|
||||||
row=gr.zoomed_dc->height;
|
row=gr.zoomed_dc->height;
|
||||||
while (row--)
|
while (row--)
|
||||||
GrUpdateLine64FlushCache(&vga,&src,d,&dst);
|
GrUpdateLine64FlushCache(&vga,&src,d,&dst);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (plane=1;plane<0x10;plane<<=1) {
|
for (plane=1;plane<0x10;plane<<=1) {
|
||||||
OutU8(VGAP_INDEX,VGAR_MAP_MASK);
|
OutU8(VGAP_IDX,VGAR_MAP_MASK);
|
||||||
OutU8(VGAP_DATA,plane);
|
OutU8(VGAP_DATA,plane);
|
||||||
vga=VGAM_GRAPHICS;
|
vga=text.vga_alias;
|
||||||
row=gr.zoomed_dc->height;
|
row=gr.zoomed_dc->height;
|
||||||
while (row--)
|
while (row--)
|
||||||
GrUpdateLine64(&vga,&src,d,&dst);
|
GrUpdateLine64(&vga,&src,d,&dst);
|
||||||
|
|||||||
+13
-13
@@ -331,33 +331,33 @@ public U0 SpriteExtents(U8 *elems,I64 *min_x=NULL,I64 *max_x=NULL,
|
|||||||
|
|
||||||
public CDC *Sprite2DC(U8 *elems)
|
public CDC *Sprite2DC(U8 *elems)
|
||||||
{//Convert sprite to device context.
|
{//Convert sprite to device context.
|
||||||
CDC *result;
|
CDC *res;
|
||||||
I64 min_x,max_x,min_y,max_y;
|
I64 min_x,max_x,min_y,max_y;
|
||||||
SpriteExtents(elems,&min_x,&max_x,&min_y,&max_y);
|
SpriteExtents(elems,&min_x,&max_x,&min_y,&max_y);
|
||||||
result=DCNew(max_x-min_x+1,max_y-min_y+1);
|
res=DCNew(max_x-min_x+1,max_y-min_y+1);
|
||||||
Sprite3(result,-min_x,-min_y,0,elems);
|
Sprite3(res,-min_x,-min_y,0,elems);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public U8 *SpriteInterpolate(U8 *elems0,U8 *elems1,F64 t)
|
public U8 *SpriteInterpolate(F64 t,U8 *elems0,U8 *elems1)
|
||||||
{//The two CSprite should be identical except for points shifted around.
|
{//The two CSprite should be ident except for points shifted around.
|
||||||
//t ranges from 0.0 to 1.0.
|
//t ranges from 0.0 to 1.0.
|
||||||
I64 i,t1=GR_SCALE*t,t0=GR_SCALE-t1;
|
I64 i,t1=GR_SCALE*t,t0=GR_SCALE-t1;
|
||||||
I32 *ptr0,*ptr1,*ptrr;
|
I32 *ptr0,*ptr1,*ptrr;
|
||||||
CD3I32 *p0,*p1,*pr;
|
CD3I32 *p0,*p1,*pr;
|
||||||
U8 *result;
|
U8 *res;
|
||||||
CSprite *tempg0=elems0-offset(CSprite.start),
|
CSprite *tempg0=elems0-offset(CSprite.start),
|
||||||
*tempg1=elems1-offset(CSprite.start),*tempgr;
|
*tempg1=elems1-offset(CSprite.start),*tempgr;
|
||||||
if (t<0.5) {
|
if (t<0.5) {
|
||||||
i=SpriteSize(elems0),
|
i=SpriteSize(elems0),
|
||||||
result=MAlloc(i);
|
res=MAlloc(i);
|
||||||
MemCpy(result,elems0,i);
|
MemCpy(res,elems0,i);
|
||||||
} else {
|
} else {
|
||||||
i=SpriteSize(elems1),
|
i=SpriteSize(elems1),
|
||||||
result=MAlloc(i);
|
res=MAlloc(i);
|
||||||
MemCpy(result,elems1,i);
|
MemCpy(res,elems1,i);
|
||||||
}
|
}
|
||||||
tempgr=result-offset(CSprite.start);
|
tempgr=res-offset(CSprite.start);
|
||||||
while (tempg0->type) {
|
while (tempg0->type) {
|
||||||
if (tempg0->type!=tempg1->type)
|
if (tempg0->type!=tempg1->type)
|
||||||
throw('Graphics');
|
throw('Graphics');
|
||||||
@@ -447,7 +447,7 @@ public U8 *SpriteInterpolate(U8 *elems0,U8 *elems1,F64 t)
|
|||||||
tempg1(U8 *)+=SpriteElemSize(tempg1);
|
tempg1(U8 *)+=SpriteElemSize(tempg1);
|
||||||
tempgr(U8 *)+=SpriteElemSize(tempgr);
|
tempgr(U8 *)+=SpriteElemSize(tempgr);
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#help_index "Graphics/Sprite;DolDoc/Output;StdOut/DolDoc"
|
#help_index "Graphics/Sprite;DolDoc/Output;StdOut/DolDoc"
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ I64 SpriteBitMapEd(CDoc *,CDocEntry *doc_e,CDC *dc,I64 *_xx1,I64 *_yy1,
|
|||||||
I64 *_xx2,I64 *_yy2,CDC **_img,CColorROPU32 bkcolor)
|
I64 *_xx2,I64 *_yy2,CDC **_img,CColorROPU32 bkcolor)
|
||||||
{
|
{
|
||||||
I64 i,j,mode=GBM_LINE,color=BLACK,width=1,msg_code,a1,a2,x1,y1,x11,y11,
|
I64 i,j,mode=GBM_LINE,color=BLACK,width=1,msg_code,a1,a2,x1,y1,x11,y11,
|
||||||
x22,y22,result,xx1=*_xx1,yy1=*_yy1,xx2=*_xx2,yy2=*_yy2,
|
x22,y22,res,xx1=*_xx1,yy1=*_yy1,xx2=*_xx2,yy2=*_yy2,
|
||||||
old_de_flags=doc_e->de_flags;
|
old_de_flags=doc_e->de_flags;
|
||||||
Bool down=FALSE;
|
Bool down=FALSE;
|
||||||
U8 *st=NULL;
|
U8 *st=NULL;
|
||||||
@@ -228,10 +228,10 @@ I64 SpriteBitMapEd(CDoc *,CDocEntry *doc_e,CDC *dc,I64 *_xx1,I64 *_yy1,
|
|||||||
case MSG_KEY_DOWN:
|
case MSG_KEY_DOWN:
|
||||||
switch (a1) {
|
switch (a1) {
|
||||||
case CH_SHIFT_ESC:
|
case CH_SHIFT_ESC:
|
||||||
result=GE_ABORT;
|
res=GE_ABORT;
|
||||||
goto bm_key_up_done;
|
goto bm_key_up_done;
|
||||||
case CH_ESC:
|
case CH_ESC:
|
||||||
result=GE_CONT;
|
res=GE_CONT;
|
||||||
goto bm_key_up_done;
|
goto bm_key_up_done;
|
||||||
case 'c': //eye-dropper
|
case 'c': //eye-dropper
|
||||||
dc2=DCScreenCapture(FALSE);
|
dc2=DCScreenCapture(FALSE);
|
||||||
@@ -253,13 +253,13 @@ bm_menu:
|
|||||||
StrCpy(Fs->task_title,DefineSub(i,"ST_SPRITE_BITMAP_MENU"));
|
StrCpy(Fs->task_title,DefineSub(i,"ST_SPRITE_BITMAP_MENU"));
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case DOCM_CANCEL:
|
case DOCM_CANCEL:
|
||||||
result=GE_ABORT;
|
res=GE_ABORT;
|
||||||
goto bm_done;
|
goto bm_done;
|
||||||
case GBM_EXIT:
|
case GBM_EXIT:
|
||||||
result=GE_EXIT;
|
res=GE_EXIT;
|
||||||
goto bm_done;
|
goto bm_done;
|
||||||
case GBM_MAIN_MENU:
|
case GBM_MAIN_MENU:
|
||||||
result=GE_CONT;
|
res=GE_CONT;
|
||||||
goto bm_done;
|
goto bm_done;
|
||||||
case GBM_COLOR:
|
case GBM_COLOR:
|
||||||
i=PopUpColor(,,FALSE);
|
i=PopUpColor(,,FALSE);
|
||||||
@@ -672,5 +672,5 @@ bm_done:
|
|||||||
doc_e->de_flags=old_de_flags;
|
doc_e->de_flags=old_de_flags;
|
||||||
*_img=img;
|
*_img=img;
|
||||||
*_xx1=xx1,*_yy1=yy1,*_xx2=xx2,*_yy2=yy2;
|
*_xx1=xx1,*_yy1=yy1,*_xx2=xx2,*_yy2=yy2;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
+26
-26
@@ -201,7 +201,7 @@ public U0 Sprite2Code(CDoc *doc=NULL,U8 *elems)
|
|||||||
CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||||
{
|
{
|
||||||
I64 i,num1,num2,size;
|
I64 i,num1,num2,size;
|
||||||
CSprite *result,g;
|
CSprite *res,g;
|
||||||
CColorROPU32 color;
|
CColorROPU32 color;
|
||||||
U8 *st,*ptr;
|
U8 *st,*ptr;
|
||||||
CQueD3I32 rootp,*tempp,*tempa1;
|
CQueD3I32 rootp,*tempp,*tempa1;
|
||||||
@@ -313,8 +313,8 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
|||||||
break;
|
break;
|
||||||
sub_switch_end:
|
sub_switch_end:
|
||||||
size=SpriteElemSize(&g)+offset(CSprite.start);
|
size=SpriteElemSize(&g)+offset(CSprite.start);
|
||||||
result=MAlloc(size);
|
res=MAlloc(size);
|
||||||
MemCpy(result,&g,size);
|
MemCpy(res,&g,size);
|
||||||
break;
|
break;
|
||||||
case SPT_TEXT:
|
case SPT_TEXT:
|
||||||
case SPT_TEXT_BOX:
|
case SPT_TEXT_BOX:
|
||||||
@@ -330,9 +330,9 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
|||||||
LexExcept(cc,"Expecting string at ");
|
LexExcept(cc,"Expecting string at ");
|
||||||
size=SpriteElemQuedBaseSize(type);
|
size=SpriteElemQuedBaseSize(type);
|
||||||
i=StrLen(st)+1;
|
i=StrLen(st)+1;
|
||||||
result=MAlloc(size+i);
|
res=MAlloc(size+i);
|
||||||
MemCpy(result,&g,size);
|
MemCpy(res,&g,size);
|
||||||
MemCpy(result(U8 *)+size,st,i);
|
MemCpy(res(U8 *)+size,st,i);
|
||||||
Free(st);
|
Free(st);
|
||||||
break;
|
break;
|
||||||
case SPT_POLYLINE:
|
case SPT_POLYLINE:
|
||||||
@@ -350,9 +350,9 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
|||||||
if (g.nu.num<2)
|
if (g.nu.num<2)
|
||||||
LexExcept(cc,"Expecting point at ");
|
LexExcept(cc,"Expecting point at ");
|
||||||
size=SpriteElemQuedBaseSize(SPT_POLYLINE);
|
size=SpriteElemQuedBaseSize(SPT_POLYLINE);
|
||||||
result=MAlloc(size+g.nu.num*sizeof(CD2I32));
|
res=MAlloc(size+g.nu.num*sizeof(CD2I32));
|
||||||
MemCpy(result,&g,size);
|
MemCpy(res,&g,size);
|
||||||
ptr=&result->nu.u;
|
ptr=&res->nu.u;
|
||||||
tempp=rootp.next;
|
tempp=rootp.next;
|
||||||
while (tempp!=&rootp) {
|
while (tempp!=&rootp) {
|
||||||
tempa1=tempp->next;
|
tempa1=tempp->next;
|
||||||
@@ -379,7 +379,7 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
|||||||
if (g.nu.num<2)
|
if (g.nu.num<2)
|
||||||
LexExcept(cc,"Expecting point at ");
|
LexExcept(cc,"Expecting point at ");
|
||||||
size=SpriteElemQuedBaseSize(type);
|
size=SpriteElemQuedBaseSize(type);
|
||||||
result=MAlloc(size+g.nu.num*sizeof(CD3I32));
|
res=MAlloc(size+g.nu.num*sizeof(CD3I32));
|
||||||
if (LexExpressionI64(cc)) {
|
if (LexExpressionI64(cc)) {
|
||||||
if (type==SPT_BSPLINE2||type==SPT_BSPLINE2_CLOSED)
|
if (type==SPT_BSPLINE2||type==SPT_BSPLINE2_CLOSED)
|
||||||
g.type=SPT_BSPLINE2_CLOSED;
|
g.type=SPT_BSPLINE2_CLOSED;
|
||||||
@@ -391,8 +391,8 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
|||||||
else
|
else
|
||||||
g.type=SPT_BSPLINE3;
|
g.type=SPT_BSPLINE3;
|
||||||
}
|
}
|
||||||
MemCpy(result,&g,size);
|
MemCpy(res,&g,size);
|
||||||
ptr=&result->nu.u;
|
ptr=&res->nu.u;
|
||||||
tempp=rootp.next;
|
tempp=rootp.next;
|
||||||
while (tempp!=&rootp) {
|
while (tempp!=&rootp) {
|
||||||
tempa1=tempp->next;
|
tempa1=tempp->next;
|
||||||
@@ -420,9 +420,9 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
|||||||
Lex(cc); //Load '}'
|
Lex(cc); //Load '}'
|
||||||
g.type=SPT_POLYPT;
|
g.type=SPT_POLYPT;
|
||||||
size=SpriteElemQuedBaseSize(SPT_POLYPT);
|
size=SpriteElemQuedBaseSize(SPT_POLYPT);
|
||||||
result=CAlloc(size+(g.npu.num*3+7)>>3);
|
res=CAlloc(size+(g.npu.num*3+7)>>3);
|
||||||
MemCpy(result,&g,size);
|
MemCpy(res,&g,size);
|
||||||
ptr=&result->npu.u;
|
ptr=&res->npu.u;
|
||||||
for (i=0;i<g.npu.num;i++)
|
for (i=0;i<g.npu.num;i++)
|
||||||
BFieldOrU32(ptr,i*3,QueVectU8Get(tempv,i));
|
BFieldOrU32(ptr,i*3,QueVectU8Get(tempv,i));
|
||||||
QueVectU8Del(tempv);
|
QueVectU8Del(tempv);
|
||||||
@@ -456,9 +456,9 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
|||||||
Lex(cc); //Load '}'
|
Lex(cc); //Load '}'
|
||||||
g.type=SPT_BITMAP;
|
g.type=SPT_BITMAP;
|
||||||
size=SpriteElemQuedBaseSize(SPT_BITMAP);
|
size=SpriteElemQuedBaseSize(SPT_BITMAP);
|
||||||
result=CAlloc(size+num1);
|
res=CAlloc(size+num1);
|
||||||
MemCpy(result,&g,size);
|
MemCpy(res,&g,size);
|
||||||
ptr=&result->pwhu.u;
|
ptr=&res->pwhu.u;
|
||||||
for (i=0;i<num1;i++)
|
for (i=0;i<num1;i++)
|
||||||
*ptr++=QueVectU8Get(tempv,i);
|
*ptr++=QueVectU8Get(tempv,i);
|
||||||
QueVectU8Del(tempv);
|
QueVectU8Del(tempv);
|
||||||
@@ -531,9 +531,9 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
|||||||
g.pmu.tri_cnt=num2;
|
g.pmu.tri_cnt=num2;
|
||||||
}
|
}
|
||||||
size=SpriteElemQuedBaseSize(g.type);
|
size=SpriteElemQuedBaseSize(g.type);
|
||||||
result=MAlloc(size+num1*sizeof(CD3I32)+num2*sizeof(CMeshTri));
|
res=MAlloc(size+num1*sizeof(CD3I32)+num2*sizeof(CMeshTri));
|
||||||
MemCpy(result,&g,size);
|
MemCpy(res,&g,size);
|
||||||
ptr=result(U8 *)+size;
|
ptr=res(U8 *)+size;
|
||||||
tempp=rootp.next;
|
tempp=rootp.next;
|
||||||
while (tempp!=&rootp) {
|
while (tempp!=&rootp) {
|
||||||
tempa1=tempp->next;
|
tempa1=tempp->next;
|
||||||
@@ -556,13 +556,13 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
|||||||
LexExcept(cc,"Expecting '}' at ");
|
LexExcept(cc,"Expecting '}' at ");
|
||||||
if (Lex(cc)!=';')
|
if (Lex(cc)!=';')
|
||||||
LexExcept(cc,"Expecting ';' at ");
|
LexExcept(cc,"Expecting ';' at ");
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public U8 *Code2Sprite(CDoc *doc,I64 *_size=NULL)
|
public U8 *Code2Sprite(CDoc *doc,I64 *_size=NULL)
|
||||||
{//Text to sprite.
|
{//Text to sprite.
|
||||||
CSprite root;
|
CSprite root;
|
||||||
U8 *result;
|
U8 *res;
|
||||||
Bool okay=TRUE,unlock_doc=DocLock(doc);
|
Bool okay=TRUE,unlock_doc=DocLock(doc);
|
||||||
CCmpCtrl *cc=CmpCtrlNew(,CCF_DONT_FREE_BUF);
|
CCmpCtrl *cc=CmpCtrlNew(,CCF_DONT_FREE_BUF);
|
||||||
CHashTable *old_hash_table_lst=cc->htc.hash_table_lst;
|
CHashTable *old_hash_table_lst=cc->htc.hash_table_lst;
|
||||||
@@ -591,12 +591,12 @@ public U8 *Code2Sprite(CDoc *doc,I64 *_size=NULL)
|
|||||||
DocUnlock(doc);
|
DocUnlock(doc);
|
||||||
if (okay) {
|
if (okay) {
|
||||||
CmpCtrlDel(cc); //TODO: can crash
|
CmpCtrlDel(cc); //TODO: can crash
|
||||||
result=SpriteQue2Sprite(&root,&size);
|
res=SpriteQue2Sprite(&root,&size);
|
||||||
} else {
|
} else {
|
||||||
result=NULL;
|
res=NULL;
|
||||||
size=0;
|
size=0;
|
||||||
}
|
}
|
||||||
if (_size) *_size=size;
|
if (_size) *_size=size;
|
||||||
QueDel(&root);
|
QueDel(&root);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
+41
-41
@@ -4,49 +4,49 @@ CSprite *SpriteSetSettings(CDC *dc=NULL,CSprite *root,I64 elem_num,
|
|||||||
I64 x=0,I64 y=0,CColorROPU32 *_color=NULL,I64 *_width=NULL,
|
I64 x=0,I64 y=0,CColorROPU32 *_color=NULL,I64 *_width=NULL,
|
||||||
I64 *_xx=NULL,I64 *_yy=NULL)
|
I64 *_xx=NULL,I64 *_yy=NULL)
|
||||||
{
|
{
|
||||||
CSprite *result=root->next;
|
CSprite *res=root->next;
|
||||||
I64 width=1,xx=0,yy=0;
|
I64 width=1,xx=0,yy=0;
|
||||||
CColorROPU32 color=BLACK;
|
CColorROPU32 color=BLACK;
|
||||||
if (dc) DCRst(dc);
|
if (dc) DCRst(dc);
|
||||||
while (elem_num-->0 && result!=root) {
|
while (elem_num-->0 && res!=root) {
|
||||||
switch (result->type) {
|
switch (res->type) {
|
||||||
case SPT_COLOR:
|
case SPT_COLOR:
|
||||||
color=result->c.color;
|
color=res->c.color;
|
||||||
if (dc) dc->color=color;
|
if (dc) dc->color=color;
|
||||||
break;
|
break;
|
||||||
case SPT_DITHER_COLOR:
|
case SPT_DITHER_COLOR:
|
||||||
color=result->d.dither_color.u8[0]|
|
color=res->d.dither_color.u8[0]|
|
||||||
result->d.dither_color.u8[1]<<COLORROP_BITS|ROPF_DITHER;
|
res->d.dither_color.u8[1]<<COLORROP_BITS|ROPF_DITHER;
|
||||||
if (dc) dc->color=color;
|
if (dc) dc->color=color;
|
||||||
break;
|
break;
|
||||||
case SPT_WIDTH:
|
case SPT_WIDTH:
|
||||||
width=result->w.width;
|
width=res->w.width;
|
||||||
if (dc) dc->pen_width=width;
|
if (dc) dc->pen_width=width;
|
||||||
break;
|
break;
|
||||||
case SPT_SHIFT:
|
case SPT_SHIFT:
|
||||||
xx+=result->p.x1;
|
xx+=res->p.x1;
|
||||||
yy+=result->p.y1;
|
yy+=res->p.y1;
|
||||||
x+=result->p.x1;
|
x+=res->p.x1;
|
||||||
y+=result->p.y1;
|
y+=res->p.y1;
|
||||||
break;
|
break;
|
||||||
case SPT_PLANAR_SYMMETRY:
|
case SPT_PLANAR_SYMMETRY:
|
||||||
if (dc) {
|
if (dc) {
|
||||||
if (DCSymmetry3Set(dc,result->pp.x1+x,result->pp.y1+y,0,
|
if (DCSymmetry3Set(dc,res->pp.x1+x,res->pp.y1+y,0,
|
||||||
result->pp.x2+x,result->pp.y2+y,0,
|
res->pp.x2+x,res->pp.y2+y,0,
|
||||||
result->pp.x2+x,result->pp.y2+y,1))
|
res->pp.x2+x,res->pp.y2+y,1))
|
||||||
dc->flags|=DCF_SYMMETRY;
|
dc->flags|=DCF_SYMMETRY;
|
||||||
else
|
else
|
||||||
dc->flags&=~DCF_SYMMETRY;
|
dc->flags&=~DCF_SYMMETRY;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
result=result->next;
|
res=res->next;
|
||||||
}
|
}
|
||||||
if (_color) *_color=color;
|
if (_color) *_color=color;
|
||||||
if (_width) *_width=width;
|
if (_width) *_width=width;
|
||||||
if (_xx) *_xx=xx;
|
if (_xx) *_xx=xx;
|
||||||
if (_yy) *_yy=yy;
|
if (_yy) *_yy=yy;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool SpritePolyPtPlot(CSprite *root,I64 x,I64 y,I64)
|
Bool SpritePolyPtPlot(CSprite *root,I64 x,I64 y,I64)
|
||||||
@@ -62,31 +62,31 @@ Bool SpritePolyPtPlot(CSprite *root,I64 x,I64 y,I64)
|
|||||||
CSprite *Sprite2SpriteQue(U8 *elems)
|
CSprite *Sprite2SpriteQue(U8 *elems)
|
||||||
{
|
{
|
||||||
I64 s;
|
I64 s;
|
||||||
CSprite *result=CAlloc(sizeof(CSprite)),
|
CSprite *res=CAlloc(sizeof(CSprite)),
|
||||||
*tempg=elems-offset(CSprite.start),*tempg1;
|
*tempg=elems-offset(CSprite.start),*tempg1;
|
||||||
QueInit(result);
|
QueInit(res);
|
||||||
while (tempg->type) {
|
while (tempg->type) {
|
||||||
tempg1=MAlloc(SpriteElemSize(tempg)+offset(CSprite.start));
|
tempg1=MAlloc(SpriteElemSize(tempg)+offset(CSprite.start));
|
||||||
s=SpriteElemSize(tempg);
|
s=SpriteElemSize(tempg);
|
||||||
MemCpy(&tempg1->start,&tempg->start,s);
|
MemCpy(&tempg1->start,&tempg->start,s);
|
||||||
tempg1->selected=FALSE;
|
tempg1->selected=FALSE;
|
||||||
QueIns(tempg1,result->last);
|
QueIns(tempg1,res->last);
|
||||||
tempg(U8 *)+=s;
|
tempg(U8 *)+=s;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U8 *SpriteQue2Sprite(CSprite *root,I64 *_size=NULL)
|
U8 *SpriteQue2Sprite(CSprite *root,I64 *_size=NULL)
|
||||||
{
|
{
|
||||||
I64 i,size=sprite_elem_base_sizes[SPT_END];
|
I64 i,size=sprite_elem_base_sizes[SPT_END];
|
||||||
CSprite *tempg=root->next;
|
CSprite *tempg=root->next;
|
||||||
U8 *result,*dst;
|
U8 *res,*dst;
|
||||||
while (tempg!=root) {
|
while (tempg!=root) {
|
||||||
size+=SpriteElemSize(tempg);
|
size+=SpriteElemSize(tempg);
|
||||||
tempg=tempg->next;
|
tempg=tempg->next;
|
||||||
}
|
}
|
||||||
if (_size) *_size=size;
|
if (_size) *_size=size;
|
||||||
result=dst=MAlloc(size);
|
res=dst=MAlloc(size);
|
||||||
tempg=root->next;
|
tempg=root->next;
|
||||||
while (tempg!=root) {
|
while (tempg!=root) {
|
||||||
i=SpriteElemSize(tempg);
|
i=SpriteElemSize(tempg);
|
||||||
@@ -95,7 +95,7 @@ U8 *SpriteQue2Sprite(CSprite *root,I64 *_size=NULL)
|
|||||||
tempg=tempg->next;
|
tempg=tempg->next;
|
||||||
}
|
}
|
||||||
*dst=SPT_END;
|
*dst=SPT_END;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 SpriteEdUpdate(CDoc *doc,CDocEntry *doc_ce,CSprite *root)
|
U0 SpriteEdUpdate(CDoc *doc,CDocEntry *doc_ce,CSprite *root)
|
||||||
@@ -555,47 +555,47 @@ U0 SpriteTransform(I64 *r,CSprite *root)
|
|||||||
|
|
||||||
I64 SpriteQueSelectCnt(CSprite *root,Bool val=TRUE)
|
I64 SpriteQueSelectCnt(CSprite *root,Bool val=TRUE)
|
||||||
{
|
{
|
||||||
I64 result=0;
|
I64 res=0;
|
||||||
CSprite *tempg=root->next;
|
CSprite *tempg=root->next;
|
||||||
val=ToBool(val);
|
val=ToBool(val);
|
||||||
while (tempg!=root) {
|
while (tempg!=root) {
|
||||||
if (ToBool(tempg->selected)==val)
|
if (ToBool(tempg->selected)==val)
|
||||||
result++;
|
res++;
|
||||||
tempg=tempg->next;
|
tempg=tempg->next;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
I64 SpriteQueSelectAll(CSprite *root,Bool val=TRUE)
|
I64 SpriteQueSelectAll(CSprite *root,Bool val=TRUE)
|
||||||
{
|
{
|
||||||
I64 result=0;
|
I64 res=0;
|
||||||
CSprite *tempg=root->next;
|
CSprite *tempg=root->next;
|
||||||
while (tempg!=root) {
|
while (tempg!=root) {
|
||||||
tempg->selected=val;
|
tempg->selected=val;
|
||||||
result++;
|
res++;
|
||||||
tempg=tempg->next;
|
tempg=tempg->next;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSprite *SpriteSideBar2SpriteQue(CDoc *doc,CSprite *root,I64 *_cur_elem_num)
|
CSprite *SpriteSideBar2SpriteQue(CDoc *doc,CSprite *root,I64 *_cur_elem_num)
|
||||||
{//For the side-bar
|
{//For the side-bar
|
||||||
CSprite *result=CAlloc(sizeof(CSprite)),*tempg;
|
CSprite *res=CAlloc(sizeof(CSprite)),*tempg;
|
||||||
CDocEntry *doc_e=doc->root.next;
|
CDocEntry *doc_e=doc->root.next;
|
||||||
Bool found=FALSE;
|
Bool found=FALSE;
|
||||||
I64 num=0;
|
I64 num=0;
|
||||||
QueInit(result);
|
QueInit(res);
|
||||||
while (doc_e!=doc) {
|
while (doc_e!=doc) {
|
||||||
if (doc_e->type_u8==DOCT_MENU_VAL && doc_e->left_exp>=0) {
|
if (doc_e->type_u8==DOCT_MENU_VAL && doc_e->left_exp>=0) {
|
||||||
tempg=SpriteSetSettings(,root,doc_e->left_exp);
|
tempg=SpriteSetSettings(,root,doc_e->left_exp);
|
||||||
if (tempg!=root) {
|
if (tempg!=root) {
|
||||||
tempg=MAllocIdentical(tempg);
|
tempg=MAllocIdent(tempg);
|
||||||
tempg->selected=Bt(&doc_e->type,DOCEt_SELECTED);
|
tempg->selected=Bt(&doc_e->type,DOCEt_SELECTED);
|
||||||
if (*_cur_elem_num==doc_e->left_exp) {
|
if (*_cur_elem_num==doc_e->left_exp) {
|
||||||
*_cur_elem_num=num;
|
*_cur_elem_num=num;
|
||||||
found=TRUE;
|
found=TRUE;
|
||||||
}
|
}
|
||||||
QueIns(tempg,result->last);
|
QueIns(tempg,res->last);
|
||||||
num++;
|
num++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -605,7 +605,7 @@ CSprite *SpriteSideBar2SpriteQue(CDoc *doc,CSprite *root,I64 *_cur_elem_num)
|
|||||||
*_cur_elem_num=num;
|
*_cur_elem_num=num;
|
||||||
QueDel(root);
|
QueDel(root);
|
||||||
Free(root);
|
Free(root);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 SpriteSideBarPickNew(CDoc *doc,CSprite *root,I64 old_num)
|
U0 SpriteSideBarPickNew(CDoc *doc,CSprite *root,I64 old_num)
|
||||||
@@ -679,7 +679,7 @@ U0 SpriteSideBarTask(CTask *parent,CSprite **_root,I64 *_cur_elem_num)
|
|||||||
|
|
||||||
Bool SpriteEdText(CSprite **_root,I64 *_cur_elem_num)
|
Bool SpriteEdText(CSprite **_root,I64 *_cur_elem_num)
|
||||||
{
|
{
|
||||||
Bool result;
|
Bool res;
|
||||||
CSprite *root=*_root;
|
CSprite *root=*_root;
|
||||||
U8 *elems=SpriteQue2Sprite(root);
|
U8 *elems=SpriteQue2Sprite(root);
|
||||||
CDoc *doc=DocNew,*doc2,*old_put=DocPut;
|
CDoc *doc=DocNew,*doc2,*old_put=DocPut;
|
||||||
@@ -690,7 +690,7 @@ Bool SpriteEdText(CSprite **_root,I64 *_cur_elem_num)
|
|||||||
Sprite2Code(doc,elems);
|
Sprite2Code(doc,elems);
|
||||||
Free(elems);
|
Free(elems);
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
if (result=PopUpPrint("DocEd(0x%X,0x%X);",doc,0)) {
|
if (res=PopUpPrint("DocEd(0x%X,0x%X);",doc,0)) {
|
||||||
Fs->put_doc=doc2=DocNew;
|
Fs->put_doc=doc2=DocNew;
|
||||||
"$$WW,1$$";
|
"$$WW,1$$";
|
||||||
if (elems=Code2Sprite(doc)) {
|
if (elems=Code2Sprite(doc)) {
|
||||||
@@ -712,7 +712,7 @@ Bool SpriteEdText(CSprite **_root,I64 *_cur_elem_num)
|
|||||||
}
|
}
|
||||||
DocDel(doc);
|
DocDel(doc);
|
||||||
if (_root) *_root=root;
|
if (_root) *_root=root;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GED_SELECT_UNSELECT_ALL 0
|
#define GED_SELECT_UNSELECT_ALL 0
|
||||||
@@ -955,7 +955,7 @@ U0 SpriteCtrlPtsMove(CEdSprite *root,I64 dx,I64 dy)
|
|||||||
Bool SpriteShiftPts(U8 *elems,I64 x,I64 y,I64 *_cur_elem_num,I64 mode)
|
Bool SpriteShiftPts(U8 *elems,I64 x,I64 y,I64 *_cur_elem_num,I64 mode)
|
||||||
{
|
{
|
||||||
I64 msg_code,a1,a2,xx,yy,xx2,yy2,dd,best_dd,cur_elem_num;
|
I64 msg_code,a1,a2,xx,yy,xx2,yy2,dd,best_dd,cur_elem_num;
|
||||||
Bool result=TRUE;
|
Bool res=TRUE;
|
||||||
CDC *dc=DCAlias;
|
CDC *dc=DCAlias;
|
||||||
CEdSprite root,*temppe,*best_pe;
|
CEdSprite root,*temppe,*best_pe;
|
||||||
|
|
||||||
@@ -1048,7 +1048,7 @@ Bool SpriteShiftPts(U8 *elems,I64 x,I64 y,I64 *_cur_elem_num,I64 mode)
|
|||||||
gs_key:
|
gs_key:
|
||||||
switch (a1.u8[0]) {
|
switch (a1.u8[0]) {
|
||||||
case CH_SHIFT_ESC:
|
case CH_SHIFT_ESC:
|
||||||
result=FALSE;
|
res=FALSE;
|
||||||
case CH_ESC:
|
case CH_ESC:
|
||||||
GetMsg(&a1,&a2,1<<MSG_KEY_UP);
|
GetMsg(&a1,&a2,1<<MSG_KEY_UP);
|
||||||
goto gs_done;
|
goto gs_done;
|
||||||
@@ -1071,9 +1071,9 @@ gs_done:
|
|||||||
}
|
}
|
||||||
DCFill(dc);
|
DCFill(dc);
|
||||||
DCDel(dc);
|
DCDel(dc);
|
||||||
if (_cur_elem_num && result)
|
if (_cur_elem_num && res)
|
||||||
*_cur_elem_num=cur_elem_num;
|
*_cur_elem_num=cur_elem_num;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
I64 SpriteEd(CDoc *doc,CDocEntry *doc_ce,I64 x,I64 y,
|
I64 SpriteEd(CDoc *doc,CDocEntry *doc_ce,I64 x,I64 y,
|
||||||
|
|||||||
+138
-138
@@ -131,7 +131,7 @@ U0 SpriteScreenInit(CDC *dc,I64,I64)
|
|||||||
CSprite *SMLine(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
CSprite *SMLine(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||||
{
|
{
|
||||||
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
||||||
CSprite *result;
|
CSprite *res;
|
||||||
do {
|
do {
|
||||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||||
@@ -141,19 +141,19 @@ CSprite *SMLine(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
|||||||
} while (msg_code!=MSG_IP_L_UP);
|
} while (msg_code!=MSG_IP_L_UP);
|
||||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_LINE));
|
res=CAlloc(SpriteElemQuedBaseSize(SPT_LINE));
|
||||||
result->type=SPT_LINE;
|
res->type=SPT_LINE;
|
||||||
result->pp.x1=x1-x;
|
res->pp.x1=x1-x;
|
||||||
result->pp.y1=y1-y;
|
res->pp.y1=y1-y;
|
||||||
result->pp.x2=x2-x;
|
res->pp.x2=x2-x;
|
||||||
result->pp.y2=y2-y;
|
res->pp.y2=y2-y;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSprite *SMArrow(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
CSprite *SMArrow(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||||
{
|
{
|
||||||
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
||||||
CSprite *result;
|
CSprite *res;
|
||||||
do {
|
do {
|
||||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||||
GrArrow3(dc,x1,y1,0,x2,y2,0);
|
GrArrow3(dc,x1,y1,0,x2,y2,0);
|
||||||
@@ -163,19 +163,19 @@ CSprite *SMArrow(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
|||||||
} while (msg_code!=MSG_IP_L_UP);
|
} while (msg_code!=MSG_IP_L_UP);
|
||||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||||
GrArrow3(dc,x1,y1,0,x2,y2,0);
|
GrArrow3(dc,x1,y1,0,x2,y2,0);
|
||||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_ARROW));
|
res=CAlloc(SpriteElemQuedBaseSize(SPT_ARROW));
|
||||||
result->type=SPT_ARROW;
|
res->type=SPT_ARROW;
|
||||||
result->pp.x1=x1-x;
|
res->pp.x1=x1-x;
|
||||||
result->pp.y1=y1-y;
|
res->pp.y1=y1-y;
|
||||||
result->pp.x2=x2-x;
|
res->pp.x2=x2-x;
|
||||||
result->pp.y2=y2-y;
|
res->pp.y2=y2-y;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSprite *SMPlanarSymmetry(CDC *dc,I64 x,I64 y,I64 a1,I64 a2)
|
CSprite *SMPlanarSymmetry(CDC *dc,I64 x,I64 y,I64 a1,I64 a2)
|
||||||
{
|
{
|
||||||
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2,old_width,old_flags;
|
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2,old_width,old_flags;
|
||||||
CSprite *result;
|
CSprite *res;
|
||||||
old_width=dc->pen_width;
|
old_width=dc->pen_width;
|
||||||
old_flags=dc->flags;
|
old_flags=dc->flags;
|
||||||
dc->flags&=~DCF_SYMMETRY;
|
dc->flags&=~DCF_SYMMETRY;
|
||||||
@@ -189,19 +189,19 @@ CSprite *SMPlanarSymmetry(CDC *dc,I64 x,I64 y,I64 a1,I64 a2)
|
|||||||
} while (msg_code!=MSG_IP_L_UP);
|
} while (msg_code!=MSG_IP_L_UP);
|
||||||
dc->flags=old_flags&DCF_SYMMETRY|dc->flags&~DCF_SYMMETRY;
|
dc->flags=old_flags&DCF_SYMMETRY|dc->flags&~DCF_SYMMETRY;
|
||||||
dc->pen_width=old_width;
|
dc->pen_width=old_width;
|
||||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_PLANAR_SYMMETRY));
|
res=CAlloc(SpriteElemQuedBaseSize(SPT_PLANAR_SYMMETRY));
|
||||||
result->type=SPT_PLANAR_SYMMETRY;
|
res->type=SPT_PLANAR_SYMMETRY;
|
||||||
result->pp.x1=x1-x;
|
res->pp.x1=x1-x;
|
||||||
result->pp.y1=y1-y;
|
res->pp.y1=y1-y;
|
||||||
result->pp.x2=x2-x;
|
res->pp.x2=x2-x;
|
||||||
result->pp.y2=y2-y;
|
res->pp.y2=y2-y;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSprite *SMRect(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
CSprite *SMRect(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||||
{
|
{
|
||||||
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2,xx1=a1,yy1=a2,xx2=a1,yy2=a2;
|
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2,xx1=a1,yy1=a2,xx2=a1,yy2=a2;
|
||||||
CSprite *result;
|
CSprite *res;
|
||||||
do {
|
do {
|
||||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||||
GrRect3(dc,xx1,yy1,0,xx2-xx1,yy2-yy1);
|
GrRect3(dc,xx1,yy1,0,xx2-xx1,yy2-yy1);
|
||||||
@@ -221,13 +221,13 @@ CSprite *SMRect(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
|||||||
} while (msg_code!=MSG_IP_L_UP);
|
} while (msg_code!=MSG_IP_L_UP);
|
||||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||||
GrRect3(dc,xx1,yy1,0,xx2-xx1,yy2-yy1);
|
GrRect3(dc,xx1,yy1,0,xx2-xx1,yy2-yy1);
|
||||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_RECT));
|
res=CAlloc(SpriteElemQuedBaseSize(SPT_RECT));
|
||||||
result->type=SPT_RECT;
|
res->type=SPT_RECT;
|
||||||
result->pp.x1=xx1-x;
|
res->pp.x1=xx1-x;
|
||||||
result->pp.y1=yy1-y;
|
res->pp.y1=yy1-y;
|
||||||
result->pp.x2=xx2-x;
|
res->pp.x2=xx2-x;
|
||||||
result->pp.y2=yy2-y;
|
res->pp.y2=yy2-y;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSprite *SMScreenBitMap(I64 eletype,CDC *dc,CDC *dc2,I64 x,I64 y,I64 a1,I64 a2,
|
CSprite *SMScreenBitMap(I64 eletype,CDC *dc,CDC *dc2,I64 x,I64 y,I64 a1,I64 a2,
|
||||||
@@ -235,7 +235,7 @@ CSprite *SMScreenBitMap(I64 eletype,CDC *dc,CDC *dc2,I64 x,I64 y,I64 a1,I64 a2,
|
|||||||
{
|
{
|
||||||
I64 i,msg_code,x1=a1,y1=a2,x2=a1,y2=a2,xx1=a1,yy1=a2,xx2=a1,yy2=a2,old_width;
|
I64 i,msg_code,x1=a1,y1=a2,x2=a1,y2=a2,xx1=a1,yy1=a2,xx2=a1,yy2=a2,old_width;
|
||||||
CDC *dc3,*img;
|
CDC *dc3,*img;
|
||||||
CSprite *result;
|
CSprite *res;
|
||||||
old_width=dc2->pen_width;
|
old_width=dc2->pen_width;
|
||||||
dc2->pen_width=1;
|
dc2->pen_width=1;
|
||||||
do {
|
do {
|
||||||
@@ -257,12 +257,12 @@ CSprite *SMScreenBitMap(I64 eletype,CDC *dc,CDC *dc2,I64 x,I64 y,I64 a1,I64 a2,
|
|||||||
}
|
}
|
||||||
} while (msg_code!=MSG_IP_L_UP);
|
} while (msg_code!=MSG_IP_L_UP);
|
||||||
xx2++; yy2++;
|
xx2++; yy2++;
|
||||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_BITMAP)+((xx2-xx1+7)&~7)*(yy2-yy1));
|
res=CAlloc(SpriteElemQuedBaseSize(SPT_BITMAP)+((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||||
result->type=SPT_BITMAP;
|
res->type=SPT_BITMAP;
|
||||||
result->pwhu.width=xx2-xx1;
|
res->pwhu.width=xx2-xx1;
|
||||||
result->pwhu.height=yy2-yy1;
|
res->pwhu.height=yy2-yy1;
|
||||||
result->pwhu.x1=0;
|
res->pwhu.x1=0;
|
||||||
result->pwhu.y1=0;
|
res->pwhu.y1=0;
|
||||||
SpriteScreenInit(dc,x,y);
|
SpriteScreenInit(dc,x,y);
|
||||||
i=gr.screen_zoom;
|
i=gr.screen_zoom;
|
||||||
GrScaleZoom(1.0/i);
|
GrScaleZoom(1.0/i);
|
||||||
@@ -274,19 +274,19 @@ CSprite *SMScreenBitMap(I64 eletype,CDC *dc,CDC *dc2,I64 x,I64 y,I64 a1,I64 a2,
|
|||||||
if (eletype==SPT_INS_TRANSPARENT_SCREEN_BITMAP)
|
if (eletype==SPT_INS_TRANSPARENT_SCREEN_BITMAP)
|
||||||
DCColorChg(img,bm_bkcolor);
|
DCColorChg(img,bm_bkcolor);
|
||||||
GrScaleZoom(i);
|
GrScaleZoom(i);
|
||||||
MemCpy(&result->pwhu.u,img->body,((xx2-xx1+7)&~7)*(yy2-yy1));
|
MemCpy(&res->pwhu.u,img->body,((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||||
DCDel(img);
|
DCDel(img);
|
||||||
DCDel(dc3);
|
DCDel(dc3);
|
||||||
dc2->pen_width=old_width;
|
dc2->pen_width=old_width;
|
||||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS
|
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS
|
||||||
-WIF_SELF_BORDER-WIF_SELF_GRAB_SCROLL;
|
-WIF_SELF_BORDER-WIF_SELF_GRAB_SCROLL;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSprite *SMCircle(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
CSprite *SMCircle(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||||
{
|
{
|
||||||
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
||||||
CSprite *result;
|
CSprite *res;
|
||||||
do {
|
do {
|
||||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||||
GrCircle3(dc,x1,y1,0,Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2)));
|
GrCircle3(dc,x1,y1,0,Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2)));
|
||||||
@@ -296,19 +296,19 @@ CSprite *SMCircle(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
|||||||
} while (msg_code!=MSG_IP_L_UP);
|
} while (msg_code!=MSG_IP_L_UP);
|
||||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||||
GrCircle3(dc,x1,y1,0,Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2)));
|
GrCircle3(dc,x1,y1,0,Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2)));
|
||||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_CIRCLE));
|
res=CAlloc(SpriteElemQuedBaseSize(SPT_CIRCLE));
|
||||||
result->type=SPT_CIRCLE;
|
res->type=SPT_CIRCLE;
|
||||||
result->pr.x1=x1-x;
|
res->pr.x1=x1-x;
|
||||||
result->pr.y1=y1-y;
|
res->pr.y1=y1-y;
|
||||||
result->pr.radius=Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2));
|
res->pr.radius=Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2));
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSprite *SMEllipse(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
CSprite *SMEllipse(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||||
{
|
{
|
||||||
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
||||||
F64 angle1,angle2;
|
F64 angle1,angle2;
|
||||||
CSprite *result;
|
CSprite *res;
|
||||||
do {
|
do {
|
||||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||||
GrEllipse3(dc,(x1+x2)>>1,(y1+y2)>>1,0,AbsI64(x1-x2)>>1,AbsI64(y1-y2)>>1);
|
GrEllipse3(dc,(x1+x2)>>1,(y1+y2)>>1,0,AbsI64(x1-x2)>>1,AbsI64(y1-y2)>>1);
|
||||||
@@ -316,37 +316,37 @@ CSprite *SMEllipse(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
|||||||
SpriteScreenInit(dc,x,y);
|
SpriteScreenInit(dc,x,y);
|
||||||
x2=a1; y2=a2;
|
x2=a1; y2=a2;
|
||||||
} while (msg_code!=MSG_IP_L_UP);
|
} while (msg_code!=MSG_IP_L_UP);
|
||||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_ELLIPSE));
|
res=CAlloc(SpriteElemQuedBaseSize(SPT_ELLIPSE));
|
||||||
result->type=SPT_ELLIPSE;
|
res->type=SPT_ELLIPSE;
|
||||||
result->pwha.x1=(x1+x2)>>1-x;
|
res->pwha.x1=(x1+x2)>>1-x;
|
||||||
result->pwha.y1=(y1+y2)>>1-y;
|
res->pwha.y1=(y1+y2)>>1-y;
|
||||||
result->pwha.width =AbsI64(x1-x2)>>1;
|
res->pwha.width =AbsI64(x1-x2)>>1;
|
||||||
result->pwha.height=AbsI64(y1-y2)>>1;
|
res->pwha.height=AbsI64(y1-y2)>>1;
|
||||||
angle2=Arg(x2-(result->pwha.x1+x),y2-(result->pwha.y1+y));
|
angle2=Arg(x2-(res->pwha.x1+x),y2-(res->pwha.y1+y));
|
||||||
if (result->pwha.width<result->pwha.height)
|
if (res->pwha.width<res->pwha.height)
|
||||||
angle2-=ă/2.0;
|
angle2-=ă/2.0;
|
||||||
do {
|
do {
|
||||||
angle1=Arg(x2-(result->pwha.x1+x),y2-(result->pwha.y1+y));
|
angle1=Arg(x2-(res->pwha.x1+x),y2-(res->pwha.y1+y));
|
||||||
if (result->pwha.width>=result->pwha.height)
|
if (res->pwha.width>=res->pwha.height)
|
||||||
result->pwha.angle=-(angle1-angle2);
|
res->pwha.angle=-(angle1-angle2);
|
||||||
else
|
else
|
||||||
result->pwha.angle=-(angle1-angle2)+ã/2.0;
|
res->pwha.angle=-(angle1-angle2)+ã/2.0;
|
||||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||||
GrEllipse3(dc,result->pwha.x1+x,result->pwha.y1+y,0,
|
GrEllipse3(dc,res->pwha.x1+x,res->pwha.y1+y,0,
|
||||||
result->pwha.width,result->pwha.height,result->pwha.angle);
|
res->pwha.width,res->pwha.height,res->pwha.angle);
|
||||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||||
SpriteScreenInit(dc,x,y);
|
SpriteScreenInit(dc,x,y);
|
||||||
x2=a1; y2=a2;
|
x2=a1; y2=a2;
|
||||||
} while (msg_code!=MSG_IP_L_UP);
|
} while (msg_code!=MSG_IP_L_UP);
|
||||||
angle1=Arg(x2-(result->pwha.x1+x),y2-(result->pwha.y1+y));
|
angle1=Arg(x2-(res->pwha.x1+x),y2-(res->pwha.y1+y));
|
||||||
if (result->pwha.width>=result->pwha.height)
|
if (res->pwha.width>=res->pwha.height)
|
||||||
result->pwha.angle=-(angle1-angle2);
|
res->pwha.angle=-(angle1-angle2);
|
||||||
else
|
else
|
||||||
result->pwha.angle=-(angle1-angle2)+ã/2.0;
|
res->pwha.angle=-(angle1-angle2)+ã/2.0;
|
||||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||||
GrEllipse3(dc,result->pwha.x1+x,result->pwha.y1+y,0,
|
GrEllipse3(dc,res->pwha.x1+x,res->pwha.y1+y,0,
|
||||||
result->pwha.width,result->pwha.height,result->pwha.angle);
|
res->pwha.width,res->pwha.height,res->pwha.angle);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSprite *SMPolygon(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,I64 sides,
|
CSprite *SMPolygon(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,I64 sides,
|
||||||
@@ -354,7 +354,7 @@ CSprite *SMPolygon(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,I64 sides,
|
|||||||
{
|
{
|
||||||
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
||||||
F64 angle1,angle2;
|
F64 angle1,angle2;
|
||||||
CSprite *result;
|
CSprite *res;
|
||||||
do {
|
do {
|
||||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||||
GrRegPoly3(dc,(x1+x2)>>1,(y1+y2)>>1,0,
|
GrRegPoly3(dc,(x1+x2)>>1,(y1+y2)>>1,0,
|
||||||
@@ -363,40 +363,40 @@ CSprite *SMPolygon(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,I64 sides,
|
|||||||
SpriteScreenInit(dc,x,y);
|
SpriteScreenInit(dc,x,y);
|
||||||
x2=a1; y2=a2;
|
x2=a1; y2=a2;
|
||||||
} while (msg_code!=MSG_IP_L_UP);
|
} while (msg_code!=MSG_IP_L_UP);
|
||||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_POLYGON));
|
res=CAlloc(SpriteElemQuedBaseSize(SPT_POLYGON));
|
||||||
result->type=SPT_POLYGON;
|
res->type=SPT_POLYGON;
|
||||||
result->pwhas.x1=(x1+x2)>>1-x;
|
res->pwhas.x1=(x1+x2)>>1-x;
|
||||||
result->pwhas.y1=(y1+y2)>>1-y;
|
res->pwhas.y1=(y1+y2)>>1-y;
|
||||||
result->pwhas.width =AbsI64(x1-x2)>>1;
|
res->pwhas.width =AbsI64(x1-x2)>>1;
|
||||||
result->pwhas.height=AbsI64(y1-y2)>>1;
|
res->pwhas.height=AbsI64(y1-y2)>>1;
|
||||||
result->pwhas.sides=sides;
|
res->pwhas.sides=sides;
|
||||||
angle2=Arg(x2-(result->pwhas.x1+x),y2-(result->pwhas.y1+y));
|
angle2=Arg(x2-(res->pwhas.x1+x),y2-(res->pwhas.y1+y));
|
||||||
if (result->pwhas.width<result->pwhas.height)
|
if (res->pwhas.width<res->pwhas.height)
|
||||||
angle2-=ă/2.0;
|
angle2-=ă/2.0;
|
||||||
do {
|
do {
|
||||||
angle1=Arg(x2-(result->pwhas.x1+x),y2-(result->pwhas.y1+y));
|
angle1=Arg(x2-(res->pwhas.x1+x),y2-(res->pwhas.y1+y));
|
||||||
if (result->pwhas.width>=result->pwhas.height)
|
if (res->pwhas.width>=res->pwhas.height)
|
||||||
result->pwhas.angle=-(angle1-angle2);
|
res->pwhas.angle=-(angle1-angle2);
|
||||||
else
|
else
|
||||||
result->pwhas.angle=-(angle1-angle2)+ã/2.0;
|
res->pwhas.angle=-(angle1-angle2)+ã/2.0;
|
||||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||||
GrRegPoly3(dc,result->pwhas.x1+x,result->pwhas.y1+y,0,
|
GrRegPoly3(dc,res->pwhas.x1+x,res->pwhas.y1+y,0,
|
||||||
result->pwhas.width,result->pwhas.height,
|
res->pwhas.width,res->pwhas.height,
|
||||||
result->pwhas.sides,result->pwhas.angle);
|
res->pwhas.sides,res->pwhas.angle);
|
||||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||||
SpriteScreenInit(dc,x,y);
|
SpriteScreenInit(dc,x,y);
|
||||||
x2=a1; y2=a2;
|
x2=a1; y2=a2;
|
||||||
} while (msg_code!=MSG_IP_L_UP);
|
} while (msg_code!=MSG_IP_L_UP);
|
||||||
angle1=Arg(x2-(result->pwhas.x1+x),y2-(result->pwhas.y1+y));
|
angle1=Arg(x2-(res->pwhas.x1+x),y2-(res->pwhas.y1+y));
|
||||||
if (result->pwhas.width>=result->pwhas.height)
|
if (res->pwhas.width>=res->pwhas.height)
|
||||||
result->pwhas.angle=-(angle1-angle2);
|
res->pwhas.angle=-(angle1-angle2);
|
||||||
else
|
else
|
||||||
result->pwhas.angle=-(angle1-angle2)+ã/2.0;
|
res->pwhas.angle=-(angle1-angle2)+ã/2.0;
|
||||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||||
GrRegPoly3(dc,result->pwhas.x1+x,result->pwhas.y1+y,0,
|
GrRegPoly3(dc,res->pwhas.x1+x,res->pwhas.y1+y,0,
|
||||||
result->pwhas.width,result->pwhas.height,result->pwhas.sides,
|
res->pwhas.width,res->pwhas.height,res->pwhas.sides,
|
||||||
result->pwhas.angle);
|
res->pwhas.angle);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
||||||
@@ -405,7 +405,7 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
|||||||
I64 i,num=0,msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
I64 i,num=0,msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
||||||
I32 *ptr;
|
I32 *ptr;
|
||||||
CD3I32 *p;
|
CD3I32 *p;
|
||||||
CSprite *result,*tempg,*tempg1,root2;
|
CSprite *res,*tempg,*tempg1,root2;
|
||||||
|
|
||||||
QueInit(&root2);
|
QueInit(&root2);
|
||||||
do {
|
do {
|
||||||
@@ -423,11 +423,11 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
|||||||
if (msg_code==MSG_IP_L_UP) {
|
if (msg_code==MSG_IP_L_UP) {
|
||||||
if (num)
|
if (num)
|
||||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_PT));
|
res=CAlloc(SpriteElemQuedBaseSize(SPT_PT));
|
||||||
result->type=SPT_PT;
|
res->type=SPT_PT;
|
||||||
result->p.x1=x2-x;
|
res->p.x1=x2-x;
|
||||||
result->p.y1=y2-y;
|
res->p.y1=y2-y;
|
||||||
QueIns(result,root2.last);
|
QueIns(res,root2.last);
|
||||||
x1=x2;y1=y2;
|
x1=x2;y1=y2;
|
||||||
num++;
|
num++;
|
||||||
}
|
}
|
||||||
@@ -436,8 +436,8 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
|||||||
switch (eletype) {
|
switch (eletype) {
|
||||||
case SPT_POLYLINE:
|
case SPT_POLYLINE:
|
||||||
if (num>1) {
|
if (num>1) {
|
||||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_POLYLINE)+num*sizeof(CD2I32));
|
res=CAlloc(SpriteElemQuedBaseSize(SPT_POLYLINE)+num*sizeof(CD2I32));
|
||||||
ptr=&result->nu.u;
|
ptr=&res->nu.u;
|
||||||
tempg1=root2.next;
|
tempg1=root2.next;
|
||||||
for (i=0;i<num;i++) {
|
for (i=0;i<num;i++) {
|
||||||
tempg=tempg1->next;
|
tempg=tempg1->next;
|
||||||
@@ -446,8 +446,8 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
|||||||
Free(tempg1);
|
Free(tempg1);
|
||||||
tempg1=tempg;
|
tempg1=tempg;
|
||||||
}
|
}
|
||||||
result->type=SPT_POLYLINE;
|
res->type=SPT_POLYLINE;
|
||||||
result->nu.num=num;
|
res->nu.num=num;
|
||||||
} else {
|
} else {
|
||||||
tempg1=root2.next;
|
tempg1=root2.next;
|
||||||
for (i=0;i<num;i++) {
|
for (i=0;i<num;i++) {
|
||||||
@@ -455,7 +455,7 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
|||||||
Free(tempg1);
|
Free(tempg1);
|
||||||
tempg1=tempg;
|
tempg1=tempg;
|
||||||
}
|
}
|
||||||
result=NULL;
|
res=NULL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SPT_BSPLINE2:
|
case SPT_BSPLINE2:
|
||||||
@@ -463,8 +463,8 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
|||||||
case SPT_BSPLINE2_CLOSED:
|
case SPT_BSPLINE2_CLOSED:
|
||||||
case SPT_BSPLINE3_CLOSED:
|
case SPT_BSPLINE3_CLOSED:
|
||||||
if (num>2) {
|
if (num>2) {
|
||||||
result=CAlloc(SpriteElemQuedBaseSize(eletype)+num*sizeof(CD3I32));
|
res=CAlloc(SpriteElemQuedBaseSize(eletype)+num*sizeof(CD3I32));
|
||||||
p=&result->nu.u;
|
p=&res->nu.u;
|
||||||
tempg1=root2.next;
|
tempg1=root2.next;
|
||||||
for (i=0;i<num;i++) {
|
for (i=0;i<num;i++) {
|
||||||
tempg=tempg1->next;
|
tempg=tempg1->next;
|
||||||
@@ -473,8 +473,8 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
|||||||
Free(tempg1);
|
Free(tempg1);
|
||||||
tempg1=tempg;
|
tempg1=tempg;
|
||||||
}
|
}
|
||||||
result->type=eletype;
|
res->type=eletype;
|
||||||
result->nu.num=num;
|
res->nu.num=num;
|
||||||
} else {
|
} else {
|
||||||
tempg1=root2.next;
|
tempg1=root2.next;
|
||||||
for (i=0;i<num;i++) {
|
for (i=0;i<num;i++) {
|
||||||
@@ -482,18 +482,18 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
|||||||
Free(tempg1);
|
Free(tempg1);
|
||||||
tempg1=tempg;
|
tempg1=tempg;
|
||||||
}
|
}
|
||||||
result=NULL;
|
res=NULL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSprite *SMPolyPoint(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
CSprite *SMPolyPoint(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||||
{
|
{
|
||||||
I64 i,num=0,msg_code,x1=a1,y1=a2,x2=a1,y2=a2,x3,y3;
|
I64 i,num=0,msg_code,x1=a1,y1=a2,x2=a1,y2=a2,x3,y3;
|
||||||
I32 *ptr;
|
I32 *ptr;
|
||||||
CSprite *result,*tempg,*tempg1,root2;
|
CSprite *res,*tempg,*tempg1,root2;
|
||||||
|
|
||||||
QueInit(&root2);
|
QueInit(&root2);
|
||||||
x3=a1-x; y3=a2-y;
|
x3=a1-x; y3=a2-y;
|
||||||
@@ -507,25 +507,25 @@ CSprite *SMPolyPoint(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
|||||||
} while (msg_code!=MSG_IP_L_UP);
|
} while (msg_code!=MSG_IP_L_UP);
|
||||||
|
|
||||||
num=0;
|
num=0;
|
||||||
result=root2.next;
|
res=root2.next;
|
||||||
x1=x3; y1=y3;
|
x1=x3; y1=y3;
|
||||||
while (result!=&root2) {
|
while (res!=&root2) {
|
||||||
tempg=result->next;
|
tempg=res->next;
|
||||||
if (result->p.x1==x1 && result->p.y1==y1) {
|
if (res->p.x1==x1 && res->p.y1==y1) {
|
||||||
QueRem(result);
|
QueRem(res);
|
||||||
Free(result);
|
Free(res);
|
||||||
} else {
|
} else {
|
||||||
num++;
|
num++;
|
||||||
x1=result->p.x1;
|
x1=res->p.x1;
|
||||||
y1=result->p.y1;
|
y1=res->p.y1;
|
||||||
}
|
}
|
||||||
result=tempg;
|
res=tempg;
|
||||||
}
|
}
|
||||||
|
|
||||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_POLYPT)+(num*3+7)>>3);
|
res=CAlloc(SpriteElemQuedBaseSize(SPT_POLYPT)+(num*3+7)>>3);
|
||||||
result->npu.x=x3;
|
res->npu.x=x3;
|
||||||
result->npu.y=y3;
|
res->npu.y=y3;
|
||||||
ptr=&result->npu.u;
|
ptr=&res->npu.u;
|
||||||
x1=x3; y1=y3;
|
x1=x3; y1=y3;
|
||||||
i=0;
|
i=0;
|
||||||
tempg1=root2.next;
|
tempg1=root2.next;
|
||||||
@@ -539,9 +539,9 @@ CSprite *SMPolyPoint(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
|||||||
Free(tempg1);
|
Free(tempg1);
|
||||||
tempg1=tempg;
|
tempg1=tempg;
|
||||||
}
|
}
|
||||||
result->type=SPT_POLYPT;
|
res->type=SPT_POLYPT;
|
||||||
result->npu.num=num;
|
res->npu.num=num;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 SMTextFamily(I64 eletype,CDoc *doc,CDocEntry *doc_ce,CSprite *root,CDC *dc,
|
U0 SMTextFamily(I64 eletype,CDoc *doc,CDocEntry *doc_ce,CSprite *root,CDC *dc,
|
||||||
@@ -809,7 +809,7 @@ U0 SMTaskTitleSet(I64 eletype)
|
|||||||
I64 SpriteMainEd(CDoc *doc)
|
I64 SpriteMainEd(CDoc *doc)
|
||||||
{
|
{
|
||||||
CDocEntry *doc_ce=doc->cur_entry;
|
CDocEntry *doc_ce=doc->cur_entry;
|
||||||
I64 result,i,x,y,a1,a2,xx,yy,xx1,yy1,xx2,yy2,width,eletype=SPT_MENU,
|
I64 res,i,x,y,a1,a2,xx,yy,xx1,yy1,xx2,yy2,width,eletype=SPT_MENU,
|
||||||
cur_elem_num,old_border_src=Fs->border_src,old_title_src=Fs->title_src,
|
cur_elem_num,old_border_src=Fs->border_src,old_title_src=Fs->title_src,
|
||||||
old_de_flags=doc_ce->de_flags;
|
old_de_flags=doc_ce->de_flags;
|
||||||
CColorROPU32 bm_bkcolor,color;
|
CColorROPU32 bm_bkcolor,color;
|
||||||
@@ -958,7 +958,7 @@ I64 SpriteMainEd(CDoc *doc)
|
|||||||
xx2+=xx; yy2+=yy;
|
xx2+=xx; yy2+=yy;
|
||||||
if (SMBitMap(eletype,doc,doc_ce,root,dc,xx,yy,a1,a2,bm_bkcolor,
|
if (SMBitMap(eletype,doc,doc_ce,root,dc,xx,yy,a1,a2,bm_bkcolor,
|
||||||
FALSE,xx1,yy1,xx2,yy2,&cur_elem_num)==GE_EXIT) {
|
FALSE,xx1,yy1,xx2,yy2,&cur_elem_num)==GE_EXIT) {
|
||||||
result=GE_EXIT;
|
res=GE_EXIT;
|
||||||
goto ei_done;
|
goto ei_done;
|
||||||
}
|
}
|
||||||
eletype=SPT_MENU;
|
eletype=SPT_MENU;
|
||||||
@@ -1028,20 +1028,20 @@ I64 SpriteMainEd(CDoc *doc)
|
|||||||
x+=xx; y+=yy;
|
x+=xx; y+=yy;
|
||||||
SpriteScreenInit(dc,x,y);
|
SpriteScreenInit(dc,x,y);
|
||||||
if (eletype==SPT_EXIT) {
|
if (eletype==SPT_EXIT) {
|
||||||
result=GE_EXIT;
|
res=GE_EXIT;
|
||||||
goto ei_done;
|
goto ei_done;
|
||||||
} else if (eletype==DOCM_CANCEL) {
|
} else if (eletype==DOCM_CANCEL) {
|
||||||
result=GE_ABORT;
|
res=GE_ABORT;
|
||||||
goto ei_done;
|
goto ei_done;
|
||||||
}
|
}
|
||||||
switch (GetMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_IP_R_UP|1<<MSG_IP_L_DOWN)) {
|
switch (GetMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_IP_R_UP|1<<MSG_IP_L_DOWN)) {
|
||||||
case MSG_KEY_DOWN:
|
case MSG_KEY_DOWN:
|
||||||
switch (a1) {
|
switch (a1) {
|
||||||
case CH_ESC:
|
case CH_ESC:
|
||||||
result=GE_EXIT;
|
res=GE_EXIT;
|
||||||
goto ei_done;
|
goto ei_done;
|
||||||
case CH_SHIFT_ESC:
|
case CH_SHIFT_ESC:
|
||||||
result=GE_ABORT;
|
res=GE_ABORT;
|
||||||
goto ei_done;
|
goto ei_done;
|
||||||
case 'c': //eye-dropper
|
case 'c': //eye-dropper
|
||||||
dc3=DCScreenCapture(FALSE);
|
dc3=DCScreenCapture(FALSE);
|
||||||
@@ -1134,7 +1134,7 @@ I64 SpriteMainEd(CDoc *doc)
|
|||||||
case SPT_BITMAP:
|
case SPT_BITMAP:
|
||||||
if (SMBitMap(eletype,doc,doc_ce,root,dc,xx,yy,a1,a2,bm_bkcolor,
|
if (SMBitMap(eletype,doc,doc_ce,root,dc,xx,yy,a1,a2,bm_bkcolor,
|
||||||
TRUE,,,,,&cur_elem_num)==GE_EXIT) {
|
TRUE,,,,,&cur_elem_num)==GE_EXIT) {
|
||||||
result=GE_EXIT;
|
res=GE_EXIT;
|
||||||
goto ei_done;
|
goto ei_done;
|
||||||
}
|
}
|
||||||
doc_ce->de_flags=old_de_flags;
|
doc_ce->de_flags=old_de_flags;
|
||||||
@@ -1164,7 +1164,7 @@ ei_done:
|
|||||||
Fs->title_src =old_title_src;
|
Fs->title_src =old_title_src;
|
||||||
QueDel(root);
|
QueDel(root);
|
||||||
Free(root);
|
Free(root);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 EdSpriteIns(CDoc *doc)
|
U0 EdSpriteIns(CDoc *doc)
|
||||||
@@ -1217,7 +1217,7 @@ U0 EdSpriteEd(CDoc *doc)
|
|||||||
tempb=doc_ce->bin_data;
|
tempb=doc_ce->bin_data;
|
||||||
old_size=tempb->size;
|
old_size=tempb->size;
|
||||||
old_csprite=tempb->data;
|
old_csprite=tempb->data;
|
||||||
tempb->data=MAllocIdentical(old_csprite,doc->mem_task);
|
tempb->data=MAllocIdent(old_csprite,doc->mem_task);
|
||||||
DocUnlock(doc);
|
DocUnlock(doc);
|
||||||
if (SpriteMainEd(doc)==GE_ABORT) {
|
if (SpriteMainEd(doc)==GE_ABORT) {
|
||||||
DocLock(doc);
|
DocLock(doc);
|
||||||
|
|||||||
@@ -74,21 +74,21 @@ CMeshEdTri *MeshTriNew(CMeshFrame *e,CColorROPU32 color,
|
|||||||
|
|
||||||
CMeshEdVertex *MeshVertexFindScrPt(CMeshFrame *e,I64 x,I64 y)
|
CMeshEdVertex *MeshVertexFindScrPt(CMeshFrame *e,I64 x,I64 y)
|
||||||
{//Screen coordinates
|
{//Screen coordinates
|
||||||
CMeshEdVertex *result=NULL,*tempv=e->vertex_root.next;
|
CMeshEdVertex *res=NULL,*tempv=e->vertex_root.next;
|
||||||
I64 dd,dz,best_dd=MAX_I64,best_dz=MAX_I64;
|
I64 dd,dz,best_dd=MAX_I64,best_dz=MAX_I64;
|
||||||
while (tempv!=&e->vertex_root) {
|
while (tempv!=&e->vertex_root) {
|
||||||
if (!(tempv->flags&VF_IGNORE)) {
|
if (!(tempv->flags&VF_IGNORE)) {
|
||||||
dd=SqrI64(x-tempv->pt.x)+SqrI64(y-tempv->pt.y);
|
dd=SqrI64(x-tempv->pt.x)+SqrI64(y-tempv->pt.y);
|
||||||
dz=AbsI64(e->my_ip_z-tempv->p.z);
|
dz=AbsI64(e->my_ip_z-tempv->p.z);
|
||||||
if (dd<best_dd || dd==best_dd && dz<best_dz) {
|
if (dd<best_dd || dd==best_dd && dz<best_dz) {
|
||||||
result=tempv;
|
res=tempv;
|
||||||
best_dd=dd;
|
best_dd=dd;
|
||||||
best_dz=dz;
|
best_dz=dz;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tempv=tempv->next;
|
tempv=tempv->next;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
CMeshEdVertex *MeshVertexFindNum(CMeshFrame *haystack_e,I64 needle_num)
|
CMeshEdVertex *MeshVertexFindNum(CMeshFrame *haystack_e,I64 needle_num)
|
||||||
@@ -248,20 +248,20 @@ U0 MeshTriSelectRect(CMeshFrame *e,I64 mode,I64 x1,I64 x2,I64 y1,I64 y2)
|
|||||||
|
|
||||||
I64 MeshSelectCnt(CMeshFrame *e)
|
I64 MeshSelectCnt(CMeshFrame *e)
|
||||||
{
|
{
|
||||||
I64 result=0;
|
I64 res=0;
|
||||||
CMeshEdVertex *tempv=e->vertex_root.next;
|
CMeshEdVertex *tempv=e->vertex_root.next;
|
||||||
CMeshEdTri *tempt=e->tri_root.next;
|
CMeshEdTri *tempt=e->tri_root.next;
|
||||||
while (tempv!=&e->vertex_root) {
|
while (tempv!=&e->vertex_root) {
|
||||||
if (tempv->flags&VF_SELECTED)
|
if (tempv->flags&VF_SELECTED)
|
||||||
result++;
|
res++;
|
||||||
tempv=tempv->next;
|
tempv=tempv->next;
|
||||||
}
|
}
|
||||||
while (tempt!=&e->tri_root) {
|
while (tempt!=&e->tri_root) {
|
||||||
if (tempt->flags&TF_SELECTED)
|
if (tempt->flags&TF_SELECTED)
|
||||||
result++;
|
res++;
|
||||||
tempt=tempt->next;
|
tempt=tempt->next;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 MeshSwapAxes(CMeshFrame *e,I64 o1,I64 o2)
|
U0 MeshSwapAxes(CMeshFrame *e,I64 o1,I64 o2)
|
||||||
@@ -823,7 +823,7 @@ I64 MeshSize(CMeshFrame *e)
|
|||||||
I32 *MeshSave(CMeshFrame *e,I64 *_size=NULL)
|
I32 *MeshSave(CMeshFrame *e,I64 *_size=NULL)
|
||||||
{
|
{
|
||||||
I64 size=MeshSize(e);
|
I64 size=MeshSize(e);
|
||||||
U8 *result=MAlloc(size),*dst=result;
|
U8 *res=MAlloc(size),*dst=res;
|
||||||
CMeshEdVertex *tempv=e->vertex_root.next;
|
CMeshEdVertex *tempv=e->vertex_root.next;
|
||||||
CMeshEdTri *tempt=e->tri_root.next;
|
CMeshEdTri *tempt=e->tri_root.next;
|
||||||
|
|
||||||
@@ -845,7 +845,7 @@ I32 *MeshSave(CMeshFrame *e,I64 *_size=NULL)
|
|||||||
tempt=tempt->next;
|
tempt=tempt->next;
|
||||||
}
|
}
|
||||||
if (_size) *_size=size;
|
if (_size) *_size=size;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 MeshCleanUp(CMeshFrame *e)
|
U0 MeshCleanUp(CMeshFrame *e)
|
||||||
|
|||||||
@@ -87,15 +87,15 @@ public I64 SpriteSize(U8 *elems)
|
|||||||
|
|
||||||
I64 SpriteTypeMask(U8 *elems)
|
I64 SpriteTypeMask(U8 *elems)
|
||||||
{
|
{
|
||||||
I64 result=0;
|
I64 res=0;
|
||||||
CSprite *tempg=elems-offset(CSprite.start);
|
CSprite *tempg=elems-offset(CSprite.start);
|
||||||
while (tempg->type) {
|
while (tempg->type) {
|
||||||
if (tempg->type>=SPT_NUM_TYPES)
|
if (tempg->type>=SPT_NUM_TYPES)
|
||||||
return 1<<SPT_NUM_TYPES;
|
return 1<<SPT_NUM_TYPES;
|
||||||
Bts(&result,tempg->type);
|
Bts(&res,tempg->type);
|
||||||
tempg(U8 *)+=SpriteElemSize(tempg);
|
tempg(U8 *)+=SpriteElemSize(tempg);
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public U8 *DC2Sprite(CDC *tempb)
|
public U8 *DC2Sprite(CDC *tempb)
|
||||||
|
|||||||
+7
-7
@@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
CTask *MenuTask()
|
CTask *MenuTask()
|
||||||
{
|
{
|
||||||
CTask *result=sys_focus_task;
|
CTask *res=sys_focus_task;
|
||||||
while (result && !result->cur_menu)
|
while (res && !res->cur_menu)
|
||||||
result=result->parent_task;
|
res=res->parent_task;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
CMenuEntry *sys_cur_submenu_entry=NULL;
|
CMenuEntry *sys_cur_submenu_entry=NULL;
|
||||||
@@ -138,13 +138,13 @@ public U0 MenuDel(CMenu *m)
|
|||||||
|
|
||||||
I64 MenuEntryWidth(CMenuEntry *tempme)
|
I64 MenuEntryWidth(CMenuEntry *tempme)
|
||||||
{
|
{
|
||||||
I64 result=StrLen(tempme->name);
|
I64 res=StrLen(tempme->name);
|
||||||
CMenuEntry *tempse=tempme->sub;
|
CMenuEntry *tempse=tempme->sub;
|
||||||
while (tempse) {
|
while (tempse) {
|
||||||
result=MaxI64(result,StrLen(tempse->name));
|
res=MaxI64(res,StrLen(tempse->name));
|
||||||
tempse=tempse->next;
|
tempse=tempse->next;
|
||||||
}
|
}
|
||||||
return result+1;
|
return res+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CMenu *MenuPush(U8 *st)
|
public CMenu *MenuPush(U8 *st)
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public Bool MakeOSDrvBootInstall(U8 src_drv=0,U8 dst_drv=0)
|
|||||||
CDrv *dv;
|
CDrv *dv;
|
||||||
CFAT32Boot br;
|
CFAT32Boot br;
|
||||||
CDirEntry de;
|
CDirEntry de;
|
||||||
Bool result=FALSE;
|
Bool res=FALSE;
|
||||||
I64 i,type;
|
I64 i,type;
|
||||||
try {
|
try {
|
||||||
if (!src_drv) src_drv=Drv2Let(Fs->cur_dv);
|
if (!src_drv) src_drv=Drv2Let(Fs->cur_dv);
|
||||||
@@ -57,7 +57,7 @@ public Bool MakeOSDrvBootInstall(U8 src_drv=0,U8 dst_drv=0)
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case BDT_ATAPI:
|
case BDT_ATAPI:
|
||||||
Move("/Kernel/Kernel.BIN.Z",BOOT_DIR_KERNEL_BIN_C);
|
Move("/Kernel/Kernel.BIN.Z",BOOT_DIR_KERNEL_BIN_C);
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
break;
|
break;
|
||||||
case BDT_RAM:
|
case BDT_RAM:
|
||||||
case BDT_ATA:
|
case BDT_ATA:
|
||||||
@@ -80,7 +80,7 @@ public Bool MakeOSDrvBootInstall(U8 src_drv=0,U8 dst_drv=0)
|
|||||||
for (;i<sizeof(CFAT32Boot.code);i++)
|
for (;i<sizeof(CFAT32Boot.code);i++)
|
||||||
br.code[i]=0;
|
br.code[i]=0;
|
||||||
WBlks(dv,&br,dv->base_offset,1);
|
WBlks(dv,&br,dv->base_offset,1);
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -88,7 +88,7 @@ public Bool MakeOSDrvBootInstall(U8 src_drv=0,U8 dst_drv=0)
|
|||||||
PutExcept;
|
PutExcept;
|
||||||
Beep;
|
Beep;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public U0 MasterBootOldRead(U8 src_drv,U8 dst_drv)
|
public U0 MasterBootOldRead(U8 src_drv,U8 dst_drv)
|
||||||
@@ -154,7 +154,7 @@ public Bool MasterBootInstall(U8 drv_let,U8 *drv_lst=NULL)
|
|||||||
CDirEntry de;
|
CDirEntry de;
|
||||||
I64 i,j,size,*_q;
|
I64 i,j,size,*_q;
|
||||||
U8 *menu_ptr,*ptr,ch,buf[STR_LEN];
|
U8 *menu_ptr,*ptr,ch,buf[STR_LEN];
|
||||||
Bool result=FALSE;
|
Bool res=FALSE;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (drv_lst) {
|
if (drv_lst) {
|
||||||
@@ -223,10 +223,10 @@ public Bool MasterBootInstall(U8 drv_let,U8 *drv_lst=NULL)
|
|||||||
|
|
||||||
ATAWriteBlks(bd,&mbr,0,1);
|
ATAWriteBlks(bd,&mbr,0,1);
|
||||||
BlkDevUnlock(bd);
|
BlkDevUnlock(bd);
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch
|
} catch
|
||||||
PutExcept;
|
PutExcept;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -37,7 +37,7 @@ public U0 RAMReboot(U8 *filename)
|
|||||||
reg *sys_ram_reboot;
|
reg *sys_ram_reboot;
|
||||||
|
|
||||||
do if (!(hi_image=FileRead(filename,&size))) return;
|
do if (!(hi_image=FileRead(filename,&size))) return;
|
||||||
while (hi_image<0x100000);
|
while (hi_image<0x100000); //If alloc from low 640K, just get another copy.
|
||||||
|
|
||||||
do sys_ram_reboot=MAlloc(SYS_RAM_REBOOT_END-SYS_RAM_REBOOT,Fs->code_heap);
|
do sys_ram_reboot=MAlloc(SYS_RAM_REBOOT_END-SYS_RAM_REBOOT,Fs->code_heap);
|
||||||
while (sys_ram_reboot<0x100000);
|
while (sys_ram_reboot<0x100000);
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ Bool DiffSub(CDoc *doc,I64 *_df_flags,I64 j1_lo,I64 j1_hi,I64 j2_lo,I64 j2_hi,
|
|||||||
{
|
{
|
||||||
I64 i,i1=0,i2=0,i2b,j1,j2,n,
|
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;
|
Bool res=FALSE;
|
||||||
|
|
||||||
if (j1_lo>=j1_hi || j2_lo>=j2_hi) {
|
if (j1_lo>=j1_hi || j2_lo>=j2_hi) {
|
||||||
if (j1_lo<j1_hi || j2_lo<j2_hi) {
|
if (j1_lo<j1_hi || j2_lo<j2_hi) {
|
||||||
@@ -208,12 +208,12 @@ Bool DiffSub(CDoc *doc,I64 *_df_flags,I64 j1_lo,I64 j1_hi,I64 j2_lo,I64 j2_hi,
|
|||||||
} else {
|
} else {
|
||||||
if (DiffSub(doc,_df_flags,j1_lo,best_j1,j2_lo,best_j2,cnt1,cnt2,
|
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;
|
res=TRUE;
|
||||||
if (DiffSub(doc,_df_flags,best_j1+best_score,j1_hi,best_j2+best_score,
|
if (DiffSub(doc,_df_flags,best_j1+best_score,j1_hi,best_j2+best_score,
|
||||||
j2_hi,cnt1,cnt2,
|
j2_hi,cnt1,cnt2,
|
||||||
doc_sorted1,doc_sorted2,doc_unsorted1,doc_unsorted2))
|
doc_sorted1,doc_sorted2,doc_unsorted1,doc_unsorted2))
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,7 +241,7 @@ public Bool Diff(U8 *dst_file,U8 *src_file,I64 *_df_flags=NULL)
|
|||||||
*doc2=DocRead(src_file,DOCF_PLAIN_TEXT_TABS|DOCF_NO_CURSOR);
|
*doc2=DocRead(src_file,DOCF_PLAIN_TEXT_TABS|DOCF_NO_CURSOR);
|
||||||
CDocEntry *doc_e,**doc_sorted1,**doc_sorted2,**doc_unsorted1,**doc_unsorted2;
|
CDocEntry *doc_e,**doc_sorted1,**doc_sorted2,**doc_unsorted1,**doc_unsorted2;
|
||||||
I64 i,cnt1=0,cnt2=0,df_flags;
|
I64 i,cnt1=0,cnt2=0,df_flags;
|
||||||
Bool result=FALSE;
|
Bool res=FALSE;
|
||||||
|
|
||||||
if (_df_flags)
|
if (_df_flags)
|
||||||
df_flags=*_df_flags;
|
df_flags=*_df_flags;
|
||||||
@@ -291,14 +291,14 @@ public Bool Diff(U8 *dst_file,U8 *src_file,I64 *_df_flags=NULL)
|
|||||||
doc_unsorted2[i]=doc2;
|
doc_unsorted2[i]=doc2;
|
||||||
QSortI64(doc_sorted2,cnt2,&DiffEntriesCompare);
|
QSortI64(doc_sorted2,cnt2,&DiffEntriesCompare);
|
||||||
|
|
||||||
result=DiffSub(doc1,&df_flags,0,cnt1,0,cnt2,cnt1,cnt2,
|
res=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))
|
if (df_flags&DF_MODIFIED && !(df_flags&DF_DONT_MODIFIED))
|
||||||
DocWrite(doc1);
|
DocWrite(doc1);
|
||||||
|
|
||||||
if (DiffBins(doc1,doc2)) {
|
if (DiffBins(doc1,doc2)) {
|
||||||
"$$RED$$Bin Data is Different$$FG$$\n";
|
"$$RED$$Bin Data is Different$$FG$$\n";
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DocDel(doc1);
|
DocDel(doc1);
|
||||||
@@ -309,7 +309,7 @@ public Bool Diff(U8 *dst_file,U8 *src_file,I64 *_df_flags=NULL)
|
|||||||
Free(doc_unsorted2);
|
Free(doc_unsorted2);
|
||||||
if (_df_flags)
|
if (_df_flags)
|
||||||
*_df_flags=df_flags;
|
*_df_flags=df_flags;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#help_index "Cmd Line (Typically);Info"
|
#help_index "Cmd Line (Typically);Info"
|
||||||
|
|||||||
+39
-39
@@ -185,7 +185,7 @@ U8 *BMPPaletteNew(CFileBMP *bmp)
|
|||||||
{
|
{
|
||||||
I64 i,j,best,score,best_score;
|
I64 i,j,best,score,best_score;
|
||||||
CBGR48 palette[NUM_COLORS];
|
CBGR48 palette[NUM_COLORS];
|
||||||
U8 *result=CAlloc(NUM_BMP_COLORS*sizeof(U8));
|
U8 *res=CAlloc(NUM_BMP_COLORS*sizeof(U8));
|
||||||
GrPaletteGet(palette);
|
GrPaletteGet(palette);
|
||||||
#assert NUM_COLORS==NUM_BMP_COLORS
|
#assert NUM_COLORS==NUM_BMP_COLORS
|
||||||
for (i=0;i<NUM_BMP_COLORS;i++) {
|
for (i=0;i<NUM_BMP_COLORS;i++) {
|
||||||
@@ -200,39 +200,39 @@ U8 *BMPPaletteNew(CFileBMP *bmp)
|
|||||||
best_score=score;
|
best_score=score;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result[i]=best;
|
res[i]=best;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U8 ms_paint_palette[NUM_BMP_COLORS]={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(CBGR24 *ptr,Bool dither_probability)
|
I64 BMP24Color(CBGR24 *ptr,Bool dither_probability)
|
||||||
{
|
{
|
||||||
I64 result,k;
|
I64 res,k;
|
||||||
if (dither_probability) {
|
if (dither_probability) {
|
||||||
k=RandU32;
|
k=RandU32;
|
||||||
if (SqrI64(ptr->r)+SqrI64(ptr->g)+SqrI64(ptr->b)>=3*SqrI64(k.u8[0]))
|
if (SqrI64(ptr->r)+SqrI64(ptr->g)+SqrI64(ptr->b)>=3*SqrI64(k.u8[0]))
|
||||||
result=8;
|
res=8;
|
||||||
else
|
else
|
||||||
result=0;
|
res=0;
|
||||||
if (ptr->r>=k.u8[1]) result|=RED;
|
if (ptr->r>=k.u8[1]) res|=RED;
|
||||||
if (ptr->g>=k.u8[2]) result|=GREEN;
|
if (ptr->g>=k.u8[2]) res|=GREEN;
|
||||||
if (ptr->b>=k.u8[3]) result|=BLUE;
|
if (ptr->b>=k.u8[3]) res|=BLUE;
|
||||||
} else {
|
} else {
|
||||||
if (SqrI64(ptr->r)+SqrI64(ptr->g)+SqrI64(ptr->b)>=SqrI64(0x80)) {
|
if (SqrI64(ptr->r)+SqrI64(ptr->g)+SqrI64(ptr->b)>=SqrI64(0x80)) {
|
||||||
result=8;
|
res=8;
|
||||||
if (ptr->r>=0x80) result|=RED;
|
if (ptr->r>=0x80) res|=RED;
|
||||||
if (ptr->g>=0x80) result|=GREEN;
|
if (ptr->g>=0x80) res|=GREEN;
|
||||||
if (ptr->b>=0x80) result|=BLUE;
|
if (ptr->b>=0x80) res|=BLUE;
|
||||||
} else {
|
} else {
|
||||||
result=0;
|
res=0;
|
||||||
if (ptr->r>=0x40) result|=RED;
|
if (ptr->r>=0x40) res|=RED;
|
||||||
if (ptr->g>=0x40) result|=GREEN;
|
if (ptr->g>=0x40) res|=GREEN;
|
||||||
if (ptr->b>=0x40) result|=BLUE;
|
if (ptr->b>=0x40) res|=BLUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CDC *BMPRead(U8 *filename,Bool dither_probability=FALSE,
|
public CDC *BMPRead(U8 *filename,Bool dither_probability=FALSE,
|
||||||
@@ -242,11 +242,11 @@ public CDC *BMPRead(U8 *filename,Bool dither_probability=FALSE,
|
|||||||
U8 *palette_map,*ptr;
|
U8 *palette_map,*ptr;
|
||||||
Bool rle;
|
Bool rle;
|
||||||
CFileBMP *bmp;
|
CFileBMP *bmp;
|
||||||
CDC *result=NULL;
|
CDC *res=NULL;
|
||||||
if (ptr=FileRead(filename)) {
|
if (ptr=FileRead(filename)) {
|
||||||
bmp=ptr;
|
bmp=ptr;
|
||||||
if (0<bmp->width<MAX_I32 && 0<bmp->height<MAX_I32) {
|
if (0<bmp->width<MAX_I32 && 0<bmp->height<MAX_I32) {
|
||||||
result=DCNew(bmp->width,bmp->height);
|
res=DCNew(bmp->width,bmp->height);
|
||||||
ptr+=bmp->data_offset;
|
ptr+=bmp->data_offset;
|
||||||
if (bmp->compression==2)
|
if (bmp->compression==2)
|
||||||
rle=TRUE;
|
rle=TRUE;
|
||||||
@@ -262,30 +262,30 @@ public CDC *BMPRead(U8 *filename,Bool dither_probability=FALSE,
|
|||||||
j=0;
|
j=0;
|
||||||
while (cnt=*ptr++) {
|
while (cnt=*ptr++) {
|
||||||
if (cnt==1) {
|
if (cnt==1) {
|
||||||
result->color=palette_map[*ptr++&15];
|
res->color=palette_map[*ptr++&15];
|
||||||
GrPlot(result,j++,i);
|
GrPlot(res,j++,i);
|
||||||
} else {
|
} else {
|
||||||
if (cnt==2 && *ptr>>4!=*ptr&15) {
|
if (cnt==2 && *ptr>>4!=*ptr&15) {
|
||||||
result->color=palette_map[*ptr&15];
|
res->color=palette_map[*ptr&15];
|
||||||
GrPlot(result,j+1,i);
|
GrPlot(res,j+1,i);
|
||||||
result->color=palette_map[*ptr>>4];
|
res->color=palette_map[*ptr>>4];
|
||||||
GrPlot(result,j,i);
|
GrPlot(res,j,i);
|
||||||
ptr++;
|
ptr++;
|
||||||
j+=2;
|
j+=2;
|
||||||
} else {
|
} else {
|
||||||
result->color=palette_map[*ptr++&15];
|
res->color=palette_map[*ptr++&15];
|
||||||
while (cnt--)
|
while (cnt--)
|
||||||
GrPlot(result,j++,i);
|
GrPlot(res,j++,i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ptr++;
|
ptr++;
|
||||||
} else
|
} else
|
||||||
for (j=0;j<(bmp->width+7)&~7;) {
|
for (j=0;j<(bmp->width+7)&~7;) {
|
||||||
result->color=palette_map[*ptr&15];
|
res->color=palette_map[*ptr&15];
|
||||||
GrPlot(result,j+1,i);
|
GrPlot(res,j+1,i);
|
||||||
result->color=palette_map[*ptr>>4];
|
res->color=palette_map[*ptr>>4];
|
||||||
GrPlot(result,j,i);
|
GrPlot(res,j,i);
|
||||||
ptr++;
|
ptr++;
|
||||||
j+=2;
|
j+=2;
|
||||||
}
|
}
|
||||||
@@ -294,8 +294,8 @@ public CDC *BMPRead(U8 *filename,Bool dither_probability=FALSE,
|
|||||||
} else if (bmp->bit_cnt==24) {
|
} else if (bmp->bit_cnt==24) {
|
||||||
for (i=bmp->height-1;i>=0;i--) {
|
for (i=bmp->height-1;i>=0;i--) {
|
||||||
for (j=0;j<bmp->width;j++,ptr+=3) {
|
for (j=0;j<bmp->width;j++,ptr+=3) {
|
||||||
result->color=BMP24Color(ptr,dither_probability);
|
res->color=BMP24Color(ptr,dither_probability);
|
||||||
GrPlot(result,j,i);
|
GrPlot(res,j,i);
|
||||||
}
|
}
|
||||||
ptr+=bmp->width&3;
|
ptr+=bmp->width&3;
|
||||||
}
|
}
|
||||||
@@ -304,21 +304,21 @@ public CDC *BMPRead(U8 *filename,Bool dither_probability=FALSE,
|
|||||||
} else if (bmp->bit_cnt>=32) {
|
} else if (bmp->bit_cnt>=32) {
|
||||||
for (i=bmp->height-1;i>=0;i--)
|
for (i=bmp->height-1;i>=0;i--)
|
||||||
for (j=0;j<bmp->width;j++,ptr+=4) {
|
for (j=0;j<bmp->width;j++,ptr+=4) {
|
||||||
result->color=BMP24Color(ptr,dither_probability);
|
res->color=BMP24Color(ptr,dither_probability);
|
||||||
GrPlot(result,j,i);
|
GrPlot(res,j,i);
|
||||||
}
|
}
|
||||||
if (!use_ms_paint_palette)
|
if (!use_ms_paint_palette)
|
||||||
Free(palette_map);
|
Free(palette_map);
|
||||||
} else {
|
} else {
|
||||||
"Format Not Supported.\n";
|
"Format Not Supported.\n";
|
||||||
DCDel(result);
|
DCDel(res);
|
||||||
result=NULL;
|
res=NULL;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
"Invalid BMP File\n";
|
"Invalid BMP File\n";
|
||||||
Free(bmp);
|
Free(bmp);
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#help_index "Graphics/Sprite;Graphics/Windows BMP Files;"\
|
#help_index "Graphics/Sprite;Graphics/Windows BMP Files;"\
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ I64 FindWiz()
|
|||||||
CDoc *doc;
|
CDoc *doc;
|
||||||
U8 buf[32],*dir,*st;
|
U8 buf[32],*dir,*st;
|
||||||
CFind *g=CAlloc(sizeof(CFind));
|
CFind *g=CAlloc(sizeof(CFind));
|
||||||
I64 result=0;
|
I64 res=0;
|
||||||
g->recurse=TRUE;
|
g->recurse=TRUE;
|
||||||
StrCpy(g->filemask,FILEMASK_TXT);
|
StrCpy(g->filemask,FILEMASK_TXT);
|
||||||
if (doc=DocPut) {
|
if (doc=DocPut) {
|
||||||
@@ -248,10 +248,10 @@ I64 FindWiz()
|
|||||||
st=MStrPrint("\"$$$$WW+H,1$$$$\";Cd(\"%s\");"
|
st=MStrPrint("\"$$$$WW+H,1$$$$\";Cd(\"%s\");"
|
||||||
"Find(\"%Q\",\"%Q\",\"%Q\");UserTaskCont;",
|
"Find(\"%Q\",\"%Q\",\"%Q\");UserTaskCont;",
|
||||||
dir,g->find_text,g->filemask,buf);
|
dir,g->find_text,g->filemask,buf);
|
||||||
result=PopUp(st);
|
res=PopUp(st);
|
||||||
}
|
}
|
||||||
Free(dir);
|
Free(dir);
|
||||||
}
|
}
|
||||||
Free(g);
|
Free(g);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#help_index "Debugging/Heap"
|
#help_index "Debugging/Heap;Memory/Debugging"
|
||||||
#help_file "::/Doc/HeapDbg"
|
#help_file "::/Doc/HeapDbg"
|
||||||
|
|
||||||
#define HL_CALLER_DEPTH 5 //Feel free to change this.
|
#define HL_CALLER_DEPTH 5 //Feel free to change this.
|
||||||
|
|||||||
+14
-14
@@ -3,7 +3,7 @@
|
|||||||
I64 LineRep1(CDirEntry *tempde)
|
I64 LineRep1(CDirEntry *tempde)
|
||||||
{
|
{
|
||||||
CDoc *doc;
|
CDoc *doc;
|
||||||
I64 result=0,i;
|
I64 res=0,i;
|
||||||
while (tempde) {
|
while (tempde) {
|
||||||
i=0;
|
i=0;
|
||||||
if (tempde->attr&RS_ATTR_DIR)
|
if (tempde->attr&RS_ATTR_DIR)
|
||||||
@@ -15,10 +15,10 @@ I64 LineRep1(CDirEntry *tempde)
|
|||||||
DocDel(doc);
|
DocDel(doc);
|
||||||
}
|
}
|
||||||
tempde->user_data=i;
|
tempde->user_data=i;
|
||||||
result+=i;
|
res+=i;
|
||||||
tempde=tempde->next;
|
tempde=tempde->next;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
U0 LineRep2(CDoc *doc,CDirEntry *tempde)
|
U0 LineRep2(CDoc *doc,CDirEntry *tempde)
|
||||||
{
|
{
|
||||||
@@ -35,26 +35,26 @@ U0 LineRep2(CDoc *doc,CDirEntry *tempde)
|
|||||||
}
|
}
|
||||||
public I64 LineRep(U8 *files_find_mask="/*",U8 *fu_flags=NULL)
|
public I64 LineRep(U8 *files_find_mask="/*",U8 *fu_flags=NULL)
|
||||||
{//Source line-of-code count report.
|
{//Source line-of-code count report.
|
||||||
I64 fuf_flags=0,result=0;
|
I64 fuf_flags=0,res=0;
|
||||||
CDoc *doc=DocNew;
|
CDoc *doc=DocNew;
|
||||||
CDirEntry *tempde1=NULL;
|
CDirEntry *tempde1=NULL;
|
||||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+S");
|
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+S");
|
||||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||||
if (tempde1=FilesFind(files_find_mask,fuf_flags)) {
|
if (tempde1=FilesFind(files_find_mask,fuf_flags)) {
|
||||||
result=LineRep1(tempde1);
|
res=LineRep1(tempde1);
|
||||||
DocPrint(doc,"%8,d $$TR+C,\"%s\"$$\n$$ID,2$$",result,files_find_mask);
|
DocPrint(doc,"%8,d $$TR+C,\"%s\"$$\n$$ID,2$$",res,files_find_mask);
|
||||||
LineRep2(doc,tempde1);
|
LineRep2(doc,tempde1);
|
||||||
DocPrint(doc,"$$ID,-2$$");
|
DocPrint(doc,"$$ID,-2$$");
|
||||||
DirTreeDel(tempde1);
|
DirTreeDel(tempde1);
|
||||||
}
|
}
|
||||||
DocInsDoc(DocPut,doc);
|
DocInsDoc(DocPut,doc);
|
||||||
DocDel(doc);
|
DocDel(doc);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
I64 SizeRep1(CDirEntry *tempde,I64 *_fuf_flags)
|
I64 SizeRep1(CDirEntry *tempde,I64 *_fuf_flags)
|
||||||
{
|
{
|
||||||
I64 result=0,i;
|
I64 res=0,i;
|
||||||
U8 buf[BLK_SIZE];
|
U8 buf[BLK_SIZE];
|
||||||
CDrv *dv;
|
CDrv *dv;
|
||||||
while (tempde) {
|
while (tempde) {
|
||||||
@@ -67,10 +67,10 @@ I64 SizeRep1(CDirEntry *tempde,I64 *_fuf_flags)
|
|||||||
i=(&buf)(CArcCompress *)->expanded_size;
|
i=(&buf)(CArcCompress *)->expanded_size;
|
||||||
}
|
}
|
||||||
tempde->user_data=i;
|
tempde->user_data=i;
|
||||||
result+=i;
|
res+=i;
|
||||||
tempde=tempde->next;
|
tempde=tempde->next;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
U0 SizeRep2(CDoc *doc,CDirEntry *tempde)
|
U0 SizeRep2(CDoc *doc,CDirEntry *tempde)
|
||||||
{
|
{
|
||||||
@@ -90,20 +90,20 @@ U0 SizeRep2(CDoc *doc,CDirEntry *tempde)
|
|||||||
}
|
}
|
||||||
public I64 SizeRep(U8 *files_find_mask="/*",U8 *fu_flags=NULL)
|
public I64 SizeRep(U8 *files_find_mask="/*",U8 *fu_flags=NULL)
|
||||||
{//Report file sizes. "+x" for expanded size of compressed files.
|
{//Report file sizes. "+x" for expanded size of compressed files.
|
||||||
I64 fuf_flags=0,result=0;
|
I64 fuf_flags=0,res=0;
|
||||||
CDoc *doc=DocNew;
|
CDoc *doc=DocNew;
|
||||||
CDirEntry *tempde1=NULL;
|
CDirEntry *tempde1=NULL;
|
||||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
|
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
|
||||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||||
if (tempde1=FilesFind(files_find_mask,fuf_flags&FUG_FILES_FIND)) {
|
if (tempde1=FilesFind(files_find_mask,fuf_flags&FUG_FILES_FIND)) {
|
||||||
fuf_flags&=FUF_EXPAND;
|
fuf_flags&=FUF_EXPAND;
|
||||||
result=SizeRep1(tempde1,&fuf_flags);
|
res=SizeRep1(tempde1,&fuf_flags);
|
||||||
DocPrint(doc,"%10,d $$TR+C,\"%s\"$$\n$$ID,2$$",result,files_find_mask);
|
DocPrint(doc,"%10,d $$TR+C,\"%s\"$$\n$$ID,2$$",res,files_find_mask);
|
||||||
SizeRep2(doc,tempde1);
|
SizeRep2(doc,tempde1);
|
||||||
DocPrint(doc,"$$ID,-2$$");
|
DocPrint(doc,"$$ID,-2$$");
|
||||||
DirTreeDel(tempde1);
|
DirTreeDel(tempde1);
|
||||||
}
|
}
|
||||||
DocInsDoc(DocPut,doc);
|
DocInsDoc(DocPut,doc);
|
||||||
DocDel(doc);
|
DocDel(doc);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@ I64 LinkChkDoc(CDoc *doc,I64 *_fuf_flags)
|
|||||||
Bool found,unlock=DocLock(doc);
|
Bool found,unlock=DocLock(doc);
|
||||||
CDoc *old_doc;
|
CDoc *old_doc;
|
||||||
CDocEntry *doc_e=doc->root.next;
|
CDocEntry *doc_e=doc->root.next;
|
||||||
I64 result=0;
|
I64 res=0;
|
||||||
while (doc_e!=doc) {
|
while (doc_e!=doc) {
|
||||||
if (ScanKey) {
|
if (ScanKey) {
|
||||||
LBts(_fuf_flags,FUf_CANCEL);
|
LBts(_fuf_flags,FUf_CANCEL);
|
||||||
@@ -22,38 +22,38 @@ I64 LinkChkDoc(CDoc *doc,I64 *_fuf_flags)
|
|||||||
if (!found) {
|
if (!found) {
|
||||||
PutFileLink(doc->filename.name,doc_e->y);
|
PutFileLink(doc->filename.name,doc_e->y);
|
||||||
"$$RED$$ %04d:%s\n$$FG$$",doc_e->y,st;
|
"$$RED$$ %04d:%s\n$$FG$$",doc_e->y,st;
|
||||||
result++;
|
res++;
|
||||||
}
|
}
|
||||||
Free(st);
|
Free(st);
|
||||||
} else if (doc_e->type_u8==DOCT_ERROR) {
|
} else if (doc_e->type_u8==DOCT_ERROR) {
|
||||||
PutFileLink(doc->filename.name,doc_e->y);
|
PutFileLink(doc->filename.name,doc_e->y);
|
||||||
"$$RED$$ Doc Error\n$$FG$$";
|
"$$RED$$ Doc Error\n$$FG$$";
|
||||||
result++;
|
res++;
|
||||||
}
|
}
|
||||||
doc_e=doc_e->next;
|
doc_e=doc_e->next;
|
||||||
}
|
}
|
||||||
if (unlock) DocUnlock(doc);
|
if (unlock) DocUnlock(doc);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
I64 LinkChkFile(U8 *filename,I64 *_fuf_flags)
|
I64 LinkChkFile(U8 *filename,I64 *_fuf_flags)
|
||||||
{
|
{
|
||||||
CDoc *doc=DocRead(filename,DOCF_NO_CURSOR);
|
CDoc *doc=DocRead(filename,DOCF_NO_CURSOR);
|
||||||
I64 result=LinkChkDoc(doc,_fuf_flags);
|
I64 res=LinkChkDoc(doc,_fuf_flags);
|
||||||
DocDel(doc);
|
DocDel(doc);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
public I64 LinkChk(U8 *files_find_mask="/*",U8 *fu_flags=NULL)
|
public I64 LinkChk(U8 *files_find_mask="/*",U8 *fu_flags=NULL)
|
||||||
{//Check documents for broken file links.
|
{//Check documents for broken file links.
|
||||||
I64 fuf_flags=0,result=0;
|
I64 fuf_flags=0,res=0;
|
||||||
CDirEntry *tempde,*tempde1;
|
CDirEntry *tempde,*tempde1;
|
||||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+T+f+F+O");
|
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+T+f+F+O");
|
||||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
||||||
while (tempde && !Bt(&fuf_flags,FUf_CANCEL)) {
|
while (tempde && !Bt(&fuf_flags,FUf_CANCEL)) {
|
||||||
result+=LinkChkFile(tempde->full_name,&fuf_flags);
|
res+=LinkChkFile(tempde->full_name,&fuf_flags);
|
||||||
tempde=tempde->next;
|
tempde=tempde->next;
|
||||||
}
|
}
|
||||||
DirTreeDel(tempde1);
|
DirTreeDel(tempde1);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
+19
-19
@@ -7,36 +7,36 @@ I64 TSSSize(CTSS *tss)
|
|||||||
|
|
||||||
I64 PenBrushesSize()
|
I64 PenBrushesSize()
|
||||||
{
|
{
|
||||||
I64 result=0,i;
|
I64 res=0,i;
|
||||||
for (i=0;i<GR_NUM_PEN_BRUSHES;i++)
|
for (i=0;i<GR_NUM_PEN_BRUSHES;i++)
|
||||||
result+=DCSize(gr.pen_brushes[i])+DCSize(gr.collision_pen_brushes[i])+
|
res+=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;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
I64 ScreenZoomTablesSize()
|
I64 ScreenZoomTablesSize()
|
||||||
{
|
{
|
||||||
I64 result=0,i;
|
I64 res=0,i;
|
||||||
for (i=1;i<=GR_MAX_SCREEN_ZOOM;i++)
|
for (i=1;i<=GR_MAX_SCREEN_ZOOM;i++)
|
||||||
result+=MSize2(gr.screen_zoom_tables[i]);
|
res+=MSize2(gr.screen_zoom_tables[i]);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
I64 TaskStkSize(CTask *task)
|
I64 TaskStkSize(CTask *task)
|
||||||
{
|
{
|
||||||
CTaskStk *temps=task->stk;
|
CTaskStk *temps=task->stk;
|
||||||
I64 result=0;
|
I64 res=0;
|
||||||
while (temps) {
|
while (temps) {
|
||||||
result+=MSize2(temps);
|
res+=MSize2(temps);
|
||||||
temps=temps->next_stk;
|
temps=temps->next_stk;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
I64 TaskQueSize(CTask *task)
|
I64 TaskQueSize(CTask *task)
|
||||||
{
|
{
|
||||||
CSrvCmd *tempc,*tempc1;
|
CSrvCmd *tempc,*tempc1;
|
||||||
I64 result=0;
|
I64 res=0;
|
||||||
PUSHFD
|
PUSHFD
|
||||||
CLI
|
CLI
|
||||||
while (LBts(&task->srv_ctrl.flags,SVCRf_LOCKED))
|
while (LBts(&task->srv_ctrl.flags,SVCRf_LOCKED))
|
||||||
@@ -45,25 +45,25 @@ I64 TaskQueSize(CTask *task)
|
|||||||
tempc1=&task->srv_ctrl.next_waiting;
|
tempc1=&task->srv_ctrl.next_waiting;
|
||||||
tempc=tempc1->next;
|
tempc=tempc1->next;
|
||||||
while (tempc!=tempc1) {
|
while (tempc!=tempc1) {
|
||||||
result+=MSize2(tempc)+MSize2(tempc->aux_str);
|
res+=MSize2(tempc)+MSize2(tempc->aux_str);
|
||||||
tempc=tempc->next;
|
tempc=tempc->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
tempc1=&task->srv_ctrl.next_done;
|
tempc1=&task->srv_ctrl.next_done;
|
||||||
tempc=tempc1->next;
|
tempc=tempc1->next;
|
||||||
while (tempc!=tempc1) {
|
while (tempc!=tempc1) {
|
||||||
result+=MSize2(tempc)+MSize2(tempc->aux_str);
|
res+=MSize2(tempc)+MSize2(tempc->aux_str);
|
||||||
tempc=tempc->next;
|
tempc=tempc->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
LBtr(&task->srv_ctrl.flags,SVCRf_LOCKED);
|
LBtr(&task->srv_ctrl.flags,SVCRf_LOCKED);
|
||||||
POPFD
|
POPFD
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
I64 BlkDevsSize()
|
I64 BlkDevsSize()
|
||||||
{
|
{
|
||||||
I64 i,result=MSize2(blkdev.blkdevs);
|
I64 i,res=MSize2(blkdev.blkdevs);
|
||||||
CBlkDev *bd;
|
CBlkDev *bd;
|
||||||
for (i=0;i<NUM_BLKDEVS;i++) {
|
for (i=0;i<NUM_BLKDEVS;i++) {
|
||||||
bd=&blkdev.blkdevs[i];
|
bd=&blkdev.blkdevs[i];
|
||||||
@@ -72,18 +72,18 @@ I64 BlkDevsSize()
|
|||||||
"RAMDsk %C\t:%010X Unused:%010X\n",
|
"RAMDsk %C\t:%010X Unused:%010X\n",
|
||||||
bd->first_drv_let,(bd->max_blk+1)<<BLK_SIZE_BITS,
|
bd->first_drv_let,(bd->max_blk+1)<<BLK_SIZE_BITS,
|
||||||
UnusedDrvSpace(bd->first_drv_let);
|
UnusedDrvSpace(bd->first_drv_let);
|
||||||
result+=MSize2(bd->dev_id_record);
|
res+=MSize2(bd->dev_id_record);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
I64 DrvsSize()
|
I64 DrvsSize()
|
||||||
{
|
{
|
||||||
I64 i,result=MSize2(blkdev.drvs);
|
I64 i,res=MSize2(blkdev.drvs);
|
||||||
for (i=0;i<NUM_DRVS;i++)
|
for (i=0;i<NUM_DRVS;i++)
|
||||||
result+=MSize2(blkdev.drvs[i].cur_fat_blk)+MSize2(blkdev.drvs[i].fis);
|
res+=MSize2(blkdev.drvs[i].cur_fat_blk)+MSize2(blkdev.drvs[i].fis);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
|
Bool MemRepTask(CTask *task,Bool override_validate=FALSE)
|
||||||
|
|||||||
+18
-18
@@ -11,7 +11,7 @@ public I64 Sort(U8 *_in_name,U8 *_out_name=NULL,
|
|||||||
U8 *in_name,*out_name,*st;
|
U8 *in_name,*out_name,*st;
|
||||||
CDoc *doc;
|
CDoc *doc;
|
||||||
CDocEntry *doc_e,*doc_e1,**a;
|
CDocEntry *doc_e,*doc_e1,**a;
|
||||||
I64 i,j,cnt=0,result;
|
I64 i,j,cnt=0,res;
|
||||||
|
|
||||||
if (!_in_name) return 0;
|
if (!_in_name) return 0;
|
||||||
in_name=DftExt(_in_name,"TXT.Z");
|
in_name=DftExt(_in_name,"TXT.Z");
|
||||||
@@ -41,7 +41,7 @@ public I64 Sort(U8 *_in_name,U8 *_out_name=NULL,
|
|||||||
}
|
}
|
||||||
QSort(a,cnt/entry_lines,entry_lines*sizeof(CDocEntry *),&DEPtrCompare);
|
QSort(a,cnt/entry_lines,entry_lines*sizeof(CDocEntry *),&DEPtrCompare);
|
||||||
|
|
||||||
result=0;
|
res=0;
|
||||||
st=NULL;
|
st=NULL;
|
||||||
for (i=0;i<cnt;) {
|
for (i=0;i<cnt;) {
|
||||||
if (!unique || !st || StrCmp(a[i]->tag,st)) {
|
if (!unique || !st || StrCmp(a[i]->tag,st)) {
|
||||||
@@ -52,7 +52,7 @@ public I64 Sort(U8 *_in_name,U8 *_out_name=NULL,
|
|||||||
doc->cur_col=0;
|
doc->cur_col=0;
|
||||||
DocPrint(doc,"\n");
|
DocPrint(doc,"\n");
|
||||||
}
|
}
|
||||||
result++;
|
res++;
|
||||||
} else
|
} else
|
||||||
for (j=0;j<entry_lines && i<cnt;j++,i++) {
|
for (j=0;j<entry_lines && i<cnt;j++,i++) {
|
||||||
QueIns(a[i],doc->root.last);
|
QueIns(a[i],doc->root.last);
|
||||||
@@ -66,13 +66,13 @@ public I64 Sort(U8 *_in_name,U8 *_out_name=NULL,
|
|||||||
DocDel(doc);
|
DocDel(doc);
|
||||||
Free(in_name);
|
Free(in_name);
|
||||||
Free(out_name);
|
Free(out_name);
|
||||||
return result; //Num Entries
|
return res; //Num Entries
|
||||||
}
|
}
|
||||||
|
|
||||||
I64 DocWordsFile(CDoc *doc_out=NULL,U8 *filename,U32 *chars_bmp)
|
I64 DocWordsFile(CDoc *doc_out=NULL,U8 *filename,U32 *chars_bmp)
|
||||||
{
|
{
|
||||||
U8 *ptr,*ptr2;
|
U8 *ptr,*ptr2;
|
||||||
I64 result=0,ch;
|
I64 res=0,ch;
|
||||||
CDoc *doc_in=DocRead(filename);
|
CDoc *doc_in=DocRead(filename);
|
||||||
CDocEntry *doc_e=doc_in->root.next;
|
CDocEntry *doc_e=doc_in->root.next;
|
||||||
while (doc_e!=doc_in) {
|
while (doc_e!=doc_in) {
|
||||||
@@ -90,7 +90,7 @@ I64 DocWordsFile(CDoc *doc_out=NULL,U8 *filename,U32 *chars_bmp)
|
|||||||
*ptr=0;
|
*ptr=0;
|
||||||
if (*ptr2) {
|
if (*ptr2) {
|
||||||
DocPrint(doc_out,"%s\n",ptr2);
|
DocPrint(doc_out,"%s\n",ptr2);
|
||||||
result++;
|
res++;
|
||||||
}
|
}
|
||||||
*ptr=ch;
|
*ptr=ch;
|
||||||
}
|
}
|
||||||
@@ -98,59 +98,59 @@ I64 DocWordsFile(CDoc *doc_out=NULL,U8 *filename,U32 *chars_bmp)
|
|||||||
doc_e=doc_e->next;
|
doc_e=doc_e->next;
|
||||||
}
|
}
|
||||||
DocDel(doc_in);
|
DocDel(doc_in);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
public I64 Words(U8 *files_find_mask="*",U32 *chars_bmp=chars_bmp_alpha,
|
public I64 Words(U8 *files_find_mask="*",U32 *chars_bmp=chars_bmp_alpha,
|
||||||
U8 *fu_flags=NULL)
|
U8 *fu_flags=NULL)
|
||||||
{//Break file into list of not-unique words.
|
{//Break file into list of not-unique words.
|
||||||
I64 fuf_flags=0,result=0;
|
I64 fuf_flags=0,res=0;
|
||||||
CDoc *doc_out=DocNew;
|
CDoc *doc_out=DocNew;
|
||||||
CDirEntry *tempde,*tempde1;
|
CDirEntry *tempde,*tempde1;
|
||||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F+T");
|
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F+T");
|
||||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
||||||
while (tempde) {
|
while (tempde) {
|
||||||
result+=DocWordsFile(doc_out,tempde->full_name,chars_bmp);
|
res+=DocWordsFile(doc_out,tempde->full_name,chars_bmp);
|
||||||
tempde=tempde->next;
|
tempde=tempde->next;
|
||||||
}
|
}
|
||||||
DirTreeDel(tempde1);
|
DirTreeDel(tempde1);
|
||||||
DocInsDoc(NULL,doc_out);
|
DocInsDoc(NULL,doc_out);
|
||||||
DocDel(doc_out);
|
DocDel(doc_out);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
I64 LongLinesFile(U8 *filename,I64 cols)
|
I64 LongLinesFile(U8 *filename,I64 cols)
|
||||||
{
|
{
|
||||||
I64 result=0;
|
I64 res=0;
|
||||||
CDoc *doc=DocRead(filename);
|
CDoc *doc=DocRead(filename);
|
||||||
CDocEntry *doc_e=doc->root.next;
|
CDocEntry *doc_e=doc->root.next;
|
||||||
while (doc_e!=doc) {
|
while (doc_e!=doc) {
|
||||||
if (doc_e->type_u8==DOCT_NEW_LINE && doc_e->x>=cols+1)
|
if (doc_e->type_u8==DOCT_NEW_LINE && doc_e->x>=cols+1)
|
||||||
result++;
|
res++;
|
||||||
doc_e=doc_e->next;
|
doc_e=doc_e->next;
|
||||||
}
|
}
|
||||||
DocDel(doc);
|
DocDel(doc);
|
||||||
if (result) {
|
if (res) {
|
||||||
"%04d ",result;
|
"%04d ",res;
|
||||||
PutFileLink(filename);
|
PutFileLink(filename);
|
||||||
'\n';
|
'\n';
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
public I64 LongLines(U8 *files_find_mask="*",I64 cols=80,U8 *fu_flags=NULL)
|
public I64 LongLines(U8 *files_find_mask="*",I64 cols=80,U8 *fu_flags=NULL)
|
||||||
{//Report files with lines of too many cols.
|
{//Report files with lines of too many cols.
|
||||||
I64 result=0,fuf_flags=0;
|
I64 res=0,fuf_flags=0;
|
||||||
CDirEntry *tempde,*tempde1;
|
CDirEntry *tempde,*tempde1;
|
||||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F+S");
|
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F+S");
|
||||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
||||||
while (tempde) {
|
while (tempde) {
|
||||||
if (LongLinesFile(tempde->full_name,cols))
|
if (LongLinesFile(tempde->full_name,cols))
|
||||||
result++;
|
res++;
|
||||||
tempde=tempde->next;
|
tempde=tempde->next;
|
||||||
}
|
}
|
||||||
DirTreeDel(tempde1);
|
DirTreeDel(tempde1);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 SUFile(U8 *filename,I64 suf_flags,F64 indent_scale_factor)
|
U0 SUFile(U8 *filename,I64 suf_flags,F64 indent_scale_factor)
|
||||||
|
|||||||
@@ -26,21 +26,21 @@ public F64 tM()
|
|||||||
|
|
||||||
public F64 Beat()
|
public F64 Beat()
|
||||||
{//Time in music beats.
|
{//Time in music beats.
|
||||||
F64 result,cur_tM;
|
F64 res,cur_tM;
|
||||||
PUSHFD
|
PUSHFD
|
||||||
CLI
|
CLI
|
||||||
if (mp_cnt>1)
|
if (mp_cnt>1)
|
||||||
while (LBts(&sys_semas[SYS_SEMA_TMBEAT],0))
|
while (LBts(&sys_semas[SYS_SEMA_TMBEAT],0))
|
||||||
PAUSE
|
PAUSE
|
||||||
cur_tM=tM;
|
cur_tM=tM;
|
||||||
result=music.last_Beat;
|
res=music.last_Beat;
|
||||||
if (music.tempo)
|
if (music.tempo)
|
||||||
result+=(cur_tM-music.last_tM)*music.tempo;
|
res+=(cur_tM-music.last_tM)*music.tempo;
|
||||||
music.last_tM=cur_tM;
|
music.last_tM=cur_tM;
|
||||||
music.last_Beat=result;
|
music.last_Beat=res;
|
||||||
LBtr(&sys_semas[SYS_SEMA_TMBEAT],0);
|
LBtr(&sys_semas[SYS_SEMA_TMBEAT],0);
|
||||||
POPFD
|
POPFD
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#help_index "Snd/Music"
|
#help_index "Snd/Music"
|
||||||
|
|||||||
+2
-3
@@ -6,9 +6,8 @@ U0 TaskRepTask(CTask *task,I64 indent)
|
|||||||
st=MStrPrint("$$MA,T=\"%08X\",LM=\"Kill(0x%X);\n\",$$",task,task,task);
|
st=MStrPrint("$$MA,T=\"%08X\",LM=\"Kill(0x%X);\n\",$$",task,task,task);
|
||||||
"%h*c%s $$TX,\"%Q...\",SCX=16$$ Mem:%08X\n",indent,CH_SPACE,
|
"%h*c%s $$TX,\"%Q...\",SCX=16$$ Mem:%08X\n",indent,CH_SPACE,
|
||||||
st,desc,TaskMemAlloced(task);
|
st,desc,TaskMemAlloced(task);
|
||||||
"%h*cFlags:%04X:%04X Time:%0.2fm\n",indent+2,CH_SPACE,
|
"%h*cFlags:%04X:%04X:%08X\n",indent+2,CH_SPACE,
|
||||||
task->task_flags,task->display_flags,
|
task->task_flags,task->display_flags,task->win_inhibit;
|
||||||
task->total_time/60.0/cnts.time_stamp_freq_initial;
|
|
||||||
Free(st);
|
Free(st);
|
||||||
Free(desc);
|
Free(desc);
|
||||||
task1=task->next_child_task;
|
task1=task->next_child_task;
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ public U0 SettingsPop(CTask *task=NULL,I64 flags=0)
|
|||||||
Suspend(task->song_task,FALSE);
|
Suspend(task->song_task,FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsPop2(task,tempse); //Do it to get results fast
|
SettingsPop2(task,tempse); //Do it to get ress fast
|
||||||
WinMgrSync(,TRUE);
|
WinMgrSync(,TRUE);
|
||||||
SettingsPop2(task,tempse); //Redo in case was lost by old update
|
SettingsPop2(task,tempse); //Redo in case was lost by old update
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -4,7 +4,7 @@ U8 *KeyMapKeyMStrPrint(I64 sc,U0 (*fp_handler)(I64 sc),
|
|||||||
U8 *desc,CTask *task=NULL)
|
U8 *desc,CTask *task=NULL)
|
||||||
{
|
{
|
||||||
I64 i=9,k,c;
|
I64 i=9,k,c;
|
||||||
U8 *st,*st2,*result,*ptr;
|
U8 *st,*st2,*res,*ptr;
|
||||||
CHashTable *old_hash=Fs->hash_table;
|
CHashTable *old_hash=Fs->hash_table;
|
||||||
st=ScanCode2KeyName(sc);
|
st=ScanCode2KeyName(sc);
|
||||||
if (sc&SCF_CTRL) i+=5;
|
if (sc&SCF_CTRL) i+=5;
|
||||||
@@ -21,19 +21,19 @@ U8 *KeyMapKeyMStrPrint(I64 sc,U0 (*fp_handler)(I64 sc),
|
|||||||
else if (k=='Cmd ') c=RED;
|
else if (k=='Cmd ') c=RED;
|
||||||
else c=BLACK;
|
else c=BLACK;
|
||||||
|
|
||||||
result=MStrPrint("%-*s $$FG,%d$$$$TX+UL+L+PU,\"%Q\",A=\"%s\"$$$$FG$$\n",
|
res=MStrPrint("%-*s $$FG,%d$$$$TX+UL+L+PU,\"%Q\",A=\"%s\"$$$$FG$$\n",
|
||||||
i,st,c,desc,st2);
|
i,st,c,desc,st2);
|
||||||
Free(st);
|
Free(st);
|
||||||
Free(st2);
|
Free(st2);
|
||||||
|
|
||||||
ptr=result;
|
ptr=res;
|
||||||
while (*ptr) {
|
while (*ptr) {
|
||||||
if (*ptr==CH_SPACE)
|
if (*ptr==CH_SPACE)
|
||||||
*ptr=CH_SHIFT_SPACE;
|
*ptr=CH_SHIFT_SPACE;
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 KeyMapKeyPrint(I64 sc,U0 (*fp_handler)(I64 sc),U8 *desc,CTask *task=NULL)
|
U0 KeyMapKeyPrint(I64 sc,U0 (*fp_handler)(I64 sc),U8 *desc,CTask *task=NULL)
|
||||||
|
|||||||
Binary file not shown.
+13
-13
@@ -7,7 +7,7 @@ CIPStateGlbls old_ip={IP_NULL,{-1000,-1000,0},{-1000,-1000,0},{-1000,-1000,0},
|
|||||||
FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE
|
FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE
|
||||||
};
|
};
|
||||||
|
|
||||||
public CWinMgrGlbls winmgr={0,0,0,WMG_FPS,tS,NULL,NULL,FALSE,FALSE,FALSE};
|
public CWinMgrGlbls winmgr={0,0,0,WINMGR_FPS,tS,NULL,NULL,FALSE,FALSE,FALSE};
|
||||||
winmgr.t=CAlloc(sizeof(CWinMgrTimingGlbls));
|
winmgr.t=CAlloc(sizeof(CWinMgrTimingGlbls));
|
||||||
winmgr.t->last_calc_idle_time=tS;
|
winmgr.t->last_calc_idle_time=tS;
|
||||||
|
|
||||||
@@ -252,7 +252,7 @@ public CTask *WinRefocus(CTask *task=NULL)
|
|||||||
I64 WinOnTopWindows()
|
I64 WinOnTopWindows()
|
||||||
{
|
{
|
||||||
CTask *task,*task1,*first_moved_fwd=NULL;
|
CTask *task,*task1,*first_moved_fwd=NULL;
|
||||||
I64 result=0;
|
I64 res=0;
|
||||||
PUSHFD
|
PUSHFD
|
||||||
CLI //TODO Multiprocessor safe
|
CLI //TODO Multiprocessor safe
|
||||||
task=sys_winmgr_task->next_task;
|
task=sys_winmgr_task->next_task;
|
||||||
@@ -260,26 +260,26 @@ I64 WinOnTopWindows()
|
|||||||
task1=task->next_task;
|
task1=task->next_task;
|
||||||
if (!TaskValidate(task)) {
|
if (!TaskValidate(task)) {
|
||||||
POPFD
|
POPFD
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
if (Bt(&task->display_flags,DISPLAYf_WIN_ON_TOP) &&
|
if (Bt(&task->display_flags,DISPLAYf_WIN_ON_TOP) &&
|
||||||
task!=sys_winmgr_task->last_task) {
|
task!=sys_winmgr_task->last_task) {
|
||||||
TaskQueRem(task);
|
TaskQueRem(task);
|
||||||
TaskQueIns(task,sys_winmgr_task);
|
TaskQueIns(task,sys_winmgr_task);
|
||||||
result++;
|
res++;
|
||||||
if (!first_moved_fwd)
|
if (!first_moved_fwd)
|
||||||
first_moved_fwd=task;
|
first_moved_fwd=task;
|
||||||
}
|
}
|
||||||
task=task1;
|
task=task1;
|
||||||
}
|
}
|
||||||
POPFD
|
POPFD
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public I64 WinToTop(CTask *task=NULL,Bool update_z_buf=TRUE)
|
public I64 WinToTop(CTask *task=NULL,Bool update_z_buf=TRUE)
|
||||||
{//Put task's win on top of window stack.
|
{//Put task's win on top of window stack.
|
||||||
CTask *task1;
|
CTask *task1;
|
||||||
I64 result=0;
|
I64 res=0;
|
||||||
if (!task) task=Fs;
|
if (!task) task=Fs;
|
||||||
if (!TaskValidate(task) || task->gs->num)
|
if (!TaskValidate(task) || task->gs->num)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -295,27 +295,27 @@ public I64 WinToTop(CTask *task=NULL,Bool update_z_buf=TRUE)
|
|||||||
if (task!=sys_winmgr_task->last_task) {
|
if (task!=sys_winmgr_task->last_task) {
|
||||||
TaskQueRem(task);
|
TaskQueRem(task);
|
||||||
TaskQueIns(task,sys_winmgr_task);
|
TaskQueIns(task,sys_winmgr_task);
|
||||||
result++;
|
res++;
|
||||||
}
|
}
|
||||||
if (!Bt(&task->win_inhibit,WIf_SELF_FOCUS))
|
if (!Bt(&task->win_inhibit,WIf_SELF_FOCUS))
|
||||||
sys_focus_task=task;
|
sys_focus_task=task;
|
||||||
if (result && !Bt(&task->display_flags,DISPLAYf_CHILDREN_NOT_ON_TOP)) {
|
if (res && !Bt(&task->display_flags,DISPLAYf_CHILDREN_NOT_ON_TOP)) {
|
||||||
task1=task->next_child_task;
|
task1=task->next_child_task;
|
||||||
while (task1!=&task->next_child_task) {
|
while (task1!=&task->next_child_task) {
|
||||||
if (!TaskValidate(task1))
|
if (!TaskValidate(task1))
|
||||||
break;
|
break;
|
||||||
result+=WinToTop(task1,FALSE);
|
res+=WinToTop(task1,FALSE);
|
||||||
task1=task1->next_sibling_task;
|
task1=task1->next_sibling_task;
|
||||||
}
|
}
|
||||||
if (task->popup_task &&
|
if (task->popup_task &&
|
||||||
task->popup_task->parent_task==task)
|
task->popup_task->parent_task==task)
|
||||||
result+=WinToTop(task->popup_task,FALSE);
|
res+=WinToTop(task->popup_task,FALSE);
|
||||||
}
|
}
|
||||||
POPFD
|
POPFD
|
||||||
result+=WinOnTopWindows;
|
res+=WinOnTopWindows;
|
||||||
if (result && update_z_buf)
|
if (res && update_z_buf)
|
||||||
WinZBufUpdate;
|
WinZBufUpdate;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
ext[EXT_WIN_TO_TOP]=&WinToTop;
|
ext[EXT_WIN_TO_TOP]=&WinToTop;
|
||||||
|
|
||||||
|
|||||||
+15
-15
@@ -270,7 +270,7 @@ I64 WinMgrSleep(Bool flush_msgs=FALSE)
|
|||||||
WinIPUpdate;
|
WinIPUpdate;
|
||||||
|
|
||||||
if (!LBtr(&sys_semas[SYS_SEMA_JUST_PUMP_MSGS],0)) {
|
if (!LBtr(&sys_semas[SYS_SEMA_JUST_PUMP_MSGS],0)) {
|
||||||
timeout_val=cnts.jiffies+JIFFY_FREQ/WMG_FPS;
|
timeout_val=cnts.jiffies+JIFFY_FREQ/WINMGR_FPS;
|
||||||
LBts(&sys_semas[SYS_SEMA_REFRESH_IN_PROGRESS],0);
|
LBts(&sys_semas[SYS_SEMA_REFRESH_IN_PROGRESS],0);
|
||||||
GrUpdateScreen;
|
GrUpdateScreen;
|
||||||
LBtr(&sys_semas[SYS_SEMA_REFRESH_IN_PROGRESS],0);
|
LBtr(&sys_semas[SYS_SEMA_REFRESH_IN_PROGRESS],0);
|
||||||
@@ -302,34 +302,34 @@ I64 WinMgrSleep(Bool flush_msgs=FALSE)
|
|||||||
|
|
||||||
CDoc *WinCursorPosSet(CTask *task,I64 ipx,I64 ipy,Bool set_cursor=TRUE)
|
CDoc *WinCursorPosSet(CTask *task,I64 ipx,I64 ipy,Bool set_cursor=TRUE)
|
||||||
{
|
{
|
||||||
CDoc *result=NULL;
|
CDoc *res=NULL;
|
||||||
Bool unlock;
|
Bool unlock;
|
||||||
I64 x0,y0;
|
I64 x0,y0;
|
||||||
if (!task) task=Fs;
|
if (!task) task=Fs;
|
||||||
if (WinInside(ipx,ipy,task)) {
|
if (WinInside(ipx,ipy,task)) {
|
||||||
if ((result=DocDisplay(task)) && result->flags&DOCF_DONT_SHOW)
|
if ((res=DocDisplay(task)) && res->flags&DOCF_DONT_SHOW)
|
||||||
result=NULL;
|
res=NULL;
|
||||||
else if (set_cursor) {
|
else if (set_cursor) {
|
||||||
unlock=DocLock(result);
|
unlock=DocLock(res);
|
||||||
if (result->doc_signature!=DOC_SIGNATURE_VAL)
|
if (res->doc_signature!=DOC_SIGNATURE_VAL)
|
||||||
result=NULL;
|
res=NULL;
|
||||||
else {
|
else {
|
||||||
x0=result->line_start_col;
|
x0=res->line_start_col;
|
||||||
y0=result->top_line_num;
|
y0=res->top_line_num;
|
||||||
DocRecalc(result,RECALCF_HAS_CURSOR);
|
DocRecalc(res,RECALCF_HAS_CURSOR);
|
||||||
result->x=(ipx-task->pix_left-task->scroll_x)/FONT_WIDTH +x0;
|
res->x=(ipx-task->pix_left-task->scroll_x)/FONT_WIDTH +x0;
|
||||||
result->y=(ipy-task->pix_top -task->scroll_y)/FONT_HEIGHT+y0;
|
res->y=(ipy-task->pix_top -task->scroll_y)/FONT_HEIGHT+y0;
|
||||||
DocRecalc(result,RECALCt_FIND_CURSOR);
|
DocRecalc(res,RECALCt_FIND_CURSOR);
|
||||||
task->scroll_x=0;
|
task->scroll_x=0;
|
||||||
task->scroll_y=0;
|
task->scroll_y=0;
|
||||||
task->scroll_z=0;
|
task->scroll_z=0;
|
||||||
if (unlock)
|
if (unlock)
|
||||||
DocUnlock(result);
|
DocUnlock(res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WinToTop(task);
|
WinToTop(task);
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 WinChkMoveSize(CTask *task)
|
U0 WinChkMoveSize(CTask *task)
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ U0 HoldCourt()
|
|||||||
Bool TakeTurn()
|
Bool TakeTurn()
|
||||||
{
|
{
|
||||||
I64 i;
|
I64 i;
|
||||||
Bool result,old_form=LBts(&(DocPut)->flags,DOCf_FORM);
|
Bool res,old_form=LBts(&(DocPut)->flags,DOCf_FORM);
|
||||||
num_people*=1.0+0.01*((RandU16%100)-30);
|
num_people*=1.0+0.01*((RandU16%100)-30);
|
||||||
if (num_people>MAX_PEOPLE)
|
if (num_people>MAX_PEOPLE)
|
||||||
num_people=MAX_PEOPLE;
|
num_people=MAX_PEOPLE;
|
||||||
@@ -96,7 +96,7 @@ Bool TakeTurn()
|
|||||||
DocBottom;
|
DocBottom;
|
||||||
|
|
||||||
if (!(0<=i<T_QUIT))
|
if (!(0<=i<T_QUIT))
|
||||||
result=FALSE;
|
res=FALSE;
|
||||||
else {
|
else {
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case T_BREAK_CAMP:
|
case T_BREAK_CAMP:
|
||||||
@@ -130,11 +130,11 @@ Bool TakeTurn()
|
|||||||
PopUpOk("Add your own story-line...\nLike old school toys.\n");
|
PopUpOk("Add your own story-line...\nLike old school toys.\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
}
|
}
|
||||||
WinMgrSync;
|
WinMgrSync;
|
||||||
Fs->song_task=NULL;
|
Fs->song_task=NULL;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 TMsg(CDC *dc,U8 *msg)
|
U0 TMsg(CDC *dc,U8 *msg)
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -5,18 +5,18 @@ U0 BgtAcctsUpdate()
|
|||||||
tempb=b_root.next;
|
tempb=b_root.next;
|
||||||
while (tempb!=&b_root) {
|
while (tempb!=&b_root) {
|
||||||
if (tempb->type!=BE_TEMPLATE_COPY) {
|
if (tempb->type!=BE_TEMPLATE_COPY) {
|
||||||
tempb->credit_index=StrFileAdd(tempb->credit,
|
tempb->credit_idx=StrFileAdd(tempb->credit,
|
||||||
&accts_table_strs,accts_table);
|
&accts_table_strs,accts_table);
|
||||||
tempb->debit_index =StrFileAdd(tempb->debit,
|
tempb->debit_idx =StrFileAdd(tempb->debit,
|
||||||
&accts_table_strs,accts_table);
|
&accts_table_strs,accts_table);
|
||||||
}
|
}
|
||||||
tempb=tempb->next;
|
tempb=tempb->next;
|
||||||
}
|
}
|
||||||
tempt=t_root.next;
|
tempt=t_root.next;
|
||||||
while (tempt!=&t_root) {
|
while (tempt!=&t_root) {
|
||||||
tempt->b.credit_index=StrFileAdd(tempt->b.credit,
|
tempt->b.credit_idx=StrFileAdd(tempt->b.credit,
|
||||||
&accts_table_strs,accts_table);
|
&accts_table_strs,accts_table);
|
||||||
tempt->b.debit_index =StrFileAdd(tempt->b.debit,
|
tempt->b.debit_idx =StrFileAdd(tempt->b.debit,
|
||||||
&accts_table_strs,accts_table);
|
&accts_table_strs,accts_table);
|
||||||
tempt=tempt->next;
|
tempt=tempt->next;
|
||||||
}
|
}
|
||||||
@@ -54,7 +54,7 @@ I64 BgtAcctColor(U8 *st)
|
|||||||
U8 *BgtPopUpAcct(U8 *header=NULL,U8 *dft=NULL)
|
U8 *BgtPopUpAcct(U8 *header=NULL,U8 *dft=NULL)
|
||||||
{
|
{
|
||||||
I64 i;
|
I64 i;
|
||||||
U8 *result;
|
U8 *res;
|
||||||
CDoc *doc=DocNew;
|
CDoc *doc=DocNew;
|
||||||
CDocEntry *doc_e,*doc_dft=NULL;
|
CDocEntry *doc_e,*doc_dft=NULL;
|
||||||
CHashGeneric *temph;
|
CHashGeneric *temph;
|
||||||
@@ -77,7 +77,7 @@ U8 *BgtPopUpAcct(U8 *header=NULL,U8 *dft=NULL)
|
|||||||
doc->cur_entry=doc_dft;
|
doc->cur_entry=doc_dft;
|
||||||
doc->cur_col=0;
|
doc->cur_col=0;
|
||||||
}
|
}
|
||||||
result=PopUpMenu(doc,DOF_DONT_HOME);
|
res=PopUpMenu(doc,DOF_DONT_HOME);
|
||||||
DocDel(doc);
|
DocDel(doc);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
+12
-12
@@ -19,9 +19,9 @@ U0 BgtDataRead()
|
|||||||
for (i=0;i<cnt;i++) {
|
for (i=0;i<cnt;i++) {
|
||||||
tempb=CAlloc(sizeof(CBgtEntry));
|
tempb=CAlloc(sizeof(CBgtEntry));
|
||||||
MemCpy(&tempb->start,ptr,BE_SIZE);
|
MemCpy(&tempb->start,ptr,BE_SIZE);
|
||||||
tempb->credit=StrNew(s[tempb->credit_index]);
|
tempb->credit=StrNew(s[tempb->credit_idx]);
|
||||||
tempb->debit =StrNew(s[tempb->debit_index]);
|
tempb->debit =StrNew(s[tempb->debit_idx]);
|
||||||
tempb->desc =StrNew(s[tempb->desc_index]);
|
tempb->desc =StrNew(s[tempb->desc_idx]);
|
||||||
QueIns(tempb,b_root.last);
|
QueIns(tempb,b_root.last);
|
||||||
ptr+=BE_SIZE;
|
ptr+=BE_SIZE;
|
||||||
}
|
}
|
||||||
@@ -33,9 +33,9 @@ U0 BgtDataRead()
|
|||||||
ptr+=BT_SIZE;
|
ptr+=BT_SIZE;
|
||||||
MemCpy(&tempt->b.start,ptr,BE_SIZE);
|
MemCpy(&tempt->b.start,ptr,BE_SIZE);
|
||||||
ptr+=BE_SIZE;
|
ptr+=BE_SIZE;
|
||||||
tempt->b.credit=StrNew(s[tempt->b.credit_index]);
|
tempt->b.credit=StrNew(s[tempt->b.credit_idx]);
|
||||||
tempt->b.debit =StrNew(s[tempt->b.debit_index]);
|
tempt->b.debit =StrNew(s[tempt->b.debit_idx]);
|
||||||
tempt->b.desc =StrNew(s[tempt->b.desc_index]);
|
tempt->b.desc =StrNew(s[tempt->b.desc_idx]);
|
||||||
QueIns(tempt,t_root.last);
|
QueIns(tempt,t_root.last);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -67,9 +67,9 @@ U0 BgtDataWrite()
|
|||||||
cnt1=0;
|
cnt1=0;
|
||||||
while (tempb!=&b_root) {
|
while (tempb!=&b_root) {
|
||||||
if (tempb->type!=BE_TEMPLATE_COPY) {
|
if (tempb->type!=BE_TEMPLATE_COPY) {
|
||||||
tempb->credit_index =StrFileAdd(tempb->credit,&num,table);
|
tempb->credit_idx =StrFileAdd(tempb->credit,&num,table);
|
||||||
tempb->debit_index =StrFileAdd(tempb->debit,&num,table);
|
tempb->debit_idx =StrFileAdd(tempb->debit,&num,table);
|
||||||
tempb->desc_index =StrFileAdd(tempb->desc,&num,table);
|
tempb->desc_idx =StrFileAdd(tempb->desc,&num,table);
|
||||||
cnt1++;
|
cnt1++;
|
||||||
}
|
}
|
||||||
tempb=tempb->next;
|
tempb=tempb->next;
|
||||||
@@ -78,9 +78,9 @@ U0 BgtDataWrite()
|
|||||||
tempt=t_root.next;
|
tempt=t_root.next;
|
||||||
cnt2=0;
|
cnt2=0;
|
||||||
while (tempt!=&t_root) {
|
while (tempt!=&t_root) {
|
||||||
tempt->b.credit_index =StrFileAdd(tempt->b.credit,&num,table);
|
tempt->b.credit_idx =StrFileAdd(tempt->b.credit,&num,table);
|
||||||
tempt->b.debit_index =StrFileAdd(tempt->b.debit,&num,table);
|
tempt->b.debit_idx =StrFileAdd(tempt->b.debit,&num,table);
|
||||||
tempt->b.desc_index =StrFileAdd(tempt->b.desc,&num,table);
|
tempt->b.desc_idx =StrFileAdd(tempt->b.desc,&num,table);
|
||||||
cnt2++;
|
cnt2++;
|
||||||
tempt=tempt->next;
|
tempt=tempt->next;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ public U8 **StrFileRead(U8 *name,I64 *_max_num=NULL,
|
|||||||
CDoc *doc=DocRead(name,DOCF_DBL_DOLLARS|DOCF_NO_CURSOR);
|
CDoc *doc=DocRead(name,DOCF_DBL_DOLLARS|DOCF_NO_CURSOR);
|
||||||
CDocEntry *doc_e=doc->root.next;
|
CDocEntry *doc_e=doc->root.next;
|
||||||
I64 i,max_num=0;
|
I64 i,max_num=0;
|
||||||
U8 *ptr,**result,*colors;
|
U8 *ptr,**res,*colors;
|
||||||
|
|
||||||
while (doc_e!=doc) {
|
while (doc_e!=doc) {
|
||||||
if (doc_e->type_u8==DOCT_TEXT) {
|
if (doc_e->type_u8==DOCT_TEXT) {
|
||||||
@@ -25,12 +25,12 @@ public U8 **StrFileRead(U8 *name,I64 *_max_num=NULL,
|
|||||||
doc_e=doc_e->next;
|
doc_e=doc_e->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
result=CAlloc(sizeof(U8 *)*(max_num+1));
|
res=CAlloc(sizeof(U8 *)*(max_num+1));
|
||||||
colors=CAlloc(sizeof(U8)*(max_num+1));
|
colors=CAlloc(sizeof(U8)*(max_num+1));
|
||||||
doc_e=doc->root.next;
|
doc_e=doc->root.next;
|
||||||
while (doc_e!=doc) {
|
while (doc_e!=doc) {
|
||||||
if (doc_e->type_u8==DOCT_TEXT && 0<=doc_e->user_data<=max_num) {
|
if (doc_e->type_u8==DOCT_TEXT && 0<=doc_e->user_data<=max_num) {
|
||||||
result[doc_e->user_data]=doc_e->tag;
|
res[doc_e->user_data]=doc_e->tag;
|
||||||
doc_e->tag=NULL;
|
doc_e->tag=NULL;
|
||||||
colors[doc_e->user_data]=doc_e->type.u8[1]&15;
|
colors[doc_e->user_data]=doc_e->type.u8[1]&15;
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ public U8 **StrFileRead(U8 *name,I64 *_max_num=NULL,
|
|||||||
*_colors=colors;
|
*_colors=colors;
|
||||||
else
|
else
|
||||||
Free(colors);
|
Free(colors);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public U0 StrFileArrDel(U8 **a,I64 max_num)
|
public U0 StrFileArrDel(U8 **a,I64 max_num)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class CBgtEntry
|
|||||||
U0 start;
|
U0 start;
|
||||||
CDate date;
|
CDate date;
|
||||||
U16 type,flags;
|
U16 type,flags;
|
||||||
U32 credit_index,debit_index,desc_index;
|
U32 credit_idx,debit_idx,desc_idx;
|
||||||
F64 amount;
|
F64 amount;
|
||||||
U0 end;
|
U0 end;
|
||||||
|
|
||||||
@@ -60,17 +60,17 @@ I64 accts_table_strs=0;
|
|||||||
CDate MyStr2Date(U8 *st)
|
CDate MyStr2Date(U8 *st)
|
||||||
{
|
{
|
||||||
CDateStruct ds;
|
CDateStruct ds;
|
||||||
CDate result;
|
CDate res;
|
||||||
if (st&&*st) {
|
if (st&&*st) {
|
||||||
if (StrOcc(st,'['))
|
if (StrOcc(st,'['))
|
||||||
result=b_root.next->date;
|
res=b_root.next->date;
|
||||||
else if (StrOcc(st,']'))
|
else if (StrOcc(st,']'))
|
||||||
result=b_root.last->date;
|
res=b_root.last->date;
|
||||||
else
|
else
|
||||||
result=Str2Date(st);
|
res=Str2Date(st);
|
||||||
} else
|
} else
|
||||||
result=Now;
|
res=Now;
|
||||||
Date2Struct(&ds,result);
|
Date2Struct(&ds,res);
|
||||||
if (ds.year>2050)
|
if (ds.year>2050)
|
||||||
ds.year-=100;
|
ds.year-=100;
|
||||||
return Struct2Date(&ds);
|
return Struct2Date(&ds);
|
||||||
|
|||||||
+14
-14
@@ -47,21 +47,21 @@ I64 AddVertex(BallDefineStruct *,I64 x,I64 y,I64 z)
|
|||||||
|
|
||||||
I64 AddTri(BallDefineStruct *,I64 c,I64 n0,I64 n1,I64 n2)
|
I64 AddTri(BallDefineStruct *,I64 c,I64 n0,I64 n1,I64 n2)
|
||||||
{
|
{
|
||||||
I64 result=b->tri_cnt++;
|
I64 res=b->tri_cnt++;
|
||||||
b->t[result].color=c;
|
b->t[res].color=c;
|
||||||
b->t[result].nums[0]=n0;
|
b->t[res].nums[0]=n0;
|
||||||
b->t[result].nums[1]=n1;
|
b->t[res].nums[1]=n1;
|
||||||
b->t[result].nums[2]=n2;
|
b->t[res].nums[2]=n2;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U8 *Ball2CSprite()
|
U8 *Ball2CSprite()
|
||||||
{
|
{
|
||||||
//See $LK,"::/Adam/Gr/GrSpritePlot.CPP",A="FL:::/Adam/Gr/GrSpritePlot.CPP,1"$ for how CSprite are stored.
|
//See $LK,"::/Adam/Gr/GrSpritePlot.CPP",A="FL:::/Adam/Gr/GrSpritePlot.CPP,1"$ for how CSprite are stored.
|
||||||
U8 *result=MAlloc(sizeof(CSpriteMeshU8s)+
|
U8 *res=MAlloc(sizeof(CSpriteMeshU8s)+
|
||||||
b->vertex_cnt*sizeof(CD3I32)+b->tri_cnt*sizeof(CMeshTri)
|
b->vertex_cnt*sizeof(CD3I32)+b->tri_cnt*sizeof(CMeshTri)
|
||||||
+sprite_elem_base_sizes[SPT_END]),
|
+sprite_elem_base_sizes[SPT_END]),
|
||||||
*dst=result;
|
*dst=res;
|
||||||
*dst++ =SPT_MESH;
|
*dst++ =SPT_MESH;
|
||||||
*dst(I32 *)++ =b->vertex_cnt;
|
*dst(I32 *)++ =b->vertex_cnt;
|
||||||
*dst(I32 *)++ =b->tri_cnt;
|
*dst(I32 *)++ =b->tri_cnt;
|
||||||
@@ -70,12 +70,12 @@ U8 *Ball2CSprite()
|
|||||||
MemCpy(dst,&b->t,b->tri_cnt*sizeof(CMeshTri));
|
MemCpy(dst,&b->t,b->tri_cnt*sizeof(CMeshTri));
|
||||||
dst+=b->tri_cnt*sizeof(CMeshTri);
|
dst+=b->tri_cnt*sizeof(CMeshTri);
|
||||||
*dst++ =SPT_END;
|
*dst++ =SPT_END;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public U8 *BallGen()
|
public U8 *BallGen()
|
||||||
{
|
{
|
||||||
U8 *result;
|
U8 *res;
|
||||||
I64 i,j,n,m,c,p1,p2,p3,p4;
|
I64 i,j,n,m,c,p1,p2,p3,p4;
|
||||||
BallDefineStruct bd1,bd2;
|
BallDefineStruct bd1,bd2;
|
||||||
F64 r,r1,r2,z1,z2,d_a1,d_a2;
|
F64 r,r1,r2,z1,z2,d_a1,d_a2;
|
||||||
@@ -112,17 +112,17 @@ public U8 *BallGen()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result=Ball2CSprite;
|
res=Ball2CSprite;
|
||||||
"%h7c",'\n';
|
"%h7c",'\n';
|
||||||
Sprite(result,"\t\t$$SP,\"<1>\",BI=%d$$");
|
Sprite(res,"\t\t$$SP,\"<1>\",BI=%d$$");
|
||||||
"%h7c",'\n';
|
"%h7c",'\n';
|
||||||
"Vertices:%d\n",b->vertex_cnt;
|
"Vertices:%d\n",b->vertex_cnt;
|
||||||
Free(b);
|
Free(b);
|
||||||
"Do another";
|
"Do another";
|
||||||
if (YorN)
|
if (YorN)
|
||||||
Free(result);
|
Free(res);
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
+19
-19
@@ -142,21 +142,21 @@ U0 MDCorrect(ManDefineStruct *md)
|
|||||||
|
|
||||||
I64 AddVertex(ManDefineStruct *md,I64 x,I64 y,I64 z)
|
I64 AddVertex(ManDefineStruct *md,I64 x,I64 y,I64 z)
|
||||||
{
|
{
|
||||||
I64 result=m->vertex_cnt++;
|
I64 res=m->vertex_cnt++;
|
||||||
m->v[result].x=-x;
|
m->v[res].x=-x;
|
||||||
m->v[result].y=-y-md->leg_len-md->foot_rad*2;
|
m->v[res].y=-y-md->leg_len-md->foot_rad*2;
|
||||||
m->v[result].z=-z;
|
m->v[res].z=-z;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
I64 AddTri(ManDefineStruct *,I64 c,I64 n0,I64 n1,I64 n2)
|
I64 AddTri(ManDefineStruct *,I64 c,I64 n0,I64 n1,I64 n2)
|
||||||
{
|
{
|
||||||
I64 result=m->tri_cnt++;
|
I64 res=m->tri_cnt++;
|
||||||
m->t[result].color=c;
|
m->t[res].color=c;
|
||||||
m->t[result].nums[0]=n1;
|
m->t[res].nums[0]=n1;
|
||||||
m->t[result].nums[1]=n0;
|
m->t[res].nums[1]=n0;
|
||||||
m->t[result].nums[2]=n2;
|
m->t[res].nums[2]=n2;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 AddBox(ManDefineStruct *md,I64 c,I64 x1,I64 y1,I64 z1,
|
U0 AddBox(ManDefineStruct *md,I64 c,I64 x1,I64 y1,I64 z1,
|
||||||
@@ -212,10 +212,10 @@ U0 AddBox(ManDefineStruct *md,I64 c,I64 x1,I64 y1,I64 z1,
|
|||||||
U8 *Man2CSprite()
|
U8 *Man2CSprite()
|
||||||
{
|
{
|
||||||
//See $LK,"::/Adam/Gr/GrSpritePlot.CPP",A="FL:::/Adam/Gr/GrSpritePlot.CPP,1"$ for how CSprite are stored.
|
//See $LK,"::/Adam/Gr/GrSpritePlot.CPP",A="FL:::/Adam/Gr/GrSpritePlot.CPP,1"$ for how CSprite are stored.
|
||||||
U8 *result=MAlloc(sizeof(CSpriteMeshU8s)+
|
U8 *res=MAlloc(sizeof(CSpriteMeshU8s)+
|
||||||
m->vertex_cnt*sizeof(CD3I32)+m->tri_cnt*sizeof(CMeshTri)+
|
m->vertex_cnt*sizeof(CD3I32)+m->tri_cnt*sizeof(CMeshTri)+
|
||||||
sprite_elem_base_sizes[SPT_END]),
|
sprite_elem_base_sizes[SPT_END]),
|
||||||
*dst=result;
|
*dst=res;
|
||||||
*dst++ =SPT_MESH;
|
*dst++ =SPT_MESH;
|
||||||
*dst(I32 *)++ =m->vertex_cnt;
|
*dst(I32 *)++ =m->vertex_cnt;
|
||||||
*dst(I32 *)++ =m->tri_cnt;
|
*dst(I32 *)++ =m->tri_cnt;
|
||||||
@@ -224,12 +224,12 @@ U8 *Man2CSprite()
|
|||||||
MemCpy(dst,&m->t,m->tri_cnt*sizeof(CMeshTri));
|
MemCpy(dst,&m->t,m->tri_cnt*sizeof(CMeshTri));
|
||||||
dst+=m->tri_cnt*sizeof(CMeshTri);
|
dst+=m->tri_cnt*sizeof(CMeshTri);
|
||||||
*dst++ =SPT_END;
|
*dst++ =SPT_END;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public U8 *ManGen()
|
public U8 *ManGen()
|
||||||
{
|
{
|
||||||
U8 *result;
|
U8 *res;
|
||||||
I64 x,y,z,c1,c2,c3,c4;
|
I64 x,y,z,c1,c2,c3,c4;
|
||||||
ManDefineStruct md1,md2;
|
ManDefineStruct md1,md2;
|
||||||
MDInit(&md1);
|
MDInit(&md1);
|
||||||
@@ -305,16 +305,16 @@ public U8 *ManGen()
|
|||||||
md2.leg_rad*2,-md2.foot_len,md2.foot_rad*2,md2.leg_rad,0,
|
md2.leg_rad*2,-md2.foot_len,md2.foot_rad*2,md2.leg_rad,0,
|
||||||
md2.l_hip_a2,0,md2.l_ankle_a,&x,&y,&z);
|
md2.l_hip_a2,0,md2.l_ankle_a,&x,&y,&z);
|
||||||
|
|
||||||
result=Man2CSprite;
|
res=Man2CSprite;
|
||||||
"%h7c",'\n';
|
"%h7c",'\n';
|
||||||
Sprite(result,"\t\t$$SP,\"<1>\",BI=%d$$");
|
Sprite(res,"\t\t$$SP,\"<1>\",BI=%d$$");
|
||||||
"%h7c",'\n';
|
"%h7c",'\n';
|
||||||
Free(m);
|
Free(m);
|
||||||
"Do another";
|
"Do another";
|
||||||
if (YorN)
|
if (YorN)
|
||||||
Free(result);
|
Free(res);
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -279,9 +279,9 @@ U0 DrawObj(CDC *dc,Obj *o,F64 tt)
|
|||||||
if (o==ball)
|
if (o==ball)
|
||||||
Sprite3(dc,o->x,(o->y-o->z)/2,GR_Z_ALL-o->y,$IB,"<1>",BI=1$);
|
Sprite3(dc,o->x,(o->y-o->z)/2,GR_Z_ALL-o->y,$IB,"<1>",BI=1$);
|
||||||
else {
|
else {
|
||||||
temps=SpriteInterpolate(imgs[o->last_img].img[o->team],
|
temps=SpriteInterpolate((tt-o->last_t0)/(o->next_t0-o->last_t0),
|
||||||
imgs[o->next_img].img[o->team],
|
imgs[o->last_img].img[o->team],
|
||||||
(tt-o->last_t0)/(o->next_t0-o->last_t0));
|
imgs[o->next_img].img[o->team]);
|
||||||
SpriteY3B(dc,o->x,(o->y-o->z)/2,GR_Z_ALL-o->y,temps,o->ay);
|
SpriteY3B(dc,o->x,(o->y-o->z)/2,GR_Z_ALL-o->y,temps,o->ay);
|
||||||
Free(temps);
|
Free(temps);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ U0 PsmNoteDel(PsmNote *tempo)
|
|||||||
|
|
||||||
PsmNote *PsmNoteCopy(PsmNote *tempo)
|
PsmNote *PsmNoteCopy(PsmNote *tempo)
|
||||||
{
|
{
|
||||||
PsmNote *tempo1=MAllocIdentical(tempo);
|
PsmNote *tempo1=MAllocIdent(tempo);
|
||||||
if (tempo->word)
|
if (tempo->word)
|
||||||
tempo1->word=StrNew(tempo->word);
|
tempo1->word=StrNew(tempo->word);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
|||||||
while (tempm1!=&ode->next_mass) {
|
while (tempm1!=&ode->next_mass) {
|
||||||
tempm2=tempm1->next;
|
tempm2=tempm1->next;
|
||||||
while (tempm2!=&ode->next_mass) {
|
while (tempm2!=&ode->next_mass) {
|
||||||
D3Sub(&tempm2->state->x,&tempm1->state->x,&p);
|
D3Sub(&p,&tempm2->state->x,&tempm1->state->x);
|
||||||
dd=D3NormSqr(&p);
|
dd=D3NormSqr(&p);
|
||||||
if (dd<=Sqr(tempm1->radius+tempm2->radius)) {
|
if (dd<=Sqr(tempm1->radius+tempm2->radius)) {
|
||||||
d=Sqrt(dd)+0.0001;
|
d=Sqrt(dd)+0.0001;
|
||||||
@@ -39,7 +39,7 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
|||||||
p2.x=ip.pos.x-task->pix_left-task->scroll_x;
|
p2.x=ip.pos.x-task->pix_left-task->scroll_x;
|
||||||
p2.y=ip.pos.y-task->pix_top-task->scroll_y;
|
p2.y=ip.pos.y-task->pix_top-task->scroll_y;
|
||||||
p2.z=0;
|
p2.z=0;
|
||||||
D3Sub(&p2,&cursor_mass->state->x,&p);
|
D3Sub(&p,&p2,&cursor_mass->state->x);
|
||||||
d=10.0*D3NormSqr(&p);
|
d=10.0*D3NormSqr(&p);
|
||||||
D3MulEqu(&p,d);
|
D3MulEqu(&p,d);
|
||||||
D3AddEqu(&cursor_mass->DstateDt->DxDt,&p);
|
D3AddEqu(&cursor_mass->DstateDt->DxDt,&p);
|
||||||
|
|||||||
@@ -10,18 +10,18 @@ F64 Cost(CMathODE *ode)
|
|||||||
{
|
{
|
||||||
MyMass *tempm;
|
MyMass *tempm;
|
||||||
MySpring *temps;
|
MySpring *temps;
|
||||||
F64 result=0;
|
F64 res=0;
|
||||||
tempm=ode->next_mass;
|
tempm=ode->next_mass;
|
||||||
while (tempm!=&ode->next_mass) {
|
while (tempm!=&ode->next_mass) {
|
||||||
result+=tempm->cost;
|
res+=tempm->cost;
|
||||||
tempm=tempm->next;
|
tempm=tempm->next;
|
||||||
}
|
}
|
||||||
temps=ode->next_spring;
|
temps=ode->next_spring;
|
||||||
while (temps!=&ode->next_spring) {
|
while (temps!=&ode->next_spring) {
|
||||||
result+=temps->cost;
|
res+=temps->cost;
|
||||||
temps=temps->next;
|
temps=temps->next;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 DrawIt(CTask *task,CDC *dc)
|
U0 DrawIt(CTask *task,CDC *dc)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ U0 SpanDel(CMathODE *ode)
|
|||||||
U8 *SpanSave(CMathODE *ode,I64 *_size=NULL)
|
U8 *SpanSave(CMathODE *ode,I64 *_size=NULL)
|
||||||
{
|
{
|
||||||
I64 cnt;
|
I64 cnt;
|
||||||
U8 *result,*ptr;
|
U8 *res,*ptr;
|
||||||
MyMass *tempm;
|
MyMass *tempm;
|
||||||
MySpring *temps;
|
MySpring *temps;
|
||||||
SpanHeader h;
|
SpanHeader h;
|
||||||
@@ -43,7 +43,7 @@ U8 *SpanSave(CMathODE *ode,I64 *_size=NULL)
|
|||||||
|
|
||||||
cnt=sizeof(SpanHeader)+h.num_masses*M_SIZE+h.num_springs*S_SIZE;
|
cnt=sizeof(SpanHeader)+h.num_masses*M_SIZE+h.num_springs*S_SIZE;
|
||||||
|
|
||||||
ptr=result=MAlloc(cnt);
|
ptr=res=MAlloc(cnt);
|
||||||
MemCpy(ptr,&h,sizeof(SpanHeader));
|
MemCpy(ptr,&h,sizeof(SpanHeader));
|
||||||
ptr+=sizeof(SpanHeader);
|
ptr+=sizeof(SpanHeader);
|
||||||
|
|
||||||
@@ -61,25 +61,25 @@ U8 *SpanSave(CMathODE *ode,I64 *_size=NULL)
|
|||||||
temps=temps->next;
|
temps=temps->next;
|
||||||
}
|
}
|
||||||
if (_size) *_size=cnt;
|
if (_size) *_size=cnt;
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool SpanWrite(CMathODE *ode)
|
Bool SpanWrite(CMathODE *ode)
|
||||||
{
|
{
|
||||||
U8 *name,*buf;
|
U8 *name,*buf;
|
||||||
I64 size;
|
I64 size;
|
||||||
Bool result=FALSE,old_silent=Silent;
|
Bool res=FALSE,old_silent=Silent;
|
||||||
MkDir("::/Home/Span");
|
MkDir("::/Home/Span");
|
||||||
Silent(old_silent);
|
Silent(old_silent);
|
||||||
if (name=PopUpFileName("::/Home/Span/Game.DAT")) {
|
if (name=PopUpFileName("::/Home/Span/Game.DAT")) {
|
||||||
if (buf=SpanSave(ode,&size)) {
|
if (buf=SpanSave(ode,&size)) {
|
||||||
FileWrite(name,buf,size);
|
FileWrite(name,buf,size);
|
||||||
Free(buf);
|
Free(buf);
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
}
|
}
|
||||||
Free(name);
|
Free(name);
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 SpanLoad(CMathODE *ode,U8 *src)
|
U0 SpanLoad(CMathODE *ode,U8 *src)
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
|||||||
while (tempm1!=&ode->next_mass) {
|
while (tempm1!=&ode->next_mass) {
|
||||||
tempm2=tempm1->next;
|
tempm2=tempm1->next;
|
||||||
while (tempm2!=&ode->next_mass) {
|
while (tempm2!=&ode->next_mass) {
|
||||||
D3Sub(&tempm2->state->x,&tempm1->state->x,&p);
|
D3Sub(&p,&tempm2->state->x,&tempm1->state->x);
|
||||||
dd=D3NormSqr(&p);
|
dd=D3NormSqr(&p);
|
||||||
if (dd<=Sqr(2*RADIUS)) {
|
if (dd<=Sqr(2*RADIUS)) {
|
||||||
d=Sqrt(dd)+0.0001;
|
d=Sqrt(dd)+0.0001;
|
||||||
@@ -212,7 +212,7 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
|||||||
while (temps!=&ode->next_spring) {
|
while (temps!=&ode->next_spring) {
|
||||||
if (main_mode_button.state==MMD_PLAY && temps->type==EMD_THRUSTER &&
|
if (main_mode_button.state==MMD_PLAY && temps->type==EMD_THRUSTER &&
|
||||||
Bt(kbd.down_bitmap,action_scan_codes[temps->action_key-'0'])) {
|
Bt(kbd.down_bitmap,action_scan_codes[temps->action_key-'0'])) {
|
||||||
D3Sub(&temps->end2->state->x,&temps->end1->state->x,&p);
|
D3Sub(&p,&temps->end2->state->x,&temps->end1->state->x);
|
||||||
D3Unit(&p);
|
D3Unit(&p);
|
||||||
D3MulEqu(&p,2000);
|
D3MulEqu(&p,2000);
|
||||||
D3AddEqu(&temps->end1->DstateDt->DxDt,&p);
|
D3AddEqu(&temps->end1->DstateDt->DxDt,&p);
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ U0 MPDrawMen(CDC *dc2)
|
|||||||
tt=4*Wrap(tempm->phase+5*ts,0)/(2*ă);
|
tt=4*Wrap(tempm->phase+5*ts,0)/(2*ă);
|
||||||
}
|
}
|
||||||
phase=tt; tt%=1.0;
|
phase=tt; tt%=1.0;
|
||||||
temps=SpriteInterpolate(_temps[phase&3],_temps[(phase+1)&3],tt);
|
temps=SpriteInterpolate(tt,_temps[phase&3],_temps[(phase+1)&3]);
|
||||||
SpriteMat3B(dc,tempm->x,yy,GR_Z_ALL,temps,r);
|
SpriteMat3B(dc,tempm->x,yy,GR_Z_ALL,temps,r);
|
||||||
Free(temps);
|
Free(temps);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,11 +199,11 @@ U0 Toward(I64 *_row,I64 *_col,I64 direction)
|
|||||||
|
|
||||||
I64 FacingChg(I64 f1,I64 f2)
|
I64 FacingChg(I64 f1,I64 f2)
|
||||||
{
|
{
|
||||||
I64 result=(f1+6-f2)%6;
|
I64 res=(f1+6-f2)%6;
|
||||||
if (result>=3)
|
if (res>=3)
|
||||||
return 6-result;
|
return 6-res;
|
||||||
else
|
else
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 RowCol2XY(F64 *_x,F64 *_y,I64 row,I64 col)
|
U0 RowCol2XY(F64 *_x,F64 *_y,I64 row,I64 col)
|
||||||
@@ -335,7 +335,7 @@ U0 RVMerge(I64 player)
|
|||||||
|
|
||||||
Bool MPRecalcVisible(MPCtrl1 *job)
|
Bool MPRecalcVisible(MPCtrl1 *job)
|
||||||
{
|
{
|
||||||
Bool result=FALSE,seen;
|
Bool res=FALSE,seen;
|
||||||
I64 i,j,row,col;
|
I64 i,j,row,col;
|
||||||
F64 x1,y1,x2,y2,dd,range;
|
F64 x1,y1,x2,y2,dd,range;
|
||||||
Unit *ut0,*ut1;
|
Unit *ut0,*ut1;
|
||||||
@@ -376,7 +376,7 @@ Bool MPRecalcVisible(MPCtrl1 *job)
|
|||||||
LOS(row,col,ut1->row,ut1->col)) {
|
LOS(row,col,ut1->row,ut1->col)) {
|
||||||
LBts(&visible_unit_bitmap[enemy_player],
|
LBts(&visible_unit_bitmap[enemy_player],
|
||||||
job->tempu->num+i*((MAX_UNITS+7)&~7));
|
job->tempu->num+i*((MAX_UNITS+7)&~7));
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
} else
|
} else
|
||||||
LBtr(&visible_unit_bitmap[enemy_player],
|
LBtr(&visible_unit_bitmap[enemy_player],
|
||||||
job->tempu->num+i*((MAX_UNITS+7)&~7));
|
job->tempu->num+i*((MAX_UNITS+7)&~7));
|
||||||
@@ -416,13 +416,13 @@ Bool MPRecalcVisible(MPCtrl1 *job)
|
|||||||
LBtr(&visible_unit_bitmap[enemy_player],j+i*((MAX_UNITS+7)&~7));
|
LBtr(&visible_unit_bitmap[enemy_player],j+i*((MAX_UNITS+7)&~7));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool RecalcVisible(I64 mode,Unit *tempu=NULL)
|
Bool RecalcVisible(I64 mode,Unit *tempu=NULL)
|
||||||
{
|
{
|
||||||
I64 i,hi,k,cnt;
|
I64 i,hi,k,cnt;
|
||||||
Bool result;
|
Bool res;
|
||||||
/*The compiler doesn't go out of it's way
|
/*The compiler doesn't go out of it's way
|
||||||
to know if something is const.;-) This
|
to know if something is const.;-) This
|
||||||
just compiles with the val at compile
|
just compiles with the val at compile
|
||||||
@@ -462,15 +462,15 @@ $LK,"MAlloc",A="MN:MAlloc"$() would probably be the better choice.
|
|||||||
job[i].lo=k;
|
job[i].lo=k;
|
||||||
}
|
}
|
||||||
|
|
||||||
result=FALSE;
|
res=FALSE;
|
||||||
for (i=0;i<cnt;i++)
|
for (i=0;i<cnt;i++)
|
||||||
cmd[i]=JobQue(&MPRecalcVisible,&job[i],i,0);
|
cmd[i]=JobQue(&MPRecalcVisible,&job[i],i,0);
|
||||||
for (i=0;i<cnt;i++)
|
for (i=0;i<cnt;i++)
|
||||||
if (JobResultGet(cmd[i]))
|
if (JobResGet(cmd[i]))
|
||||||
result=TRUE;
|
res=TRUE;
|
||||||
if (mode==RV_UPDATE_FRIENDLY_UNIT)
|
if (mode==RV_UPDATE_FRIENDLY_UNIT)
|
||||||
RVMerge(cur_player);
|
RVMerge(cur_player);
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
class MPCtrl2
|
class MPCtrl2
|
||||||
@@ -512,30 +512,30 @@ U0 RecalcVisibleMap(I64 row,I64 col)
|
|||||||
for (i=0;i<cnt;i++)
|
for (i=0;i<cnt;i++)
|
||||||
cmd[i]=JobQue(&MPRecalcVisibleMap,&job[i],i,0);
|
cmd[i]=JobQue(&MPRecalcVisibleMap,&job[i],i,0);
|
||||||
for (i=0;i<cnt;i++)
|
for (i=0;i<cnt;i++)
|
||||||
JobResultGet(cmd[i]);
|
JobResGet(cmd[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
I64 MoveCost(Unit *tempu,I64 r,I64 c,I64 facing)
|
I64 MoveCost(Unit *tempu,I64 r,I64 c,I64 facing)
|
||||||
{
|
{
|
||||||
I64 result;
|
I64 res;
|
||||||
if (tempu->infantry)
|
if (tempu->infantry)
|
||||||
result=0;
|
res=0;
|
||||||
else {
|
else {
|
||||||
result=FacingChg(facing,tempu->facing);
|
res=FacingChg(facing,tempu->facing);
|
||||||
if (result>0) result--;
|
if (res>0) res--;
|
||||||
}
|
}
|
||||||
if (roads[r][c] && roads[tempu->row][tempu->col])
|
if (roads[r][c] && roads[tempu->row][tempu->col])
|
||||||
result+=1;
|
res+=1;
|
||||||
else {
|
else {
|
||||||
if (tempu->infantry)
|
if (tempu->infantry)
|
||||||
result+=2;
|
res+=2;
|
||||||
else {
|
else {
|
||||||
result+=movement_costs[terrain[r][c]];
|
res+=movement_costs[terrain[r][c]];
|
||||||
if (rivers[r][c])
|
if (rivers[r][c])
|
||||||
result=tempu->movement;
|
res=tempu->movement;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
I64 MoveOneHex(I64 *_row,I64 *_col,F64 x,F64 y)
|
I64 MoveOneHex(I64 *_row,I64 *_col,F64 x,F64 y)
|
||||||
@@ -1633,7 +1633,7 @@ U0 TaskEndCB()
|
|||||||
|
|
||||||
I64 DoPhase()
|
I64 DoPhase()
|
||||||
{
|
{
|
||||||
I64 result='ExitGame';
|
I64 res='ExitGame';
|
||||||
NewPhase;
|
NewPhase;
|
||||||
try {
|
try {
|
||||||
if (phase&~1==PHASE_PLOT)
|
if (phase&~1==PHASE_PLOT)
|
||||||
@@ -1643,15 +1643,15 @@ I64 DoPhase()
|
|||||||
else
|
else
|
||||||
Call(fire_routines[cur_player]);
|
Call(fire_routines[cur_player]);
|
||||||
} catch {
|
} catch {
|
||||||
result=Fs->except_ch;
|
res=Fs->except_ch;
|
||||||
Fs->catch_except=TRUE;
|
Fs->catch_except=TRUE;
|
||||||
}
|
}
|
||||||
return result;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 ToTheFront()
|
U0 ToTheFront()
|
||||||
{
|
{
|
||||||
I64 result,ch;
|
I64 res,ch;
|
||||||
map_dc=DCNew(MAP_WIDTH,MAP_HEIGHT);
|
map_dc=DCNew(MAP_WIDTH,MAP_HEIGHT);
|
||||||
|
|
||||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||||
@@ -1697,8 +1697,8 @@ U0 ToTheFront()
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
do {
|
do {
|
||||||
result=DoPhase;
|
res=DoPhase;
|
||||||
if (result=='GameOver') {
|
if (res=='GameOver') {
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
msg_off_timeout=0;
|
msg_off_timeout=0;
|
||||||
StrCpy(msg_buf,"Game Over");
|
StrCpy(msg_buf,"Game Over");
|
||||||
@@ -1709,18 +1709,18 @@ U0 ToTheFront()
|
|||||||
Init;
|
Init;
|
||||||
break;
|
break;
|
||||||
} else if (ch==CH_ESC || ch==CH_SHIFT_ESC) {
|
} else if (ch==CH_ESC || ch==CH_SHIFT_ESC) {
|
||||||
result='ExitGame';
|
res='ExitGame';
|
||||||
break;
|
break;
|
||||||
} else if (ch=='1')
|
} else if (ch=='1')
|
||||||
SetViewPlayer(0);
|
SetViewPlayer(0);
|
||||||
else if (ch=='2')
|
else if (ch=='2')
|
||||||
SetViewPlayer(1);
|
SetViewPlayer(1);
|
||||||
}
|
}
|
||||||
} else if (result=='NewGame') {
|
} else if (res=='NewGame') {
|
||||||
CleanUp;
|
CleanUp;
|
||||||
Init;
|
Init;
|
||||||
}
|
}
|
||||||
} while (result!='ExitGame');
|
} while (res!='ExitGame');
|
||||||
} catch
|
} catch
|
||||||
PutExcept;
|
PutExcept;
|
||||||
ProgressBarsRst;
|
ProgressBarsRst;
|
||||||
|
|||||||
+365
-101
@@ -41,6 +41,7 @@ class MyMass:CMass
|
|||||||
F64 temperature;
|
F64 temperature;
|
||||||
F64 radius;
|
F64 radius;
|
||||||
I64 color;
|
I64 color;
|
||||||
|
Bool no_overlap;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MySpring:CSpring
|
class MySpring:CSpring
|
||||||
@@ -52,9 +53,26 @@ class MySpring:CSpring
|
|||||||
#define SPIN_GAIN 0.25
|
#define SPIN_GAIN 0.25
|
||||||
#define MAX_MASSES 8
|
#define MAX_MASSES 8
|
||||||
#define MAX_SPRINGS 16
|
#define MAX_SPRINGS 16
|
||||||
|
#define MAX_MISSILES 2
|
||||||
#define ST_HUMAN1 0
|
#define ST_HUMAN1 0
|
||||||
#define ST_ENEMY1 1
|
#define ST_ENEMY1 1
|
||||||
#define ST_ENEMY2 2
|
#define ST_ENEMY2 2
|
||||||
|
extern class Ship;
|
||||||
|
|
||||||
|
#define MISSILE_LEN 5
|
||||||
|
class Missile
|
||||||
|
{
|
||||||
|
Missile *next,*last;
|
||||||
|
F64 explosion_radius;
|
||||||
|
F64 fuse_time,die_timeout;
|
||||||
|
MyMass p_front,p_back;
|
||||||
|
MySpring s[5];
|
||||||
|
U8 *img;
|
||||||
|
Ship *owner,*target;
|
||||||
|
Bool active,launched,exploding;
|
||||||
|
U8 label[5];
|
||||||
|
} missile_root;
|
||||||
|
|
||||||
class Ship
|
class Ship
|
||||||
{
|
{
|
||||||
Ship *next,*last;
|
Ship *next,*last;
|
||||||
@@ -66,19 +84,20 @@ class Ship
|
|||||||
F64 die_time,die_timeout;
|
F64 die_time,die_timeout;
|
||||||
I64 spacewalk_side;
|
I64 spacewalk_side;
|
||||||
F64 laser_temperature;
|
F64 laser_temperature;
|
||||||
|
Missile missiles[MAX_MISSILES];
|
||||||
Bool lasering,exploding,laser_overheat;
|
Bool lasering,exploding,laser_overheat;
|
||||||
} *human;
|
} ship_root,*human;
|
||||||
|
|
||||||
F64 human_t_left,human_t_right,human_antispin;
|
F64 human_t_left,human_t_right,human_antispin;
|
||||||
|
|
||||||
class Shot
|
class Shot
|
||||||
{
|
{
|
||||||
Shot *next,*last;
|
Shot *next,*last;
|
||||||
F64 radius;
|
F64 radius,explosion_radius;
|
||||||
F64 fuse_time,die_timeout;
|
F64 fuse_time,die_timeout;
|
||||||
MyMass p;
|
MyMass p;
|
||||||
Bool exploding;
|
Bool exploding;
|
||||||
};
|
} shot_root;
|
||||||
|
|
||||||
#define MAX_THRUST 200.0
|
#define MAX_THRUST 200.0
|
||||||
#define MAX_ANTISPIN 25.0
|
#define MAX_ANTISPIN 25.0
|
||||||
@@ -95,8 +114,6 @@ Bool game_over,show_level_msg;
|
|||||||
#define NUM_STARS 100
|
#define NUM_STARS 100
|
||||||
I64 stars_x[NUM_STARS],stars_y[NUM_STARS];
|
I64 stars_x[NUM_STARS],stars_y[NUM_STARS];
|
||||||
|
|
||||||
Ship ship_root;
|
|
||||||
Shot shot_root;
|
|
||||||
CMathODE *ode=NULL;
|
CMathODE *ode=NULL;
|
||||||
I64 level,score,remaining;
|
I64 level,score,remaining;
|
||||||
|
|
||||||
@@ -114,6 +131,10 @@ $SP,"<5>",BI=5$
|
|||||||
|
|
||||||
$SP,"<6>",BI=6$
|
$SP,"<6>",BI=6$
|
||||||
|
|
||||||
|
$SP,"<7>",BI=7$
|
||||||
|
|
||||||
|
$SP,"<8>",BI=8$
|
||||||
|
|
||||||
$BG$
|
$BG$
|
||||||
//********************************** Ship
|
//********************************** Ship
|
||||||
Bool CheckOverlap()
|
Bool CheckOverlap()
|
||||||
@@ -124,8 +145,8 @@ Bool CheckOverlap()
|
|||||||
while (tempm!=&ode->next_mass) {
|
while (tempm!=&ode->next_mass) {
|
||||||
tempm1=ode->next_mass;
|
tempm1=ode->next_mass;
|
||||||
while (tempm1!=&ode->next_mass) {
|
while (tempm1!=&ode->next_mass) {
|
||||||
if (tempm!=tempm1) {
|
if (tempm!=tempm1 && !tempm->no_overlap && !tempm1->no_overlap) {
|
||||||
D3Sub(&tempm->x,&tempm1->x,&p);
|
D3Sub(&p,&tempm->x,&tempm1->x);
|
||||||
if (D3NormSqr(&p)<=Sqr(tempm->radius+tempm1->radius))
|
if (D3NormSqr(&p)<=Sqr(tempm->radius+tempm1->radius))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -136,6 +157,63 @@ Bool CheckOverlap()
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
U0 MissileNew(Ship *tempsp,I64 n)
|
||||||
|
{
|
||||||
|
I64 i;
|
||||||
|
CD3 p,p1,p2;
|
||||||
|
Missile *tempmi=&tempsp->missiles[n];
|
||||||
|
MemSet(tempmi,0,sizeof(Missile));
|
||||||
|
|
||||||
|
D3Equ(&tempmi->p_front.x,
|
||||||
|
(tempsp->p[n+1].x+tempsp->p[n+3].x)/2,
|
||||||
|
(tempsp->p[n+1].y+tempsp->p[n+3].y)/2,0);
|
||||||
|
D3Copy(&tempmi->p_back.x,&tempmi->p_front.x);
|
||||||
|
|
||||||
|
if (n&1)
|
||||||
|
StrCpy(tempmi->label,"L");
|
||||||
|
else
|
||||||
|
StrCpy(tempmi->label,"R");
|
||||||
|
tempmi->owner=tempsp;
|
||||||
|
tempmi->explosion_radius=5;
|
||||||
|
tempmi->p_front.mass=0.1;
|
||||||
|
tempmi->p_back.mass =0.1;
|
||||||
|
tempmi->p_front.radius=2;
|
||||||
|
tempmi->p_back.radius =2;
|
||||||
|
tempmi->p_front.no_overlap=TRUE;
|
||||||
|
tempmi->p_back.no_overlap =TRUE;
|
||||||
|
D3Sub(&p1,&tempsp->p[0].x,&tempsp->p[1].x);
|
||||||
|
D3Sub(&p2,&tempsp->p[0].x,&tempsp->p[2].x);
|
||||||
|
D3Unit(D3Add(&p,&p1,&p2));
|
||||||
|
D3AddEqu(&tempmi->p_front.x,D3MulEqu(D3Copy(&p1,&p),MISSILE_LEN/2+1));
|
||||||
|
D3SubEqu(&tempmi->p_back.x ,D3MulEqu(D3Copy(&p1,&p),MISSILE_LEN/2-1));
|
||||||
|
D3Copy(&tempmi->p_front.DxDt,&tempsp->p[n].DxDt);
|
||||||
|
D3Copy(&tempmi->p_back.DxDt,&tempsp->p[n].DxDt);
|
||||||
|
QueIns(&tempmi->p_front,ode->last_mass);
|
||||||
|
QueIns(&tempmi->p_back, ode->last_mass);
|
||||||
|
|
||||||
|
tempmi->s[0].end1=&tempmi->p_front;
|
||||||
|
tempmi->s[0].end2=&tempmi->p_back;
|
||||||
|
tempmi->s[1].end1=&tempmi->p_front;
|
||||||
|
tempmi->s[1].end2=&tempsp->p[n+1];
|
||||||
|
tempmi->s[2].end1=&tempmi->p_back;
|
||||||
|
tempmi->s[2].end2=&tempsp->p[n+1];
|
||||||
|
tempmi->s[3].end1=&tempmi->p_front;
|
||||||
|
tempmi->s[3].end2=&tempsp->p[n+3];
|
||||||
|
tempmi->s[4].end1=&tempmi->p_back;
|
||||||
|
tempmi->s[4].end2=&tempsp->p[n+3];
|
||||||
|
|
||||||
|
for (i=0;i<5;i++) {
|
||||||
|
tempmi->s[i].const=10000;
|
||||||
|
tempmi->s[i].strength =20000;
|
||||||
|
tempmi->s[i].color=BLACK;
|
||||||
|
tempmi->s[i].rest_len=D3Dist(&tempmi->s[i].end1->x,&tempmi->s[i].end2->x);
|
||||||
|
QueIns(&tempmi->s[i],ode->last_spring);
|
||||||
|
}
|
||||||
|
tempmi->img=$IB,"<7>",BI=7$;
|
||||||
|
tempmi->active=TRUE;
|
||||||
|
QueIns(tempmi,missile_root.last);
|
||||||
|
}
|
||||||
|
|
||||||
Ship *ShipNew(I64 x,I64 y,I64 type)
|
Ship *ShipNew(I64 x,I64 y,I64 type)
|
||||||
{
|
{
|
||||||
I64 i;
|
I64 i;
|
||||||
@@ -195,6 +273,8 @@ Ship *ShipNew(I64 x,I64 y,I64 type)
|
|||||||
tempsp->s[i].color=LTGRAY;
|
tempsp->s[i].color=LTGRAY;
|
||||||
QueIns(&tempsp->s[i],ode->last_spring);
|
QueIns(&tempsp->s[i],ode->last_spring);
|
||||||
}
|
}
|
||||||
|
MissileNew(tempsp,0);
|
||||||
|
MissileNew(tempsp,1);
|
||||||
remaining=0;
|
remaining=0;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -289,6 +369,19 @@ Ship *ShipNew(I64 x,I64 y,I64 type)
|
|||||||
return tempsp;
|
return tempsp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
U0 MissileDel(Missile *tempmi)
|
||||||
|
{
|
||||||
|
I64 i;
|
||||||
|
if (tempmi->active) {
|
||||||
|
QueRem(tempmi);
|
||||||
|
for(i=0;i<5;i++)
|
||||||
|
QueRem(&tempmi->s[i]);
|
||||||
|
QueRem(&tempmi->p_front);
|
||||||
|
QueRem(&tempmi->p_back);
|
||||||
|
tempmi->active=FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
U0 ShipDel(Ship *tempsp)
|
U0 ShipDel(Ship *tempsp)
|
||||||
{
|
{
|
||||||
I64 i;
|
I64 i;
|
||||||
@@ -297,6 +390,8 @@ U0 ShipDel(Ship *tempsp)
|
|||||||
QueRem(&tempsp->p[i]);
|
QueRem(&tempsp->p[i]);
|
||||||
for (i=0;i<tempsp->springs;i++)
|
for (i=0;i<tempsp->springs;i++)
|
||||||
QueRem(&tempsp->s[i]);
|
QueRem(&tempsp->s[i]);
|
||||||
|
for (i=0;i<2;i++)
|
||||||
|
MissileDel(&tempsp->missiles[i]);
|
||||||
QueRem(tempsp);
|
QueRem(tempsp);
|
||||||
Free(tempsp);
|
Free(tempsp);
|
||||||
remaining--;
|
remaining--;
|
||||||
@@ -323,12 +418,12 @@ I64 Tweaked()
|
|||||||
{
|
{
|
||||||
CD3 p,p1,p2;
|
CD3 p,p1,p2;
|
||||||
if (human) {
|
if (human) {
|
||||||
D3Sub(&human->p[0].x,&human->p[1].x,&p1);
|
D3Sub(&p1,&human->p[0].x,&human->p[1].x);
|
||||||
D3Sub(&human->p[0].x,&human->p[2].x,&p2);
|
D3Sub(&p2,&human->p[0].x,&human->p[2].x);
|
||||||
D3Add(&p1,&p2,&p);
|
D3Add(&p,&p1,&p2);
|
||||||
D3Unit(&p);
|
D3Unit(&p);
|
||||||
D3Sub(&human->p[0].x,&human->p[3].x,&p1);
|
D3Sub(&p1,&human->p[0].x,&human->p[3].x);
|
||||||
D3Sub(&human->p[0].x,&human->p[4].x,&p2);
|
D3Sub(&p2,&human->p[0].x,&human->p[4].x);
|
||||||
D3Unit(&p1);
|
D3Unit(&p1);
|
||||||
D3Unit(&p2);
|
D3Unit(&p2);
|
||||||
if (!(human->s[3].flags&SSF_INACTIVE) && D3Dot(&p,&p1)>Cos(20*ã/180))
|
if (!(human->s[3].flags&SSF_INACTIVE) && D3Dot(&p,&p1)>Cos(20*ã/180))
|
||||||
@@ -373,6 +468,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
|||||||
F64 arg;
|
F64 arg;
|
||||||
Ship *tempsp;
|
Ship *tempsp;
|
||||||
Shot *temps;
|
Shot *temps;
|
||||||
|
Missile *tempmi;
|
||||||
CD3 p,p1,p2;
|
CD3 p,p1,p2;
|
||||||
F64 t_left,t_right,spin,d,x,y;
|
F64 t_left,t_right,spin,d,x,y;
|
||||||
MySpring *tempsps;
|
MySpring *tempsps;
|
||||||
@@ -398,7 +494,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
|||||||
|
|
||||||
tempsps=ode->next_spring;
|
tempsps=ode->next_spring;
|
||||||
while (tempsps!=&ode->next_spring) {
|
while (tempsps!=&ode->next_spring) {
|
||||||
if (!(tempsps->flags&SSF_INACTIVE)) {
|
if (!(tempsps->flags&SSF_INACTIVE) && tempsps->color) {
|
||||||
dc->color=tempsps->color;
|
dc->color=tempsps->color;
|
||||||
GrLine(dc,tempsps->end1->x,tempsps->end1->y,
|
GrLine(dc,tempsps->end1->x,tempsps->end1->y,
|
||||||
tempsps->end2->x,tempsps->end2->y);
|
tempsps->end2->x,tempsps->end2->y);
|
||||||
@@ -406,6 +502,28 @@ U0 DrawIt(CTask *task,CDC *dc)
|
|||||||
tempsps=tempsps->next;
|
tempsps=tempsps->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tempmi=missile_root.next;
|
||||||
|
while (tempmi!=&missile_root) {
|
||||||
|
if (tempmi->active) {
|
||||||
|
if (tempmi->launched && tempmi->exploding) {
|
||||||
|
d=(tS-tempmi->fuse_time)/(tempmi->die_timeout-tempmi->fuse_time);
|
||||||
|
d=7*Sin(ã*d)*tempmi->explosion_radius+1;
|
||||||
|
for (i=1;i<d;i++) {
|
||||||
|
if (i&1)
|
||||||
|
dc->color=YELLOW;
|
||||||
|
else
|
||||||
|
dc->color=LTRED;
|
||||||
|
GrCircle(dc,tempmi->p_front.x,tempmi->p_front.y,i);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
SpriteZ3B(dc,(tempmi->p_front.x+tempmi->p_back.x)/2,
|
||||||
|
(tempmi->p_front.y+tempmi->p_back.y)/2,0,tempmi->img,
|
||||||
|
Arg(tempmi->p_front.x-tempmi->p_back.x,
|
||||||
|
tempmi->p_front.y-tempmi->p_back.y));
|
||||||
|
}
|
||||||
|
tempmi=tempmi->next;
|
||||||
|
}
|
||||||
|
|
||||||
tempsp=ship_root.next;
|
tempsp=ship_root.next;
|
||||||
while (tempsp!=&ship_root) {
|
while (tempsp!=&ship_root) {
|
||||||
if (!tempsp->exploding)
|
if (!tempsp->exploding)
|
||||||
@@ -415,18 +533,18 @@ U0 DrawIt(CTask *task,CDC *dc)
|
|||||||
t_left=0;
|
t_left=0;
|
||||||
t_right=0;
|
t_right=0;
|
||||||
} else {
|
} else {
|
||||||
if (d=D3Norm(D3Sub(&tempsp->p[0].x,&tempsp->p[1].x,&p1))) {
|
if (d=D3Norm(D3Sub(&p1,&tempsp->p[0].x,&tempsp->p[1].x))) {
|
||||||
D3Sub(&tempsp->p[0].DxDt,&tempsp->p[1].DxDt,&p2);
|
D3Sub(&p2,&tempsp->p[0].DxDt,&tempsp->p[1].DxDt);
|
||||||
D3Cross(&p1,&p2,&p);
|
D3Cross(&p,&p1,&p2);
|
||||||
spin=p.z/d;
|
spin=p.z/d;
|
||||||
} else
|
} else
|
||||||
spin=0;
|
spin=0;
|
||||||
t_left =Clamp(human_t_left+SPIN_GAIN*spin*human_antispin,
|
t_left =Clamp(human_t_left+SPIN_GAIN*spin*human_antispin,
|
||||||
0,MAX_THRUST);
|
0,MAX_THRUST);
|
||||||
|
|
||||||
if (d=D3Norm(D3Sub(&tempsp->p[0].x,&tempsp->p[2].x,&p1))) {
|
if (d=D3Norm(D3Sub(&p1,&tempsp->p[0].x,&tempsp->p[2].x))) {
|
||||||
D3Sub(&tempsp->p[0].DxDt,&tempsp->p[2].DxDt,&p2);
|
D3Sub(&p2,&tempsp->p[0].DxDt,&tempsp->p[2].DxDt);
|
||||||
D3Cross(&p1,&p2,&p);
|
D3Cross(&p,&p1,&p2);
|
||||||
spin=p.z/d;
|
spin=p.z/d;
|
||||||
} else
|
} else
|
||||||
spin=0;
|
spin=0;
|
||||||
@@ -434,13 +552,13 @@ U0 DrawIt(CTask *task,CDC *dc)
|
|||||||
0,MAX_THRUST);
|
0,MAX_THRUST);
|
||||||
}
|
}
|
||||||
|
|
||||||
D3Sub(&tempsp->p[1].x,&tempsp->p[0].x,&p1);
|
D3Sub(&p1,&tempsp->p[1].x,&tempsp->p[0].x);
|
||||||
D3Sub(&tempsp->p[2].x,&tempsp->p[0].x,&p2);
|
D3Sub(&p2,&tempsp->p[2].x,&tempsp->p[0].x);
|
||||||
D3Unit(D3Add(&p1,&p2,&p));
|
D3Unit(D3Add(&p,&p1,&p2));
|
||||||
|
|
||||||
if (!(tempsp->s[3].flags&SSF_INACTIVE)) {
|
if (!(tempsp->s[3].flags&SSF_INACTIVE)) {
|
||||||
dc->color=YELLOW;
|
dc->color=YELLOW;
|
||||||
D3AddEqu(D3Mul(t_left/25,&p,&p1),&tempsp->p[3].x);
|
D3AddEqu(D3Mul(&p1,t_left/25,&p),&tempsp->p[3].x);
|
||||||
GrLine(dc,tempsp->p[1].x,tempsp->p[1].y,p1.x,p1.y);
|
GrLine(dc,tempsp->p[1].x,tempsp->p[1].y,p1.x,p1.y);
|
||||||
arg=Arg(p.x,p.y);
|
arg=Arg(p.x,p.y);
|
||||||
SpriteZ3B(dc,tempsp->p[3].x,tempsp->p[3].y,0,$IB,"<thruster>",BI=1$,arg);
|
SpriteZ3B(dc,tempsp->p[3].x,tempsp->p[3].y,0,$IB,"<thruster>",BI=1$,arg);
|
||||||
@@ -448,7 +566,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
|||||||
|
|
||||||
if (!(tempsp->s[5].flags&SSF_INACTIVE)) {
|
if (!(tempsp->s[5].flags&SSF_INACTIVE)) {
|
||||||
dc->color=YELLOW;
|
dc->color=YELLOW;
|
||||||
D3AddEqu(D3Mul(t_right/25,&p,&p2),&tempsp->p[4].x);
|
D3AddEqu(D3Mul(&p2,t_right/25,&p),&tempsp->p[4].x);
|
||||||
GrLine(dc,tempsp->p[2].x,tempsp->p[2].y,p2.x,p2.y);
|
GrLine(dc,tempsp->p[2].x,tempsp->p[2].y,p2.x,p2.y);
|
||||||
arg=Arg(p.x,p.y);
|
arg=Arg(p.x,p.y);
|
||||||
SpriteZ3B(dc,tempsp->p[4].x,tempsp->p[4].y,0,$IB,"<thruster>",BI=1$,arg);
|
SpriteZ3B(dc,tempsp->p[4].x,tempsp->p[4].y,0,$IB,"<thruster>",BI=1$,arg);
|
||||||
@@ -522,9 +640,9 @@ U0 DrawIt(CTask *task,CDC *dc)
|
|||||||
GrCircle(dc,tempsp->p[i].x,tempsp->p[i].y,tempsp->p[i].radius);
|
GrCircle(dc,tempsp->p[i].x,tempsp->p[i].y,tempsp->p[i].radius);
|
||||||
}
|
}
|
||||||
case ST_ENEMY1:
|
case ST_ENEMY1:
|
||||||
D3DivEqu(D3Sub(&tempsp->p[1].x,&tempsp->p[0].x,&p1),2.0);
|
D3DivEqu(D3Sub(&p1,&tempsp->p[1].x,&tempsp->p[0].x),2.0);
|
||||||
D3DivEqu(D3Sub(&tempsp->p[2].x,&tempsp->p[0].x,&p2),2.0);
|
D3DivEqu(D3Sub(&p2,&tempsp->p[2].x,&tempsp->p[0].x),2.0);
|
||||||
D3Unit(D3Add(&p1,&p2,&p));
|
D3Unit(D3Add(&p,&p1,&p2));
|
||||||
if (tS>tempsp->reload_timeout)
|
if (tS>tempsp->reload_timeout)
|
||||||
img=$IB,"<gun_ready>",BI=2$;
|
img=$IB,"<gun_ready>",BI=2$;
|
||||||
else
|
else
|
||||||
@@ -562,9 +680,9 @@ U0 DrawIt(CTask *task,CDC *dc)
|
|||||||
|
|
||||||
temps=shot_root.next;
|
temps=shot_root.next;
|
||||||
while (temps!=&shot_root) {
|
while (temps!=&shot_root) {
|
||||||
if (tS>temps->fuse_time) {
|
if (temps->exploding) {
|
||||||
d=(tS-temps->fuse_time)/(temps->die_timeout-temps->fuse_time);
|
d=(tS-temps->fuse_time)/(temps->die_timeout-temps->fuse_time);
|
||||||
d=7*Sin(ã*d)*temps->radius+1;
|
d=7*Sin(ã*d)*temps->explosion_radius+1;
|
||||||
for (i=1;i<d;i++) {
|
for (i=1;i<d;i++) {
|
||||||
if (i&1)
|
if (i&1)
|
||||||
dc->color=YELLOW;
|
dc->color=YELLOW;
|
||||||
@@ -589,16 +707,26 @@ U0 DrawIt(CTask *task,CDC *dc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (human && draw_laser_line) {
|
if (human && draw_laser_line) {
|
||||||
D3Sub(&human->p[1].x,&human->p[0].x,&p1);
|
D3Sub(&p1,&human->p[1].x,&human->p[0].x);
|
||||||
D3Sub(&human->p[2].x,&human->p[0].x,&p2);
|
D3Sub(&p2,&human->p[2].x,&human->p[0].x);
|
||||||
D3Unit(D3Add(&p1,&p2,&p));
|
D3Unit(D3Add(&p,&p1,&p2));
|
||||||
dc->color=LTBLUE;
|
dc->color=LTBLUE;
|
||||||
Line(dc,human->p[0].x-10*p.x,human->p[0].y-10*p.y,0,
|
Line(dc,human->p[0].x-10*p.x,human->p[0].y-10*p.y,0,
|
||||||
human->p[0].x-800*p.x,human->p[0].y-800*p.y,0,&LaserPlot);
|
human->p[0].x-800*p.x,human->p[0].y-800*p.y,0,&LaserPlot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tempmi=missile_root.next;
|
||||||
|
while (tempmi!=&missile_root) {
|
||||||
|
if (tempsp=tempmi->target) {
|
||||||
|
dc->color=LTRED;
|
||||||
|
GrCircle(dc,tempsp->p[0].x,tempsp->p[0].y,10);
|
||||||
|
GrPrint(dc,tempsp->p[0].x+12,tempsp->p[0].y-4,tempmi->label);
|
||||||
|
}
|
||||||
|
tempmi=tempmi->next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 Explosion(MyMass *tempm1,F64 r)
|
U0 Explosion(MyMass *tempm1,MyMass *tempm2,F64 r)
|
||||||
{
|
{
|
||||||
MyMass *tempm;
|
MyMass *tempm;
|
||||||
CD3 p1;
|
CD3 p1;
|
||||||
@@ -606,8 +734,8 @@ U0 Explosion(MyMass *tempm1,F64 r)
|
|||||||
|
|
||||||
tempm=ode->next_mass;
|
tempm=ode->next_mass;
|
||||||
while (tempm!=&ode->next_mass) {
|
while (tempm!=&ode->next_mass) {
|
||||||
if (tempm!=tempm1) {
|
if (tempm!=tempm1 && tempm!=tempm2) {
|
||||||
D3Sub(&tempm->state->x,&tempm1->state->x,&p1);
|
D3Sub(&p1,&tempm->state->x,&tempm1->state->x);
|
||||||
d=D3NormSqr(&p1)-tempm->radius*tempm->radius;
|
d=D3NormSqr(&p1)-tempm->radius*tempm->radius;
|
||||||
if (d<100.0*100.0) {
|
if (d<100.0*100.0) {
|
||||||
if (d<1)
|
if (d<1)
|
||||||
@@ -624,14 +752,42 @@ U0 Explosion(MyMass *tempm1,F64 r)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ship TargetGet(Missile *tempmi)
|
||||||
|
{
|
||||||
|
Ship *tempsp,*res=NULL;
|
||||||
|
F64 dd,best_dd=MAX_F64;
|
||||||
|
I64 i;
|
||||||
|
CD3 p,p1,p2;
|
||||||
|
D3Unit(D3Sub(&p,&tempmi->p_front.state->x,&tempmi->p_back.state->x));
|
||||||
|
tempsp=ship_root.next;
|
||||||
|
while (tempsp!=&ship_root) {
|
||||||
|
if (!tempsp->exploding && tempsp!=tempmi->owner)
|
||||||
|
for (i=0;i<tempsp->masses;i++) {
|
||||||
|
D3Sub(&p1,&tempsp->p[i].state->x,&tempmi->p_front.state->x);
|
||||||
|
D3Unit(D3Copy(&p2,&p1));
|
||||||
|
D3Cross(&p1,&p,&p2);
|
||||||
|
if (D3Dot(&p,&p2)>0 && D3Norm(&p1)<=ã/16) {
|
||||||
|
dd=D3NormSqr(&p1);
|
||||||
|
if (dd<best_dd) {
|
||||||
|
best_dd=dd;
|
||||||
|
res=tempsp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tempsp=tempsp->next;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
||||||
{
|
{
|
||||||
I64 i;
|
I64 i;
|
||||||
F64 d,dd,dd2,spin,t_left,t_right;
|
F64 d,dd,dd2,spin,t_left,t_right,é_err,é_thrust,DéDt;
|
||||||
CTask *task=ode->win_task;
|
CTask *task=ode->win_task;
|
||||||
CD3 p,p1,p2;
|
CD3 p,p1,p2;
|
||||||
Shot *temps;
|
|
||||||
Ship *tempsp;
|
Ship *tempsp;
|
||||||
|
Shot *temps;
|
||||||
|
Missile *tempmi;
|
||||||
MyMass *tempm,*tempm1;
|
MyMass *tempm,*tempm1;
|
||||||
|
|
||||||
tempm=ode->next_mass;
|
tempm=ode->next_mass;
|
||||||
@@ -650,7 +806,7 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
|||||||
tempm1=ode->next_mass;
|
tempm1=ode->next_mass;
|
||||||
while (tempm1!=&ode->next_mass) {
|
while (tempm1!=&ode->next_mass) {
|
||||||
if (tempm!=tempm1) {
|
if (tempm!=tempm1) {
|
||||||
D3Sub(&tempm->state->x,&tempm1->state->x,&p);
|
D3Sub(&p,&tempm->state->x,&tempm1->state->x);
|
||||||
dd=D3NormSqr(&p);
|
dd=D3NormSqr(&p);
|
||||||
dd2=Sqr(tempm->radius+tempm1->radius);
|
dd2=Sqr(tempm->radius+tempm1->radius);
|
||||||
if (dd<=dd2) {
|
if (dd<=dd2) {
|
||||||
@@ -669,7 +825,7 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
|||||||
while (tempsp!=&ship_root) {
|
while (tempsp!=&ship_root) {
|
||||||
if (tempsp->exploding && tempsp->die_time<=tS<=tempsp->die_timeout)
|
if (tempsp->exploding && tempsp->die_time<=tS<=tempsp->die_timeout)
|
||||||
for (i=0;i<tempsp->masses;i++)
|
for (i=0;i<tempsp->masses;i++)
|
||||||
Explosion(&tempsp->p[i],tempsp->p[i].radius/3.0);
|
Explosion(&tempsp->p[i],NULL,tempsp->p[i].radius/3.0);
|
||||||
switch (tempsp->type) {
|
switch (tempsp->type) {
|
||||||
case ST_HUMAN1:
|
case ST_HUMAN1:
|
||||||
if (!tempsp->exploding) {
|
if (!tempsp->exploding) {
|
||||||
@@ -678,7 +834,7 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
|||||||
t_right=0;
|
t_right=0;
|
||||||
d=1.0-(tempsp->spacewalk_timeout-tS)/SPACEWALK_TIME;
|
d=1.0-(tempsp->spacewalk_timeout-tS)/SPACEWALK_TIME;
|
||||||
if (0.485<d<0.515) {
|
if (0.485<d<0.515) {
|
||||||
D3Unit(D3Sub(&tempsp->p[2].state->x,&tempsp->p[1].state->x,&p));
|
D3Unit(D3Sub(&p,&tempsp->p[2].state->x,&tempsp->p[1].state->x));
|
||||||
if (tempsp->spacewalk_side==3) {
|
if (tempsp->spacewalk_side==3) {
|
||||||
tempsp->p[3].DstateDt->DxDt-=10*MAX_THRUST*p.x;
|
tempsp->p[3].DstateDt->DxDt-=10*MAX_THRUST*p.x;
|
||||||
tempsp->p[3].DstateDt->DyDt-=10*MAX_THRUST*p.y;
|
tempsp->p[3].DstateDt->DyDt-=10*MAX_THRUST*p.y;
|
||||||
@@ -692,35 +848,35 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (d=D3Norm(D3Sub(&tempsp->p[0].state->x,
|
if (d=D3Norm(D3Sub(&p1,&tempsp->p[0].state->x,
|
||||||
&tempsp->p[1].state->x,&p1))) {
|
&tempsp->p[1].state->x))) {
|
||||||
D3Sub(&tempsp->p[0].state->DxDt,&tempsp->p[1].state->DxDt,&p2);
|
D3Sub(&p2,&tempsp->p[0].state->DxDt,&tempsp->p[1].state->DxDt);
|
||||||
D3Cross(&p1,&p2,&p);
|
D3Cross(&p,&p1,&p2);
|
||||||
spin=p.z/d;
|
spin=p.z/d;
|
||||||
} else
|
} else
|
||||||
spin=0;
|
spin=0;
|
||||||
t_left =Clamp(human_t_left+SPIN_GAIN*spin*human_antispin,
|
t_left =Clamp(human_t_left+SPIN_GAIN*spin*human_antispin,
|
||||||
0,MAX_THRUST);
|
0,MAX_THRUST);
|
||||||
|
|
||||||
if (d=D3Norm(D3Sub(&tempsp->p[0].state->x,
|
if (d=D3Norm(D3Sub(&p1,&tempsp->p[0].state->x,
|
||||||
&tempsp->p[2].state->x,&p1))) {
|
&tempsp->p[2].state->x))) {
|
||||||
D3Sub(&tempsp->p[0].state->DxDt,&tempsp->p[2].state->DxDt,&p2);
|
D3Sub(&p2,&tempsp->p[0].state->DxDt,&tempsp->p[2].state->DxDt);
|
||||||
D3Cross(&p1,&p2,&p);
|
D3Cross(&p,&p1,&p2);
|
||||||
spin=p.z/d;
|
spin=p.z/d;
|
||||||
} else
|
} else
|
||||||
spin=0;
|
spin=0;
|
||||||
t_right=Clamp(human_t_right-SPIN_GAIN*spin*human_antispin,
|
t_right=Clamp(human_t_right-SPIN_GAIN*spin*human_antispin,
|
||||||
0,MAX_THRUST);
|
0,MAX_THRUST);
|
||||||
|
|
||||||
D3Sub(&tempsp->p[0].state->x,&tempsp->p[1].state->x,&p1);
|
D3Sub(&p1,&tempsp->p[0].state->x,&tempsp->p[1].state->x);
|
||||||
D3Sub(&tempsp->p[0].state->x,&tempsp->p[2].state->x,&p2);
|
D3Sub(&p2,&tempsp->p[0].state->x,&tempsp->p[2].state->x);
|
||||||
D3Unit(D3Add(&p1,&p2,&p));
|
D3Unit(D3Add(&p,&p1,&p2));
|
||||||
if (!(tempsp->s[3].flags&SSF_INACTIVE)) {
|
if (!(tempsp->s[3].flags&SSF_INACTIVE)) {
|
||||||
D3Mul(t_left,&p,&p1);
|
D3Mul(&p1,t_left,&p);
|
||||||
D3AddEqu(&tempsp->p[3].DstateDt->DxDt,&p1);
|
D3AddEqu(&tempsp->p[3].DstateDt->DxDt,&p1);
|
||||||
}
|
}
|
||||||
if (!(tempsp->s[5].flags&SSF_INACTIVE)) {
|
if (!(tempsp->s[5].flags&SSF_INACTIVE)) {
|
||||||
D3Mul(t_right,&p,&p2);
|
D3Mul(&p2,t_right,&p);
|
||||||
D3AddEqu(&tempsp->p[4].DstateDt->DxDt,&p2);
|
D3AddEqu(&tempsp->p[4].DstateDt->DxDt,&p2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -732,10 +888,44 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
|||||||
|
|
||||||
temps=shot_root.next;
|
temps=shot_root.next;
|
||||||
while (temps!=&shot_root) {
|
while (temps!=&shot_root) {
|
||||||
if (temps->fuse_time<=tS<=temps->die_timeout)
|
if (temps->exploding)
|
||||||
Explosion(&temps->p,temps->radius);
|
Explosion(&temps->p,NULL,temps->explosion_radius);
|
||||||
temps=temps->next;
|
temps=temps->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tempmi=missile_root.next;
|
||||||
|
while (tempmi!=&missile_root) {
|
||||||
|
if (tempmi->active) {
|
||||||
|
if (tempmi->launched) {
|
||||||
|
if (tempmi->exploding)
|
||||||
|
Explosion(&tempmi->p_front,&tempmi->p_back,tempmi->explosion_radius);
|
||||||
|
else {
|
||||||
|
//Guide missile
|
||||||
|
if (tempsp=tempmi->target) {
|
||||||
|
D3Unit(D3Sub(&p,&tempmi->p_front.state->x,
|
||||||
|
&tempmi->p_back.state->x));
|
||||||
|
D3Sub(&p1,&tempsp->p[0].state->x,&tempmi->p_front.state->x);
|
||||||
|
d=D3Norm(&p1);
|
||||||
|
D3Unit(&p1);
|
||||||
|
é_err=D3Dot(&p,&p1);
|
||||||
|
D3Sub(&p1,&tempmi->p_front.state->DxDt,&tempmi->p_back.state->DxDt);
|
||||||
|
D3Cross(&p2,&p,&p1);
|
||||||
|
DéDt=D3Norm(&p2);
|
||||||
|
if (p2.z<0)
|
||||||
|
DéDt=-DéDt;
|
||||||
|
é_thrust=Clamp(200*(é_err+2*DéDt)/(d+200),-ã/8,ã/8);
|
||||||
|
p2.x=p.x*Cos(é_thrust)-p.y*Sin(é_thrust);
|
||||||
|
p2.y=p.y*Cos(é_thrust)+p.x*Sin(é_thrust);
|
||||||
|
p2.z=0;
|
||||||
|
D3AddEqu(&tempmi->p_back.DstateDt->DxDt,D3MulEqu(&p2,MAX_THRUST));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
tempmi->target=TargetGet(tempmi);
|
||||||
|
} else
|
||||||
|
tempmi->target=NULL;
|
||||||
|
tempmi=tempmi->next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 CheckDamage()
|
U0 CheckDamage()
|
||||||
@@ -764,9 +954,9 @@ U0 CheckDamage()
|
|||||||
Snd(0);
|
Snd(0);
|
||||||
} else {
|
} else {
|
||||||
human->laser_temperature+=1.0;
|
human->laser_temperature+=1.0;
|
||||||
D3Sub(&human->p[0].x,&human->p[1].x,&p1);
|
D3Sub(&p1,&human->p[0].x,&human->p[1].x);
|
||||||
D3Sub(&human->p[0].x,&human->p[2].x,&p2);
|
D3Sub(&p2,&human->p[0].x,&human->p[2].x);
|
||||||
D3Unit(D3Add(&p1,&p2,&p));
|
D3Unit(D3Add(&p,&p1,&p2));
|
||||||
p2.x=p.y;
|
p2.x=p.y;
|
||||||
p2.y=-p.x;
|
p2.y=-p.x;
|
||||||
p2.z=0;
|
p2.z=0;
|
||||||
@@ -774,7 +964,7 @@ U0 CheckDamage()
|
|||||||
best_distance=MAX_F64;
|
best_distance=MAX_F64;
|
||||||
tempm=ode->next_mass;
|
tempm=ode->next_mass;
|
||||||
while (tempm!=&ode->next_mass) {
|
while (tempm!=&ode->next_mass) {
|
||||||
D3Sub(&human->p[0].x,&tempm->x,&p1);
|
D3Sub(&p1,&human->p[0].x,&tempm->x);
|
||||||
if (Abs(D3Dot(&p1,&p2))<tempm->radius &&
|
if (Abs(D3Dot(&p1,&p2))<tempm->radius &&
|
||||||
D3Dot(&p1,&p)<0.0) {
|
D3Dot(&p1,&p)<0.0) {
|
||||||
d=D3NormSqr(&p1);
|
d=D3NormSqr(&p1);
|
||||||
@@ -803,8 +993,13 @@ U0 CheckDamage()
|
|||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
for (i=0;i<tempsp->springs;i++) {
|
for (i=0;i<tempsp->springs;i++) {
|
||||||
if (Abs(tempsp->s[i].f)>tempsp->s[i].strength)
|
if (Abs(tempsp->s[i].f)>tempsp->s[i].strength) {
|
||||||
tempsp->s[i].flags|=SSF_INACTIVE;
|
tempsp->s[i].flags|=SSF_INACTIVE;
|
||||||
|
if (i==4)
|
||||||
|
MissileDel(&tempsp->missiles[0]);
|
||||||
|
else if (i==5)
|
||||||
|
MissileDel(&tempsp->missiles[1]);
|
||||||
|
}
|
||||||
if (tempsp->s[i].flags&SSF_INACTIVE) {
|
if (tempsp->s[i].flags&SSF_INACTIVE) {
|
||||||
if (i<3) {
|
if (i<3) {
|
||||||
if (!tempsp->exploding) {
|
if (!tempsp->exploding) {
|
||||||
@@ -856,33 +1051,47 @@ U0 CheckDamage()
|
|||||||
|
|
||||||
//********************************** Shots
|
//********************************** Shots
|
||||||
|
|
||||||
U0 FireOneGun(Ship *tempsp,I64 g,F64 r,F64 fuse_time)
|
U0 FireOneGun(Ship *tempsp,I64 n,F64 r,F64 fuse_time)
|
||||||
{
|
{
|
||||||
CD3 p,p1,p2;
|
CD3 p,p1,p2;
|
||||||
Shot *temps;
|
Shot *temps;
|
||||||
|
|
||||||
temps=CAlloc(sizeof(Shot));
|
temps=CAlloc(sizeof(Shot));
|
||||||
D3Copy(&temps->p.x,&tempsp->p[g].x);
|
D3Copy(&temps->p.x,&tempsp->p[n].x);
|
||||||
temps->radius=r;
|
temps->explosion_radius=temps->radius=r;
|
||||||
temps->fuse_time=tS+1.5*fuse_time;
|
temps->fuse_time=tS+1.5*fuse_time;
|
||||||
temps->die_timeout=temps->fuse_time+0.125;
|
temps->die_timeout=temps->fuse_time+0.125;
|
||||||
temps->p.mass=0.3*r*r*r;
|
temps->p.mass=0.3*r*r*r;
|
||||||
D3Sub(&tempsp->p[0].x,&tempsp->p[1].x,&p1);
|
D3Sub(&p1,&tempsp->p[0].x,&tempsp->p[1].x);
|
||||||
D3Sub(&tempsp->p[0].x,&tempsp->p[2].x,&p2);
|
D3Sub(&p2,&tempsp->p[0].x,&tempsp->p[2].x);
|
||||||
D3Add(&p1,&p2,&p);
|
D3Unit(D3Add(&p,&p1,&p2));
|
||||||
D3AddEqu(&temps->p.x,
|
D3AddEqu(&temps->p.x,D3MulEqu(D3Copy(&p1,&p),r+tempsp->p[0].radius+5));
|
||||||
D3MulEqu(D3Copy(&p1,D3Unit(&p)),r+tempsp->p[0].radius+5));
|
D3AddEqu(D3MulEqu(&p,1000/(r+1)),&tempsp->p[n].DxDt);
|
||||||
D3AddEqu(D3MulEqu(&p,1000/(r+1)),&tempsp->p[g].DxDt);
|
|
||||||
D3Copy(&temps->p.DxDt,&p);
|
D3Copy(&temps->p.DxDt,&p);
|
||||||
D3MulEqu(&p,temps->p.mass/tempsp->p[g].mass/100.0);
|
D3MulEqu(&p,temps->p.mass/tempsp->p[n].mass/100.0);
|
||||||
D3SubEqu(&tempsp->p[g].DxDt,&p);
|
D3SubEqu(&tempsp->p[n].DxDt,&p);
|
||||||
QueIns(&temps->p,ode->last_mass);
|
QueIns(&temps->p,ode->last_mass);
|
||||||
QueIns(temps,shot_root.last);
|
QueIns(temps,shot_root.last);
|
||||||
tempsp->reload_timeout=tS+r/tempsp->fire_rate;
|
tempsp->reload_timeout=tS+r/tempsp->fire_rate;
|
||||||
Noise(100,r*200,r*400);
|
Noise(100,r*200,r*400);
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 HumanFireBegin()
|
U0 FireOneMissile(Ship *tempsp,I64 n)
|
||||||
|
{
|
||||||
|
I64 i;
|
||||||
|
Missile *tempmi=&tempsp->missiles[n];
|
||||||
|
if (!tempmi->launched && tempmi->target) {
|
||||||
|
tempmi->fuse_time=tS+1.0;
|
||||||
|
tempmi->die_timeout=tempmi->fuse_time+0.125;
|
||||||
|
tempmi->img=$IB,"<8>",BI=8$;
|
||||||
|
for (i=1;i<5;i++)
|
||||||
|
tempmi->s[i].flags|=SSF_INACTIVE;
|
||||||
|
tempmi->launched=TRUE;
|
||||||
|
Sweep(250,300,350);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
U0 HumanFireGunBegin()
|
||||||
{
|
{
|
||||||
F64 r=3.0*ctrl_panel.shot_radius/CTRL_PANEL_RANGE+0.5,
|
F64 r=3.0*ctrl_panel.shot_radius/CTRL_PANEL_RANGE+0.5,
|
||||||
fuse_time=ToF64(ctrl_panel.fuse_time+1)/CTRL_PANEL_RANGE;
|
fuse_time=ToF64(ctrl_panel.fuse_time+1)/CTRL_PANEL_RANGE;
|
||||||
@@ -902,41 +1111,72 @@ U0 HumanFireBegin()
|
|||||||
case 1:
|
case 1:
|
||||||
FireOneGun(human,0,r,fuse_time);
|
FireOneGun(human,0,r,fuse_time);
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
human->lasering=TRUE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 HumanFireEnd()
|
U0 HumanFireMissileBegin(I64 n)
|
||||||
{
|
{
|
||||||
if (human && !human->exploding)
|
if (human && !human->exploding &&
|
||||||
switch (level) {
|
!human->spacewalk_side && tS>human->reload_timeout)
|
||||||
case 3:
|
FireOneMissile(human,n);
|
||||||
case 2:
|
}
|
||||||
case 1:
|
|
||||||
break;
|
U0 HumanFireLaserBegin()
|
||||||
default:
|
{
|
||||||
human->lasering=FALSE;
|
if (human && !human->exploding &&
|
||||||
Snd(0);
|
!human->spacewalk_side && tS>human->reload_timeout)
|
||||||
}
|
human->lasering=TRUE;
|
||||||
|
}
|
||||||
|
U0 HumanFireLaserEnd()
|
||||||
|
{
|
||||||
|
if (human && !human->exploding) {
|
||||||
|
human->lasering=FALSE;
|
||||||
|
Snd(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
U0 ExpireShots()
|
U0 ExpireShots()
|
||||||
{
|
{
|
||||||
Shot *temps=shot_root.next,*tempb1;
|
Shot *temps=shot_root.next,*temps1;
|
||||||
while (temps!=&shot_root) {
|
while (temps!=&shot_root) {
|
||||||
tempb1=temps->next;
|
temps1=temps->next;
|
||||||
if (tS>temps->fuse_time && !temps->exploding) {
|
if (!temps->exploding && tS>temps->fuse_time) {
|
||||||
temps->exploding=TRUE;
|
temps->exploding=TRUE;
|
||||||
Noise(50,3000,6000);
|
Noise(50,3000,6000);
|
||||||
}
|
} else if (tS>temps->die_timeout) {
|
||||||
if (tS>temps->die_timeout) {
|
|
||||||
QueRem(temps);
|
QueRem(temps);
|
||||||
QueRem(&temps->p);
|
QueRem(&temps->p);
|
||||||
Free(temps);
|
Free(temps);
|
||||||
}
|
}
|
||||||
temps=tempb1;
|
temps=temps1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
U0 ExpireMissiles()
|
||||||
|
{
|
||||||
|
I64 i;
|
||||||
|
F64 dd,best_dd;
|
||||||
|
Missile *tempmi=missile_root.next,*tempm1;
|
||||||
|
while (tempmi!=&missile_root) {
|
||||||
|
tempm1=tempmi->next;
|
||||||
|
if (tempmi->launched) {
|
||||||
|
best_dd=MAX_F64;
|
||||||
|
if (tempmi->target)
|
||||||
|
for (i=0;i<tempmi->target->masses;i++) {
|
||||||
|
dd=D3DistSqr(&tempmi->p_front.x,&tempmi->target->p[i].x);
|
||||||
|
if (dd<best_dd)
|
||||||
|
best_dd=dd;
|
||||||
|
}
|
||||||
|
if (!tempmi->exploding && (best_dd<30*30 || tS>tempmi->fuse_time)) {
|
||||||
|
tempmi->p_front.mass=10.0; //They go flying, if too light.
|
||||||
|
tempmi->p_back.mass =10.0;
|
||||||
|
tempmi->exploding=TRUE;
|
||||||
|
Noise(50,3000,6000);
|
||||||
|
} else if (tS>tempmi->die_timeout)
|
||||||
|
MissileDel(tempmi);
|
||||||
|
}
|
||||||
|
tempmi=tempm1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -948,10 +1188,10 @@ U0 AI()
|
|||||||
Ship *tempsp=ship_root.next;
|
Ship *tempsp=ship_root.next;
|
||||||
if (human && !human->exploding) {
|
if (human && !human->exploding) {
|
||||||
while (tempsp!=&ship_root) {
|
while (tempsp!=&ship_root) {
|
||||||
D3Sub(&tempsp->p[0].x,&tempsp->p[1].x,&p1);
|
D3Sub(&p1,&tempsp->p[0].x,&tempsp->p[1].x);
|
||||||
D3Sub(&tempsp->p[0].x,&tempsp->p[2].x,&p2);
|
D3Sub(&p2,&tempsp->p[0].x,&tempsp->p[2].x);
|
||||||
D3Add(&p1,&p2,&p);
|
D3Add(&p,&p1,&p2);
|
||||||
D3Sub(&human->p[0].x,&tempsp->p[0].x,&p1);
|
D3Sub(&p1,&human->p[0].x,&tempsp->p[0].x);
|
||||||
if (D3Dot(D3Unit(&p),D3Unit(&p1))>0.995 &&
|
if (D3Dot(D3Unit(&p),D3Unit(&p1))>0.995 &&
|
||||||
tS>tempsp->reload_timeout) {
|
tS>tempsp->reload_timeout) {
|
||||||
FireOneGun(tempsp,0,1.5+.5,.4);
|
FireOneGun(tempsp,0,1.5+.5,.4);
|
||||||
@@ -983,8 +1223,9 @@ U0 Init()
|
|||||||
score=0;
|
score=0;
|
||||||
level=1;
|
level=1;
|
||||||
|
|
||||||
ship_root.next=ship_root.last=&ship_root;
|
QueInit(&ship_root);
|
||||||
shot_root.next=shot_root.last=&shot_root;
|
QueInit(&shot_root);
|
||||||
|
QueInit(&missile_root);
|
||||||
|
|
||||||
for (i=0;i<NUM_STARS;i++) {
|
for (i=0;i<NUM_STARS;i++) {
|
||||||
stars_x[i]=RandU16%GR_WIDTH;
|
stars_x[i]=RandU16%GR_WIDTH;
|
||||||
@@ -1011,13 +1252,19 @@ U0 XCaliber()
|
|||||||
" Abort(,CH_SHIFT_ESC);"
|
" Abort(,CH_SHIFT_ESC);"
|
||||||
" Exit(,CH_ESC);"
|
" Exit(,CH_ESC);"
|
||||||
"}"
|
"}"
|
||||||
"Play {"
|
"Game {"
|
||||||
" Restart(,'\n');"
|
" Restart(,'\n');"
|
||||||
|
" LevelUp(,'+');"
|
||||||
|
" LevelDown(,'-');"
|
||||||
|
"}"
|
||||||
|
"Play {"
|
||||||
" Fire(,CH_SPACE);"
|
" Fire(,CH_SPACE);"
|
||||||
" Thrust(,,SC_CURSOR_UP);"
|
" Thrust(,,SC_CURSOR_UP);"
|
||||||
" StopSpin(,,SC_CURSOR_DOWN);"
|
" StopSpin(,,SC_CURSOR_DOWN);"
|
||||||
" Left(,,SC_CURSOR_LEFT);"
|
" Left(,,SC_CURSOR_LEFT);"
|
||||||
" Right(,,SC_CURSOR_RIGHT);"
|
" Right(,,SC_CURSOR_RIGHT);"
|
||||||
|
" LeftMissile(,'l');"
|
||||||
|
" RightMissile(,'r');"
|
||||||
" Spackwalk(,'w');"
|
" Spackwalk(,'w');"
|
||||||
" LongerFuse(,,SC_CURSOR_RIGHT|SCF_SHIFT);"
|
" LongerFuse(,,SC_CURSOR_RIGHT|SCF_SHIFT);"
|
||||||
" ShorterFuse(,,SC_CURSOR_LEFT|SCF_SHIFT);"
|
" ShorterFuse(,,SC_CURSOR_LEFT|SCF_SHIFT);"
|
||||||
@@ -1079,11 +1326,26 @@ U0 XCaliber()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CH_SPACE:
|
case CH_SPACE:
|
||||||
HumanFireBegin;
|
if (level<4)
|
||||||
|
HumanFireGunBegin;
|
||||||
|
else
|
||||||
|
HumanFireLaserBegin;
|
||||||
|
break;
|
||||||
|
case 'l':
|
||||||
|
HumanFireMissileBegin(1);
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
HumanFireMissileBegin(0);
|
||||||
break;
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
ctrl_panel.spacewalk=TRUE;
|
ctrl_panel.spacewalk=TRUE;
|
||||||
break;
|
break;
|
||||||
|
case '+':
|
||||||
|
level++;
|
||||||
|
break;
|
||||||
|
case '-':
|
||||||
|
level--;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MSG_KEY_UP:
|
case MSG_KEY_UP:
|
||||||
@@ -1110,7 +1372,8 @@ U0 XCaliber()
|
|||||||
ch=0;
|
ch=0;
|
||||||
break;
|
break;
|
||||||
case CH_SPACE:
|
case CH_SPACE:
|
||||||
HumanFireEnd;
|
if (level>=4)
|
||||||
|
HumanFireLaserEnd;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1118,6 +1381,7 @@ U0 XCaliber()
|
|||||||
}
|
}
|
||||||
AI;
|
AI;
|
||||||
ExpireShots;
|
ExpireShots;
|
||||||
|
ExpireMissiles;
|
||||||
CheckDamage;
|
CheckDamage;
|
||||||
WinMgrSync; //msgs are only qued by winmngr
|
WinMgrSync; //msgs are only qued by winmngr
|
||||||
if (show_level_msg) {
|
if (show_level_msg) {
|
||||||
@@ -1196,4 +1460,4 @@ U0 XCaliber()
|
|||||||
| |||||||