TempleOSCDV4.06.ISO
This commit is contained in:
1 parent
6fe38d2d9d
commit
b632ab9a4f
260 files changed
+6246
-5765
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
|
||||
//be stored compressed. If not ".Z"
|
||||
//it will be stored uncompressed.
|
||||
Bool result=TRUE;
|
||||
Bool res=TRUE;
|
||||
CDirContext *dirc;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
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)) {
|
||||
st=FileNameAbs(tempde->name);
|
||||
if (!CopySingle(tempde->full_name,st))
|
||||
result=FALSE;
|
||||
res=FALSE;
|
||||
Free(st);
|
||||
}
|
||||
tempde=tempde->next;
|
||||
@@ -84,7 +84,7 @@ public Bool Copy(U8 *src_files_find_mask,U8 *dst_files_find_mask=".")
|
||||
DirContextDel(dirc);
|
||||
}
|
||||
DirTreeDel(tempde1);
|
||||
return result;
|
||||
return res;
|
||||
} else {
|
||||
DirTreeDel(tempde1);
|
||||
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)
|
||||
{
|
||||
U8 *st;
|
||||
I64 result=1;
|
||||
I64 res=1;
|
||||
while (tempde) {
|
||||
st=MAlloc(StrLen(tempde->full_name)+dst_dir_len+2);
|
||||
MemCpy(st,dst_dir,dst_dir_len);
|
||||
StrCpy(st+dst_dir_len,tempde->full_name+src_dir_len);
|
||||
if (tempde->attr & RS_ATTR_DIR) {
|
||||
MkDir(st);
|
||||
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
|
||||
if (CopySingle(tempde->full_name,st))
|
||||
result++;
|
||||
res++;
|
||||
Free(st);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
public I64 CopyTree(U8 *src_files_find_mask,U8 *dst_files_find_mask,
|
||||
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).
|
||||
CDirContext *dirc;
|
||||
CDirEntry *tempde=NULL;
|
||||
I64 result=0,i1,i2;
|
||||
I64 res=0,i1,i2;
|
||||
U8 *st1,*st2;
|
||||
|
||||
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;
|
||||
i2=StrLen(st2);
|
||||
if (i2==3) i2--;
|
||||
result=CopyTree2(tempde,i1,i2,st2);
|
||||
res=CopyTree2(tempde,i1,i2,st2);
|
||||
DirContextDel(dirc);
|
||||
Free(st2);
|
||||
}
|
||||
DirTreeDel(tempde);
|
||||
Free(st1);
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
I64 DelTreeDirs(CDirEntry *tempde1)
|
||||
{
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
CDirEntry *tempde2;
|
||||
while (tempde1) {
|
||||
tempde2=tempde1->next;
|
||||
if (tempde1->attr & RS_ATTR_DIR) {
|
||||
if (tempde1->sub)
|
||||
result+=DelTreeDirs(tempde1->sub);
|
||||
result+=Del(tempde1->full_name,TRUE,TRUE);
|
||||
res+=DelTreeDirs(tempde1->sub);
|
||||
res+=Del(tempde1->full_name,TRUE,TRUE);
|
||||
}
|
||||
DirEntryDel(tempde1);
|
||||
tempde1=tempde2;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
I64 DelTreeFiles(CDirEntry *tempde1)
|
||||
{
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
CDirEntry *tempde2;
|
||||
while (tempde1) {
|
||||
tempde2=tempde1->next;
|
||||
if (tempde1->attr & RS_ATTR_DIR) {
|
||||
if (tempde1->sub)
|
||||
result+=DelTreeFiles(tempde1->sub);
|
||||
res+=DelTreeFiles(tempde1->sub);
|
||||
} else
|
||||
result+=Del(tempde1->full_name,FALSE,TRUE);
|
||||
res+=Del(tempde1->full_name,FALSE,TRUE);
|
||||
DirEntryDel(tempde1);
|
||||
tempde1=tempde2;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
public I64 DelTree(U8 *files_find_mask,U8 *fu_flags=NULL)
|
||||
{//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"),fu_flags);
|
||||
if (IsDir(files_find_mask)) {
|
||||
result=DelTreeDirs(FilesFind(files_find_mask,fuf_flags));
|
||||
result+=Del(files_find_mask,TRUE,TRUE);
|
||||
result+=Del(files_find_mask,FALSE,TRUE);
|
||||
res=DelTreeDirs(FilesFind(files_find_mask,fuf_flags));
|
||||
res+=Del(files_find_mask,TRUE,TRUE);
|
||||
res+=Del(files_find_mask,FALSE,TRUE);
|
||||
} else
|
||||
result=DelTreeFiles(FilesFind(files_find_mask,fuf_flags));
|
||||
return result;
|
||||
res=DelTreeFiles(FilesFind(files_find_mask,fuf_flags));
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 TouchFile(U8 *filename,U8 *attr,CDate cdt=MIN_I64)
|
||||
|
||||
+21
-21
@@ -1,33 +1,33 @@
|
||||
#help_index "File/Internal"
|
||||
I64 DirTreeSerializeSize(CDirEntry *tempde)
|
||||
{
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
while (tempde) {
|
||||
result+=CDIR_SIZE+1;
|
||||
res+=CDIR_SIZE+1;
|
||||
if (tempde->attr & RS_ATTR_DIR)
|
||||
result+=DirTreeSerializeSize(tempde->sub);
|
||||
res+=DirTreeSerializeSize(tempde->sub);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
return result+1;
|
||||
return res+1;
|
||||
}
|
||||
I64 DirTreeSerializeFill(CDirEntry *tempde,U8 *dst)
|
||||
{
|
||||
I64 result=0,i;
|
||||
I64 res=0,i;
|
||||
while (tempde) {
|
||||
*dst++=1;
|
||||
result++;
|
||||
res++;
|
||||
MemCpy(dst,&tempde->start,CDIR_SIZE);
|
||||
dst+=CDIR_SIZE;
|
||||
result+=CDIR_SIZE;
|
||||
res+=CDIR_SIZE;
|
||||
if (tempde->attr & RS_ATTR_DIR) {
|
||||
i=DirTreeSerializeFill(tempde->sub,dst);
|
||||
dst+=i;
|
||||
result+=i;
|
||||
res+=i;
|
||||
}
|
||||
tempde=tempde->next;
|
||||
}
|
||||
*dst=0;
|
||||
return result+1;
|
||||
return res+1;
|
||||
}
|
||||
public U8 *DirTreeSerialize(CDirEntry *tempde,I64 *_size=NULL)
|
||||
{//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)
|
||||
{
|
||||
U8 buf[BLK_SIZE];
|
||||
I64 result=0,i;
|
||||
I64 res=0,i;
|
||||
CDrv *dv;
|
||||
while (tempde) {
|
||||
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)
|
||||
i+=Size1(tempde->sub,_fuf_flags,round_to);
|
||||
tempde->user_data=i;
|
||||
result+=i;
|
||||
res+=i;
|
||||
tempde=tempde->next;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
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.
|
||||
//Does not include directory size of base directory, but
|
||||
//does include size of sub directories.
|
||||
I64 fuf_flags=0,result=0;
|
||||
I64 fuf_flags=0,res=0;
|
||||
CDirEntry *tempde1=NULL;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
if (tempde1=FilesFind(files_find_mask,fuf_flags&FUG_FILES_FIND)) {
|
||||
fuf_flags&=FUF_EXPAND;
|
||||
result=Size1(tempde1,&fuf_flags,round_to);
|
||||
res=Size1(tempde1,&fuf_flags,round_to);
|
||||
DirTreeDel(tempde1);
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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.
|
||||
U8 *st;
|
||||
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"),fu_flags);
|
||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
||||
while (tempde) {
|
||||
if (!IsDotZ(tempde->full_name)) {
|
||||
st=MStrPrint("%s.Z",tempde->full_name);
|
||||
result+=Move(tempde->full_name,st);
|
||||
res+=Move(tempde->full_name,st);
|
||||
Free(st);
|
||||
}
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirTreeDel(tempde1);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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.
|
||||
U8 *st;
|
||||
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"),fu_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)) {
|
||||
st=StrNew(tempde->full_name);
|
||||
StrLastRem(st,".");
|
||||
result+=Move(tempde->full_name,st);
|
||||
res+=Move(tempde->full_name,st);
|
||||
Free(st);
|
||||
}
|
||||
tempde=tempde->next;
|
||||
}
|
||||
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)
|
||||
{
|
||||
CDrv *dv=Let2Drv(drv_let);
|
||||
I64 result=0,i,l;
|
||||
I64 res=0,i,l;
|
||||
U8 *bitmap;
|
||||
try {
|
||||
l=(dv->size+dv->spc-1)/dv->spc;
|
||||
@@ -398,16 +398,16 @@ I64 RedSeaUnusedDrvSpace(U8 drv_let=0)
|
||||
RBlks(dv,bitmap,dv->fat1,i);
|
||||
for (i=0;i<l;i++)
|
||||
if (!Bt(bitmap,i))
|
||||
result++;
|
||||
res++;
|
||||
Free(bitmap);
|
||||
} catch
|
||||
DrvUnlock(dv);
|
||||
return result*BLK_SIZE*dv->spc;
|
||||
return res*BLK_SIZE*dv->spc;
|
||||
}
|
||||
I64 FAT32UnusedDrvSpace(U8 drv_let=0)
|
||||
{
|
||||
CDrv *dv=Let2Drv(drv_let);
|
||||
I64 result=0,i,l;
|
||||
I64 res=0,i,l;
|
||||
U32 *bitmap;
|
||||
try {
|
||||
l=(dv->size+dv->spc-1)/dv->spc;
|
||||
@@ -416,24 +416,24 @@ I64 FAT32UnusedDrvSpace(U8 drv_let=0)
|
||||
RBlks(dv,bitmap,dv->fat1,i);
|
||||
for (i=0;i<l;i++)
|
||||
if (!bitmap[i])
|
||||
result++;
|
||||
res++;
|
||||
Free(bitmap);
|
||||
} catch
|
||||
DrvUnlock(dv);
|
||||
return result*BLK_SIZE*dv->spc;
|
||||
return res*BLK_SIZE*dv->spc;
|
||||
}
|
||||
public I64 UnusedDrvSpace(U8 drv_let=0)
|
||||
{//Returns unused size in bytes.
|
||||
CDrv *dv=Let2Drv(drv_let),*old_dv=Fs->cur_dv;
|
||||
U8 *old_dir=StrNew(Fs->cur_dir);
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
Drv(drv_let);
|
||||
switch (dv->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
result=RedSeaUnusedDrvSpace(drv_let);
|
||||
res=RedSeaUnusedDrvSpace(drv_let);
|
||||
break;
|
||||
case FSt_FAT32:
|
||||
result=FAT32UnusedDrvSpace(drv_let);
|
||||
res=FAT32UnusedDrvSpace(drv_let);
|
||||
break;
|
||||
default:
|
||||
PrintErr("File System Not Supported\n");
|
||||
@@ -441,5 +441,5 @@ public I64 UnusedDrvSpace(U8 drv_let=0)
|
||||
Drv(Drv2Let(old_dv));
|
||||
Cd(old_dir);
|
||||
Free(old_dir);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
+11
-11
@@ -31,22 +31,22 @@ class CFMUncollapsedLst
|
||||
CFMUncollapsedLst *FMCollectUncollapsedLst(CDoc *doc)
|
||||
{
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
CFMUncollapsedLst *result=NULL,*tempc;
|
||||
CFMUncollapsedLst *res=NULL,*tempc;
|
||||
CDirEntry *tempde;
|
||||
while (doc_e!=doc) {
|
||||
if (doc_e->type_u8==DOCT_TREE) {
|
||||
if (!(doc_e->de_flags&DOCEF_CHECKED_COLLAPSED)) {
|
||||
if (tempde=doc_e->user_data) {
|
||||
tempc=MAlloc(sizeof(CFMUncollapsedLst));
|
||||
tempc->next=result;
|
||||
result=tempc;
|
||||
tempc->next=res;
|
||||
res=tempc;
|
||||
tempc->name=StrNew(tempde->full_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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;
|
||||
I64 sc,ch,a1,a2,msg_code;
|
||||
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;
|
||||
Bool okay;
|
||||
|
||||
@@ -706,13 +706,13 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
|
||||
doc_ce=doc->cur_entry;
|
||||
tempde=doc_ce->user_data;
|
||||
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) {
|
||||
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 &&
|
||||
(tempde=tempde->parent))
|
||||
result=StrNew(tempde->full_name,mem_task);
|
||||
res=StrNew(tempde->full_name,mem_task);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -747,8 +747,8 @@ fm_regular_key:
|
||||
DirTreeDel(root);
|
||||
Cd(old_cur_dir);
|
||||
Free(old_cur_dir);
|
||||
if (mode!=FM_NORMAL && !result)
|
||||
result=StrNew("",mem_task);
|
||||
if (mode!=FM_NORMAL && !res)
|
||||
res=StrNew("",mem_task);
|
||||
MenuPop;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
#help_index "Install;File/Cmd Line (Typically);Cmd Line (Typically);"
|
||||
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"$().
|
||||
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];
|
||||
CATARep *root=NULL,*tempha;
|
||||
Bool one_drv,make_free;
|
||||
@@ -103,9 +103,9 @@ I64 Mount2(U8 boot_drv_let,CDoc *_doc,Bool repartition)
|
||||
DocDel(doc);
|
||||
}
|
||||
}
|
||||
result+=cnt;
|
||||
} while (cnt || !result && _doc); //At least 1 if Called by $LK,"::/Kernel/KCfg.CPP"$
|
||||
return result;
|
||||
res+=cnt;
|
||||
} while (cnt || !res && _doc); //At least 1 if Called by $LK,"::/Kernel/KCfg.CPP"$
|
||||
return res;
|
||||
}
|
||||
|
||||
public I64 Mount(Bool repartition=FALSE)
|
||||
|
||||
+2
-3
@@ -11,13 +11,12 @@ U0 LoadDocDefines()
|
||||
//This is cut and replaced when I generate a distro.
|
||||
//See $LK,"DD_TEMPLEOS_LOC",A="FF:::/Demo/AcctExample/TOSDistro.CPP,DD_TEMPLEOS_LOC"$.
|
||||
$TR-C,"LineRep"$
|
||||
$ID,4$DefinePrint("DD_TEMPLEOS_LOC","119,248");
|
||||
DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","79,899");
|
||||
$ID,4$DefinePrint("DD_TEMPLEOS_LOC","119,714");
|
||||
DefinePrint("DD_TEMPLEOS_LOC_OFFICIAL","79,854");
|
||||
$ID,-4$
|
||||
DefinePrint("DD_KERNEL","%08X",bfh);
|
||||
bfh(I64)+=bfh->file_size-1;
|
||||
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"$
|
||||
|
||||
|
||||
+55
-55
@@ -2,7 +2,7 @@
|
||||
class CWho
|
||||
{
|
||||
CHashGeneric *h;
|
||||
U8 *index;
|
||||
U8 *idx;
|
||||
};
|
||||
|
||||
I64 HashEntriesCompare(CWho *h1,CWho *h2)
|
||||
@@ -28,11 +28,11 @@ I64 HashEntriesCompare2(CWho *h1,CWho *h2)
|
||||
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) {
|
||||
if (!StrNCmp(ptr,index,index_len))
|
||||
if (!StrNCmp(ptr,idx,idx_len))
|
||||
cnt++;
|
||||
while (ch=*ptr++)
|
||||
if (ch==';')
|
||||
@@ -43,10 +43,10 @@ I64 HelpIndexCnt(U8 *ptr,U8 *index)
|
||||
return cnt;
|
||||
}
|
||||
|
||||
U8 *HelpIndexStr(U8 **_ptr,U8 *index)
|
||||
U8 *HelpIndexStr(U8 **_ptr,U8 *idx)
|
||||
{
|
||||
U8 *ptr=*_ptr,*ptr2,*result;
|
||||
I64 ch,index_len=StrLen(index);
|
||||
U8 *ptr=*_ptr,*ptr2,*res;
|
||||
I64 ch,idx_len=StrLen(idx);
|
||||
while (*ptr) {
|
||||
ptr2=ptr;
|
||||
while (ch=*ptr++)
|
||||
@@ -55,13 +55,13 @@ U8 *HelpIndexStr(U8 **_ptr,U8 *index)
|
||||
if (!ch)
|
||||
ptr--;
|
||||
*_ptr=ptr;
|
||||
if (!StrNCmp(ptr2,index,index_len)) {
|
||||
if (!StrNCmp(ptr2,idx,idx_len)) {
|
||||
if (ch==';')
|
||||
ptr--;
|
||||
*ptr=0;
|
||||
result=StrNew(ptr2);
|
||||
res=StrNew(ptr2);
|
||||
*ptr=ch;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
@@ -71,7 +71,7 @@ U8 *HelpComment(CTask *task,CHash *temph,U8 *_src_link)
|
||||
{
|
||||
CDoc *doc;
|
||||
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]==':')
|
||||
*src_link='P';
|
||||
@@ -102,35 +102,35 @@ U8 *HelpComment(CTask *task,CHash *temph,U8 *_src_link)
|
||||
ptr+=6;
|
||||
while (*ptr==CH_SPACE)
|
||||
ptr++;
|
||||
result=StrNew(ptr);
|
||||
res=StrNew(ptr);
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
while (doc_e!=doc && doc_e->type_u8!=DOCT_NEW_LINE) {
|
||||
if (doc_e->type_u8==DOCT_TAB) {
|
||||
ptr=MStrPrint("%s ",result);
|
||||
Free(result);
|
||||
result=ptr;
|
||||
ptr=MStrPrint("%s ",res);
|
||||
Free(res);
|
||||
res=ptr;
|
||||
} else if (doc_e->de_flags&DOCEF_TAG) {
|
||||
ptr=MStrPrint("%s%s",result,doc_e->tag);
|
||||
Free(result);
|
||||
result=ptr;
|
||||
ptr=MStrPrint("%s%s",res,doc_e->tag);
|
||||
Free(res);
|
||||
res=ptr;
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
}
|
||||
XTalkWait(task,"%c",CH_SHIFT_ESC);
|
||||
if (result) {
|
||||
ptr=MStrUtil(result,SUF_REM_TRAILING|SUF_REM_LEADING|SUF_SINGLE_SPACE);
|
||||
Free(result);
|
||||
result=ptr;
|
||||
if (res) {
|
||||
ptr=MStrUtil(res,SUF_REM_TRAILING|SUF_REM_LEADING|SUF_SINGLE_SPACE);
|
||||
Free(res);
|
||||
res=ptr;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
I64 HashEntriesCompare3(CWho *h1,CWho *h2)
|
||||
{
|
||||
I64 i,i1=0,i2=0;
|
||||
i=StrCmp(h1->index,h2->index);
|
||||
i=StrCmp(h1->idx,h2->idx);
|
||||
if (i)
|
||||
return i;
|
||||
else {
|
||||
@@ -147,7 +147,7 @@ I64 HashEntriesCompare3(CWho *h1,CWho *h2)
|
||||
}
|
||||
|
||||
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.
|
||||
// "+p" for only public symbols
|
||||
// "+m" to order by number (normally alphabetical)
|
||||
@@ -157,7 +157,7 @@ U8 *index=NULL,CDoc *doc=NULL)
|
||||
CHashGeneric *ptr;
|
||||
CWho *lst;
|
||||
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;
|
||||
CTask *task;
|
||||
|
||||
@@ -171,7 +171,7 @@ U8 *index=NULL,CDoc *doc=NULL)
|
||||
|
||||
if (!h) h=Fs->hash_table;
|
||||
|
||||
if (index) {
|
||||
if (idx) {
|
||||
task=User;
|
||||
TaskWait(task);
|
||||
LBtr(&task->display_flags,DISPLAYf_SHOW);
|
||||
@@ -186,10 +186,10 @@ U8 *index=NULL,CDoc *doc=NULL)
|
||||
while (temph) {
|
||||
if (!(temph->type & (HTF_IMPORT | HTF_PRIVATE)) &&
|
||||
(temph->type & HTF_PUBLIC || !publics)) {
|
||||
if (!index)
|
||||
if (!idx)
|
||||
cnt++;
|
||||
else if (temph->type&HTG_SRC_SYM && (cur_index=temph->index))
|
||||
cnt+=HelpIndexCnt(cur_index,index);
|
||||
else if (temph->type&HTG_SRC_SYM && (cur_idx=temph->idx))
|
||||
cnt+=HelpIndexCnt(cur_idx,idx);
|
||||
}
|
||||
temph=temph->next;
|
||||
}
|
||||
@@ -210,12 +210,12 @@ U8 *index=NULL,CDoc *doc=NULL)
|
||||
while (temph) {
|
||||
if (!(temph->type & (HTF_IMPORT | HTF_PRIVATE)) &&
|
||||
(temph->type & HTF_PUBLIC || !publics))
|
||||
if (!index)
|
||||
if (!idx)
|
||||
lst[j++].h=temph;
|
||||
else if (temph->type&HTG_SRC_SYM && (cur_index=temph->index) &&
|
||||
(k=HelpIndexCnt(cur_index,index)))
|
||||
else if (temph->type&HTG_SRC_SYM && (cur_idx=temph->idx) &&
|
||||
(k=HelpIndexCnt(cur_idx,idx)))
|
||||
while (k--) {
|
||||
lst[j].index=HelpIndexStr(&cur_index,index);
|
||||
lst[j].idx=HelpIndexStr(&cur_idx,idx);
|
||||
lst[j++].h=temph;
|
||||
}
|
||||
temph=temph->next;
|
||||
@@ -229,30 +229,30 @@ U8 *index=NULL,CDoc *doc=NULL)
|
||||
|
||||
if (map)
|
||||
QSort(lst,cnt,sizeof(CWho),&HashEntriesCompare2);
|
||||
else if (index)
|
||||
else if (idx)
|
||||
QSort(lst,cnt,sizeof(CWho),&HashEntriesCompare3);
|
||||
else
|
||||
QSort(lst,cnt,sizeof(CWho),&HashEntriesCompare);
|
||||
|
||||
if (index) {
|
||||
if (idx) {
|
||||
progress1_max=cnt;
|
||||
progress1=0;
|
||||
}
|
||||
for (i=0;i<cnt;i++) {
|
||||
comment=NULL;
|
||||
ptr=lst[i].h;
|
||||
if (index)
|
||||
if (cur_index=lst[i].index) {
|
||||
if (StrCmp(cur_index,last_index)) {
|
||||
Free(last_index);
|
||||
last_index=StrNew(cur_index);
|
||||
if (idx)
|
||||
if (cur_idx=lst[i].idx) {
|
||||
if (StrCmp(cur_idx,last_idx)) {
|
||||
Free(last_idx);
|
||||
last_idx=StrNew(cur_idx);
|
||||
if (i)
|
||||
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$$");
|
||||
DocType(doc,ptr->str);
|
||||
DocPrint(doc,"$$WW,0$$");
|
||||
@@ -260,12 +260,12 @@ U8 *index=NULL,CDoc *doc=NULL)
|
||||
if (ptr->type&HTG_SRC_SYM && ptr(CHashSrcSym *)->src_link) {
|
||||
DocPrint(doc,"$$LK,\"%-20s\",A=\"%s\"$$",
|
||||
ptr->str,ptr(CHashSrcSym *)->src_link);
|
||||
if (index)
|
||||
if (idx)
|
||||
comment=HelpComment(task,ptr,ptr(CHashSrcSym *)->src_link);
|
||||
} else
|
||||
DocPrint(doc,"%-20s",ptr->str);
|
||||
|
||||
if (!index) {
|
||||
if (!idx) {
|
||||
if (ptr->type & HTT_DEFINE_STR) {
|
||||
st=MStrUtil(ptr(CHashDefineStr *)->data,SUF_SAFE_DOLLAR);
|
||||
j=ptr(CHashDefineStr *)->cnt;
|
||||
@@ -305,12 +305,12 @@ U8 *index=NULL,CDoc *doc=NULL)
|
||||
}
|
||||
DocPrint(doc,"\n");
|
||||
}
|
||||
Free(lst[i].index);
|
||||
if (index)
|
||||
Free(lst[i].idx);
|
||||
if (idx)
|
||||
progress1++;
|
||||
}
|
||||
Free(lst);
|
||||
if (index)
|
||||
if (idx)
|
||||
progress1=progress1_max=0;
|
||||
|
||||
wh_done:
|
||||
@@ -320,7 +320,7 @@ wh_done:
|
||||
else
|
||||
DocRecalc(doc);
|
||||
}
|
||||
Free(last_index);
|
||||
Free(last_idx);
|
||||
Kill(task);
|
||||
}
|
||||
|
||||
@@ -357,15 +357,15 @@ public I64 HashDepthRep(CHashTable *table=NULL)
|
||||
#help_index "Help System"
|
||||
#help_file "::/Doc/HelpSystem"
|
||||
|
||||
public U0 DocHelpIndex(CDoc *doc,U8 *index)
|
||||
{//Put to doc report for given help index.
|
||||
Who("+p",,index,doc);
|
||||
public U0 DocHelpIndex(CDoc *doc,U8 *idx)
|
||||
{//Put to doc report for given help idx.
|
||||
Who("+p",,idx,doc);
|
||||
}
|
||||
|
||||
public U0 PopUpHelpIndex(U8 *index,CTask *parent=NULL)
|
||||
{//PopUp win report for given help index.
|
||||
public U0 PopUpHelpIndex(U8 *idx,CTask *parent=NULL)
|
||||
{//PopUp win report for given help idx.
|
||||
U8 *buf;
|
||||
buf=MStrPrint("DocHelpIndex(DocPut,\"%s\");View;",index);
|
||||
buf=MStrPrint("DocHelpIndex(DocPut,\"%s\");View;",idx);
|
||||
PopUp(buf,parent);
|
||||
Free(buf);
|
||||
}
|
||||
|
||||
+19
-20
@@ -18,12 +18,12 @@ public U0 P2R(F64 *_x=NULL,F64 *_y=NULL,F64 mag,F64 arg)
|
||||
|
||||
public F64 Wrap(F64 é,F64 base=-ã)
|
||||
{//Returns angle in range [base,base+2*ã)
|
||||
F64 result=é%(2*ã);
|
||||
if (result>=base+2*ã)
|
||||
result-=2*ã;
|
||||
else if (result<base)
|
||||
result+=2*ã;
|
||||
return result;
|
||||
F64 res=é%(2*ã);
|
||||
if (res>=base+2*ã)
|
||||
res-=2*ã;
|
||||
else if (res<base)
|
||||
res+=2*ã;
|
||||
return res;
|
||||
}
|
||||
|
||||
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"
|
||||
public Complex *CAdd(Complex *n1,Complex *n2,Complex *sum)
|
||||
{//n1 + n2 -->sum
|
||||
public Complex *CAdd(Complex *sum,Complex *n1,Complex *n2)
|
||||
{//sum=n1+n2
|
||||
sum->x=n1->x+n2->x;
|
||||
sum->y=n1->y+n2->y;
|
||||
return sum;
|
||||
}
|
||||
|
||||
public Complex *CSub(Complex *n1,Complex *n2,Complex *diff)
|
||||
{//n1 - n2 -->diff
|
||||
public Complex *CSub(Complex *diff,Complex *n1,Complex *n2)
|
||||
{//diff=n1-n2
|
||||
diff->x=n1->x-n2->x;
|
||||
diff->y=n1->y-n2->y;
|
||||
return diff;
|
||||
}
|
||||
|
||||
public Complex *CMul(Complex *n1,Complex *n2,Complex *prod)
|
||||
{//n1 * n2 -->prod
|
||||
public Complex *CMul(Complex *prod,Complex *n1,Complex *n2)
|
||||
{//prod=n1*n2
|
||||
prod->x=n1->x*n2->x-n1->y*n2->y;
|
||||
prod->y=n1->x*n2->y+n1->y*n2->x;
|
||||
return prod;
|
||||
}
|
||||
|
||||
public Complex *CDiv(Complex *n1,Complex *n2,Complex *quot)
|
||||
{//n1 / n2 -->quot
|
||||
public Complex *CDiv(Complex *quot,Complex *n1,Complex *n2)
|
||||
{//quot=n1/n2
|
||||
F64 m1,a1,m2,a2;
|
||||
R2P(&m1,&a1,n1->x,n1->y);
|
||||
R2P(&m2,&a2,n2->x,n2->y);
|
||||
@@ -113,22 +113,21 @@ public Complex *CCopy(Complex *dst,Complex *src)
|
||||
}
|
||||
|
||||
public Complex *CEqu(Complex *dst,F64 x,F64 y)
|
||||
{//dst=x,y
|
||||
{//dst=(x,y)
|
||||
dst->x=x;
|
||||
dst->y=y;
|
||||
return dst;
|
||||
}
|
||||
|
||||
public Complex *CPoly(Complex *dst,Complex *x,Complex *zeros,I64 n)
|
||||
{//Eval complex polynomial.
|
||||
public Complex *CPoly(Complex *dst,I64 n,Complex *zeros,Complex *x)
|
||||
{//Eval complex polynomial
|
||||
I64 i;
|
||||
Complex n1,n2;
|
||||
if (n>0) {
|
||||
CSub(x,&zeros[0],dst);
|
||||
CSub(dst,x,&zeros[0]);
|
||||
for (i=1;i<n;i++) {
|
||||
CCopy(&n1,dst);
|
||||
CSub(x,&zeros[i],&n2);
|
||||
CMul(&n1,&n2,dst);
|
||||
CMul(dst,&n1,CSub(&n2,x,&zeros[i]));
|
||||
}
|
||||
} else
|
||||
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(
|
||||
CMathODE *ode,CMass **result_mass,CSpring **result_spring,
|
||||
CMathODE *ode,CMass **res_mass,CSpring **res_spring,
|
||||
F64 x,F64 y,F64 z=0)
|
||||
{//Find spring or mass nearest x,y,z.
|
||||
CMass *tempm,*best_mass=NULL;
|
||||
@@ -219,8 +219,8 @@ public U0 MassOrSpringFind(
|
||||
}
|
||||
temps=temps->next;
|
||||
}
|
||||
if (result_mass) *result_mass =best_mass;
|
||||
if (result_spring) *result_spring=best_spring;
|
||||
if (res_mass) *res_mass =best_mass;
|
||||
if (res_spring) *res_spring=best_spring;
|
||||
}
|
||||
|
||||
public CMass *MassFindNum(CMathODE *ode,I64 num)
|
||||
@@ -263,7 +263,7 @@ U0 ODECalcSprings(CMathODE *ode)
|
||||
} else {
|
||||
e1=temps->end1;
|
||||
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->f=temps->displacement*temps->const;
|
||||
if (temps->f>0 && temps->flags&SSF_NO_TENSION)
|
||||
@@ -297,7 +297,7 @@ U0 ODECalcDrag(CMathODE *ode)
|
||||
if (ode->drag_v3)
|
||||
d+=dd*ode->drag_v3;
|
||||
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;
|
||||
}
|
||||
@@ -501,7 +501,7 @@ F64 ode_alloced_factor=0.75;
|
||||
U0 ODEsUpdate(CTask *task)
|
||||
{/* 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
|
||||
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.
|
||||
|
||||
It is adaptive step-sized, so it slows down when an important
|
||||
|
||||
+11
-11
@@ -1,31 +1,31 @@
|
||||
#help_index "Memory/Task"
|
||||
public I64 TaskMemAlloced(CTask *task=NULL,Bool override_validate=FALSE)
|
||||
{//Count of bytes alloced to a task, used+unused.
|
||||
I64 result;
|
||||
I64 res;
|
||||
if (!task) task=Fs;
|
||||
if (override_validate || TaskValidate(task)) {
|
||||
result=task->code_heap->alloced_u8s;
|
||||
res=task->code_heap->alloced_u8s;
|
||||
if (task->code_heap!=task->data_heap)
|
||||
result+=task->data_heap->alloced_u8s;
|
||||
return result;
|
||||
res+=task->data_heap->alloced_u8s;
|
||||
return res;
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
public I64 TaskMemUsed(CTask *task=NULL,Bool override_validate=FALSE)
|
||||
{//Count of bytes alloced to a task and in use.
|
||||
I64 result;
|
||||
I64 res;
|
||||
if (!task) task=Fs;
|
||||
if (override_validate || TaskValidate(task)) {
|
||||
result=task->code_heap->used_u8s;
|
||||
res=task->code_heap->used_u8s;
|
||||
if (task->data_heap!=task->code_heap)
|
||||
result+=task->data_heap->used_u8s;
|
||||
return result;
|
||||
res+=task->data_heap->used_u8s;
|
||||
return res;
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
#help_index "Memory/Task;Debugging/Heap"
|
||||
#help_index "Memory/Task;Debugging/Heap;Memory/Debugging"
|
||||
public Bool HeapRep(CTask *task)
|
||||
{//Report status of task's heap.
|
||||
I64 i,cnt;
|
||||
@@ -85,7 +85,7 @@ public Bool HeapRep(CTask *task)
|
||||
'\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)
|
||||
{//Check addr if in HeapCtrl.
|
||||
CMemBlk *m;
|
||||
@@ -156,7 +156,7 @@ public Bool HeapCtrlWalk(CHeapCtrl *hc)
|
||||
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)
|
||||
{//Check addr if in task's heaps.
|
||||
if (!task) task=Fs;
|
||||
|
||||
+10
-10
@@ -18,7 +18,7 @@ Bool RegCache()
|
||||
|
||||
public Bool RegSetDftEntry(U8 *path,U8 *val,Bool is_adam_entry=FALSE)
|
||||
{//Add code doc tree branch to registry.
|
||||
Bool result,unlock_doc;
|
||||
Bool res,unlock_doc;
|
||||
RegCache;
|
||||
unlock_doc=DocLock(sys_registry_doc);
|
||||
if (!DocTreeFind(sys_registry_doc,path)) {
|
||||
@@ -32,12 +32,12 @@ public Bool RegSetDftEntry(U8 *path,U8 *val,Bool is_adam_entry=FALSE)
|
||||
}
|
||||
if (DrvIsWritable(':'))
|
||||
DocWrite(sys_registry_doc);
|
||||
result=FALSE;
|
||||
res=FALSE;
|
||||
} else
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
if (unlock_doc)
|
||||
DocUnlock(sys_registry_doc);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public I64 RegExeBranch(U8 *path)
|
||||
@@ -48,12 +48,12 @@ public I64 RegExeBranch(U8 *path)
|
||||
|
||||
public Bool RegWriteBranch(U8 *path,U8 *fmt,...)
|
||||
{//Rewrite doc tree branch in registry.
|
||||
Bool result,unlock_doc;
|
||||
Bool res,unlock_doc;
|
||||
CDocEntry *tree_branch,*start_indent,*end_indent;
|
||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
||||
RegCache;
|
||||
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))
|
||||
DocCut(sys_registry_doc,tree_branch,end_indent);
|
||||
DocTreeMake(sys_registry_doc,path);
|
||||
@@ -63,12 +63,12 @@ public Bool RegWriteBranch(U8 *path,U8 *fmt,...)
|
||||
if (unlock_doc)
|
||||
DocUnlock(sys_registry_doc);
|
||||
Free(buf);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Bool OneTimePopUp(U8 *_flags,I64 flag_num,U8 *msg)
|
||||
{//See $LK,"::/Apps/X-Caliber/X-Caliber.CPP"$.
|
||||
Bool result=FALSE;
|
||||
Bool res=FALSE;
|
||||
CDoc *doc=DocNew;
|
||||
CDocEntry *doc_e;
|
||||
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");
|
||||
if (PopUpMenu(doc)==1 && doc_e->de_flags&DOCEF_CHECKED_COLLAPSED) {
|
||||
LBts(_flags,flag_num);
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
}
|
||||
DocDel(doc);
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 RegOneTimePopUp(I64 flag_num,U8 *msg)
|
||||
|
||||
@@ -56,7 +56,7 @@ $$ --> $$$$
|
||||
I64 ACDNextCmd(U8 **_ptr)
|
||||
{
|
||||
U8 *ptr=*_ptr,*ptr2;
|
||||
I64 ch,result=-1;
|
||||
I64 ch,res=-1;
|
||||
do {
|
||||
do {
|
||||
if (!(ch=*ptr++)) goto ncmd_done;
|
||||
@@ -67,22 +67,22 @@ I64 ACDNextCmd(U8 **_ptr)
|
||||
if (!(ch=*ptr2++)) goto ncmd_done;
|
||||
} while (ch!='>');
|
||||
*--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"
|
||||
"@cref\0@syn\0/ety\0@/fld\0@/cd\0@/blockquote\0@/wordforms\0@/note\0"
|
||||
"@/altname\0@/chform\0@/cref\0@/syn\0");
|
||||
*ptr2++='>';
|
||||
ptr=ptr2;
|
||||
} while (result<0);
|
||||
} while (res<0);
|
||||
|
||||
ncmd_done:
|
||||
*_ptr=ptr;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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;
|
||||
while (TRUE) {
|
||||
while (TRUE) {
|
||||
@@ -111,9 +111,9 @@ U8 *ACDNextEntry(U8 **_ptr)
|
||||
}
|
||||
nentry_done:
|
||||
*out_ptr++=0;
|
||||
result=StrNew(buf);
|
||||
res=StrNew(buf);
|
||||
*_ptr=ptr-1;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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.
|
||||
CFile *f;
|
||||
CHashGeneric *temph;
|
||||
U8 *result=NULL,*buf,*in_ptr,
|
||||
U8 *res=NULL,*buf,*in_ptr,
|
||||
*st2=MStrUtil(st,SUF_TO_UPPER);
|
||||
temph=HashFind(st2,ac.hash_table,HTT_DICT_WORD);
|
||||
Free(st2);
|
||||
@@ -31,7 +31,7 @@ public U8 *ACDDefGet(U8 *st,I64 def_num=1)
|
||||
in_ptr++;
|
||||
}
|
||||
if (*in_ptr++==ACD_DEF_CHAR) {
|
||||
result=StrNew(in_ptr);
|
||||
res=StrNew(in_ptr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -40,14 +40,14 @@ public U8 *ACDDefGet(U8 *st,I64 def_num=1)
|
||||
Free(buf);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public U8 *ACDDefsGet(U8 *st)
|
||||
{//MAlloc str with all dict definitions of word.
|
||||
CFile *f;
|
||||
CHashGeneric *temph;
|
||||
U8 *result=NULL,*buf,*in_ptr,*in_ptr2,
|
||||
U8 *res=NULL,*buf,*in_ptr,*in_ptr2,
|
||||
*st2=MStrUtil(st,SUF_TO_UPPER);
|
||||
temph=HashFind(st2,ac.hash_table,HTT_DICT_WORD);
|
||||
Free(st2);
|
||||
@@ -70,9 +70,9 @@ public U8 *ACDDefsGet(U8 *st)
|
||||
&& in_ptr2<buf+ACD_BLK_SIZE*2) {
|
||||
in_ptr2++;
|
||||
}
|
||||
result=MAlloc(in_ptr2+1-in_ptr);
|
||||
MemCpy(result,in_ptr,in_ptr2-in_ptr);
|
||||
result[in_ptr2-in_ptr]=ACD_END_CHAR;
|
||||
res=MAlloc(in_ptr2+1-in_ptr);
|
||||
MemCpy(res,in_ptr,in_ptr2-in_ptr);
|
||||
res[in_ptr2-in_ptr]=ACD_END_CHAR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,7 @@ public U8 *ACDDefsGet(U8 *st)
|
||||
Free(buf);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
/*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()
|
||||
{//Let user type until <ESC> or <SHIFT-ESC>.
|
||||
Bool result=View;
|
||||
Bool res=View;
|
||||
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,
|
||||
I32 *state_colors,CCtrlButtonState *_s=NULL)
|
||||
{//Create button ctrl. See $LK,"::/Apps/Strut/Strut.CPP"$.
|
||||
CCtrl *result;
|
||||
CCtrl *res;
|
||||
CCtrlButtonState *s;
|
||||
I64 i,j,l;
|
||||
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;
|
||||
}
|
||||
if (height<0) height=BUTTON_BORDER*4+FONT_HEIGHT;
|
||||
result=CAlloc(sizeof(CCtrl));
|
||||
res=CAlloc(sizeof(CCtrl));
|
||||
if (_s) {
|
||||
s=_s;
|
||||
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->state_texts=state_texts;
|
||||
s->state_colors=state_colors;
|
||||
result->win_task=Fs;
|
||||
result->flags=CTRLF_SHOW;
|
||||
result->type=CTRLT_GENERIC;
|
||||
result->state=s;
|
||||
result->draw_it=&DrawCtrlButton;
|
||||
result->left_click=&LeftClickCtrlButton;
|
||||
result->left=x;
|
||||
result->top=y;
|
||||
result->right=result->left+width-1;
|
||||
result->bottom=result->top+height-1;
|
||||
QueIns(result,Fs->last_ctrl);
|
||||
return result;
|
||||
res->win_task=Fs;
|
||||
res->flags=CTRLF_SHOW;
|
||||
res->type=CTRLT_GENERIC;
|
||||
res->state=s;
|
||||
res->draw_it=&DrawCtrlButton;
|
||||
res->left_click=&LeftClickCtrlButton;
|
||||
res->left=x;
|
||||
res->top=y;
|
||||
res->right=res->left+width-1;
|
||||
res->bottom=res->top+height-1;
|
||||
QueIns(res,Fs->last_ctrl);
|
||||
return res;
|
||||
}
|
||||
|
||||
public U0 CtrlButtonDel(CCtrl *c)
|
||||
|
||||
+10
-10
@@ -16,18 +16,18 @@ CTemplateCS *CtrlSliderGet()
|
||||
{
|
||||
CTemplateCSSlider *temps;
|
||||
U8 *st,pmt[STR_LEN];
|
||||
CTemplateCS *result=CAlloc(sizeof(CTemplateCS));
|
||||
CTemplateCS *res=CAlloc(sizeof(CTemplateCS));
|
||||
|
||||
"$$PURPLE$$Ctrl Slider$$FG$$\n\n";
|
||||
|
||||
result->glbl_name=GetStr("Glbl Struct Name (ENTER for No Glbl):");
|
||||
result->range=GetI64 ("Range (%4d):",30);
|
||||
result->spacing=GetI64("Spacing (%4d):",20);
|
||||
result->border=GetI64 ("Border (%4d):",2);
|
||||
res->glbl_name=GetStr("Glbl Struct Name (ENTER for No Glbl):");
|
||||
res->range=GetI64 ("Range (%4d):",30);
|
||||
res->spacing=GetI64("Spacing (%4d):",20);
|
||||
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) {
|
||||
StrPrint(pmt,"Slider #%d Name:",result->num_sliders+1);
|
||||
StrPrint(pmt,"Slider #%d Name:",res->num_sliders+1);
|
||||
st=GetStr(pmt);
|
||||
if (!*st) {
|
||||
Free(st);
|
||||
@@ -35,10 +35,10 @@ CTemplateCS *CtrlSliderGet()
|
||||
}
|
||||
temps=CAlloc(sizeof(CTemplateCSSlider));
|
||||
temps->name=st;
|
||||
QueIns(temps,result->last_slider);
|
||||
temps->num=result->num_sliders++;
|
||||
QueIns(temps,res->last_slider);
|
||||
temps->num=res->num_sliders++;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 TemplateCtrlSlider(CDoc *doc)
|
||||
|
||||
@@ -119,9 +119,9 @@ I64 DocBinPtrRst(CDoc *doc,CDocEntry *doc_e)
|
||||
}
|
||||
} else
|
||||
bin_num=doc->cur_bin_num++;
|
||||
tempb=MAllocIdentical(tempb2,doc->mem_task);
|
||||
tempb=MAllocIdent(tempb2,doc->mem_task);
|
||||
tempb->use_cnt=i;
|
||||
tempb->data=MAllocIdentical(tempb2->data,doc->mem_task);
|
||||
tempb->data=MAllocIdent(tempb2->data,doc->mem_task);
|
||||
tempb->num=bin_num;
|
||||
doc_e->bin_data=tempb;
|
||||
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.
|
||||
Bool unlock=DocLock(doc);
|
||||
CDocEntry *doc_ce=doc->cur_entry;
|
||||
I64 result=-1;
|
||||
I64 res=-1;
|
||||
if (doc_ce->type_u8==DOCT_TEXT &&
|
||||
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)
|
||||
result='\t';
|
||||
res='\t';
|
||||
else if (doc_ce->type_u8==DOCT_NEW_LINE ||
|
||||
doc_ce->type_u8==DOCT_SOFT_NEW_LINE)
|
||||
result='\n';
|
||||
res='\n';
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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 EF_REINDENT 0
|
||||
#define EF_CHK_COMPILE 1
|
||||
#define EF_CMP_CHK 1
|
||||
#define EF_RENUM_ASM 2
|
||||
#define EF_CTRL_SLIDER 3
|
||||
#define EF_CH_SC 4
|
||||
@@ -39,7 +39,7 @@ I64 PopUpEdFmt()
|
||||
{
|
||||
I64 i;
|
||||
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.)\","
|
||||
"LE=EF_REINDENT$$\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"
|
||||
"$$MU,\"CANCEL\",LE=DOCM_CANCEL$$\n\n"
|
||||
"$$GREEN$$<ALT-BACKSPACE>$$FG$$ to undo if not happy\n"
|
||||
"with the results.\n");
|
||||
"with the ress.\n");
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
return i;
|
||||
@@ -243,7 +243,7 @@ U0 EdRIStmt(CRILex *rx,Bool indent)
|
||||
|
||||
CQueVectU8 *EdRICode(CDoc *doc)
|
||||
{
|
||||
CQueVectU8 *result;
|
||||
CQueVectU8 *res;
|
||||
CRILex *rx=CAlloc(sizeof(CRILex));
|
||||
|
||||
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->cc2);
|
||||
result=rx->indent;
|
||||
res=rx->indent;
|
||||
Free(rx);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 EdRemFunLeadingSpace(CDoc *doc)
|
||||
@@ -334,13 +334,13 @@ class CRenum
|
||||
|
||||
I64 EdRAGetU8(CDoc *doc)
|
||||
{
|
||||
I64 result=-1;
|
||||
I64 res=-1;
|
||||
while (doc->cur_entry!=doc &&
|
||||
doc->cur_entry->type&DOCET_SELECTED && result<0) {
|
||||
result=EdCurU8(doc);
|
||||
doc->cur_entry->type&DOCET_SELECTED && res<0) {
|
||||
res=EdCurU8(doc);
|
||||
EdCursorRight(doc);
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 EdRACollect(CDoc *doc,CRenum *root)
|
||||
@@ -434,7 +434,7 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action,Bool beep=TRUE)
|
||||
|
||||
DocCaptureUndo(doc,TRUE);
|
||||
switch (tool_action) {
|
||||
case EF_CHK_COMPILE:
|
||||
case EF_CMP_CHK:
|
||||
okay=FALSE;
|
||||
if (doc->flags&DOCF_PLAIN_TEXT)
|
||||
DocFlagsToggle(doc,DOCF_PLAIN_TEXT);
|
||||
@@ -447,7 +447,7 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action,Bool beep=TRUE)
|
||||
Free(st);
|
||||
WinHorz(Fs->win_left,Fs->win_right, task);
|
||||
WinVert(Fs->win_top, Fs->win_bottom,task);
|
||||
if (JobResultScan(tempc,&r)) {
|
||||
if (JobResScan(tempc,&r)) {
|
||||
st=DirFile(doc->filename.name,,"PRJ.Z");
|
||||
prj_file=FileNameAbs(st,FUF_Z_OR_NOT_Z);
|
||||
Free(st);
|
||||
@@ -462,17 +462,17 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action,Bool beep=TRUE)
|
||||
prj_file);
|
||||
tempc=TaskExe(task,Fs,st,1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
Free(st);
|
||||
if (JobResultScan(tempc,&r))
|
||||
if (JobResScan(tempc,&r))
|
||||
if (!r) {
|
||||
tempc=TaskExe(task,Fs,
|
||||
"Load(\"SysTemp\",LDF_JUST_LOAD);",
|
||||
1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
if (JobResultScan(tempc,&r))
|
||||
if (JobResScan(tempc,&r))
|
||||
okay=TRUE;
|
||||
}
|
||||
tempc=TaskExe(task,Fs,"Del(\"SysTemp.*\");",
|
||||
1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
JobResultScan(tempc,&r);
|
||||
JobResScan(tempc,&r);
|
||||
} else {
|
||||
Free(prj_file);
|
||||
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);
|
||||
tempc=TaskExe(task,Fs,st,1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
Free(st);
|
||||
if (JobResultScan(tempc,&r) && r)
|
||||
if (JobResScan(tempc,&r) && r)
|
||||
okay=TRUE;
|
||||
}
|
||||
Free(prj_file);
|
||||
@@ -642,7 +642,7 @@ U0 EdCodeTools(CDoc *doc)
|
||||
{
|
||||
I64 tool_action=PopUpEdFmt;
|
||||
switch (tool_action) {
|
||||
case EF_CHK_COMPILE:
|
||||
case EF_CMP_CHK:
|
||||
case EF_REINDENT:
|
||||
case EF_RENUM_ASM:
|
||||
EdCodeTools2(doc,tool_action);
|
||||
|
||||
+33
-33
@@ -2,30 +2,30 @@
|
||||
public CDoc *DocPut(CTask *task=NULL)
|
||||
{//Current document that StdOut Put() goes to.
|
||||
//Basically, StdOut unless double buffering.
|
||||
CDoc *result;
|
||||
CDoc *res;
|
||||
if (!task) task=Fs;
|
||||
if ((result=task->put_doc) && result->doc_signature==DOC_SIGNATURE_VAL)
|
||||
return result;
|
||||
if ((res=task->put_doc) && res->doc_signature==DOC_SIGNATURE_VAL)
|
||||
return res;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
public CDoc *DocDisplay(CTask *task=NULL)
|
||||
{//StdOut displayed unless double buffering.
|
||||
CDoc *result;
|
||||
CDoc *res;
|
||||
if (!task) task=Fs;
|
||||
if ((result=task->display_doc) && result->doc_signature==DOC_SIGNATURE_VAL)
|
||||
return result;
|
||||
if ((res=task->display_doc) && res->doc_signature==DOC_SIGNATURE_VAL)
|
||||
return res;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
public CDoc *DocBorder(CTask *task=NULL)
|
||||
{//Doc holding border of window text.
|
||||
CDoc *result;
|
||||
CDoc *res;
|
||||
if (!task) task=Fs;
|
||||
if ((result=task->border_doc) && result->doc_signature==DOC_SIGNATURE_VAL)
|
||||
return result;
|
||||
if ((res=task->border_doc) && res->doc_signature==DOC_SIGNATURE_VAL)
|
||||
return res;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
@@ -33,36 +33,36 @@ public CDoc *DocBorder(CTask *task=NULL)
|
||||
public CDoc *DocDblBufStart(CTask *task=NULL)
|
||||
{//See $LK,"::/Demo/Spy.CPP"$
|
||||
Bool unlock_ddoc;
|
||||
CDoc *pdoc=DocPut(task),*ddoc=DocDisplay(task),*result;
|
||||
CDoc *pdoc=DocPut(task),*ddoc=DocDisplay(task),*res;
|
||||
if (!pdoc || !ddoc || pdoc!=ddoc)
|
||||
result=NULL; //Already Double buffering
|
||||
res=NULL; //Already Double buffering
|
||||
else {
|
||||
if (!task) task=Fs;
|
||||
unlock_ddoc=DocLock(ddoc); //dont change during winupdate, so lock DocPut$WW,0$
|
||||
result=DocNew(,task);
|
||||
result->win_task =ddoc->win_task;
|
||||
result->max_entries =ddoc->max_entries;
|
||||
MemCpy(result->find_replace,ddoc->find_replace,sizeof(CEdFindText));
|
||||
MemCpy(&result->filename,&ddoc->filename,sizeof(CEdFileName));
|
||||
result->left_click_link =ddoc->left_click_link;
|
||||
result->right_click_link =ddoc->right_click_link;
|
||||
result->user_put_data =ddoc->user_put_data;
|
||||
result->user_put_key =ddoc->user_put_key;
|
||||
result->user_put_s =ddoc->user_put_s;
|
||||
result->parent_doc =ddoc->parent_doc;
|
||||
result->desc =ddoc->desc;
|
||||
result->user_data =ddoc->user_data;
|
||||
result->flags|=ddoc->flags&DOCG_DBL_BUF_FLAGS | DOCF_DONT_SHOW;
|
||||
task->put_doc=result;
|
||||
res=DocNew(,task);
|
||||
res->win_task =ddoc->win_task;
|
||||
res->max_entries =ddoc->max_entries;
|
||||
MemCpy(res->find_replace,ddoc->find_replace,sizeof(CEdFindText));
|
||||
MemCpy(&res->filename,&ddoc->filename,sizeof(CEdFileName));
|
||||
res->left_click_link =ddoc->left_click_link;
|
||||
res->right_click_link =ddoc->right_click_link;
|
||||
res->user_put_data =ddoc->user_put_data;
|
||||
res->user_put_key =ddoc->user_put_key;
|
||||
res->user_put_s =ddoc->user_put_s;
|
||||
res->parent_doc =ddoc->parent_doc;
|
||||
res->desc =ddoc->desc;
|
||||
res->user_data =ddoc->user_data;
|
||||
res->flags|=ddoc->flags&DOCG_DBL_BUF_FLAGS | DOCF_DONT_SHOW;
|
||||
task->put_doc=res;
|
||||
if (unlock_ddoc)
|
||||
DocUnlock(ddoc);
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Bool DocDblBufEnd(CTask *task=NULL)
|
||||
{//See $LK,"::/Demo/Spy.CPP"$
|
||||
Bool result=FALSE;
|
||||
Bool res=FALSE;
|
||||
CDoc *pdoc=DocPut(task),*ddoc=DocDisplay(task);
|
||||
if (pdoc && ddoc && pdoc!=ddoc) {//Double buffering?
|
||||
if (!task) task=Fs;
|
||||
@@ -72,14 +72,14 @@ public Bool DocDblBufEnd(CTask *task=NULL)
|
||||
task->display_doc=pdoc;
|
||||
DocUnlock(ddoc);
|
||||
DocDel(ddoc);
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Bool DocDblBufSwap(CTask *task=NULL)
|
||||
{//See $LK,"::/Demo/Spy.CPP"$
|
||||
Bool result=FALSE;
|
||||
Bool res=FALSE;
|
||||
CDoc *pdoc=DocPut(task),*ddoc=DocDisplay(task);
|
||||
if (pdoc && ddoc && pdoc!=ddoc) {//Double buffering?
|
||||
if (!task) task=Fs;
|
||||
@@ -102,7 +102,7 @@ public Bool DocDblBufSwap(CTask *task=NULL)
|
||||
ddoc->desc =pdoc->desc;
|
||||
ddoc->user_data =pdoc->user_data;
|
||||
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_left=Fs->win_left,old_right =Fs->win_right,
|
||||
old_title_src=Fs->title_src;
|
||||
Bool result,unlock;
|
||||
Bool res,unlock;
|
||||
U8 *old_task_title;
|
||||
if (dof_flags&DOF_WIN_MAX)
|
||||
WinMax;
|
||||
@@ -155,10 +155,10 @@ public Bool DocEd(CDoc *doc,I64 dof_flags=0)
|
||||
if (doc->flags&DOCF_MIN_SIZE)
|
||||
WinMgrSync(2,TRUE);
|
||||
}
|
||||
result=View;
|
||||
res=View;
|
||||
|
||||
DocLock(doc);
|
||||
if (result) {
|
||||
if (res) {
|
||||
doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
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);
|
||||
WinVert(old_top,old_bottom);
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#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.
|
||||
U8 *filename,*needle_str;
|
||||
I64 i,num;
|
||||
Bool cont,result=FALSE;
|
||||
Bool cont,res=FALSE;
|
||||
CDoc *doc;
|
||||
|
||||
switch (i=EdLinkCvt(link_st,&filename,&needle_str,&num,edf_dof_flags)) {
|
||||
@@ -211,11 +211,11 @@ ej_doc:
|
||||
DocDel(doc);
|
||||
}
|
||||
if (!(edf_dof_flags&EDF_WAS_WRITE))
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
break;
|
||||
default:
|
||||
if (IsRaw)
|
||||
result=EdLite(filename,num,edf_dof_flags);
|
||||
res=EdLite(filename,num,edf_dof_flags);
|
||||
else {
|
||||
cont=TRUE;
|
||||
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"))
|
||||
cont=FALSE;
|
||||
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(needle_str);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Bool Plain(U8 *filename,I64 edf_dof_flags=0)
|
||||
{//Edit document in plain text mode, so dollar signs are not special.
|
||||
Bool result;
|
||||
Bool res;
|
||||
U8 *st=MStrPrint("PI:%s",filename);
|
||||
result=Ed(st,edf_dof_flags);
|
||||
res=Ed(st,edf_dof_flags);
|
||||
Free(st);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#help_index "DolDoc;Task/Srv/Exe"
|
||||
public I64 PopUpEd(U8 *filename,CTask *parent=NULL,CTask **_pu_task=NULL)
|
||||
{//Create PopUp win task and edit a doc.
|
||||
U8 *st=MStrPrint("Ed(\"%Q\");",filename);
|
||||
I64 result=PopUp(st,parent,_pu_task);
|
||||
I64 res=PopUp(st,parent,_pu_task);
|
||||
Free(st);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
+14
-14
@@ -56,7 +56,7 @@ public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
|
||||
CDocBin *b;
|
||||
Bool unlock=DocLock(doc);
|
||||
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)))
|
||||
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)
|
||||
if (b->use_cnt>b->temp_use_cnt)
|
||||
cnt+=offset(CDocBin.end)-offset(CDocBin.start)+b->size;
|
||||
result=MAlloc(cnt);
|
||||
dst=result;
|
||||
res=MAlloc(cnt);
|
||||
dst=res;
|
||||
doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
doc_e1=doc_e->next;
|
||||
@@ -167,7 +167,7 @@ public U8 *DocSave(CDoc *doc,I64 *_size=NULL)
|
||||
if (_size) *_size=cnt;
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Bool DocWrite(CDoc *doc,Bool prompt=FALSE)
|
||||
@@ -244,7 +244,7 @@ public U0 StreamDoc(CDoc *doc)
|
||||
#help_index "DolDoc"
|
||||
Bool DocCaptureUndo(CDoc *doc,Bool force=FALSE)
|
||||
{
|
||||
Bool result=FALSE,unlock;
|
||||
Bool res=FALSE,unlock;
|
||||
I64 time_stamp,flags;
|
||||
CDocUndo *u;
|
||||
if (doc->flags&DOCF_ALLOW_UNDO) {
|
||||
@@ -263,12 +263,12 @@ Bool DocCaptureUndo(CDoc *doc,Bool force=FALSE)
|
||||
doc->flags&=~DOCF_UNDO_DIRTY;
|
||||
doc->undo_cnt++;
|
||||
u->doc_flags=doc->flags;
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
}
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 DocUndoRestore(CDoc *doc)
|
||||
@@ -298,7 +298,7 @@ U0 DocUndoRestore(CDoc *doc)
|
||||
"DolDoc/Output;StdOut/DolDoc"
|
||||
public Bool DocType(CDoc *doc=NULL,U8 *filename,I64 trailing_new_lines=1)
|
||||
{//Output txt or graphic file to document.
|
||||
Bool result=FALSE;
|
||||
Bool res=FALSE;
|
||||
CDoc *doc2;
|
||||
if (!doc && !(doc=DocPut) || doc->doc_signature!=DOC_SIGNATURE_VAL)
|
||||
return FALSE;
|
||||
@@ -308,20 +308,20 @@ public Bool DocType(CDoc *doc=NULL,U8 *filename,I64 trailing_new_lines=1)
|
||||
if (IsRaw)
|
||||
DocDump(doc2,100000);
|
||||
DocDel(doc2);
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
} else if (FilesFindMatch(filename,"*.BMP.Z")) {
|
||||
DocBMP(doc,filename,,FALSE);
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
} else if (FilesFindMatch(filename,"*.BMP;*.bmp")) {
|
||||
DocBMP(doc,filename,,TRUE);
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
} else if (FilesFindMatch(filename,"*.GRA*")) {
|
||||
DocGRA(doc,filename);
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
}
|
||||
if (result)
|
||||
if (res)
|
||||
DocPrint(doc,"%h*c",trailing_new_lines,'\n');
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#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
|
||||
{//Nearest to specified line num. Move cur_entry & center.
|
||||
Bool result=FALSE,unlock;
|
||||
Bool res=FALSE,unlock;
|
||||
if (doc) {
|
||||
unlock=DocLock(doc);
|
||||
doc->x=0;
|
||||
@@ -10,32 +10,32 @@ public Bool DocLineNumGoTo(CDoc *doc,I64 line_num) //one based
|
||||
DocRecalc(doc,RECALCt_FIND_CURSOR);
|
||||
DocCenter(doc);
|
||||
if (doc->cur_entry->y==line_num-1)
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Bool DocFind(CDoc *haystack_doc,I64 start_line_num=MIN_I64,
|
||||
U8 *needle,I64 match=1)
|
||||
{//Find str by searching tags. Move cur_entry & center.
|
||||
Bool result=FALSE,unlock;
|
||||
Bool res=FALSE,unlock;
|
||||
CDocEntry *doc_e;
|
||||
U8 *ptr;
|
||||
I64 i;
|
||||
if (haystack_doc) {
|
||||
unlock=DocLock(haystack_doc);
|
||||
if (start_line_num==MIN_I64) {
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
doc_e=haystack_doc->root.next;
|
||||
} else {
|
||||
result=DocLineNumGoTo(haystack_doc,start_line_num);
|
||||
res=DocLineNumGoTo(haystack_doc,start_line_num);
|
||||
doc_e=haystack_doc->cur_entry;
|
||||
}
|
||||
if (result) {
|
||||
if (res) {
|
||||
if (needle) {
|
||||
result=FALSE;
|
||||
res=FALSE;
|
||||
while (doc_e!=haystack_doc) {
|
||||
if (doc_e->de_flags&DOCEF_TAG && doc_e->tag &&
|
||||
//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->max_col) i=doc_e->max_col;
|
||||
haystack_doc->cur_col=i;
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
} else
|
||||
result=FALSE;
|
||||
res=FALSE;
|
||||
}
|
||||
if (!result) DocBottom(haystack_doc);
|
||||
if (!res) DocBottom(haystack_doc);
|
||||
DocCenter(haystack_doc);
|
||||
if (unlock)
|
||||
DocUnlock(haystack_doc);
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Bool DocAnchorFind(CDoc *haystack_doc,U8 *needle_str)
|
||||
{//Find named anchor. Move cur_entry & center.
|
||||
Bool result=FALSE,unlock;
|
||||
Bool res=FALSE,unlock;
|
||||
CDocEntry *doc_e;
|
||||
if (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)) {
|
||||
haystack_doc->cur_entry=doc_e;
|
||||
haystack_doc->cur_col=doc_e->min_col;
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
if (!result) DocBottom(haystack_doc);
|
||||
if (!res) DocBottom(haystack_doc);
|
||||
DocCenter(haystack_doc);
|
||||
if (unlock)
|
||||
DocUnlock(haystack_doc);
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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,
|
||||
Bool fwd,Bool abort_on_dbl_colon=FALSE)
|
||||
{//Find { } or ( ) pair. Move cur_entry & center.
|
||||
Bool unlock=DocLock(doc),result=FALSE;
|
||||
Bool unlock=DocLock(doc),res=FALSE;
|
||||
U8 *ptr;
|
||||
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;
|
||||
@@ -209,7 +209,7 @@ Bool fwd,Bool abort_on_dbl_colon=FALSE)
|
||||
doc->cur_entry=doc_e;
|
||||
doc->cur_col=ptr-doc_e->tag-1;
|
||||
EdCursorLeft(doc);
|
||||
result=FALSE;
|
||||
res=FALSE;
|
||||
goto pa_done;
|
||||
}
|
||||
} else {
|
||||
@@ -220,7 +220,7 @@ Bool fwd,Bool abort_on_dbl_colon=FALSE)
|
||||
if (!levels--) {
|
||||
doc->cur_entry=doc_e;
|
||||
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;
|
||||
goto pa_done;
|
||||
}
|
||||
@@ -241,7 +241,7 @@ Bool fwd,Bool abort_on_dbl_colon=FALSE)
|
||||
if (++colons==2) {
|
||||
doc->cur_entry=doc_e;
|
||||
doc->cur_col=ptr-doc_e->tag+1;
|
||||
result=FALSE;
|
||||
res=FALSE;
|
||||
goto pa_done;
|
||||
}
|
||||
} else {
|
||||
@@ -252,7 +252,7 @@ Bool fwd,Bool abort_on_dbl_colon=FALSE)
|
||||
if (!levels--) {
|
||||
doc->cur_entry=doc_e;
|
||||
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;
|
||||
goto pa_done;
|
||||
}
|
||||
@@ -273,12 +273,12 @@ pa_done:
|
||||
DocCenter(doc);
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Bool EdGoToFun(CDoc *doc,Bool fwd,Bool abort_on_dbl_colon)
|
||||
{//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;
|
||||
if (fwd) {
|
||||
levels=0;
|
||||
@@ -301,22 +301,22 @@ public Bool EdGoToFun(CDoc *doc,Bool fwd,Bool abort_on_dbl_colon)
|
||||
}
|
||||
DocRecalc(doc);
|
||||
if (doc->cur_entry!=doc)
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
} else {
|
||||
while (EdFindPaired(doc,'}','{',FALSE,abort_on_dbl_colon));
|
||||
if (doc->cur_entry!=doc) {
|
||||
ch=EdCurU8(doc);
|
||||
if (abort_on_dbl_colon && ch==':')
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
else {
|
||||
if (ch=='{')
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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;
|
||||
CDocEntry *doc_ce,*doc_e,*doc_marker=NULL;
|
||||
if (doc->find_replace->pmt)
|
||||
@@ -391,7 +391,7 @@ I64 EdFindReplace(CDoc *doc)
|
||||
else
|
||||
cmd=RSAC_ALL;
|
||||
if (!doc->find_replace->pmt || DocForm(doc->find_replace)) {
|
||||
result=0;
|
||||
res=0;
|
||||
unlock=DocLock(doc);
|
||||
if (doc->find_replace->match_case || doc->find_replace->local_var)
|
||||
sf_flags=0;
|
||||
@@ -407,7 +407,7 @@ I64 EdFindReplace(CDoc *doc)
|
||||
!(doc_ce->de_flags&DOCEF_FILTER_SKIP) &&
|
||||
StrFind(doc->find_replace->find_text,doc_ce->tag,sf_flags)) {
|
||||
doc_ce->type|=DOCET_SELECTED;
|
||||
result++;
|
||||
res++;
|
||||
} else
|
||||
doc_ce->type&=~DOCET_SELECTED;
|
||||
doc_ce=doc_ce->next;
|
||||
@@ -516,7 +516,7 @@ I64 EdFindReplace(CDoc *doc)
|
||||
}
|
||||
doc_e=doc->cur_entry;
|
||||
src=doc->cur_col+doc_e->tag;
|
||||
result++;
|
||||
res++;
|
||||
} else
|
||||
src++;
|
||||
}
|
||||
@@ -537,7 +537,7 @@ fr_unlock_done:
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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.
|
||||
CEdFindText old_find_replace;
|
||||
Bool unlock;
|
||||
I64 i,result=-1;
|
||||
I64 i,res=-1;
|
||||
if (!doc) return -1;
|
||||
unlock=DocLock(doc);
|
||||
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->whole_labels=whole_labels;
|
||||
doc->find_replace->pmt=FALSE;
|
||||
result=EdFindReplace(doc);
|
||||
res=EdFindReplace(doc);
|
||||
}
|
||||
}
|
||||
MemCpy(doc->find_replace,&old_find_replace,sizeof(CEdFindText));
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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) {
|
||||
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) {
|
||||
ptr=MStrPrint("[%s]",temph->sub_lst[d]);
|
||||
ptr=MStrPrint("[%s]",temph->sub_idx[d]);
|
||||
Free(doc_e->tag);
|
||||
doc_e->tag=StrNew(ptr,doc->mem_task);
|
||||
Free(ptr);
|
||||
@@ -215,7 +215,7 @@ public Bool DocForm(U8 *_d,U8 *class_name=lastclass,
|
||||
U8 *fmtstr;
|
||||
CHashClass *tempc,*tempc2;
|
||||
CDoc *doc;
|
||||
Bool result=FALSE;
|
||||
Bool res=FALSE;
|
||||
I64 old_border_src=Fs->border_src,has_action;
|
||||
if (!(tempc=HashFind(class_name,Fs->hash_table,HTT_CLASS)))
|
||||
return FALSE;
|
||||
@@ -265,10 +265,10 @@ public Bool DocForm(U8 *_d,U8 *class_name=lastclass,
|
||||
DocRecalc(doc);
|
||||
if (DocEd(doc,dof_flags)) {
|
||||
doc_e=doc->cur_entry;
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
if (doc_e!=doc) {
|
||||
if (DocEntryRun(doc,doc_e,TRUE,&has_action)==DOCM_CANCEL && has_action)
|
||||
result=FALSE;
|
||||
res=FALSE;
|
||||
DocUnlock(doc);
|
||||
}
|
||||
}
|
||||
@@ -283,7 +283,7 @@ public Bool DocForm(U8 *_d,U8 *class_name=lastclass,
|
||||
}
|
||||
DocDel(doc);
|
||||
Fs->border_src=old_border_src;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 DocMenuEndTaskCB()
|
||||
@@ -297,7 +297,7 @@ public I64 DocMenu(CDoc *m,I64 dof_flags=0)
|
||||
U8 *old_end_cb=Fs->task_end_cb;
|
||||
Bool old_break_shift_esc=LBts(&Fs->task_flags,TASKf_BREAK_TO_SHIFT_ESC);
|
||||
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;
|
||||
try {
|
||||
if (m) {
|
||||
@@ -307,10 +307,10 @@ dm_restart:
|
||||
if (DocEd(m,dof_flags)) {
|
||||
doc_e=m->cur_entry;
|
||||
if (doc_e!=m) {
|
||||
result=DocEntryRun(m,doc_e,TRUE,&has_action);
|
||||
res=DocEntryRun(m,doc_e,TRUE,&has_action);
|
||||
DocUnlock(m);
|
||||
if (!has_action) {
|
||||
result=DOCM_CANCEL;
|
||||
res=DOCM_CANCEL;
|
||||
dof_flags|=DOF_DONT_HOME;
|
||||
goto dm_restart;
|
||||
}
|
||||
@@ -327,7 +327,7 @@ dm_restart:
|
||||
LBEqu(&Fs->task_flags,TASKf_BREAK_TO_SHIFT_ESC,old_break_shift_esc);
|
||||
Fs->border_src=old_border_src;
|
||||
Fs->task_end_cb=old_end_cb;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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.
|
||||
CDocEntry *doc_e2=doc_e;
|
||||
Bool unlock=DocLock(doc);
|
||||
U8 *dst,*src,*start,*result;
|
||||
U8 *dst,*src,*start,*res;
|
||||
I64 i=0;
|
||||
if (cur_col)
|
||||
*cur_col=-1;
|
||||
@@ -53,8 +53,8 @@ public U8 *DocScanLine(CDoc *doc,CDocEntry *doc_e,
|
||||
i++;
|
||||
doc_e2=doc_e2->next;
|
||||
}
|
||||
result=MAlloc(i+1);
|
||||
dst=result;
|
||||
res=MAlloc(i+1);
|
||||
dst=res;
|
||||
while (doc_e!=doc && doc_e->type_u8!=DOCT_NEW_LINE) {
|
||||
start=dst;
|
||||
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)
|
||||
*dst++='\t';
|
||||
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;
|
||||
}
|
||||
if (_do_e_end) *_do_e_end=doc_e;
|
||||
*dst=0;
|
||||
if (doc_e==doc->cur_entry && cur_col && !doc->cur_col)
|
||||
*cur_col=dst-result;
|
||||
*cur_col=dst-res;
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
U8 *DocGetStr2(I64 flags=0)
|
||||
{//$LK,"Flags",A="MN:GSF_SHIFT_ESC_EXIT"$
|
||||
CDoc *doc;
|
||||
CDocEntry *doc_e,*doc_e_end;
|
||||
U8 *st,*st2,*result;
|
||||
U8 *st,*st2,*res;
|
||||
I64 ch,sc;
|
||||
"$$PT$$";
|
||||
do {
|
||||
@@ -102,7 +102,7 @@ U8 *DocGetStr2(I64 flags=0)
|
||||
if (flags&GSF_SHIFT_ESC_EXIT)
|
||||
Exit;
|
||||
else {
|
||||
result=StrNew("");
|
||||
res=StrNew("");
|
||||
goto gs_done;
|
||||
}
|
||||
}
|
||||
@@ -117,16 +117,16 @@ U8 *DocGetStr2(I64 flags=0)
|
||||
do doc_e=doc_e->last;
|
||||
while (doc_e!=doc && doc_e->type_u8!=DOCT_PMT);
|
||||
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) {
|
||||
st2=MStrPrint("%s\n",result);
|
||||
Free(result);
|
||||
result=st2;
|
||||
st2=MStrPrint("%s\n",res);
|
||||
Free(res);
|
||||
res=st2;
|
||||
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(result);
|
||||
result=st2;
|
||||
Free(res);
|
||||
res=st2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -141,12 +141,12 @@ U8 *DocGetStr2(I64 flags=0)
|
||||
doc_e->type_u8!=DOCT_PMT);
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
result=DocScanLine(doc,doc_e,NULL);
|
||||
res=DocScanLine(doc,doc_e,NULL);
|
||||
}
|
||||
DocUnlock(doc);
|
||||
gs_done:
|
||||
"$$PT$$$$FG$$$$BG$$";
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#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.
|
||||
Bool okay;
|
||||
U8 *st;
|
||||
I64 result;
|
||||
I64 res;
|
||||
while (TRUE) {
|
||||
if (msg)
|
||||
"" 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;
|
||||
}
|
||||
try {
|
||||
result=ExePrint2("ToI64(%s);",st);
|
||||
res=ExePrint2("ToI64(%s);",st);
|
||||
okay=TRUE;
|
||||
} catch {
|
||||
Fs->catch_except=TRUE;
|
||||
okay=FALSE;
|
||||
}
|
||||
Free(st);
|
||||
if (okay && lo<=result<=hi)
|
||||
return result;
|
||||
if (okay && lo<=res<=hi)
|
||||
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.
|
||||
Bool okay;
|
||||
U8 *st;
|
||||
F64 result;
|
||||
F64 res;
|
||||
while (TRUE) {
|
||||
if (msg)
|
||||
"" 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;
|
||||
}
|
||||
try {
|
||||
result=ExePrint2("ToF64(%s);",st)(F64);
|
||||
res=ExePrint2("ToF64(%s);",st)(F64);
|
||||
okay=TRUE;
|
||||
} catch {
|
||||
Fs->catch_except=TRUE;
|
||||
okay=FALSE;
|
||||
}
|
||||
Free(st);
|
||||
if (okay && lo<=result<=hi)
|
||||
return result;
|
||||
if (okay && lo<=res<=hi)
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ public CDate GetDate(U8 *msg=NULL,CDate dft=MIN_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.)
|
||||
U8 *st;
|
||||
CDate result;
|
||||
CDate res;
|
||||
if (dft==MIN_I64) dft=Now;
|
||||
while (TRUE) {
|
||||
if (msg)
|
||||
@@ -216,9 +216,9 @@ public CDate GetDate(U8 *msg=NULL,CDate dft=MIN_I64,
|
||||
Free(st);
|
||||
return dft;
|
||||
}
|
||||
result=Str2Date(st);
|
||||
res=Str2Date(st);
|
||||
Free(st);
|
||||
if (result>=lo && result<=hi)
|
||||
return result;
|
||||
if (res>=lo && res<=hi)
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
|
||||
I64 DitherColor2(U8 *header=NULL)
|
||||
{
|
||||
I64 msg_code,a1,a2,result=-1,i,j;
|
||||
I64 msg_code,a1,a2,res=-1,i,j;
|
||||
DocClear;
|
||||
"%s",header;
|
||||
DocRecalc(DocPut);
|
||||
@@ -140,7 +140,7 @@ I64 DitherColor2(U8 *header=NULL)
|
||||
if (a1>=0 && a2>=0 && 0<=j<17 && 0<=i<17) {
|
||||
if (j==16) j=TRANSPARENT;
|
||||
if (i==16) i=TRANSPARENT;
|
||||
result=j+i<<16+ROPF_DITHER;
|
||||
res=j+i<<16+ROPF_DITHER;
|
||||
goto dc_done;
|
||||
}
|
||||
}
|
||||
@@ -150,7 +150,7 @@ I64 DitherColor2(U8 *header=NULL)
|
||||
dc_done:
|
||||
SettingsPop;
|
||||
FramePtrDel("DitherFrame");
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public I64 PopUpColorDither(U8 *header=NULL)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
U32 *DocHighlight(CDocEntry *doc_e,U8 *src,I64 len,I64 _temp_u32_attr)
|
||||
{//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;
|
||||
CDocSettings *s=&doc_e->settings;
|
||||
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->brace_depth=brace_depth;
|
||||
*dst=0;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
+41
-35
@@ -62,7 +62,7 @@ Bool DocFileEd(I64 _type,U8 *filename,
|
||||
CDocEntry *doc_e;
|
||||
CDoc *doc;
|
||||
Bool old_silent=Bt(&Fs->display_flags,DISPLAYf_SILENT),
|
||||
result=FALSE,other_found=FALSE;
|
||||
res=FALSE,other_found=FALSE;
|
||||
U8 *st1,*st2;
|
||||
try {
|
||||
switch (type) {
|
||||
@@ -93,7 +93,7 @@ Bool DocFileEd(I64 _type,U8 *filename,
|
||||
|
||||
if (LK_DOC<=_type<=LK_DOC_LINE) {
|
||||
doc=Str2I64(filename);//See $LK,"SpriteEdText",A="MN:SpriteEdText"$()
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
} else {
|
||||
|
||||
st1=StrNew(filename);
|
||||
@@ -105,9 +105,9 @@ Bool DocFileEd(I64 _type,U8 *filename,
|
||||
else {
|
||||
Silent;
|
||||
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);
|
||||
else if (!(result=FileFind(filename,,
|
||||
else if (!(res=FileFind(filename,,
|
||||
FUF_JUST_FILES)))
|
||||
other_found=FileFind(filename,,
|
||||
FUF_JUST_FILES|FUF_Z_OR_NOT_Z|FUF_SCAN_PARENTS);
|
||||
@@ -121,26 +121,26 @@ Bool DocFileEd(I64 _type,U8 *filename,
|
||||
Free(st2);
|
||||
}
|
||||
if (!doc||doc->doc_signature!=DOC_SIGNATURE_VAL)
|
||||
result=FALSE;
|
||||
res=FALSE;
|
||||
else {
|
||||
if (Bt(&edf_dof_flags,EDf_COLLAPSE))
|
||||
DocCollapse(TRUE,doc);
|
||||
else if (Bt(&edf_dof_flags,EDf_UNCOLLAPSE))
|
||||
DocCollapse(FALSE,doc);
|
||||
|
||||
if (result || other_found)
|
||||
if (res || other_found)
|
||||
switch (type) {
|
||||
case LK_FILE_LINE:
|
||||
result=DocLineNumGoTo(doc,*_num);
|
||||
res=DocLineNumGoTo(doc,*_num);
|
||||
break;
|
||||
case LK_FILE_ANCHOR:
|
||||
result=DocAnchorFind(doc,needle_str);
|
||||
res=DocAnchorFind(doc,needle_str);
|
||||
break;
|
||||
case LK_FILE_FIND:
|
||||
result=DocFind(doc,,needle_str,*_num);
|
||||
res=DocFind(doc,,needle_str,*_num);
|
||||
break;
|
||||
case LK_BIBLE_FIND:
|
||||
result=DocFind(doc,*_num,needle_str);
|
||||
res=DocFind(doc,*_num,needle_str);
|
||||
break;
|
||||
default:
|
||||
DocCenter(doc);
|
||||
@@ -148,7 +148,7 @@ Bool DocFileEd(I64 _type,U8 *filename,
|
||||
*_num=doc->cur_entry->y+1;
|
||||
|
||||
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)) {
|
||||
DocLock(doc);
|
||||
doc_e=doc->cur_entry;
|
||||
@@ -158,7 +158,7 @@ Bool DocFileEd(I64 _type,U8 *filename,
|
||||
if (!(LK_DOC<=_type<=LK_DOC_LINE)) {
|
||||
DocWrite(doc);
|
||||
if (edf_dof_flags&EDF_WAS_WRITE)
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
}
|
||||
}
|
||||
if (!(LK_DOC<=_type<=LK_DOC_LINE))
|
||||
@@ -166,10 +166,10 @@ Bool DocFileEd(I64 _type,U8 *filename,
|
||||
}
|
||||
} catch {
|
||||
Silent(old_silent);
|
||||
result=FALSE;
|
||||
res=FALSE;
|
||||
}
|
||||
Fs->border_src=old_border_src;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#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,
|
||||
I64 *_num=NULL,I64 edf_dof_flags=0)
|
||||
{//$LK,"Editor Link",A="MN:LK_FILE"$--> filename, needle_str and line number.
|
||||
U8 *st,*ptr,*filename=NULL,*needle_str=NULL,*filename2;
|
||||
I64 result,i,num=1;
|
||||
U8 *st,*ptr,*src,*filename=NULL,*needle_str=NULL,*filename2;
|
||||
I64 res,i,num=1;
|
||||
CHashSrcSym *temph;
|
||||
if (!link_st||!*link_st) {
|
||||
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;
|
||||
}
|
||||
st=StrNew(link_st);
|
||||
result=LK_FILE;
|
||||
res=LK_FILE;
|
||||
if (StrLen(st)>3 && st[2]==':') {
|
||||
st[2]=0;
|
||||
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:
|
||||
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);
|
||||
else
|
||||
result=-1;
|
||||
res=-1;
|
||||
goto lc_done;
|
||||
case LK_ADDR:
|
||||
if (ptr=StrLastOcc(filename2,",")) {
|
||||
@@ -205,10 +205,10 @@ public I64 EdLinkCvt(U8 *link_st,U8 **_filename=NULL,U8 **_needle_str=NULL,
|
||||
} else
|
||||
i=DFT_ADDR_LINK_BIN_SIZE;
|
||||
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);
|
||||
} else
|
||||
result=-1;
|
||||
res=-1;
|
||||
goto lc_done;
|
||||
case LK_DEF:
|
||||
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:
|
||||
if (ptr=StrLastOcc(filename2,",")) {
|
||||
*ptr=0;
|
||||
src=ptr+1;
|
||||
while (*src) { //We do not allow ending verse
|
||||
if (*src=='-')
|
||||
*src=0;
|
||||
src++;
|
||||
}
|
||||
needle_str=StrNew(ptr+1);
|
||||
}
|
||||
i=DefineMatch(filename2,"ST_BIBLE_BOOKS",LMF_IGNORE_CASE);
|
||||
if (i<0)
|
||||
result=-1;
|
||||
res=-1;
|
||||
else {
|
||||
num=Str2I64(DefineSub(i,"ST_BIBLE_BOOK_LINES"));
|
||||
filename2=BIBLE_FILENAME;
|
||||
@@ -265,8 +271,8 @@ public I64 EdLinkCvt(U8 *link_st,U8 **_filename=NULL,U8 **_needle_str=NULL,
|
||||
}
|
||||
} else
|
||||
filename2=st;
|
||||
if (result>=0) {
|
||||
if (LK_DOC<=result<=LK_DOC_LINE)
|
||||
if (res>=0) {
|
||||
if (LK_DOC<=res<=LK_DOC_LINE)
|
||||
filename=StrNew(filename2); //Holds document address as number.
|
||||
else
|
||||
filename=FileNameAbs(filename2,FUF_Z_OR_NOT_Z);
|
||||
@@ -283,13 +289,13 @@ lc_done:
|
||||
Free(needle_str);
|
||||
if (_num)
|
||||
*_num=num;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Bool DocLinkChk(U8 *link_st)
|
||||
{//Check for bad $LK,"Editor Link",A="MN:LK_FILE"$.
|
||||
U8 *filename,*st;
|
||||
Bool result=FALSE;
|
||||
Bool res=FALSE;
|
||||
if (link_st) {
|
||||
switch (EdLinkCvt(link_st,&filename)) {
|
||||
case -1:
|
||||
@@ -298,7 +304,7 @@ public Bool DocLinkChk(U8 *link_st)
|
||||
case LK_PLAIN_LINE:
|
||||
case LK_FILE:
|
||||
//We don't check line number
|
||||
result=FileFind(filename,,
|
||||
res=FileFind(filename,,
|
||||
FUF_JUST_FILES|FUF_Z_OR_NOT_Z|FUF_SCAN_PARENTS);
|
||||
break;
|
||||
case LK_BIBLE_FIND:
|
||||
@@ -306,21 +312,21 @@ public Bool DocLinkChk(U8 *link_st)
|
||||
if (StrOcc(st,','))
|
||||
StrLastRem(st,",");
|
||||
if (DefineMatch(st,"ST_BIBLE_BOOKS",LMF_IGNORE_CASE)>=0)
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
Free(st);
|
||||
break;
|
||||
default://TODO: Need to validate HI: and DN:
|
||||
if (Ed(link_st,EDF_BAIL))
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
}
|
||||
Free(filename);
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public U8 *DocLinkFile(U8 *link_st,CTask *mem_task=NULL)
|
||||
{//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) {
|
||||
switch (EdLinkCvt(link_st,&filename)) {
|
||||
case LK_FILE:
|
||||
@@ -331,14 +337,14 @@ public U8 *DocLinkFile(U8 *link_st,CTask *mem_task=NULL)
|
||||
case LK_PLAIN_FIND:
|
||||
case LK_PLAIN_LINE:
|
||||
st=FileNameAbs(filename,FUF_Z_OR_NOT_Z|FUF_SCAN_PARENTS);
|
||||
result=StrNew(st);
|
||||
res=StrNew(st);
|
||||
Free(st);
|
||||
break;
|
||||
case LK_BIBLE_FIND:
|
||||
result=StrNew(BIBLE_FILENAME,mem_task);
|
||||
res=StrNew(BIBLE_FILENAME,mem_task);
|
||||
break;
|
||||
}
|
||||
Free(filename);
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
@@ -137,7 +137,7 @@ U0 EdInsCapturedMacro()
|
||||
|
||||
I64 PopUpMacroMenu()
|
||||
{
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
U8 buf[STR_LEN];
|
||||
CSrvCmd *tempc;
|
||||
CDoc *doc=DocNew;
|
||||
@@ -164,13 +164,13 @@ I64 PopUpMacroMenu()
|
||||
LBts(&sys_macro_task->display_flags,DISPLAYf_WIN_ON_TOP);
|
||||
tempc=TaskExe(sys_macro_task,Fs,buf,
|
||||
1<<SVCf_WAKE_MASTER|1<<SVCf_FOCUS_MASTER);
|
||||
JobResultScan(tempc,&result);
|
||||
JobResScan(tempc,&res);
|
||||
Fs->popup_task=NULL;
|
||||
Kill(sys_macro_task);
|
||||
sys_macro_task=NULL;
|
||||
DocDataScan(doc,doc_e);
|
||||
DocDel(doc);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 MacroTask(I64)
|
||||
|
||||
+47
-47
@@ -37,27 +37,27 @@ Bool IsEditableText(CDocEntry *doc_e)
|
||||
|
||||
CDocEntry *DocEntryNewBase(CDoc *doc,I64 type,I64 de_flags=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;"$.
|
||||
CDocEntry *result=CAlloc(sizeof(CDocEntryBase),doc->mem_task);
|
||||
result->type=type;
|
||||
result->de_flags=de_flags|doldoc.dft_de_flags[type.u8[0]];
|
||||
result->x=x;
|
||||
result->y=y;
|
||||
result->page_line_num=page_line_num;
|
||||
return result;
|
||||
{//See also $LK,"MAllocIdent",A="FF:::/Adam/DolDoc/DocRecalc.CPP,MAllocIdent"$ and $MA-X+PU,"CDocEntry",LM="F(\"sizeof(CDocEntry)\");View;"$.
|
||||
CDocEntry *res=CAlloc(sizeof(CDocEntryBase),doc->mem_task);
|
||||
res->type=type;
|
||||
res->de_flags=de_flags|doldoc.dft_de_flags[type.u8[0]];
|
||||
res->x=x;
|
||||
res->y=y;
|
||||
res->page_line_num=page_line_num;
|
||||
return res;
|
||||
}
|
||||
|
||||
CDocEntry *DocEntryNewTag(CDoc *doc,CDocEntry *doc_ce,U8 *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);
|
||||
result->de_flags=doc_ce->de_flags; //Override
|
||||
result->max_col=l;
|
||||
result->tag=MAlloc(l+1,doc->mem_task);
|
||||
MemCpy(result->tag,tag,l+1);
|
||||
MemCpy(&result->settings,&doc_ce->settings,sizeof(CDocSettings));
|
||||
return result;
|
||||
res->de_flags=doc_ce->de_flags; //Override
|
||||
res->max_col=l;
|
||||
res->tag=MAlloc(l+1,doc->mem_task);
|
||||
MemCpy(res->tag,tag,l+1);
|
||||
MemCpy(&res->settings,&doc_ce->settings,sizeof(CDocSettings));
|
||||
return res;
|
||||
}
|
||||
|
||||
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)
|
||||
{//Mem size of entry and all parts.
|
||||
I64 result;
|
||||
I64 res;
|
||||
if (!doc_e) return 0;
|
||||
result=MSize2(doc_e);
|
||||
res=MSize2(doc_e);
|
||||
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)
|
||||
result+=MSize2(doc_e->aux_str);
|
||||
res+=MSize2(doc_e->aux_str);
|
||||
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)
|
||||
result+=MSize2(doc_e->html_link);
|
||||
res+=MSize2(doc_e->html_link);
|
||||
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)
|
||||
result+=MSize2(doc_e->right_macro);
|
||||
res+=MSize2(doc_e->right_macro);
|
||||
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)
|
||||
result+=MSize2(doc_e->data);
|
||||
return result;
|
||||
res+=MSize2(doc_e->data);
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 DocUndoDel(CDoc *,CDocUndo *u)
|
||||
@@ -138,26 +138,26 @@ public CDocEntry *DocEntryCopy(CDoc *doc,CDocEntry *doc_e)
|
||||
CDocEntry *doc_ne;
|
||||
CDocBin *tempb;
|
||||
CTask *task=doc->mem_task;
|
||||
doc_ne=MAllocIdentical(doc_e,task);
|
||||
doc_ne=MAllocIdent(doc_e,task);
|
||||
doc_ne->next=doc_ne;
|
||||
doc_ne->last=doc_ne;
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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) {
|
||||
tempb=MAllocIdentical(doc_e->bin_data,task);
|
||||
tempb->data=MAllocIdentical(doc_e->bin_data->data,task);
|
||||
tempb=MAllocIdent(doc_e->bin_data,task);
|
||||
tempb->data=MAllocIdent(doc_e->bin_data->data,task);
|
||||
doc_ne->bin_num=doc->cur_bin_num;
|
||||
tempb->num=doc->cur_bin_num++;
|
||||
doc_ne->bin_data=tempb;
|
||||
@@ -168,7 +168,7 @@ public CDocEntry *DocEntryCopy(CDoc *doc,CDocEntry *doc_e)
|
||||
QueIns(tempb,doc->bin_root.last);
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -326,37 +326,37 @@ public I64 DocSize(CDoc *doc)
|
||||
CDocEntry *doc_e;
|
||||
CDocUndo *u;
|
||||
CDocBin *b;
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
|
||||
if (!doc || doc->doc_signature!=DOC_SIGNATURE_VAL) return 0;
|
||||
unlock=DocLock(doc);
|
||||
|
||||
doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
result+=DocEntrySize(doc,doc_e);
|
||||
res+=DocEntrySize(doc,doc_e);
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
|
||||
u=doc->undo_root.next;
|
||||
while (u!=&doc->undo_root) {
|
||||
result+=MSize2(u->body);
|
||||
result+=MSize2(u);
|
||||
res+=MSize2(u->body);
|
||||
res+=MSize2(u);
|
||||
u=u->next;
|
||||
}
|
||||
|
||||
b=doc->bin_root.next;
|
||||
while (b!=&doc->bin_root) {
|
||||
result+=MSize2(b->data);
|
||||
result+=MSize2(b);
|
||||
res+=MSize2(b->data);
|
||||
res+=MSize2(b);
|
||||
b=b->next;
|
||||
}
|
||||
|
||||
result+=MSize2(doc->find_replace);
|
||||
result+=MSize2(doc->dollar_buf);
|
||||
result+=MSize2(doc);
|
||||
res+=MSize2(doc->find_replace);
|
||||
res+=MSize2(doc->dollar_buf);
|
||||
res+=MSize2(doc);
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#help_index "DolDoc"
|
||||
|
||||
+18
-18
@@ -3,7 +3,7 @@
|
||||
I64 DocOptEntry(CDoc *,CDocEntry *doc_e,I64 fuf_flags)
|
||||
{
|
||||
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_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);
|
||||
doc_e->aux_str=NULL;
|
||||
doc_e->de_flags&=~DOCEF_AUX_STR;
|
||||
result++;
|
||||
res++;
|
||||
}
|
||||
if (doc_e->de_flags & DOCEF_AUX_STR)
|
||||
_dst=&doc_e->aux_str;
|
||||
@@ -26,7 +26,7 @@ I64 DocOptEntry(CDoc *,CDocEntry *doc_e,I64 fuf_flags)
|
||||
i=StrLen(st);
|
||||
if ((st2=StrMatch(st,*_dst)) && st2[i]=='.' && st2[i+1]=='Z') {
|
||||
StrCpy(st2+i,st2+i+2);
|
||||
result++;
|
||||
res++;
|
||||
}
|
||||
}
|
||||
Free(st);
|
||||
@@ -35,66 +35,66 @@ I64 DocOptEntry(CDoc *,CDocEntry *doc_e,I64 fuf_flags)
|
||||
if (doc_e->de_flags & DOCEF_AUX_STR) {
|
||||
if (st=StrMatch(".Z",doc_e->aux_str)) {
|
||||
StrCpy(st,st+2);
|
||||
result++;
|
||||
res++;
|
||||
}
|
||||
}
|
||||
if (doc_e->de_flags&DOCEF_TAG) {
|
||||
if (st=StrMatch(".Z",doc_e->tag)) {
|
||||
StrCpy(st,st+2);
|
||||
result++;
|
||||
res++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
I64 DocOptDoc(CDoc *doc,I64 fuf_flags)
|
||||
{//Optimize Doc.
|
||||
Bool unlock=DocLock(doc);
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
CDocEntry *doc_e;
|
||||
DocRecalc(doc);
|
||||
doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
if (result+=DocOptEntry(doc,doc_e,fuf_flags))
|
||||
result+=DocOptEntry(doc,doc_e,fuf_flags);
|
||||
if (res+=DocOptEntry(doc,doc_e,fuf_flags))
|
||||
res+=DocOptEntry(doc,doc_e,fuf_flags);
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
DocRecalc(doc);
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
I64 DocOptFile(U8 *filename,I64 fuf_flags)
|
||||
{//Optimize File.
|
||||
I64 result;
|
||||
I64 res;
|
||||
CDoc *doc=DocRead(filename);
|
||||
if (result=DocOptDoc(doc,fuf_flags)) {
|
||||
"-%d:%s\n",result,doc->filename.name;
|
||||
if (res=DocOptDoc(doc,fuf_flags)) {
|
||||
"-%d:%s\n",res,doc->filename.name;
|
||||
DocWrite(doc);
|
||||
}
|
||||
DocDel(doc);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
I64 DocOptLst(CDirEntry *tempde,I64 fuf_flags)
|
||||
{
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
CDirEntry *tempde1;
|
||||
while (tempde) {
|
||||
tempde1=tempde->next;
|
||||
if (tempde->attr & RS_ATTR_DIR) {
|
||||
if (tempde->sub) {
|
||||
"Scanning Directory: %s\n",tempde->full_name;
|
||||
result+=DocOptLst(tempde->sub,fuf_flags);
|
||||
res+=DocOptLst(tempde->sub,fuf_flags);
|
||||
}
|
||||
} else
|
||||
result+=DocOptFile(tempde->full_name,fuf_flags);
|
||||
res+=DocOptFile(tempde->full_name,fuf_flags);
|
||||
DirEntryDel(tempde);
|
||||
tempde=tempde1;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
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.
|
||||
|
||||
+10
-10
@@ -2,30 +2,30 @@
|
||||
|
||||
I64 PrsDocFlagSingle(CCmpCtrl *cc,I64 *_de_flags,U32 *_type,Bool turn_on)
|
||||
{
|
||||
I64 result=-1;
|
||||
I64 res=-1;
|
||||
CHashGeneric *temph;
|
||||
if (cc->token==TK_IDENT &&
|
||||
(temph=HashFind(cc->cur_str,doldoc.hash,DHT_DOC_FLAG))) {
|
||||
result=temph->user_data0;
|
||||
if (result<64) {
|
||||
BEqu(_de_flags,result,turn_on);
|
||||
switch (result) {
|
||||
res=temph->user_data0;
|
||||
if (res<64) {
|
||||
BEqu(_de_flags,res,turn_on);
|
||||
switch (res) {
|
||||
case DOCEf_SELECTED:
|
||||
case DOCEf_UNDERLINE:
|
||||
case DOCEf_INVERT:
|
||||
case DOCEf_BLINK:
|
||||
BEqu(_type,result,turn_on);
|
||||
BEqu(_type,res,turn_on);
|
||||
break;
|
||||
}
|
||||
}
|
||||
Lex(cc); //skip flag
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
I64 PrsDocFlags(CCmpCtrl *cc,I64 *_de_flags,U32 *_type)
|
||||
{
|
||||
I64 result=-1;
|
||||
I64 res=-1;
|
||||
Bool turn_on;
|
||||
while (TRUE) {
|
||||
if (cc->token=='+')
|
||||
@@ -35,9 +35,9 @@ I64 PrsDocFlags(CCmpCtrl *cc,I64 *_de_flags,U32 *_type)
|
||||
else
|
||||
break;
|
||||
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)
|
||||
|
||||
+29
-29
@@ -30,7 +30,7 @@ public CTask *PopUpViewPrint(U8 *fmt,...)
|
||||
#help_index "DolDoc/Input;File/FileNames;StdIn/DolDoc"
|
||||
public U8 *PopUpPickFile(U8 *dir=NULL)
|
||||
{//Filename chooser. Uses $LK,"FileMgr",A="MN:FileMgr"$().
|
||||
U8 *result,*st,*st2;
|
||||
U8 *res,*st,*st2;
|
||||
if (dir)
|
||||
st=MStrPrint("Cd(\"%Q\");FileMgr(FM_PICK_FILE,Fs->parent_task);",dir);
|
||||
else {
|
||||
@@ -38,14 +38,14 @@ public U8 *PopUpPickFile(U8 *dir=NULL)
|
||||
st=MStrPrint("Cd(\"%Q\");FileMgr(FM_PICK_FILE,Fs->parent_task);",st2);
|
||||
Free(st2);
|
||||
}
|
||||
result=PopUp(st,Fs);
|
||||
res=PopUp(st,Fs);
|
||||
Free(st);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public U8 *PopUpPickDir(U8 *dir=NULL)
|
||||
{//File dir name chooser. Uses $LK,"FileMgr",A="MN:FileMgr"$().
|
||||
U8 *result,*st,*st2;
|
||||
U8 *res,*st,*st2;
|
||||
if (dir)
|
||||
st=MStrPrint("Cd(\"%Q\");FileMgr(FM_PICK_DIR,Fs->parent_task);",dir);
|
||||
else {
|
||||
@@ -53,9 +53,9 @@ public U8 *PopUpPickDir(U8 *dir=NULL)
|
||||
st=MStrPrint("Cd(\"%Q\");FileMgr(FM_PICK_DIR,Fs->parent_task);",st2);
|
||||
Free(st2);
|
||||
}
|
||||
result=PopUp(st,Fs);
|
||||
res=PopUp(st,Fs);
|
||||
Free(st);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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)
|
||||
{//Filename chooser. Uses form, not $LK,"FileMgr",A="MN:FileMgr"$().
|
||||
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);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#help_index "DolDoc"
|
||||
Bool PopUpCd()
|
||||
{
|
||||
Bool result;
|
||||
Bool res;
|
||||
U8 *st=PopUpPickDir;
|
||||
if (st) {
|
||||
result=Cd(st);
|
||||
res=Cd(st);
|
||||
Free(st);
|
||||
} else
|
||||
result=FALSE;
|
||||
return result;
|
||||
res=FALSE;
|
||||
return res;
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Input;Char/Lists;StdIn/DolDoc"
|
||||
@@ -112,9 +112,9 @@ public U8 *PopUpPickLst(U8 *lst)
|
||||
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.
|
||||
return PopUpPickLst(Define(st));
|
||||
return PopUpPickLst(Define(dname));
|
||||
}
|
||||
|
||||
#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 *result,*st;
|
||||
U8 *res,*st;
|
||||
if (header)
|
||||
"%s",header;
|
||||
st=GetStr(,,GSF_WITH_NEW_LINE);
|
||||
result=StrNew(st,mem_task);
|
||||
res=StrNew(st,mem_task);
|
||||
Free(st);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public U8 *PopUpGetStr(U8 *header=NULL)
|
||||
{//Prompt for text str in PopUp win task.
|
||||
U8 *st=MStrPrint("PopUpGetStr2(0x%X,0x%X);",header,Fs),
|
||||
*result=PopUp(st,Fs);
|
||||
*res=PopUp(st,Fs);
|
||||
Free(st);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public I64 PopUpGetI64(U8 *msg,I64 dft,I64 lo=MIN_I64,I64 hi=MAX_I64)
|
||||
{//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);
|
||||
I64 result=PopUp(st,Fs);
|
||||
I64 res=PopUp(st,Fs);
|
||||
Free(st);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public F64 PopUpGetF64(U8 *msg,F64 dft,F64 lo=MIN_F64,F64 hi=MAX_F64)
|
||||
{//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);
|
||||
F64 result=PopUp(st,Fs)(F64);
|
||||
F64 res=PopUp(st,Fs)(F64);
|
||||
Free(st);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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;
|
||||
U8 *name=FileNameAbs(filename),
|
||||
*name2=DftExt(name,"CPP.Z");
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
if (warn_ext &&
|
||||
!FilesFindMatch(name2,FILEMASK_JIT) &&
|
||||
!PopUpCancelOk(ST_WARN_ST "Not .CPP File\n\n"))
|
||||
okay=FALSE;
|
||||
if (okay)
|
||||
result=Adam("#include \"%s\";",name2);
|
||||
res=Adam("#include \"%s\";",name2);
|
||||
Free(name2);
|
||||
Free(name);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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;
|
||||
U8 *st,*name=FileNameAbs(filename),
|
||||
*name2=DftExt(name,"CPP.Z");
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
if (warn_ext &&
|
||||
!FilesFindMatch(name2,FILEMASK_JIT) &&
|
||||
!PopUpCancelOk(ST_WARN_ST "Not .CPP File\n\n"))
|
||||
@@ -297,10 +297,10 @@ public I64 PopUpFile(U8 *filename,Bool warn_ext=TRUE,
|
||||
st=MStrPrint(
|
||||
"\"$$$$WW+H,1$$$$\";Auto(\"ExeFile2(\\\"%s\\\");\\n\");UserTaskCont;",
|
||||
name2);
|
||||
result=PopUp(st,parent,_pu_task);
|
||||
res=PopUp(st,parent,_pu_task);
|
||||
Free(st);
|
||||
}
|
||||
Free(name2);
|
||||
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_KEY_DESC)
|
||||
KeyDescSet("Cmd /Code Tools");
|
||||
else
|
||||
else {
|
||||
DocUnlock(doc);
|
||||
EdCodeTools(doc);
|
||||
DocLock(doc);
|
||||
}
|
||||
} else {
|
||||
if (sc&SCF_KEY_DESC)
|
||||
KeyDescSet("Cmd /Insert Text Widgets Wizard");
|
||||
|
||||
@@ -8,7 +8,7 @@ CDocEntry *DocPutS(CDoc *doc,U8 *st)
|
||||
*char_bitmap;
|
||||
Bool unlock;
|
||||
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)
|
||||
return NULL;
|
||||
unlock=DocLock(doc);
|
||||
@@ -128,7 +128,7 @@ CDocEntry *DocPutS(CDoc *doc,U8 *st)
|
||||
}
|
||||
*ptr4=0;
|
||||
if (doc_e=PrsDollarCmd(doc,st2)) {
|
||||
result=doc_e;
|
||||
res=doc_e;
|
||||
DocInsEntry(doc,doc_e);
|
||||
}
|
||||
Free(st2);
|
||||
@@ -152,16 +152,16 @@ CDocEntry *DocPutS(CDoc *doc,U8 *st)
|
||||
}
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public CDocEntry *DocPrint(CDoc *doc=NULL,U8 *fmt,...)
|
||||
{//You must not print partial doc cmds.
|
||||
//Returns last newly created dollar-sign CDocEntry or NULL.
|
||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
||||
CDocEntry *result=DocPutS(doc,buf);
|
||||
CDocEntry *res=DocPutS(doc,buf);
|
||||
Free(buf);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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;
|
||||
if (doc_e->type_u8==DOCT_TEXT && i) {
|
||||
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->de_flags=doc_e->de_flags&~DOCEG_HAS_ALLOC|DOCEF_TAG;
|
||||
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)
|
||||
{//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,
|
||||
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,
|
||||
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,
|
||||
*added_cursor=NULL;
|
||||
CDocBin *tempb;
|
||||
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;
|
||||
CTask *win_task,*mem_task;
|
||||
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;
|
||||
|
||||
//WinMgr updates all wins $TX,"30",D="WINMGR_FPS"$, 33.33333mS
|
||||
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)) {
|
||||
if (cnts.jiffies>=ijif)
|
||||
return FALSE;
|
||||
if (cnts.jiffies>=i_jif)
|
||||
return FALSE; //Bail-out if doc locked.
|
||||
Yield;
|
||||
}
|
||||
}
|
||||
@@ -426,7 +427,7 @@ public Bool DocRecalc(CDoc *doc,I64 recalc_flags=RECALCt_NORMAL)
|
||||
}
|
||||
while (doc_e!=doc) {
|
||||
while (TRUE) {
|
||||
del_cl=FALSE;
|
||||
del_doc_e=FALSE;
|
||||
if (doc_e->de_flags & (DOCEF_SKIP|DOCEF_FILTER_SKIP)) {
|
||||
doc_e2=doc_e;
|
||||
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);
|
||||
if (doc_e==doc->cur_entry) {
|
||||
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 &&
|
||||
!(doc_e->de_flags & ~(DOCEF_TAG|DOCG_BL_IV_UL|DOCEF_WORD_WRAP|
|
||||
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) {
|
||||
j=StrLen(doc_e->tag);
|
||||
if (j && doc_e->scroll_len) {
|
||||
ijif=cur_time*FONT_WIDTH*DOC_SCROLL_SPEED;
|
||||
ijif%=j*FONT_WIDTH;
|
||||
i_jif=ToI64(cur_time*FONT_WIDTH*DOC_SCROLL_SPEED)%(j*FONT_WIDTH);
|
||||
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
|
||||
ijif>>=3;
|
||||
i_jif>>=3;
|
||||
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 (recalc_flags&RECALCG_MASK==RECALCt_TO_SCREEN &&
|
||||
!(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
|
||||
&(DOCEF_TREE|DOCEF_LST|DOCEF_TAG_CB|DOCEF_DEFINE|
|
||||
DOCEF_AUX_STR|DOCEF_HTML_LINK|DOCEF_BIN_PTR_LINK)))
|
||||
del_cl=TRUE;
|
||||
del_doc_e=TRUE;
|
||||
break;
|
||||
case DOCT_HEX_ED:
|
||||
if (doc_e->de_flags&DOCEF_DEREF_DATA &&
|
||||
@@ -944,7 +944,7 @@ rc_adjust_xy:
|
||||
doc->cur_col=doc->cur_entry->min_col;
|
||||
}
|
||||
if (doc_e!=added_cursor)
|
||||
del_cl=TRUE;
|
||||
del_doc_e=TRUE;
|
||||
break;
|
||||
case DOCT_SPRITE:
|
||||
if (!doc_e->bin_data && doc->flags&DOCEF_HAS_BIN)
|
||||
@@ -1136,7 +1136,7 @@ rc_skip:
|
||||
}
|
||||
|
||||
if (full_refresh) {
|
||||
if (del_cl) {
|
||||
if (del_doc_e) {
|
||||
if (!(doc_e->de_flags & (DOCEF_HOLD|DOCEF_FILTER_SKIP))) {
|
||||
if (doc_e==doc->cur_entry) {
|
||||
doc->cur_entry=doc_e2;
|
||||
|
||||
@@ -179,12 +179,12 @@ public I64 DocMax(I64 i=MAX_I64)
|
||||
//Normally, the cmd line deletes entries
|
||||
//when more are added and the old scroll up.
|
||||
//See $LK,"max_entries",A="FF:::/Adam/DolDoc/DocTerm.CPP,max_entries"$.
|
||||
I64 result;
|
||||
I64 res;
|
||||
CDoc *doc;
|
||||
if (doc=DocPut) {
|
||||
result=doc->max_entries;
|
||||
res=doc->max_entries;
|
||||
doc->max_entries=i;
|
||||
return result;
|
||||
return res;
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
+14
-14
@@ -5,7 +5,7 @@ public I64 DocEntryRun(CDoc *doc,CDocEntry *doc_e,
|
||||
{//Do action on final entry selected by user.
|
||||
//Sometimes returns locked, sometimes unlocked
|
||||
U8 ch=doc->cmd_U8,*st;
|
||||
I64 result=DOCM_CANCEL,has_action=FALSE;
|
||||
I64 res=DOCM_CANCEL,has_action=FALSE;
|
||||
CHashDefineStr *temph;
|
||||
DocLock(doc);
|
||||
if (!exited) {
|
||||
@@ -25,19 +25,19 @@ public I64 DocEntryRun(CDoc *doc,CDocEntry *doc_e,
|
||||
try {
|
||||
if (ch==CH_SPACE) {
|
||||
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;
|
||||
}
|
||||
if (doc_e->de_flags & DOCEF_LEFT_EXP) {
|
||||
result=doc_e->left_exp;
|
||||
res=doc_e->left_exp;
|
||||
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) {
|
||||
DocUnlock(doc);
|
||||
result=(*doc_e->left_cb)(doc,doc_e);
|
||||
res=(*doc_e->left_cb)(doc,doc_e);
|
||||
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_POPUP) {
|
||||
@@ -57,26 +57,26 @@ public I64 DocEntryRun(CDoc *doc,CDocEntry *doc_e,
|
||||
doc_e->de_flags & DOCEF_DEFINE &&
|
||||
(temph=HashFind(doc_e->define_str,
|
||||
doc->win_task->hash_table,HTT_DEFINE_STR)) &&
|
||||
(result=PopUpPickLst(temph->data))!=DOCM_CANCEL) {
|
||||
DocDataFmt(doc,doc_e,result);
|
||||
(res=PopUpPickLst(temph->data))!=DOCM_CANCEL) {
|
||||
DocDataFmt(doc,doc_e,res);
|
||||
DocDataScan(doc,doc_e);
|
||||
has_action=TRUE;
|
||||
}
|
||||
} else if (ch=='\n') {
|
||||
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;
|
||||
}
|
||||
if (doc_e->de_flags & DOCEF_RIGHT_EXP) {
|
||||
result=doc_e->right_exp;
|
||||
res=doc_e->right_exp;
|
||||
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) {
|
||||
DocUnlock(doc);
|
||||
result=(*doc_e->right_cb)(doc,doc_e);
|
||||
res=(*doc_e->right_cb)(doc,doc_e);
|
||||
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_POPUP) {
|
||||
@@ -99,5 +99,5 @@ public I64 DocEntryRun(CDoc *doc,CDocEntry *doc_e,
|
||||
doc->cmd_U8=CH_SPACE;
|
||||
er_done:
|
||||
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)
|
||||
{//Called with doc locked, exit unlocked
|
||||
Bool result;
|
||||
Bool res;
|
||||
U8 *st;
|
||||
if (st=DocEntryLink(doc,doc_e)) {
|
||||
DocUnlock(doc);
|
||||
if (doc_e->de_flags & DOCEF_POPUP)
|
||||
result=PopUpEd(st);
|
||||
res=PopUpEd(st);
|
||||
else
|
||||
result=Ed(st);
|
||||
res=Ed(st);
|
||||
Free(st);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
I64 TermRightClickLink(CDoc *doc,CDocEntry *doc_e)
|
||||
{//Called with doc locked, exit unlocked
|
||||
Bool send_new_line=FALSE,result=FALSE;
|
||||
Bool send_new_line=FALSE,res=FALSE;
|
||||
U8 *st,*st2;
|
||||
I64 i;
|
||||
CEdFileName fn;
|
||||
@@ -122,7 +122,7 @@ I64 TermRightClickLink(CDoc *doc,CDocEntry *doc_e)
|
||||
"#include \"%s\";\n$$PT$$$$FG$$$$BG$$",st;
|
||||
WinZBufUpdate;
|
||||
ExeFile(st);
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
break;
|
||||
case RIGHT_AINCLUDE:
|
||||
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;
|
||||
WinZBufUpdate;
|
||||
AdamFile(st,FALSE);
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
break;
|
||||
case RIGHT_COPY:
|
||||
StrCpy(fn.name,st);
|
||||
if (DocForm(&fn)) {
|
||||
result=ToBool(Copy(st,fn.name));
|
||||
res=ToBool(Copy(st,fn.name));
|
||||
} else
|
||||
send_new_line=TRUE;
|
||||
break;
|
||||
case RIGHT_MOVE:
|
||||
StrCpy(fn.name,st);
|
||||
if (DocForm(&fn))
|
||||
result=Move(st,fn.name);
|
||||
res=Move(st,fn.name);
|
||||
else
|
||||
send_new_line=TRUE;
|
||||
break;
|
||||
case RIGHT_DELETE:
|
||||
result=ToBool(Del(st));
|
||||
res=ToBool(Del(st));
|
||||
break;
|
||||
case RIGHT_TYPE:
|
||||
result=Type(st);
|
||||
res=Type(st);
|
||||
break;
|
||||
case RIGHT_ED:
|
||||
"Ed(\"%s\");\n$$PT$$$$FG$$$$BG$$",st;
|
||||
result=Ed(st);
|
||||
res=Ed(st);
|
||||
break;
|
||||
case RIGHT_PLAIN:
|
||||
"Plain(\"%s\");\n$$PT$$$$FG$$$$BG$$",st;
|
||||
result=Plain(st);
|
||||
res=Plain(st);
|
||||
break;
|
||||
case RIGHT_AUTOFILE:
|
||||
if (FileExtDot(st) && !FilesFindMatch(st,"*.AUT*")) {
|
||||
@@ -174,7 +174,7 @@ I64 TermRightClickLink(CDoc *doc,CDocEntry *doc_e)
|
||||
"AutoFile(\"%s\");\n$$PT$$$$FG$$$$BG$$",st;
|
||||
WinZBufUpdate;
|
||||
AutoFile(st);
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
break;
|
||||
}
|
||||
} else
|
||||
@@ -189,5 +189,5 @@ I64 TermRightClickLink(CDoc *doc,CDocEntry *doc_e)
|
||||
"$$PT$$$$FG$$$$BG$$";
|
||||
if (send_new_line)
|
||||
'\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.
|
||||
I64 i=0,k=0;
|
||||
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;
|
||||
if (_tree_entry) *_tree_entry=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;
|
||||
if (i<=0) {
|
||||
if (_end_indent) *_end_indent=doc_e;
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ ft_done:
|
||||
DocUnlock(haystack_doc);
|
||||
Free(st1);
|
||||
Free(st2);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Bool DocTreeMake(CDoc *doc,U8 *path)
|
||||
@@ -64,7 +64,7 @@ public Bool DocTreeMake(CDoc *doc,U8 *path)
|
||||
U8 *st1=StrNew(path),
|
||||
*st2=MAlloc(StrLen(path)+1),
|
||||
*st3=StrNew(path);
|
||||
Bool result=TRUE,unlock_doc=DocLock(doc);
|
||||
Bool res=TRUE,unlock_doc=DocLock(doc);
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
doc->cur_entry=doc;
|
||||
doc->cur_col=0;
|
||||
@@ -85,7 +85,7 @@ public Bool DocTreeMake(CDoc *doc,U8 *path)
|
||||
st3=StrNew(st1);
|
||||
j=i;
|
||||
if (!*st1)
|
||||
result=FALSE;
|
||||
res=FALSE;
|
||||
else
|
||||
break;
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public Bool DocTreeMake(CDoc *doc,U8 *path)
|
||||
}
|
||||
}
|
||||
mt_done:
|
||||
if (result) {
|
||||
if (res) {
|
||||
while (*st3) {
|
||||
StrFirstRem(st3,"/",st2);
|
||||
if (*st2) {
|
||||
@@ -110,13 +110,13 @@ mt_done:
|
||||
Free(st1);
|
||||
Free(st2);
|
||||
Free(st3);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#help_index "DolDoc/Compiler;Compiler"
|
||||
public I64 ExeDoc(CDoc *doc,Bool just_load=FALSE)
|
||||
{//JIT Compile and execute a document.
|
||||
I64 result;
|
||||
I64 res;
|
||||
Bool okay=TRUE,unlock_doc=DocLock(doc);
|
||||
CCmpCtrl *cc=CmpCtrlNew(,CCF_DONT_FREE_BUF);
|
||||
if (just_load)
|
||||
@@ -127,12 +127,12 @@ public I64 ExeDoc(CDoc *doc,Bool just_load=FALSE)
|
||||
LexAttachDoc(cc,,doc);
|
||||
try {
|
||||
Lex(cc);
|
||||
result=ExeCmdLine(cc);
|
||||
res=ExeCmdLine(cc);
|
||||
} catch {
|
||||
if (Fs->except_ch=='Compiler' || Fs->except_ch=='Break') {
|
||||
Fs->catch_except=TRUE;
|
||||
okay=FALSE;
|
||||
result=0;
|
||||
res=0;
|
||||
}
|
||||
}
|
||||
QueRem(cc);
|
||||
@@ -140,7 +140,7 @@ public I64 ExeDoc(CDoc *doc,Bool just_load=FALSE)
|
||||
CmpCtrlDel(cc); //TODO: can crash
|
||||
if (unlock_doc)
|
||||
DocUnlock(doc);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public I64 DocTreeBranchExe(CDoc *doc,U8 *path)
|
||||
@@ -148,22 +148,22 @@ public I64 DocTreeBranchExe(CDoc *doc,U8 *path)
|
||||
CDoc *doc2;
|
||||
Bool unlock_doc=DocLock(doc);
|
||||
CDocEntry *tree_branch,*start_indent,*end_indent;
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
if (DocTreeFind(doc,path,&tree_branch,&start_indent,&end_indent)) {
|
||||
doc2=DocCopy(doc,tree_branch,end_indent);
|
||||
result=ExeDoc(doc2);
|
||||
res=ExeDoc(doc2);
|
||||
DocDel(doc2);
|
||||
}
|
||||
if (unlock_doc)
|
||||
DocUnlock(doc);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public I64 ExeTreeBranch(U8 *registry_file,U8 *path)
|
||||
{//JIT Compile and execute a specified branch in a specified file.
|
||||
I64 result;
|
||||
I64 res;
|
||||
CDoc *doc=DocRead(registry_file);
|
||||
result=DocTreeBranchExe(doc,path);
|
||||
res=DocTreeBranchExe(doc,path);
|
||||
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)
|
||||
{
|
||||
CEdFileLink *e=CAlloc(sizeof(CEdFileLink));
|
||||
Bool result=FALSE;
|
||||
Bool res=FALSE;
|
||||
if (type>=0) {
|
||||
e->num=1;
|
||||
switch (type) {
|
||||
case LK_FILE:
|
||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->file);
|
||||
else
|
||||
@@ -180,7 +180,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
||||
break;
|
||||
case LK_PLAIN:
|
||||
if (DocForm(e,,,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->file);
|
||||
else
|
||||
@@ -190,7 +190,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
||||
break;
|
||||
case LK_FILE_ANCHOR:
|
||||
if (DocForm(e,"CEdFileAnchorLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->aux);
|
||||
else
|
||||
@@ -200,7 +200,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
||||
break;
|
||||
case LK_FILE_FIND:
|
||||
if (DocForm(e,"CEdFileFindLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
if (e->num==1) {
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->aux);
|
||||
@@ -218,7 +218,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
||||
break;
|
||||
case LK_PLAIN_FIND:
|
||||
if (DocForm(e,"CEdFileFindLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
if (e->num==1) {
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->aux);
|
||||
@@ -236,7 +236,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
||||
break;
|
||||
case LK_FILE_LINE:
|
||||
if (DocForm(e,"CEdFileLineLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->file);
|
||||
else
|
||||
@@ -246,7 +246,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
||||
break;
|
||||
case LK_PLAIN_LINE:
|
||||
if (DocForm(e,"CEdFileLineLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->file);
|
||||
else
|
||||
@@ -256,7 +256,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
||||
break;
|
||||
case LK_MAN_PAGE:
|
||||
if (DocForm(e,"CEdManPageLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->aux);
|
||||
else
|
||||
@@ -266,7 +266,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
||||
break;
|
||||
case LK_PLACE_ANCHOR:
|
||||
if (DocForm(e,"CEdPlaceAnchor",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
if (!*e->tag) {
|
||||
if (e->hide)
|
||||
*_tag=StrNew("");
|
||||
@@ -279,7 +279,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
||||
break;
|
||||
case LK_BIBLE_FIND:
|
||||
if (DocForm(e,"CEdBibleLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=MStrPrint("%Z,%s",e->book,"ST_BIBLE_BOOKS",e->aux);
|
||||
else
|
||||
@@ -290,7 +290,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
||||
case LK_DEF:
|
||||
e->num=-1;
|
||||
if (DocForm(e,"CEdDefLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->aux);
|
||||
else
|
||||
@@ -304,7 +304,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
||||
break;
|
||||
case LK_HELP_INDEX:
|
||||
if (DocForm(e,"CEdManPageLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->aux);
|
||||
else
|
||||
@@ -315,7 +315,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
||||
case LK_ADDR:
|
||||
e->num=DFT_ADDR_LINK_BIN_SIZE;
|
||||
if (DocForm(e,"CEdAddrLink",,,ctrl_L_footer)) {
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
if (e->num==DFT_ADDR_LINK_BIN_SIZE) {
|
||||
if (!*e->tag)
|
||||
*_tag=StrNew(e->aux);
|
||||
@@ -346,7 +346,7 @@ Bool GetLink(I64 type,U8 **_tag,U8 **_link,Bool *_pop_up,
|
||||
else
|
||||
*_quote=FALSE;
|
||||
Free(e);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 EdInsLink()
|
||||
@@ -1092,15 +1092,15 @@ class CEdMenuSprite
|
||||
|
||||
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;
|
||||
I64 type=PopUpLinkType(FALSE);
|
||||
*_html_link=NULL;
|
||||
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(link);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
U8 *EdSprite(I64 bin_num)
|
||||
|
||||
+25
-19
@@ -143,7 +143,7 @@ U0 BibleInit()
|
||||
|
||||
public U8 *BibleLine2Verse(I64 line,I64 separate_ch=CH_SPACE)
|
||||
{//Line number to verse str, Malloc()ed.
|
||||
//Separate with <SPACE> or ','.
|
||||
//Separate with <SPACE> or ','. If you pass '%', it uses "%20".
|
||||
CDoc *doc;
|
||||
CDocEntry *doc_e;
|
||||
I64 i=0,cnt=DefineCnt("ST_BIBLE_BOOKS"),start=0,last_start=0;
|
||||
@@ -167,6 +167,9 @@ public U8 *BibleLine2Verse(I64 line,I64 separate_ch=CH_SPACE)
|
||||
while ('0'<=*ptr2<='9' || *ptr2==':')
|
||||
ptr2++;
|
||||
*ptr2=0;
|
||||
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 {
|
||||
while (TRUE) {
|
||||
@@ -195,6 +198,9 @@ public U8 *BibleLine2Verse(I64 line,I64 separate_ch=CH_SPACE)
|
||||
while ('0'<=*ptr2<='9')
|
||||
ptr2++;
|
||||
*ptr2=0;
|
||||
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;
|
||||
}
|
||||
@@ -272,8 +278,8 @@ public U0 BibleVerse(CDoc *doc_out=NULL,U8 *verse,I64 lines)
|
||||
|
||||
public CDoc *BibleDoc()
|
||||
{//Return Bible as DolDoc with trees.
|
||||
CDoc *result=DocRead(BIBLE_FILENAME);
|
||||
CDocEntry *doc_e=result->root.next,*doc_e1;
|
||||
CDoc *res=DocRead(BIBLE_FILENAME);
|
||||
CDocEntry *doc_e=res->root.next,*doc_e1;
|
||||
Bool open_chapter=FALSE;
|
||||
U8 *ptr=Define("ST_BIBLE_BOOK_LINES");
|
||||
I64 book,book_cnt=DefineCnt("ST_BIBLE_BOOK_LINES")-1,
|
||||
@@ -283,47 +289,47 @@ public CDoc *BibleDoc()
|
||||
for (book=0;book<book_cnt;book++) {
|
||||
while (doc_e->y+1<line) {
|
||||
doc_e1=doc_e->next;
|
||||
DocEntryDel(result,doc_e);
|
||||
DocEntryDel(res,doc_e);
|
||||
doc_e=doc_e1;
|
||||
}
|
||||
result->cur_entry=doc_e;
|
||||
result->cur_col=0;
|
||||
DocPrint(result,"$$TR,\"%Z\"$$\n$$ID,2$$",book,"ST_BIBLE_BOOKS");
|
||||
res->cur_entry=doc_e;
|
||||
res->cur_col=0;
|
||||
DocPrint(res,"$$TR,\"%Z\"$$\n$$ID,2$$",book,"ST_BIBLE_BOOKS");
|
||||
line=Str2I64(ptr,,&ptr);
|
||||
ptr++;
|
||||
chapter=1;
|
||||
while (doc_e->y+1<line) {
|
||||
doc_e1=doc_e->next;
|
||||
if (doc_e->type_u8==DOCT_TEXT && StrMatch(":1 ",doc_e->tag)) {
|
||||
result->cur_entry=doc_e;
|
||||
result->cur_col=0;
|
||||
res->cur_entry=doc_e;
|
||||
res->cur_col=0;
|
||||
if (open_chapter) {
|
||||
DocPrint(result,"$$ID,-2$$");
|
||||
DocPrint(res,"$$ID,-2$$");
|
||||
open_chapter=FALSE;
|
||||
}
|
||||
DocPrint(result,"$$TR,\"%d\"$$\n$$ID,2$$",chapter++);
|
||||
DocPrint(res,"$$TR,\"%d\"$$\n$$ID,2$$",chapter++);
|
||||
open_chapter=TRUE;
|
||||
} else if (chapter==1) {
|
||||
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;
|
||||
result->cur_col=0;
|
||||
res->cur_entry=doc_e;
|
||||
res->cur_col=0;
|
||||
if (open_chapter) {
|
||||
DocPrint(result,"$$ID,-2$$");
|
||||
DocPrint(res,"$$ID,-2$$");
|
||||
open_chapter=FALSE;
|
||||
}
|
||||
DocPrint(result,"$$ID,-2$$");
|
||||
DocPrint(res,"$$ID,-2$$");
|
||||
}
|
||||
while (doc_e!=result) {
|
||||
while (doc_e!=res) {
|
||||
doc_e1=doc_e->next;
|
||||
DocEntryDel(result,doc_e);
|
||||
DocEntryDel(res,doc_e);
|
||||
doc_e=doc_e1;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public U0 BibleView()
|
||||
|
||||
@@ -72,10 +72,10 @@ U0 GodDoodleHexIns(U8 *st)
|
||||
I64 GodDoodleBits(I64 num_bits)
|
||||
{
|
||||
U8 b;
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
while (num_bits) {
|
||||
if (FifoU8Rem(god.doodle_fifo,&b)) {
|
||||
result=result<<1+b;
|
||||
res=res<<1+b;
|
||||
num_bits--;
|
||||
} else {
|
||||
god.doodle_ch=GetChar(,FALSE);
|
||||
@@ -90,7 +90,7 @@ I64 GodDoodleBits(I64 num_bits)
|
||||
GodDoodleBitsIns(GOD_GOOD_BITS,KbdMouseEvtTime>>GOD_BAD_BITS);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public U8 *GodDoodleSprite(U8 *hex=NULL)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
$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?
|
||||
|
||||
|
||||
@@ -62,15 +62,15 @@ public U0 GodHexIns(U8 *st)
|
||||
public I64 GodBits(I64 num_bits,U8 *msg=NULL)
|
||||
{//Return N bits. If low on entropy pop-up okay.
|
||||
U8 b;
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
while (num_bits) {
|
||||
if (FifoU8Rem(god.fifo,&b)) {
|
||||
result=result<<1+b;
|
||||
res=res<<1+b;
|
||||
num_bits--;
|
||||
} else
|
||||
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)
|
||||
|
||||
+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,
|
||||
CTask *task=NULL)
|
||||
{//Extract new device context rect from device context.
|
||||
CDC *result;
|
||||
CDC *res;
|
||||
CTask *win_task;
|
||||
if (x1>x2) SwapI64(&x1,&x2);
|
||||
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;
|
||||
y2+=win_task->pix_top +win_task->scroll_y;
|
||||
}
|
||||
result=DCNew(x2-x1+1,y2-y1+1,task);
|
||||
DCFill(result);
|
||||
GrBlot(result,-x1,-y1,dc);
|
||||
return result;
|
||||
res=DCNew(x2-x1+1,y2-y1+1,task);
|
||||
DCFill(res);
|
||||
GrBlot(res,-x1,-y1,dc);
|
||||
return res;
|
||||
}
|
||||
|
||||
#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)
|
||||
{//Use $LK,"GrPrint",A="MN:GrPrint"$()
|
||||
I64 x0,ch,result;
|
||||
I64 x0,ch,res;
|
||||
if (!_s) return 0;
|
||||
x0=x;
|
||||
result=0;
|
||||
res=0;
|
||||
while (ch=*_s++) {
|
||||
if (ch=='\n') {
|
||||
x=x0;
|
||||
@@ -873,20 +873,20 @@ I64 GrPutS(CDC *dc=gr.dc,I64 x,I64 y,U8 *_s)
|
||||
} else if (ch=='\t')
|
||||
x=x0+CeilU64(x-x0+FONT_WIDTH,8*FONT_WIDTH);
|
||||
else {
|
||||
result+=GrPutChar(dc,x,y,ch);
|
||||
res+=GrPutChar(dc,x,y,ch);
|
||||
x+=FONT_WIDTH;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
I64 GrVPutS(CDC *dc=gr.dc,I64 x,I64 y,U8 *_s)
|
||||
{//Vertical Text. Use $LK,"GrVPrint",A="MN:GrVPrint"$()
|
||||
I64 y0,result;
|
||||
I64 y0,res;
|
||||
U8 buf[2];
|
||||
if (!_s) return 0;
|
||||
y0=y;
|
||||
result=0;
|
||||
res=0;
|
||||
|
||||
buf[1]=0;
|
||||
while (*buf=*_s++) {
|
||||
@@ -896,36 +896,36 @@ I64 GrVPutS(CDC *dc=gr.dc,I64 x,I64 y,U8 *_s)
|
||||
} else if (*buf=='\t')
|
||||
y=y0+CeilU64(y-y0+FONT_HEIGHT,8*FONT_HEIGHT);
|
||||
else {
|
||||
result+=GrPutS(dc,x,y,buf);
|
||||
res+=GrPutS(dc,x,y,buf);
|
||||
y+=FONT_HEIGHT;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public I64 GrPrint(CDC *dc=gr.dc,I64 x,I64 y,U8 *fmt,...)
|
||||
{//2D. Clipping but not transformation.
|
||||
I64 result;
|
||||
I64 res;
|
||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
||||
result=GrPutS(dc,x,y,buf);
|
||||
res=GrPutS(dc,x,y,buf);
|
||||
Free(buf);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public I64 GrVPrint(CDC *dc=gr.dc,I64 x,I64 y,U8 *fmt,...)
|
||||
{//2D. Vertical text. Clipping but not transformation.
|
||||
I64 result;
|
||||
I64 res;
|
||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
||||
result=GrVPutS(dc,x,y,buf);
|
||||
res=GrVPutS(dc,x,y,buf);
|
||||
Free(buf);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#help_index "Graphics"
|
||||
public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
{//2D. Width Height. Clipping but not transformation.
|
||||
//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,
|
||||
trailing_pixels,leading_pixel_mask,trailing_pixel_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];
|
||||
if (leading_pixels+trailing_pixels>w2-w1) {
|
||||
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;
|
||||
}
|
||||
if (color.c0.rop==ROPB_COLLISION) {//TODO: Might want to check win_z_buf
|
||||
color =dc->bkcolor.c0.color;
|
||||
k1=(h1+y)*dc->width_internal+x;
|
||||
result=-dc->collision_cnt;
|
||||
res=-dc->collision_cnt;
|
||||
for (j=h2-h1;j;j--) {
|
||||
for (i=w1;i<w2;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;
|
||||
}
|
||||
result+=dc->collision_cnt;
|
||||
res+=dc->collision_cnt;
|
||||
} else {
|
||||
if (!(dc->flags & DCF_SCREEN_BITMAP) || dc->flags&DCF_ON_TOP)
|
||||
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_MONO:
|
||||
if (win_z_buf_ptr) {
|
||||
result=0;
|
||||
res=0;
|
||||
for (j=h1;j<h2;j++) {
|
||||
color_mask=gr.to_8_colors[color.c0.color];
|
||||
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++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||
color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
res+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
}
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=color_mask;
|
||||
result+=8;
|
||||
res+=8;
|
||||
}
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
res+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
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
|
||||
color.c0=dither_colors.c0;
|
||||
}
|
||||
result=(h2-h1)*(w2-w1);
|
||||
res=(h2-h1)*(w2-w1);
|
||||
}
|
||||
break;
|
||||
case ROPB_XOR:
|
||||
if (win_z_buf_ptr) {
|
||||
result=0;
|
||||
res=0;
|
||||
for (j=h1;j<h2;j++) {
|
||||
color_mask=gr.to_8_colors[color.c0.color];
|
||||
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++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||
*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
res+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
}
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)^=color_mask;
|
||||
result+=8;
|
||||
res+=8;
|
||||
}
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
res+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
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
|
||||
color.c0=dither_colors.c0;
|
||||
}
|
||||
result=(h2-h1)*(w2-w1);
|
||||
res=(h2-h1)*(w2-w1);
|
||||
}
|
||||
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_MONO:
|
||||
if (win_z_buf_ptr) {
|
||||
result=0;
|
||||
res=0;
|
||||
for (j=h1;j<h2;j++) {
|
||||
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];
|
||||
@@ -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++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||
color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
res+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
}
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=color_mask;
|
||||
result+=8;
|
||||
res+=8;
|
||||
}
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
res+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
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;
|
||||
SwapU16(&color.c0,&color.c1);
|
||||
}
|
||||
result=(h2-h1)*(w2-w1);
|
||||
res=(h2-h1)*(w2-w1);
|
||||
}
|
||||
break;
|
||||
case ROPB_XOR:
|
||||
if (win_z_buf_ptr) {
|
||||
result=0;
|
||||
res=0;
|
||||
for (j=h1;j<h2;j++) {
|
||||
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];
|
||||
@@ -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++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||
*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
res+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
}
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)^=color_mask;
|
||||
result+=8;
|
||||
res+=8;
|
||||
}
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
res+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
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;
|
||||
SwapU16(&color.c0,&color.c1);
|
||||
}
|
||||
result=(h2-h1)*(w2-w1);
|
||||
res=(h2-h1)*(w2-w1);
|
||||
}
|
||||
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_MONO:
|
||||
if (win_z_buf_ptr) {
|
||||
result=0;
|
||||
res=0;
|
||||
for (j=h1;j<h2;j++) {
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||
color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
res+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
}
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=color_mask;
|
||||
result+=8;
|
||||
res+=8;
|
||||
}
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
res+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
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;
|
||||
kk1+=dc->width_internal;
|
||||
}
|
||||
result=(h2-h1)*(w2-w1);
|
||||
res=(h2-h1)*(w2-w1);
|
||||
}
|
||||
break;
|
||||
case ROPB_XOR:
|
||||
if (win_z_buf_ptr) {
|
||||
result=0;
|
||||
res=0;
|
||||
for (j=h1;j<h2;j++) {
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|
|
||||
*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
res+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
}
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)^=color_mask;
|
||||
result+=8;
|
||||
res+=8;
|
||||
}
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
res+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
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;
|
||||
kk1+=dc->width_internal;
|
||||
}
|
||||
result=(h2-h1)*(w2-w1);
|
||||
res=(h2-h1)*(w2-w1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
I64 GrRayLenMinus(CDC *dc,I64 x,I64 y)
|
||||
{
|
||||
//Returns cnt of pixs changed
|
||||
I64 result=0,c,x3,y3,d;
|
||||
I64 res=0,c,x3,y3,d;
|
||||
U8 *dst,*dst2;
|
||||
Bool not_color=ToBool(dc->flags&DCF_FILL_NOT_COLOR);
|
||||
CTask *win_task;
|
||||
@@ -1417,19 +1417,19 @@ I64 GrRayLenMinus(CDC *dc,I64 x,I64 y)
|
||||
c=*dst;
|
||||
if (not_color) {
|
||||
if (c!=dc->color2) {
|
||||
result++;
|
||||
res++;
|
||||
x--;
|
||||
} else
|
||||
break;
|
||||
} else {
|
||||
if (c==dc->color2) {
|
||||
result++;
|
||||
res++;
|
||||
x--;
|
||||
} else
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
gr_done:
|
||||
return 0;
|
||||
}
|
||||
@@ -1437,7 +1437,7 @@ gr_done:
|
||||
I64 GrRayLen(CDC *dc,I64 *x1,I64 y,I64 z=0,I32 *db=NULL)
|
||||
{
|
||||
//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,
|
||||
not_color=ToBool(dc->flags&DCF_FILL_NOT_COLOR);
|
||||
U8 *dst,*dst2;
|
||||
@@ -1551,7 +1551,7 @@ I64 GrRayLen(CDC *dc,I64 *x1,I64 y,I64 z=0,I32 *db=NULL)
|
||||
*dst^=c;
|
||||
break;
|
||||
}
|
||||
result++;
|
||||
res++;
|
||||
x++;
|
||||
} else
|
||||
break;
|
||||
@@ -1628,12 +1628,12 @@ I64 GrRayLen(CDC *dc,I64 *x1,I64 y,I64 z=0,I32 *db=NULL)
|
||||
*dst^=c;
|
||||
break;
|
||||
}
|
||||
result++;
|
||||
res++;
|
||||
x--;
|
||||
} else
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
gr_done:
|
||||
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.
|
||||
//Returns cnt of pixs changed
|
||||
//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;
|
||||
CColorROPU32 c,c2,color=dc->color,bkcolor=dc->bkcolor,dither_colors;
|
||||
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;
|
||||
break;
|
||||
}
|
||||
result++;
|
||||
res++;
|
||||
}
|
||||
}
|
||||
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:
|
||||
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.
|
||||
//Returns cnt of pixs changed
|
||||
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 (dc->flags & DCF_SYMMETRY) {
|
||||
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);
|
||||
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)
|
||||
return result;
|
||||
return res;
|
||||
for (i=1;i<n-1;i++) {
|
||||
j=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);
|
||||
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)
|
||||
@@ -105,7 +105,7 @@ public Bool GrArrow3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,
|
||||
{//3D. Transformation with pen width.
|
||||
I64 _x1,_y1,_z1,_x2,_y2,_z2,dx,dy;
|
||||
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) {
|
||||
(*dc->transform)(dc,&x1,&y1,&z1);
|
||||
(*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;
|
||||
DCReflect(dc,&_x2,&_y2,&_z2);
|
||||
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;
|
||||
if (d=Sqrt(dx*dx+dy*dy)) {
|
||||
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);
|
||||
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);
|
||||
}
|
||||
was_symmetry=TRUE;
|
||||
if (dc->flags&DCF_JUST_MIRROR)
|
||||
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;
|
||||
if (d=Sqrt(dx*dx+dy*dy)) {
|
||||
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);
|
||||
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);
|
||||
}
|
||||
gr_done:
|
||||
@@ -145,14 +145,14 @@ gr_done:
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
if (was_symmetry)
|
||||
dc->flags|=DCF_SYMMETRY;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#help_index "Graphics/Char;Char/Graphics"
|
||||
public Bool GrTextBox3(CDC *dc=gr.dc,I64 x1,I64 y1,I64 z1,U8 *s,I64 border=2)
|
||||
{//3D. Transformation. DCF_SYMMETRY is silly.
|
||||
U8 *ptr;
|
||||
I64 ch,result,w,w_max,h;
|
||||
I64 ch,res,w,w_max,h;
|
||||
if (!s) return FALSE;
|
||||
ptr=s;
|
||||
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;
|
||||
}
|
||||
if (w>w_max) w_max=w;
|
||||
result=GrPrint(dc,x1,y1,"%s",s);
|
||||
result|=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);
|
||||
result|=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);
|
||||
return ToBool(result);
|
||||
res=GrPrint(dc,x1,y1,"%s",s);
|
||||
res|=GrLine(dc,x1-border ,y1-border ,x1+w_max+border,y1-border);
|
||||
res|=GrLine(dc,x1-border ,y1+h+border,x1+w_max+border,y1+h+border);
|
||||
res|=GrLine(dc,x1-border ,y1-border ,x1-border,y1+h+border);
|
||||
res|=GrLine(dc,x1+w_max+border,y1-border ,x1+w_max+border,y1+h+border);
|
||||
return ToBool(res);
|
||||
}
|
||||
|
||||
#define MAX_DIAMOND_SLOPE 2.75
|
||||
@@ -185,7 +185,7 @@ public Bool GrTextDiamond3(CDC *dc=gr.dc,
|
||||
{//3D. Transformation. DCF_SYMMETRY is silly.
|
||||
Bool first=TRUE;
|
||||
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;
|
||||
if (!_s) return FALSE;
|
||||
if (dc->flags & DCF_TRANSFORMATION)
|
||||
@@ -214,10 +214,10 @@ public Bool GrTextDiamond3(CDC *dc=gr.dc,
|
||||
|
||||
w=(StrLen(st)*FONT_WIDTH)>>1;
|
||||
if (first) {
|
||||
result|=GrPrint(dc,x1-w,y,"%s",st);
|
||||
res|=GrPrint(dc,x1-w,y,"%s",st);
|
||||
first=FALSE;
|
||||
} else
|
||||
result|=GrPrint(dc,x1-w,y,"%s",st);
|
||||
res|=GrPrint(dc,x1-w,y,"%s",st);
|
||||
if (w) {
|
||||
w+=border;
|
||||
do {
|
||||
@@ -238,11 +238,11 @@ public Bool GrTextDiamond3(CDC *dc=gr.dc,
|
||||
}
|
||||
Free(s);
|
||||
|
||||
result|=GrLine(dc,x1,y1-dy,x1+dx,y1);
|
||||
result|=GrLine(dc,x1+dx,y1,x1,y1+dy);
|
||||
result|=GrLine(dc,x1,y1+dy,x1-dx,y1);
|
||||
result|=GrLine(dc,x1-dx,y1,x1,y1-dy);
|
||||
return ToBool(result);
|
||||
res|=GrLine(dc,x1,y1-dy,x1+dx,y1);
|
||||
res|=GrLine(dc,x1+dx,y1,x1,y1+dy);
|
||||
res|=GrLine(dc,x1,y1+dy,x1-dx,y1);
|
||||
res|=GrLine(dc,x1-dx,y1,x1,y1-dy);
|
||||
return ToBool(res);
|
||||
}
|
||||
|
||||
#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)
|
||||
{//Returns cnt of pixs changed.
|
||||
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;
|
||||
CMeshTri *tri_sym=tri;
|
||||
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++) {
|
||||
(*dc->lighting)(dc,&p_sym[tri_sym->nums[0]],&p_sym[tri_sym->nums[2]],
|
||||
&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]]);
|
||||
}
|
||||
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++) {
|
||||
(*dc->lighting)(dc,&p[tri->nums[0]],&p[tri->nums[1]],
|
||||
&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:
|
||||
dc->color=old_color;
|
||||
Free(pt);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#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)
|
||||
{//Create alias of dc, so can change pen, color, etc.
|
||||
//NULL means gr.dc
|
||||
CDC *result;
|
||||
CDC *res;
|
||||
if (!dc) dc=gr.dc;
|
||||
if (!task) task=Fs;
|
||||
if (dc->dc_signature!=DCS_SIGNATURE_VAL)
|
||||
throw('Graphics');
|
||||
result=MAlloc(sizeof(CDC),task);
|
||||
MemCpy(result,dc,sizeof(CDC));
|
||||
result->win_task=result->mem_task=task;
|
||||
result->r=MAlloc(16*sizeof(I64),task);
|
||||
DCRst(result);
|
||||
result->flags|=DCF_ALIAS;
|
||||
result->alias=dc;
|
||||
return result;
|
||||
res=MAlloc(sizeof(CDC),task);
|
||||
MemCpy(res,dc,sizeof(CDC));
|
||||
res->win_task=res->mem_task=task;
|
||||
res->r=MAlloc(16*sizeof(I64),task);
|
||||
DCRst(res);
|
||||
res->flags|=DCF_ALIAS;
|
||||
res->alias=dc;
|
||||
return res;
|
||||
}
|
||||
|
||||
public CDC *DCNew(I64 width,I64 height,CTask *task=NULL,Bool null_bitmap=FALSE)
|
||||
{//Create new width x height device context.
|
||||
//Internally only allows widths which are divisible by 8.
|
||||
//Don't forget these $MA-X+PU,"sizeof(CDC)",LM="Find(\"sizeof(CDC)\",\"/*\");View;"$.
|
||||
CDC *result;
|
||||
CDC *res;
|
||||
if (!task) task=Fs;
|
||||
result=CAlloc(sizeof(CDC),task);
|
||||
result->win_task=task;
|
||||
result->mem_task=task;
|
||||
result->width=width;
|
||||
result->width_internal=(width+7)&~7;
|
||||
result->height=height;
|
||||
res=CAlloc(sizeof(CDC),task);
|
||||
res->win_task=task;
|
||||
res->mem_task=task;
|
||||
res->width=width;
|
||||
res->width_internal=(width+7)&~7;
|
||||
res->height=height;
|
||||
if (null_bitmap)
|
||||
result->flags|=DCF_DONT_DRAW;
|
||||
res->flags|=DCF_DONT_DRAW;
|
||||
else
|
||||
result->body=CAlloc(result->width_internal*result->height,task);
|
||||
result->r=MAlloc(16*sizeof(I64),task);
|
||||
DCRst(result);
|
||||
result->dc_signature=DCS_SIGNATURE_VAL;
|
||||
return result;
|
||||
res->body=CAlloc(res->width_internal*res->height,task);
|
||||
res->r=MAlloc(16*sizeof(I64),task);
|
||||
DCRst(res);
|
||||
res->dc_signature=DCS_SIGNATURE_VAL;
|
||||
return res;
|
||||
}
|
||||
|
||||
public U0 DCDel(CDC *dc)
|
||||
@@ -241,16 +241,16 @@ public U0 DCDepthBufAlloc(CDC *dc)
|
||||
|
||||
public CDC *DCCopy(CDC *dc,CTask *task=NULL)
|
||||
{//Alloc copy of dc, including image body, rot mat and depth buf.
|
||||
CDC *result;
|
||||
CDC *res;
|
||||
if (!dc) return NULL;
|
||||
if (dc->dc_signature!=DCS_SIGNATURE_VAL)
|
||||
throw('Graphics');
|
||||
result=MAllocIdentical(dc,task);
|
||||
DCMat4x4Set(result,Mat4x4New(dc->r,task));
|
||||
result->mem_task=task;
|
||||
result->body=MAllocIdentical(dc->body,task);
|
||||
result->depth_buf=MAllocIdentical(dc->depth_buf,task);
|
||||
return result;
|
||||
res=MAllocIdent(dc,task);
|
||||
DCMat4x4Set(res,Mat4x4New(dc->r,task));
|
||||
res->mem_task=task;
|
||||
res->body=MAllocIdent(dc->body,task);
|
||||
res->depth_buf=MAllocIdent(dc->depth_buf,task);
|
||||
return res;
|
||||
}
|
||||
|
||||
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)
|
||||
{//Find and replace src color with dst in device context.
|
||||
I64 i,result=0;
|
||||
I64 i,res=0;
|
||||
U8 *dst;
|
||||
dst=dc->body;
|
||||
i=dc->width_internal*dc->height;
|
||||
while (i--)
|
||||
if (*dst==src_color) {
|
||||
*dst++=dst_color;
|
||||
result++;
|
||||
res++;
|
||||
} else
|
||||
dst++;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public U8 *DCSave(CDC *dc,I64 *_size=NULL,I64 dcsf_flags=DCSF_COMPRESSED)
|
||||
{//Stores device context to mem, perhaps, with compression.
|
||||
U8 *result,*ptr,*body;
|
||||
U8 *res,*ptr,*body;
|
||||
CArcCompress *arc;
|
||||
I64 body_size=dc->width_internal*dc->height,total_size,flags;
|
||||
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);
|
||||
}
|
||||
|
||||
ptr=result=MAlloc(total_size);
|
||||
ptr=res=MAlloc(total_size);
|
||||
|
||||
#assert !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);
|
||||
if (_size) *_size=total_size;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public CDC *DCLoad(U8 *src,I64 *_size=NULL,CTask *task=NULL)
|
||||
{//Loads device context from mem.
|
||||
CDC *result;
|
||||
CDC *res;
|
||||
U8 *ptr=src;
|
||||
CArcCompress *arc;
|
||||
I64 body_size;
|
||||
if (!task) task=Fs;
|
||||
result=CAlloc(sizeof(CDC),task);
|
||||
result->win_task=task;
|
||||
result->mem_task=task;
|
||||
MemCpy(&result->start,ptr,offset(CDC.end)-offset(CDC.start));
|
||||
res=CAlloc(sizeof(CDC),task);
|
||||
res->win_task=task;
|
||||
res->mem_task=task;
|
||||
MemCpy(&res->start,ptr,offset(CDC.end)-offset(CDC.start));
|
||||
ptr+=offset(CDC.end)-offset(CDC.start);
|
||||
|
||||
if (result->flags&DCF_PALETTE) {
|
||||
MemCpy(&result->palette,ptr,NUM_COLORS*sizeof(CBGR48));
|
||||
if (res->flags&DCF_PALETTE) {
|
||||
MemCpy(&res->palette,ptr,NUM_COLORS*sizeof(CBGR48));
|
||||
ptr+=NUM_COLORS*sizeof(CBGR48);
|
||||
} 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;
|
||||
if (result->flags&DCF_COMPRESSED) {
|
||||
result->flags&=~DCF_COMPRESSED;
|
||||
body_size=res->width_internal*res->height;
|
||||
if (res->flags&DCF_COMPRESSED) {
|
||||
res->flags&=~DCF_COMPRESSED;
|
||||
arc=ptr;
|
||||
result->body=ExpandBuf(arc,task);
|
||||
res->body=ExpandBuf(arc,task);
|
||||
ptr+=arc->compressed_size;
|
||||
} else {
|
||||
result->body=MAlloc(body_size,task);
|
||||
MemCpy(result->body,ptr,body_size);
|
||||
res->body=MAlloc(body_size,task);
|
||||
MemCpy(res->body,ptr,body_size);
|
||||
ptr+=body_size;
|
||||
}
|
||||
result->pen_width=1;
|
||||
result->r=Mat4x4IdentNew(task);
|
||||
result->r_norm.u32[1]=1;
|
||||
result->dc_signature=DCS_SIGNATURE_VAL;
|
||||
res->pen_width=1;
|
||||
res->r=Mat4x4IdentNew(task);
|
||||
res->r_norm.u32[1]=1;
|
||||
res->dc_signature=DCS_SIGNATURE_VAL;
|
||||
if (_size) *_size=ptr-src;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#help_index "Graphics/GRA Files"
|
||||
|
||||
+2
-2
@@ -60,10 +60,10 @@ U0 GrSetUpTables()
|
||||
MemSet(VGAM_TEXT,0,TEXT_ROWS*TEXT_COLS*sizeof(U16));
|
||||
MemSet(gr.vga_text_cache,0,TEXT_ROWS*TEXT_COLS*sizeof(U16));
|
||||
} else {
|
||||
OutU8(VGAP_INDEX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_IDX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,0x0F);
|
||||
//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);
|
||||
}
|
||||
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"
|
||||
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));
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public F64 D3I32Norm(CD3I32 *p)
|
||||
{//Norm of p.
|
||||
{//Norm
|
||||
return Sqrt(SqrI64(p->x)+SqrI64(p->y)+SqrI64(p->z));
|
||||
}
|
||||
|
||||
public I64 D3I32NormSqr(CD3I32 *p)
|
||||
{//Norm Squared of p.
|
||||
{//Norm Squared
|
||||
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)
|
||||
{//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;
|
||||
PUSHFD
|
||||
CLI
|
||||
@@ -53,12 +53,12 @@ public CBGR48 GrPaletteColorGet(I64 color_num)
|
||||
Yield;
|
||||
OutU8(VGAP_PALETTE_MASK,0xFF);
|
||||
OutU8(VGAP_REG_READ,color_num);
|
||||
result.r=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
||||
result.g=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
||||
result.b=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
||||
res.r=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
||||
res.g=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
||||
res.b=0xFFFF<<10*InU8(VGAP_PALETTE_DATA)/0xFC00;
|
||||
LBtr(&sys_semas[SYS_SEMA_VGA],0);
|
||||
POPFD
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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.
|
||||
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)
|
||||
Dbg("Stk Overflow",Fs);
|
||||
|
||||
result=ray_len=GrRayLen(dc,&x,y,z,db);
|
||||
res=ray_len=GrRayLen(dc,&x,y,z,db);
|
||||
y--;
|
||||
j=ray_len;
|
||||
x1=x;
|
||||
while (j>0) {
|
||||
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;
|
||||
x1-=ray_len2+1;
|
||||
}
|
||||
@@ -155,11 +155,11 @@ I64 GrFloodFillRay(CDC *dc,I64 x,I64 y,I64 z,I32 *db)
|
||||
x1=x;
|
||||
while (j>0) {
|
||||
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;
|
||||
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)
|
||||
{//See the above commented-out routine for an easier to understand version.
|
||||
//Returns cnt of pixs changed
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
//We don't dynamically calculate the size to avoid
|
||||
//fragmentation of memory.
|
||||
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] {
|
||||
case 0:
|
||||
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->j=f->ray_len;
|
||||
f->x1=f->x;
|
||||
@@ -233,7 +233,7 @@ I64 GrFloodFillRay(CDC *dc,I64 x,I64 y,I64 z,I32 *db)
|
||||
}
|
||||
} while (f>=f_dc);
|
||||
Free(f_dc);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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=FALSE means fill all parts equ to the color under the point.
|
||||
//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;
|
||||
CDC *old_brush;
|
||||
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 ||
|
||||
!not_color)
|
||||
result=GrFloodFillRay(dc,x,y,z,db);
|
||||
res=GrFloodFillRay(dc,x,y,z,db);
|
||||
}
|
||||
ff_done:
|
||||
dc->brush=old_brush;
|
||||
dc->flags=old_flags;
|
||||
dc->color2=old_color2;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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,
|
||||
I64 step=1,I64 start=0)
|
||||
{//2D. Clipping but not transformation.
|
||||
Bool result=FALSE;
|
||||
Bool res=FALSE;
|
||||
I32 *db=dc->depth_buf;
|
||||
dc->depth_buf=NULL;
|
||||
if (step==1 && !start && !dc->brush && !dc->depth_buf) {
|
||||
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
|
||||
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;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Bool GrCircle(CDC *dc=gr.dc,I64 cx,I64 cy,I64 radius,
|
||||
I64 step=1,F64 start_radians=0,F64 len_radians=2*ã)
|
||||
{//2D. Clipping but not transformation.
|
||||
Bool result;
|
||||
Bool res;
|
||||
I32 *db=dc->depth_buf;
|
||||
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;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Bool GrEllipse(CDC *dc=gr.dc,
|
||||
@@ -473,13 +473,13 @@ public Bool GrEllipse(CDC *dc=gr.dc,
|
||||
F64 start_radians=0,
|
||||
F64 len_radians=2*ã)
|
||||
{//2D. Clipping but not transformation.
|
||||
Bool result;
|
||||
Bool res;
|
||||
I32 *db=dc->depth_buf;
|
||||
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);
|
||||
dc->depth_buf=db;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Bool GrRegPoly(CDC *dc=gr.dc,
|
||||
@@ -490,13 +490,13 @@ public Bool GrRegPoly(CDC *dc=gr.dc,
|
||||
F64 start_radians=0,
|
||||
F64 len_radians=2*ã)
|
||||
{//2D. Clipping but no transform or pen width.
|
||||
Bool result;
|
||||
Bool res;
|
||||
I32 *db=dc->depth_buf;
|
||||
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);
|
||||
dc->depth_buf=db;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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)
|
||||
{//3D. Transformation with pen width.
|
||||
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) {
|
||||
(*dc->transform)(dc,&x1,&y1,&z1);
|
||||
(*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 &&
|
||||
!dc->depth_buf) {//TODO: clip z for depth buf
|
||||
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
|
||||
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;
|
||||
if (dc->flags&DCF_JUST_MIRROR)
|
||||
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 &&
|
||||
!dc->depth_buf) {//TODO: clip z for depth buf
|
||||
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
|
||||
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:
|
||||
if (was_transform)
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
if (was_symmetry)
|
||||
dc->flags|=DCF_SYMMETRY;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#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,...)
|
||||
{//3D. Transformation. DCF_SYMMETRY is silly.
|
||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
||||
I64 result;
|
||||
I64 res;
|
||||
if (dc->flags & DCF_TRANSFORMATION)
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
result=GrPrint(dc,x,y,"%s",buf);
|
||||
res=GrPrint(dc,x,y,"%s",buf);
|
||||
Free(buf);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public I64 GrVPrint3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *fmt,...)
|
||||
{//3D. Vertical text. Transformation. DCF_SYMMETRY is silly.
|
||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
||||
I64 result;
|
||||
I64 res;
|
||||
if (dc->flags & DCF_TRANSFORMATION)
|
||||
(*dc->transform)(dc,&x,&y,&z);
|
||||
result=GrVPrint(dc,x,y,"%s",buf);
|
||||
res=GrVPrint(dc,x,y,"%s",buf);
|
||||
Free(buf);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#help_index "Graphics"
|
||||
@@ -601,7 +601,7 @@ public Bool GrEllipse3(CDC *dc=gr.dc,
|
||||
F64 start_radians=0,
|
||||
F64 len_radians=2*ã)
|
||||
{//3D. Transformation with pen width.
|
||||
Bool result;
|
||||
Bool res;
|
||||
I64 x,y,z,xx,yy,zz;
|
||||
F64 m1,a1,m2,a2,s,c;
|
||||
if (dc->flags & DCF_TRANSFORMATION) {
|
||||
@@ -638,13 +638,13 @@ public Bool GrEllipse3(CDC *dc=gr.dc,
|
||||
R2P(&m2,&a2,x,y);
|
||||
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);
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
} 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);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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 len_radians=2*ã)
|
||||
{//3D. Clipping and transform and pen width.
|
||||
Bool result;
|
||||
Bool res;
|
||||
I64 x,y,z,xx,yy,zz;
|
||||
F64 m1,a1,m2,a2,s,c;
|
||||
if (dc->flags & DCF_TRANSFORMATION) {
|
||||
@@ -703,14 +703,14 @@ public Bool GrRegPoly3(CDC *dc=gr.dc,
|
||||
R2P(&m2,&a2,x,y);
|
||||
m2*=Abs(Sin(a2-a1));
|
||||
|
||||
result=RegPoly(dc,cx,cy,cz,
|
||||
res=RegPoly(dc,cx,cy,cz,
|
||||
m1/0x10000,m2/0x10000,sides,&GrPlot3,-a1,
|
||||
step,start_radians,len_radians);
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
} 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);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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=FALSE means fill all parts equ to the color under the point.
|
||||
//Returns cnt of pixs changed
|
||||
I64 result,old_flags=dc->flags,
|
||||
I64 res,old_flags=dc->flags,
|
||||
_x,_y,_z;
|
||||
if (dc->flags & DCF_TRANSFORMATION) {
|
||||
(*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;
|
||||
DCReflect(dc,&_x,&_y,&_z);
|
||||
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)
|
||||
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:
|
||||
dc->flags=old_flags;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#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,
|
||||
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;
|
||||
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;
|
||||
x+=dw;
|
||||
}
|
||||
result=1;
|
||||
res=1;
|
||||
normal_image:
|
||||
if (dc->flags&DCF_JUST_MIRROR)
|
||||
goto gr_done;
|
||||
@@ -945,20 +945,20 @@ normal_image:
|
||||
x1+=dx1; y1+=dy1; z1+=dz1;
|
||||
x+=dw;
|
||||
}
|
||||
result=1; //TODO: check off screen
|
||||
res=1; //TODO: check off screen
|
||||
} else
|
||||
result=GrBlot(dc,x1,y1,img);
|
||||
res=GrBlot(dc,x1,y1,img);
|
||||
gr_done:
|
||||
dc->color=old_color;
|
||||
dc->brush=old_brush;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#help_index "Graphics"
|
||||
|
||||
public Bool Gr2Bezier3(CDC *dc=gr.dc,CD3I32 *ctrl)
|
||||
{//2nd order. Clipping and transform and pen width.
|
||||
Bool result=FALSE;
|
||||
Bool res=FALSE;
|
||||
I64 i,x,y,z,
|
||||
old_flags=dc->flags;
|
||||
CD3I32 *ctrl2=NULL,*ctrl3=NULL;
|
||||
@@ -988,22 +988,22 @@ public Bool Gr2Bezier3(CDC *dc=gr.dc,CD3I32 *ctrl)
|
||||
ctrl3[i].z=z;
|
||||
}
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
result=Bezier2(dc,ctrl3,&GrPlot3);
|
||||
res=Bezier2(dc,ctrl3,&GrPlot3);
|
||||
if (dc->flags & DCF_JUST_MIRROR)
|
||||
goto gr_done;
|
||||
}
|
||||
|
||||
result|=Bezier2(dc,ctrl,&GrPlot3);
|
||||
res|=Bezier2(dc,ctrl,&GrPlot3);
|
||||
gr_done:
|
||||
Free(ctrl2);
|
||||
Free(ctrl3);
|
||||
dc->flags=old_flags;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Bool Gr3Bezier3(CDC *dc=gr.dc,CD3I32 *ctrl)
|
||||
{//3rd order. Clipping and transform and pen width.
|
||||
Bool result=FALSE;
|
||||
Bool res=FALSE;
|
||||
I64 i,x,y,z,
|
||||
old_flags=dc->flags;
|
||||
CD3I32 *ctrl2=NULL,*ctrl3=NULL;
|
||||
@@ -1033,22 +1033,22 @@ public Bool Gr3Bezier3(CDC *dc=gr.dc,CD3I32 *ctrl)
|
||||
ctrl3[i].z=z;
|
||||
}
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
result=Bezier3(dc,ctrl3,&GrPlot3);
|
||||
res=Bezier3(dc,ctrl3,&GrPlot3);
|
||||
if (dc->flags & DCF_JUST_MIRROR)
|
||||
goto gr_done;
|
||||
}
|
||||
|
||||
result|=Bezier3(dc,ctrl,&GrPlot3);
|
||||
res|=Bezier3(dc,ctrl,&GrPlot3);
|
||||
gr_done:
|
||||
Free(ctrl2);
|
||||
Free(ctrl3);
|
||||
dc->flags=old_flags;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public I64 Gr2BSpline3(CDC *dc=gr.dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
||||
{//2nd order. Clipping and transform and pen width.
|
||||
Bool result=FALSE;
|
||||
Bool res=FALSE;
|
||||
I64 i,x,y,z,
|
||||
old_flags=dc->flags;
|
||||
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;
|
||||
}
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
result=BSpline2(dc,ctrl3,cnt,&GrPlot3,closed);
|
||||
res=BSpline2(dc,ctrl3,cnt,&GrPlot3,closed);
|
||||
if (dc->flags & DCF_JUST_MIRROR)
|
||||
goto gr_done;
|
||||
}
|
||||
|
||||
result|=BSpline2(dc,ctrl,cnt,&GrPlot3,closed);
|
||||
res|=BSpline2(dc,ctrl,cnt,&GrPlot3,closed);
|
||||
gr_done:
|
||||
Free(ctrl2);
|
||||
Free(ctrl3);
|
||||
dc->flags=old_flags;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Bool Gr3BSpline3(CDC *dc=gr.dc,CD3I32 *ctrl,I64 cnt,Bool closed=FALSE)
|
||||
{//3rd order. Clipping and transform and pen width.
|
||||
Bool result=FALSE;
|
||||
Bool res=FALSE;
|
||||
I64 i,x,y,z,
|
||||
old_flags=dc->flags;
|
||||
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;
|
||||
}
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
result=BSpline3(dc,ctrl3,cnt,&GrPlot3,closed);
|
||||
res=BSpline3(dc,ctrl3,cnt,&GrPlot3,closed);
|
||||
if (dc->flags & DCF_JUST_MIRROR)
|
||||
goto gr_done;
|
||||
}
|
||||
|
||||
result|=BSpline3(dc,ctrl,cnt,&GrPlot3,closed);
|
||||
res|=BSpline3(dc,ctrl,cnt,&GrPlot3,closed);
|
||||
gr_done:
|
||||
Free(ctrl2);
|
||||
Free(ctrl3);
|
||||
dc->flags=old_flags;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public I64 GrFillTri0(CDC *dc=gr.dc,CD3I32 *p1,CD3I32 *p2,CD3I32 *p4)
|
||||
{//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;
|
||||
//p1 is min x
|
||||
if (p4->x<p2->x)
|
||||
@@ -1219,7 +1219,7 @@ p1y
|
||||
z2+=dz2*i;
|
||||
}
|
||||
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--;
|
||||
x1+=dx1;
|
||||
x2+=dx2;
|
||||
@@ -1246,7 +1246,7 @@ p1y
|
||||
}
|
||||
}
|
||||
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--;
|
||||
x1+=dx1;
|
||||
x2+=dx2;
|
||||
@@ -1304,7 +1304,7 @@ p4y
|
||||
z2+=dz2*i;
|
||||
}
|
||||
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++;
|
||||
x1+=dx1;
|
||||
x2+=dx2;
|
||||
@@ -1331,7 +1331,7 @@ p4y
|
||||
}
|
||||
}
|
||||
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++;
|
||||
x1+=dx1;
|
||||
x2+=dx2;
|
||||
@@ -1403,7 +1403,7 @@ p4y
|
||||
}
|
||||
while (dy1++<=0) {
|
||||
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++;
|
||||
x1+=dx1;
|
||||
x2+=dx2;
|
||||
@@ -1438,7 +1438,7 @@ p4y
|
||||
z2+=dz2*i;
|
||||
}
|
||||
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--;
|
||||
x1+=dx1;
|
||||
x2+=dx2;
|
||||
@@ -1448,5 +1448,5 @@ p4y
|
||||
}
|
||||
}
|
||||
ft_done:
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
@@ -379,18 +379,18 @@ U0 GrUpdateVGAGraphics()
|
||||
dst=gr.screen_image->body;
|
||||
if (LBtr(&sys_semas[SYS_SEMA_FLUSH_VGA_IMAGE],0)) {
|
||||
for (plane=1;plane<0x10;plane<<=1) {
|
||||
OutU8(VGAP_INDEX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_IDX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,plane);
|
||||
vga=VGAM_GRAPHICS;
|
||||
vga=text.vga_alias;
|
||||
row=gr.zoomed_dc->height;
|
||||
while (row--)
|
||||
GrUpdateLine64FlushCache(&vga,&src,d,&dst);
|
||||
}
|
||||
} else {
|
||||
for (plane=1;plane<0x10;plane<<=1) {
|
||||
OutU8(VGAP_INDEX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_IDX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,plane);
|
||||
vga=VGAM_GRAPHICS;
|
||||
vga=text.vga_alias;
|
||||
row=gr.zoomed_dc->height;
|
||||
while (row--)
|
||||
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)
|
||||
{//Convert sprite to device context.
|
||||
CDC *result;
|
||||
CDC *res;
|
||||
I64 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);
|
||||
Sprite3(result,-min_x,-min_y,0,elems);
|
||||
return result;
|
||||
res=DCNew(max_x-min_x+1,max_y-min_y+1);
|
||||
Sprite3(res,-min_x,-min_y,0,elems);
|
||||
return res;
|
||||
}
|
||||
|
||||
public U8 *SpriteInterpolate(U8 *elems0,U8 *elems1,F64 t)
|
||||
{//The two CSprite should be identical except for points shifted around.
|
||||
public U8 *SpriteInterpolate(F64 t,U8 *elems0,U8 *elems1)
|
||||
{//The two CSprite should be ident except for points shifted around.
|
||||
//t ranges from 0.0 to 1.0.
|
||||
I64 i,t1=GR_SCALE*t,t0=GR_SCALE-t1;
|
||||
I32 *ptr0,*ptr1,*ptrr;
|
||||
CD3I32 *p0,*p1,*pr;
|
||||
U8 *result;
|
||||
U8 *res;
|
||||
CSprite *tempg0=elems0-offset(CSprite.start),
|
||||
*tempg1=elems1-offset(CSprite.start),*tempgr;
|
||||
if (t<0.5) {
|
||||
i=SpriteSize(elems0),
|
||||
result=MAlloc(i);
|
||||
MemCpy(result,elems0,i);
|
||||
res=MAlloc(i);
|
||||
MemCpy(res,elems0,i);
|
||||
} else {
|
||||
i=SpriteSize(elems1),
|
||||
result=MAlloc(i);
|
||||
MemCpy(result,elems1,i);
|
||||
res=MAlloc(i);
|
||||
MemCpy(res,elems1,i);
|
||||
}
|
||||
tempgr=result-offset(CSprite.start);
|
||||
tempgr=res-offset(CSprite.start);
|
||||
while (tempg0->type) {
|
||||
if (tempg0->type!=tempg1->type)
|
||||
throw('Graphics');
|
||||
@@ -447,7 +447,7 @@ public U8 *SpriteInterpolate(U8 *elems0,U8 *elems1,F64 t)
|
||||
tempg1(U8 *)+=SpriteElemSize(tempg1);
|
||||
tempgr(U8 *)+=SpriteElemSize(tempgr);
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#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 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;
|
||||
Bool down=FALSE;
|
||||
U8 *st=NULL;
|
||||
@@ -228,10 +228,10 @@ I64 SpriteBitMapEd(CDoc *,CDocEntry *doc_e,CDC *dc,I64 *_xx1,I64 *_yy1,
|
||||
case MSG_KEY_DOWN:
|
||||
switch (a1) {
|
||||
case CH_SHIFT_ESC:
|
||||
result=GE_ABORT;
|
||||
res=GE_ABORT;
|
||||
goto bm_key_up_done;
|
||||
case CH_ESC:
|
||||
result=GE_CONT;
|
||||
res=GE_CONT;
|
||||
goto bm_key_up_done;
|
||||
case 'c': //eye-dropper
|
||||
dc2=DCScreenCapture(FALSE);
|
||||
@@ -253,13 +253,13 @@ bm_menu:
|
||||
StrCpy(Fs->task_title,DefineSub(i,"ST_SPRITE_BITMAP_MENU"));
|
||||
switch (i) {
|
||||
case DOCM_CANCEL:
|
||||
result=GE_ABORT;
|
||||
res=GE_ABORT;
|
||||
goto bm_done;
|
||||
case GBM_EXIT:
|
||||
result=GE_EXIT;
|
||||
res=GE_EXIT;
|
||||
goto bm_done;
|
||||
case GBM_MAIN_MENU:
|
||||
result=GE_CONT;
|
||||
res=GE_CONT;
|
||||
goto bm_done;
|
||||
case GBM_COLOR:
|
||||
i=PopUpColor(,,FALSE);
|
||||
@@ -672,5 +672,5 @@ bm_done:
|
||||
doc_e->de_flags=old_de_flags;
|
||||
*_img=img;
|
||||
*_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)
|
||||
{
|
||||
I64 i,num1,num2,size;
|
||||
CSprite *result,g;
|
||||
CSprite *res,g;
|
||||
CColorROPU32 color;
|
||||
U8 *st,*ptr;
|
||||
CQueD3I32 rootp,*tempp,*tempa1;
|
||||
@@ -313,8 +313,8 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
break;
|
||||
sub_switch_end:
|
||||
size=SpriteElemSize(&g)+offset(CSprite.start);
|
||||
result=MAlloc(size);
|
||||
MemCpy(result,&g,size);
|
||||
res=MAlloc(size);
|
||||
MemCpy(res,&g,size);
|
||||
break;
|
||||
case SPT_TEXT:
|
||||
case SPT_TEXT_BOX:
|
||||
@@ -330,9 +330,9 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
LexExcept(cc,"Expecting string at ");
|
||||
size=SpriteElemQuedBaseSize(type);
|
||||
i=StrLen(st)+1;
|
||||
result=MAlloc(size+i);
|
||||
MemCpy(result,&g,size);
|
||||
MemCpy(result(U8 *)+size,st,i);
|
||||
res=MAlloc(size+i);
|
||||
MemCpy(res,&g,size);
|
||||
MemCpy(res(U8 *)+size,st,i);
|
||||
Free(st);
|
||||
break;
|
||||
case SPT_POLYLINE:
|
||||
@@ -350,9 +350,9 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
if (g.nu.num<2)
|
||||
LexExcept(cc,"Expecting point at ");
|
||||
size=SpriteElemQuedBaseSize(SPT_POLYLINE);
|
||||
result=MAlloc(size+g.nu.num*sizeof(CD2I32));
|
||||
MemCpy(result,&g,size);
|
||||
ptr=&result->nu.u;
|
||||
res=MAlloc(size+g.nu.num*sizeof(CD2I32));
|
||||
MemCpy(res,&g,size);
|
||||
ptr=&res->nu.u;
|
||||
tempp=rootp.next;
|
||||
while (tempp!=&rootp) {
|
||||
tempa1=tempp->next;
|
||||
@@ -379,7 +379,7 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
if (g.nu.num<2)
|
||||
LexExcept(cc,"Expecting point at ");
|
||||
size=SpriteElemQuedBaseSize(type);
|
||||
result=MAlloc(size+g.nu.num*sizeof(CD3I32));
|
||||
res=MAlloc(size+g.nu.num*sizeof(CD3I32));
|
||||
if (LexExpressionI64(cc)) {
|
||||
if (type==SPT_BSPLINE2||type==SPT_BSPLINE2_CLOSED)
|
||||
g.type=SPT_BSPLINE2_CLOSED;
|
||||
@@ -391,8 +391,8 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
else
|
||||
g.type=SPT_BSPLINE3;
|
||||
}
|
||||
MemCpy(result,&g,size);
|
||||
ptr=&result->nu.u;
|
||||
MemCpy(res,&g,size);
|
||||
ptr=&res->nu.u;
|
||||
tempp=rootp.next;
|
||||
while (tempp!=&rootp) {
|
||||
tempa1=tempp->next;
|
||||
@@ -420,9 +420,9 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
Lex(cc); //Load '}'
|
||||
g.type=SPT_POLYPT;
|
||||
size=SpriteElemQuedBaseSize(SPT_POLYPT);
|
||||
result=CAlloc(size+(g.npu.num*3+7)>>3);
|
||||
MemCpy(result,&g,size);
|
||||
ptr=&result->npu.u;
|
||||
res=CAlloc(size+(g.npu.num*3+7)>>3);
|
||||
MemCpy(res,&g,size);
|
||||
ptr=&res->npu.u;
|
||||
for (i=0;i<g.npu.num;i++)
|
||||
BFieldOrU32(ptr,i*3,QueVectU8Get(tempv,i));
|
||||
QueVectU8Del(tempv);
|
||||
@@ -456,9 +456,9 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
Lex(cc); //Load '}'
|
||||
g.type=SPT_BITMAP;
|
||||
size=SpriteElemQuedBaseSize(SPT_BITMAP);
|
||||
result=CAlloc(size+num1);
|
||||
MemCpy(result,&g,size);
|
||||
ptr=&result->pwhu.u;
|
||||
res=CAlloc(size+num1);
|
||||
MemCpy(res,&g,size);
|
||||
ptr=&res->pwhu.u;
|
||||
for (i=0;i<num1;i++)
|
||||
*ptr++=QueVectU8Get(tempv,i);
|
||||
QueVectU8Del(tempv);
|
||||
@@ -531,9 +531,9 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
g.pmu.tri_cnt=num2;
|
||||
}
|
||||
size=SpriteElemQuedBaseSize(g.type);
|
||||
result=MAlloc(size+num1*sizeof(CD3I32)+num2*sizeof(CMeshTri));
|
||||
MemCpy(result,&g,size);
|
||||
ptr=result(U8 *)+size;
|
||||
res=MAlloc(size+num1*sizeof(CD3I32)+num2*sizeof(CMeshTri));
|
||||
MemCpy(res,&g,size);
|
||||
ptr=res(U8 *)+size;
|
||||
tempp=rootp.next;
|
||||
while (tempp!=&rootp) {
|
||||
tempa1=tempp->next;
|
||||
@@ -556,13 +556,13 @@ CSprite *Code2SpriteElem(CCmpCtrl *cc,I64 type)
|
||||
LexExcept(cc,"Expecting '}' at ");
|
||||
if (Lex(cc)!=';')
|
||||
LexExcept(cc,"Expecting ';' at ");
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public U8 *Code2Sprite(CDoc *doc,I64 *_size=NULL)
|
||||
{//Text to sprite.
|
||||
CSprite root;
|
||||
U8 *result;
|
||||
U8 *res;
|
||||
Bool okay=TRUE,unlock_doc=DocLock(doc);
|
||||
CCmpCtrl *cc=CmpCtrlNew(,CCF_DONT_FREE_BUF);
|
||||
CHashTable *old_hash_table_lst=cc->htc.hash_table_lst;
|
||||
@@ -591,12 +591,12 @@ public U8 *Code2Sprite(CDoc *doc,I64 *_size=NULL)
|
||||
DocUnlock(doc);
|
||||
if (okay) {
|
||||
CmpCtrlDel(cc); //TODO: can crash
|
||||
result=SpriteQue2Sprite(&root,&size);
|
||||
res=SpriteQue2Sprite(&root,&size);
|
||||
} else {
|
||||
result=NULL;
|
||||
res=NULL;
|
||||
size=0;
|
||||
}
|
||||
if (_size) *_size=size;
|
||||
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 *_xx=NULL,I64 *_yy=NULL)
|
||||
{
|
||||
CSprite *result=root->next;
|
||||
CSprite *res=root->next;
|
||||
I64 width=1,xx=0,yy=0;
|
||||
CColorROPU32 color=BLACK;
|
||||
if (dc) DCRst(dc);
|
||||
while (elem_num-->0 && result!=root) {
|
||||
switch (result->type) {
|
||||
while (elem_num-->0 && res!=root) {
|
||||
switch (res->type) {
|
||||
case SPT_COLOR:
|
||||
color=result->c.color;
|
||||
color=res->c.color;
|
||||
if (dc) dc->color=color;
|
||||
break;
|
||||
case SPT_DITHER_COLOR:
|
||||
color=result->d.dither_color.u8[0]|
|
||||
result->d.dither_color.u8[1]<<COLORROP_BITS|ROPF_DITHER;
|
||||
color=res->d.dither_color.u8[0]|
|
||||
res->d.dither_color.u8[1]<<COLORROP_BITS|ROPF_DITHER;
|
||||
if (dc) dc->color=color;
|
||||
break;
|
||||
case SPT_WIDTH:
|
||||
width=result->w.width;
|
||||
width=res->w.width;
|
||||
if (dc) dc->pen_width=width;
|
||||
break;
|
||||
case SPT_SHIFT:
|
||||
xx+=result->p.x1;
|
||||
yy+=result->p.y1;
|
||||
x+=result->p.x1;
|
||||
y+=result->p.y1;
|
||||
xx+=res->p.x1;
|
||||
yy+=res->p.y1;
|
||||
x+=res->p.x1;
|
||||
y+=res->p.y1;
|
||||
break;
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
if (dc) {
|
||||
if (DCSymmetry3Set(dc,result->pp.x1+x,result->pp.y1+y,0,
|
||||
result->pp.x2+x,result->pp.y2+y,0,
|
||||
result->pp.x2+x,result->pp.y2+y,1))
|
||||
if (DCSymmetry3Set(dc,res->pp.x1+x,res->pp.y1+y,0,
|
||||
res->pp.x2+x,res->pp.y2+y,0,
|
||||
res->pp.x2+x,res->pp.y2+y,1))
|
||||
dc->flags|=DCF_SYMMETRY;
|
||||
else
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
}
|
||||
break;
|
||||
}
|
||||
result=result->next;
|
||||
res=res->next;
|
||||
}
|
||||
if (_color) *_color=color;
|
||||
if (_width) *_width=width;
|
||||
if (_xx) *_xx=xx;
|
||||
if (_yy) *_yy=yy;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
I64 s;
|
||||
CSprite *result=CAlloc(sizeof(CSprite)),
|
||||
CSprite *res=CAlloc(sizeof(CSprite)),
|
||||
*tempg=elems-offset(CSprite.start),*tempg1;
|
||||
QueInit(result);
|
||||
QueInit(res);
|
||||
while (tempg->type) {
|
||||
tempg1=MAlloc(SpriteElemSize(tempg)+offset(CSprite.start));
|
||||
s=SpriteElemSize(tempg);
|
||||
MemCpy(&tempg1->start,&tempg->start,s);
|
||||
tempg1->selected=FALSE;
|
||||
QueIns(tempg1,result->last);
|
||||
QueIns(tempg1,res->last);
|
||||
tempg(U8 *)+=s;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
U8 *SpriteQue2Sprite(CSprite *root,I64 *_size=NULL)
|
||||
{
|
||||
I64 i,size=sprite_elem_base_sizes[SPT_END];
|
||||
CSprite *tempg=root->next;
|
||||
U8 *result,*dst;
|
||||
U8 *res,*dst;
|
||||
while (tempg!=root) {
|
||||
size+=SpriteElemSize(tempg);
|
||||
tempg=tempg->next;
|
||||
}
|
||||
if (_size) *_size=size;
|
||||
result=dst=MAlloc(size);
|
||||
res=dst=MAlloc(size);
|
||||
tempg=root->next;
|
||||
while (tempg!=root) {
|
||||
i=SpriteElemSize(tempg);
|
||||
@@ -95,7 +95,7 @@ U8 *SpriteQue2Sprite(CSprite *root,I64 *_size=NULL)
|
||||
tempg=tempg->next;
|
||||
}
|
||||
*dst=SPT_END;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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 result=0;
|
||||
I64 res=0;
|
||||
CSprite *tempg=root->next;
|
||||
val=ToBool(val);
|
||||
while (tempg!=root) {
|
||||
if (ToBool(tempg->selected)==val)
|
||||
result++;
|
||||
res++;
|
||||
tempg=tempg->next;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
I64 SpriteQueSelectAll(CSprite *root,Bool val=TRUE)
|
||||
{
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
CSprite *tempg=root->next;
|
||||
while (tempg!=root) {
|
||||
tempg->selected=val;
|
||||
result++;
|
||||
res++;
|
||||
tempg=tempg->next;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
CSprite *SpriteSideBar2SpriteQue(CDoc *doc,CSprite *root,I64 *_cur_elem_num)
|
||||
{//For the side-bar
|
||||
CSprite *result=CAlloc(sizeof(CSprite)),*tempg;
|
||||
CSprite *res=CAlloc(sizeof(CSprite)),*tempg;
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
Bool found=FALSE;
|
||||
I64 num=0;
|
||||
QueInit(result);
|
||||
QueInit(res);
|
||||
while (doc_e!=doc) {
|
||||
if (doc_e->type_u8==DOCT_MENU_VAL && doc_e->left_exp>=0) {
|
||||
tempg=SpriteSetSettings(,root,doc_e->left_exp);
|
||||
if (tempg!=root) {
|
||||
tempg=MAllocIdentical(tempg);
|
||||
tempg=MAllocIdent(tempg);
|
||||
tempg->selected=Bt(&doc_e->type,DOCEt_SELECTED);
|
||||
if (*_cur_elem_num==doc_e->left_exp) {
|
||||
*_cur_elem_num=num;
|
||||
found=TRUE;
|
||||
}
|
||||
QueIns(tempg,result->last);
|
||||
QueIns(tempg,res->last);
|
||||
num++;
|
||||
}
|
||||
}
|
||||
@@ -605,7 +605,7 @@ CSprite *SpriteSideBar2SpriteQue(CDoc *doc,CSprite *root,I64 *_cur_elem_num)
|
||||
*_cur_elem_num=num;
|
||||
QueDel(root);
|
||||
Free(root);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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 result;
|
||||
Bool res;
|
||||
CSprite *root=*_root;
|
||||
U8 *elems=SpriteQue2Sprite(root);
|
||||
CDoc *doc=DocNew,*doc2,*old_put=DocPut;
|
||||
@@ -690,7 +690,7 @@ Bool SpriteEdText(CSprite **_root,I64 *_cur_elem_num)
|
||||
Sprite2Code(doc,elems);
|
||||
Free(elems);
|
||||
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;
|
||||
"$$WW,1$$";
|
||||
if (elems=Code2Sprite(doc)) {
|
||||
@@ -712,7 +712,7 @@ Bool SpriteEdText(CSprite **_root,I64 *_cur_elem_num)
|
||||
}
|
||||
DocDel(doc);
|
||||
if (_root) *_root=root;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#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)
|
||||
{
|
||||
I64 msg_code,a1,a2,xx,yy,xx2,yy2,dd,best_dd,cur_elem_num;
|
||||
Bool result=TRUE;
|
||||
Bool res=TRUE;
|
||||
CDC *dc=DCAlias;
|
||||
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:
|
||||
switch (a1.u8[0]) {
|
||||
case CH_SHIFT_ESC:
|
||||
result=FALSE;
|
||||
res=FALSE;
|
||||
case CH_ESC:
|
||||
GetMsg(&a1,&a2,1<<MSG_KEY_UP);
|
||||
goto gs_done;
|
||||
@@ -1071,9 +1071,9 @@ gs_done:
|
||||
}
|
||||
DCFill(dc);
|
||||
DCDel(dc);
|
||||
if (_cur_elem_num && result)
|
||||
if (_cur_elem_num && res)
|
||||
*_cur_elem_num=cur_elem_num;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
||||
CSprite *result;
|
||||
CSprite *res;
|
||||
do {
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
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);
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_LINE));
|
||||
result->type=SPT_LINE;
|
||||
result->pp.x1=x1-x;
|
||||
result->pp.y1=y1-y;
|
||||
result->pp.x2=x2-x;
|
||||
result->pp.y2=y2-y;
|
||||
return result;
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_LINE));
|
||||
res->type=SPT_LINE;
|
||||
res->pp.x1=x1-x;
|
||||
res->pp.y1=y1-y;
|
||||
res->pp.x2=x2-x;
|
||||
res->pp.y2=y2-y;
|
||||
return res;
|
||||
}
|
||||
|
||||
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;
|
||||
CSprite *result;
|
||||
CSprite *res;
|
||||
do {
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
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);
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrArrow3(dc,x1,y1,0,x2,y2,0);
|
||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_ARROW));
|
||||
result->type=SPT_ARROW;
|
||||
result->pp.x1=x1-x;
|
||||
result->pp.y1=y1-y;
|
||||
result->pp.x2=x2-x;
|
||||
result->pp.y2=y2-y;
|
||||
return result;
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_ARROW));
|
||||
res->type=SPT_ARROW;
|
||||
res->pp.x1=x1-x;
|
||||
res->pp.y1=y1-y;
|
||||
res->pp.x2=x2-x;
|
||||
res->pp.y2=y2-y;
|
||||
return res;
|
||||
}
|
||||
|
||||
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;
|
||||
CSprite *result;
|
||||
CSprite *res;
|
||||
old_width=dc->pen_width;
|
||||
old_flags=dc->flags;
|
||||
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);
|
||||
dc->flags=old_flags&DCF_SYMMETRY|dc->flags&~DCF_SYMMETRY;
|
||||
dc->pen_width=old_width;
|
||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_PLANAR_SYMMETRY));
|
||||
result->type=SPT_PLANAR_SYMMETRY;
|
||||
result->pp.x1=x1-x;
|
||||
result->pp.y1=y1-y;
|
||||
result->pp.x2=x2-x;
|
||||
result->pp.y2=y2-y;
|
||||
return result;
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_PLANAR_SYMMETRY));
|
||||
res->type=SPT_PLANAR_SYMMETRY;
|
||||
res->pp.x1=x1-x;
|
||||
res->pp.y1=y1-y;
|
||||
res->pp.x2=x2-x;
|
||||
res->pp.y2=y2-y;
|
||||
return res;
|
||||
}
|
||||
|
||||
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;
|
||||
CSprite *result;
|
||||
CSprite *res;
|
||||
do {
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
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);
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrRect3(dc,xx1,yy1,0,xx2-xx1,yy2-yy1);
|
||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_RECT));
|
||||
result->type=SPT_RECT;
|
||||
result->pp.x1=xx1-x;
|
||||
result->pp.y1=yy1-y;
|
||||
result->pp.x2=xx2-x;
|
||||
result->pp.y2=yy2-y;
|
||||
return result;
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_RECT));
|
||||
res->type=SPT_RECT;
|
||||
res->pp.x1=xx1-x;
|
||||
res->pp.y1=yy1-y;
|
||||
res->pp.x2=xx2-x;
|
||||
res->pp.y2=yy2-y;
|
||||
return res;
|
||||
}
|
||||
|
||||
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;
|
||||
CDC *dc3,*img;
|
||||
CSprite *result;
|
||||
CSprite *res;
|
||||
old_width=dc2->pen_width;
|
||||
dc2->pen_width=1;
|
||||
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);
|
||||
xx2++; yy2++;
|
||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_BITMAP)+((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
result->type=SPT_BITMAP;
|
||||
result->pwhu.width=xx2-xx1;
|
||||
result->pwhu.height=yy2-yy1;
|
||||
result->pwhu.x1=0;
|
||||
result->pwhu.y1=0;
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_BITMAP)+((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
res->type=SPT_BITMAP;
|
||||
res->pwhu.width=xx2-xx1;
|
||||
res->pwhu.height=yy2-yy1;
|
||||
res->pwhu.x1=0;
|
||||
res->pwhu.y1=0;
|
||||
SpriteScreenInit(dc,x,y);
|
||||
i=gr.screen_zoom;
|
||||
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)
|
||||
DCColorChg(img,bm_bkcolor);
|
||||
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(dc3);
|
||||
dc2->pen_width=old_width;
|
||||
Fs->win_inhibit=WIG_TASK_DFT-WIF_SELF_FOCUS
|
||||
-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)
|
||||
{
|
||||
I64 msg_code,x1=a1,y1=a2,x2=a1,y2=a2;
|
||||
CSprite *result;
|
||||
CSprite *res;
|
||||
do {
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
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);
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrCircle3(dc,x1,y1,0,Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2)));
|
||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_CIRCLE));
|
||||
result->type=SPT_CIRCLE;
|
||||
result->pr.x1=x1-x;
|
||||
result->pr.y1=y1-y;
|
||||
result->pr.radius=Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2));
|
||||
return result;
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_CIRCLE));
|
||||
res->type=SPT_CIRCLE;
|
||||
res->pr.x1=x1-x;
|
||||
res->pr.y1=y1-y;
|
||||
res->pr.radius=Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2));
|
||||
return res;
|
||||
}
|
||||
|
||||
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;
|
||||
F64 angle1,angle2;
|
||||
CSprite *result;
|
||||
CSprite *res;
|
||||
do {
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
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);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_ELLIPSE));
|
||||
result->type=SPT_ELLIPSE;
|
||||
result->pwha.x1=(x1+x2)>>1-x;
|
||||
result->pwha.y1=(y1+y2)>>1-y;
|
||||
result->pwha.width =AbsI64(x1-x2)>>1;
|
||||
result->pwha.height=AbsI64(y1-y2)>>1;
|
||||
angle2=Arg(x2-(result->pwha.x1+x),y2-(result->pwha.y1+y));
|
||||
if (result->pwha.width<result->pwha.height)
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_ELLIPSE));
|
||||
res->type=SPT_ELLIPSE;
|
||||
res->pwha.x1=(x1+x2)>>1-x;
|
||||
res->pwha.y1=(y1+y2)>>1-y;
|
||||
res->pwha.width =AbsI64(x1-x2)>>1;
|
||||
res->pwha.height=AbsI64(y1-y2)>>1;
|
||||
angle2=Arg(x2-(res->pwha.x1+x),y2-(res->pwha.y1+y));
|
||||
if (res->pwha.width<res->pwha.height)
|
||||
angle2-=ă/2.0;
|
||||
do {
|
||||
angle1=Arg(x2-(result->pwha.x1+x),y2-(result->pwha.y1+y));
|
||||
if (result->pwha.width>=result->pwha.height)
|
||||
result->pwha.angle=-(angle1-angle2);
|
||||
angle1=Arg(x2-(res->pwha.x1+x),y2-(res->pwha.y1+y));
|
||||
if (res->pwha.width>=res->pwha.height)
|
||||
res->pwha.angle=-(angle1-angle2);
|
||||
else
|
||||
result->pwha.angle=-(angle1-angle2)+ã/2.0;
|
||||
res->pwha.angle=-(angle1-angle2)+ã/2.0;
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrEllipse3(dc,result->pwha.x1+x,result->pwha.y1+y,0,
|
||||
result->pwha.width,result->pwha.height,result->pwha.angle);
|
||||
GrEllipse3(dc,res->pwha.x1+x,res->pwha.y1+y,0,
|
||||
res->pwha.width,res->pwha.height,res->pwha.angle);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
SpriteScreenInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
angle1=Arg(x2-(result->pwha.x1+x),y2-(result->pwha.y1+y));
|
||||
if (result->pwha.width>=result->pwha.height)
|
||||
result->pwha.angle=-(angle1-angle2);
|
||||
angle1=Arg(x2-(res->pwha.x1+x),y2-(res->pwha.y1+y));
|
||||
if (res->pwha.width>=res->pwha.height)
|
||||
res->pwha.angle=-(angle1-angle2);
|
||||
else
|
||||
result->pwha.angle=-(angle1-angle2)+ã/2.0;
|
||||
res->pwha.angle=-(angle1-angle2)+ã/2.0;
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrEllipse3(dc,result->pwha.x1+x,result->pwha.y1+y,0,
|
||||
result->pwha.width,result->pwha.height,result->pwha.angle);
|
||||
return result;
|
||||
GrEllipse3(dc,res->pwha.x1+x,res->pwha.y1+y,0,
|
||||
res->pwha.width,res->pwha.height,res->pwha.angle);
|
||||
return res;
|
||||
}
|
||||
|
||||
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;
|
||||
F64 angle1,angle2;
|
||||
CSprite *result;
|
||||
CSprite *res;
|
||||
do {
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
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);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_POLYGON));
|
||||
result->type=SPT_POLYGON;
|
||||
result->pwhas.x1=(x1+x2)>>1-x;
|
||||
result->pwhas.y1=(y1+y2)>>1-y;
|
||||
result->pwhas.width =AbsI64(x1-x2)>>1;
|
||||
result->pwhas.height=AbsI64(y1-y2)>>1;
|
||||
result->pwhas.sides=sides;
|
||||
angle2=Arg(x2-(result->pwhas.x1+x),y2-(result->pwhas.y1+y));
|
||||
if (result->pwhas.width<result->pwhas.height)
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_POLYGON));
|
||||
res->type=SPT_POLYGON;
|
||||
res->pwhas.x1=(x1+x2)>>1-x;
|
||||
res->pwhas.y1=(y1+y2)>>1-y;
|
||||
res->pwhas.width =AbsI64(x1-x2)>>1;
|
||||
res->pwhas.height=AbsI64(y1-y2)>>1;
|
||||
res->pwhas.sides=sides;
|
||||
angle2=Arg(x2-(res->pwhas.x1+x),y2-(res->pwhas.y1+y));
|
||||
if (res->pwhas.width<res->pwhas.height)
|
||||
angle2-=ă/2.0;
|
||||
do {
|
||||
angle1=Arg(x2-(result->pwhas.x1+x),y2-(result->pwhas.y1+y));
|
||||
if (result->pwhas.width>=result->pwhas.height)
|
||||
result->pwhas.angle=-(angle1-angle2);
|
||||
angle1=Arg(x2-(res->pwhas.x1+x),y2-(res->pwhas.y1+y));
|
||||
if (res->pwhas.width>=res->pwhas.height)
|
||||
res->pwhas.angle=-(angle1-angle2);
|
||||
else
|
||||
result->pwhas.angle=-(angle1-angle2)+ã/2.0;
|
||||
res->pwhas.angle=-(angle1-angle2)+ã/2.0;
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrRegPoly3(dc,result->pwhas.x1+x,result->pwhas.y1+y,0,
|
||||
result->pwhas.width,result->pwhas.height,
|
||||
result->pwhas.sides,result->pwhas.angle);
|
||||
GrRegPoly3(dc,res->pwhas.x1+x,res->pwhas.y1+y,0,
|
||||
res->pwhas.width,res->pwhas.height,
|
||||
res->pwhas.sides,res->pwhas.angle);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
SpriteScreenInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
angle1=Arg(x2-(result->pwhas.x1+x),y2-(result->pwhas.y1+y));
|
||||
if (result->pwhas.width>=result->pwhas.height)
|
||||
result->pwhas.angle=-(angle1-angle2);
|
||||
angle1=Arg(x2-(res->pwhas.x1+x),y2-(res->pwhas.y1+y));
|
||||
if (res->pwhas.width>=res->pwhas.height)
|
||||
res->pwhas.angle=-(angle1-angle2);
|
||||
else
|
||||
result->pwhas.angle=-(angle1-angle2)+ã/2.0;
|
||||
res->pwhas.angle=-(angle1-angle2)+ã/2.0;
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrRegPoly3(dc,result->pwhas.x1+x,result->pwhas.y1+y,0,
|
||||
result->pwhas.width,result->pwhas.height,result->pwhas.sides,
|
||||
result->pwhas.angle);
|
||||
return result;
|
||||
GrRegPoly3(dc,res->pwhas.x1+x,res->pwhas.y1+y,0,
|
||||
res->pwhas.width,res->pwhas.height,res->pwhas.sides,
|
||||
res->pwhas.angle);
|
||||
return res;
|
||||
}
|
||||
|
||||
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;
|
||||
I32 *ptr;
|
||||
CD3I32 *p;
|
||||
CSprite *result,*tempg,*tempg1,root2;
|
||||
CSprite *res,*tempg,*tempg1,root2;
|
||||
|
||||
QueInit(&root2);
|
||||
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 (num)
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_PT));
|
||||
result->type=SPT_PT;
|
||||
result->p.x1=x2-x;
|
||||
result->p.y1=y2-y;
|
||||
QueIns(result,root2.last);
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_PT));
|
||||
res->type=SPT_PT;
|
||||
res->p.x1=x2-x;
|
||||
res->p.y1=y2-y;
|
||||
QueIns(res,root2.last);
|
||||
x1=x2;y1=y2;
|
||||
num++;
|
||||
}
|
||||
@@ -436,8 +436,8 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
||||
switch (eletype) {
|
||||
case SPT_POLYLINE:
|
||||
if (num>1) {
|
||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_POLYLINE)+num*sizeof(CD2I32));
|
||||
ptr=&result->nu.u;
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_POLYLINE)+num*sizeof(CD2I32));
|
||||
ptr=&res->nu.u;
|
||||
tempg1=root2.next;
|
||||
for (i=0;i<num;i++) {
|
||||
tempg=tempg1->next;
|
||||
@@ -446,8 +446,8 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
||||
Free(tempg1);
|
||||
tempg1=tempg;
|
||||
}
|
||||
result->type=SPT_POLYLINE;
|
||||
result->nu.num=num;
|
||||
res->type=SPT_POLYLINE;
|
||||
res->nu.num=num;
|
||||
} else {
|
||||
tempg1=root2.next;
|
||||
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);
|
||||
tempg1=tempg;
|
||||
}
|
||||
result=NULL;
|
||||
res=NULL;
|
||||
}
|
||||
break;
|
||||
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_BSPLINE3_CLOSED:
|
||||
if (num>2) {
|
||||
result=CAlloc(SpriteElemQuedBaseSize(eletype)+num*sizeof(CD3I32));
|
||||
p=&result->nu.u;
|
||||
res=CAlloc(SpriteElemQuedBaseSize(eletype)+num*sizeof(CD3I32));
|
||||
p=&res->nu.u;
|
||||
tempg1=root2.next;
|
||||
for (i=0;i<num;i++) {
|
||||
tempg=tempg1->next;
|
||||
@@ -473,8 +473,8 @@ CSprite *SMPolyLineFamily(I64 eletype,CDC *dc,I64 x,I64 y,I64 a1,I64 a2,
|
||||
Free(tempg1);
|
||||
tempg1=tempg;
|
||||
}
|
||||
result->type=eletype;
|
||||
result->nu.num=num;
|
||||
res->type=eletype;
|
||||
res->nu.num=num;
|
||||
} else {
|
||||
tempg1=root2.next;
|
||||
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);
|
||||
tempg1=tempg;
|
||||
}
|
||||
result=NULL;
|
||||
res=NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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;
|
||||
I32 *ptr;
|
||||
CSprite *result,*tempg,*tempg1,root2;
|
||||
CSprite *res,*tempg,*tempg1,root2;
|
||||
|
||||
QueInit(&root2);
|
||||
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);
|
||||
|
||||
num=0;
|
||||
result=root2.next;
|
||||
res=root2.next;
|
||||
x1=x3; y1=y3;
|
||||
while (result!=&root2) {
|
||||
tempg=result->next;
|
||||
if (result->p.x1==x1 && result->p.y1==y1) {
|
||||
QueRem(result);
|
||||
Free(result);
|
||||
while (res!=&root2) {
|
||||
tempg=res->next;
|
||||
if (res->p.x1==x1 && res->p.y1==y1) {
|
||||
QueRem(res);
|
||||
Free(res);
|
||||
} else {
|
||||
num++;
|
||||
x1=result->p.x1;
|
||||
y1=result->p.y1;
|
||||
x1=res->p.x1;
|
||||
y1=res->p.y1;
|
||||
}
|
||||
result=tempg;
|
||||
res=tempg;
|
||||
}
|
||||
|
||||
result=CAlloc(SpriteElemQuedBaseSize(SPT_POLYPT)+(num*3+7)>>3);
|
||||
result->npu.x=x3;
|
||||
result->npu.y=y3;
|
||||
ptr=&result->npu.u;
|
||||
res=CAlloc(SpriteElemQuedBaseSize(SPT_POLYPT)+(num*3+7)>>3);
|
||||
res->npu.x=x3;
|
||||
res->npu.y=y3;
|
||||
ptr=&res->npu.u;
|
||||
x1=x3; y1=y3;
|
||||
i=0;
|
||||
tempg1=root2.next;
|
||||
@@ -539,9 +539,9 @@ CSprite *SMPolyPoint(CDC *dc,I64 x,I64 y,I64 a1,I64 a2,CColorROPU32 color)
|
||||
Free(tempg1);
|
||||
tempg1=tempg;
|
||||
}
|
||||
result->type=SPT_POLYPT;
|
||||
result->npu.num=num;
|
||||
return result;
|
||||
res->type=SPT_POLYPT;
|
||||
res->npu.num=num;
|
||||
return res;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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,
|
||||
old_de_flags=doc_ce->de_flags;
|
||||
CColorROPU32 bm_bkcolor,color;
|
||||
@@ -958,7 +958,7 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
xx2+=xx; yy2+=yy;
|
||||
if (SMBitMap(eletype,doc,doc_ce,root,dc,xx,yy,a1,a2,bm_bkcolor,
|
||||
FALSE,xx1,yy1,xx2,yy2,&cur_elem_num)==GE_EXIT) {
|
||||
result=GE_EXIT;
|
||||
res=GE_EXIT;
|
||||
goto ei_done;
|
||||
}
|
||||
eletype=SPT_MENU;
|
||||
@@ -1028,20 +1028,20 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
x+=xx; y+=yy;
|
||||
SpriteScreenInit(dc,x,y);
|
||||
if (eletype==SPT_EXIT) {
|
||||
result=GE_EXIT;
|
||||
res=GE_EXIT;
|
||||
goto ei_done;
|
||||
} else if (eletype==DOCM_CANCEL) {
|
||||
result=GE_ABORT;
|
||||
res=GE_ABORT;
|
||||
goto ei_done;
|
||||
}
|
||||
switch (GetMsg(&a1,&a2,1<<MSG_KEY_DOWN|1<<MSG_IP_R_UP|1<<MSG_IP_L_DOWN)) {
|
||||
case MSG_KEY_DOWN:
|
||||
switch (a1) {
|
||||
case CH_ESC:
|
||||
result=GE_EXIT;
|
||||
res=GE_EXIT;
|
||||
goto ei_done;
|
||||
case CH_SHIFT_ESC:
|
||||
result=GE_ABORT;
|
||||
res=GE_ABORT;
|
||||
goto ei_done;
|
||||
case 'c': //eye-dropper
|
||||
dc3=DCScreenCapture(FALSE);
|
||||
@@ -1134,7 +1134,7 @@ I64 SpriteMainEd(CDoc *doc)
|
||||
case SPT_BITMAP:
|
||||
if (SMBitMap(eletype,doc,doc_ce,root,dc,xx,yy,a1,a2,bm_bkcolor,
|
||||
TRUE,,,,,&cur_elem_num)==GE_EXIT) {
|
||||
result=GE_EXIT;
|
||||
res=GE_EXIT;
|
||||
goto ei_done;
|
||||
}
|
||||
doc_ce->de_flags=old_de_flags;
|
||||
@@ -1164,7 +1164,7 @@ ei_done:
|
||||
Fs->title_src =old_title_src;
|
||||
QueDel(root);
|
||||
Free(root);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 EdSpriteIns(CDoc *doc)
|
||||
@@ -1217,7 +1217,7 @@ U0 EdSpriteEd(CDoc *doc)
|
||||
tempb=doc_ce->bin_data;
|
||||
old_size=tempb->size;
|
||||
old_csprite=tempb->data;
|
||||
tempb->data=MAllocIdentical(old_csprite,doc->mem_task);
|
||||
tempb->data=MAllocIdent(old_csprite,doc->mem_task);
|
||||
DocUnlock(doc);
|
||||
if (SpriteMainEd(doc)==GE_ABORT) {
|
||||
DocLock(doc);
|
||||
|
||||
@@ -74,21 +74,21 @@ CMeshEdTri *MeshTriNew(CMeshFrame *e,CColorROPU32 color,
|
||||
|
||||
CMeshEdVertex *MeshVertexFindScrPt(CMeshFrame *e,I64 x,I64 y)
|
||||
{//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;
|
||||
while (tempv!=&e->vertex_root) {
|
||||
if (!(tempv->flags&VF_IGNORE)) {
|
||||
dd=SqrI64(x-tempv->pt.x)+SqrI64(y-tempv->pt.y);
|
||||
dz=AbsI64(e->my_ip_z-tempv->p.z);
|
||||
if (dd<best_dd || dd==best_dd && dz<best_dz) {
|
||||
result=tempv;
|
||||
res=tempv;
|
||||
best_dd=dd;
|
||||
best_dz=dz;
|
||||
}
|
||||
}
|
||||
tempv=tempv->next;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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 result=0;
|
||||
I64 res=0;
|
||||
CMeshEdVertex *tempv=e->vertex_root.next;
|
||||
CMeshEdTri *tempt=e->tri_root.next;
|
||||
while (tempv!=&e->vertex_root) {
|
||||
if (tempv->flags&VF_SELECTED)
|
||||
result++;
|
||||
res++;
|
||||
tempv=tempv->next;
|
||||
}
|
||||
while (tempt!=&e->tri_root) {
|
||||
if (tempt->flags&TF_SELECTED)
|
||||
result++;
|
||||
res++;
|
||||
tempt=tempt->next;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 MeshSwapAxes(CMeshFrame *e,I64 o1,I64 o2)
|
||||
@@ -823,7 +823,7 @@ I64 MeshSize(CMeshFrame *e)
|
||||
I32 *MeshSave(CMeshFrame *e,I64 *_size=NULL)
|
||||
{
|
||||
I64 size=MeshSize(e);
|
||||
U8 *result=MAlloc(size),*dst=result;
|
||||
U8 *res=MAlloc(size),*dst=res;
|
||||
CMeshEdVertex *tempv=e->vertex_root.next;
|
||||
CMeshEdTri *tempt=e->tri_root.next;
|
||||
|
||||
@@ -845,7 +845,7 @@ I32 *MeshSave(CMeshFrame *e,I64 *_size=NULL)
|
||||
tempt=tempt->next;
|
||||
}
|
||||
if (_size) *_size=size;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 MeshCleanUp(CMeshFrame *e)
|
||||
|
||||
@@ -87,15 +87,15 @@ public I64 SpriteSize(U8 *elems)
|
||||
|
||||
I64 SpriteTypeMask(U8 *elems)
|
||||
{
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
CSprite *tempg=elems-offset(CSprite.start);
|
||||
while (tempg->type) {
|
||||
if (tempg->type>=SPT_NUM_TYPES)
|
||||
return 1<<SPT_NUM_TYPES;
|
||||
Bts(&result,tempg->type);
|
||||
Bts(&res,tempg->type);
|
||||
tempg(U8 *)+=SpriteElemSize(tempg);
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public U8 *DC2Sprite(CDC *tempb)
|
||||
|
||||
+7
-7
@@ -3,10 +3,10 @@
|
||||
|
||||
CTask *MenuTask()
|
||||
{
|
||||
CTask *result=sys_focus_task;
|
||||
while (result && !result->cur_menu)
|
||||
result=result->parent_task;
|
||||
return result;
|
||||
CTask *res=sys_focus_task;
|
||||
while (res && !res->cur_menu)
|
||||
res=res->parent_task;
|
||||
return res;
|
||||
}
|
||||
|
||||
CMenuEntry *sys_cur_submenu_entry=NULL;
|
||||
@@ -138,13 +138,13 @@ public U0 MenuDel(CMenu *m)
|
||||
|
||||
I64 MenuEntryWidth(CMenuEntry *tempme)
|
||||
{
|
||||
I64 result=StrLen(tempme->name);
|
||||
I64 res=StrLen(tempme->name);
|
||||
CMenuEntry *tempse=tempme->sub;
|
||||
while (tempse) {
|
||||
result=MaxI64(result,StrLen(tempse->name));
|
||||
res=MaxI64(res,StrLen(tempse->name));
|
||||
tempse=tempse->next;
|
||||
}
|
||||
return result+1;
|
||||
return res+1;
|
||||
}
|
||||
|
||||
public CMenu *MenuPush(U8 *st)
|
||||
|
||||
@@ -38,7 +38,7 @@ public Bool MakeOSDrvBootInstall(U8 src_drv=0,U8 dst_drv=0)
|
||||
CDrv *dv;
|
||||
CFAT32Boot br;
|
||||
CDirEntry de;
|
||||
Bool result=FALSE;
|
||||
Bool res=FALSE;
|
||||
I64 i,type;
|
||||
try {
|
||||
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) {
|
||||
case BDT_ATAPI:
|
||||
Move("/Kernel/Kernel.BIN.Z",BOOT_DIR_KERNEL_BIN_C);
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
break;
|
||||
case BDT_RAM:
|
||||
case BDT_ATA:
|
||||
@@ -80,7 +80,7 @@ public Bool MakeOSDrvBootInstall(U8 src_drv=0,U8 dst_drv=0)
|
||||
for (;i<sizeof(CFAT32Boot.code);i++)
|
||||
br.code[i]=0;
|
||||
WBlks(dv,&br,dv->base_offset,1);
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -88,7 +88,7 @@ public Bool MakeOSDrvBootInstall(U8 src_drv=0,U8 dst_drv=0)
|
||||
PutExcept;
|
||||
Beep;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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;
|
||||
I64 i,j,size,*_q;
|
||||
U8 *menu_ptr,*ptr,ch,buf[STR_LEN];
|
||||
Bool result=FALSE;
|
||||
Bool res=FALSE;
|
||||
|
||||
try {
|
||||
if (drv_lst) {
|
||||
@@ -223,10 +223,10 @@ public Bool MasterBootInstall(U8 drv_let,U8 *drv_lst=NULL)
|
||||
|
||||
ATAWriteBlks(bd,&mbr,0,1);
|
||||
BlkDevUnlock(bd);
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
}
|
||||
}
|
||||
} catch
|
||||
PutExcept;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
@@ -37,7 +37,7 @@ public U0 RAMReboot(U8 *filename)
|
||||
reg *sys_ram_reboot;
|
||||
|
||||
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);
|
||||
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,
|
||||
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) {
|
||||
@@ -208,12 +208,12 @@ Bool DiffSub(CDoc *doc,I64 *_df_flags,I64 j1_lo,I64 j1_hi,I64 j2_lo,I64 j2_hi,
|
||||
} else {
|
||||
if (DiffSub(doc,_df_flags,j1_lo,best_j1,j2_lo,best_j2,cnt1,cnt2,
|
||||
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,
|
||||
j2_hi,cnt1,cnt2,
|
||||
doc_sorted1,doc_sorted2,doc_unsorted1,doc_unsorted2))
|
||||
result=TRUE;
|
||||
return result;
|
||||
res=TRUE;
|
||||
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);
|
||||
CDocEntry *doc_e,**doc_sorted1,**doc_sorted2,**doc_unsorted1,**doc_unsorted2;
|
||||
I64 i,cnt1=0,cnt2=0,df_flags;
|
||||
Bool result=FALSE;
|
||||
Bool res=FALSE;
|
||||
|
||||
if (_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;
|
||||
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);
|
||||
if (df_flags&DF_MODIFIED && !(df_flags&DF_DONT_MODIFIED))
|
||||
DocWrite(doc1);
|
||||
|
||||
if (DiffBins(doc1,doc2)) {
|
||||
"$$RED$$Bin Data is Different$$FG$$\n";
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
}
|
||||
|
||||
DocDel(doc1);
|
||||
@@ -309,7 +309,7 @@ public Bool Diff(U8 *dst_file,U8 *src_file,I64 *_df_flags=NULL)
|
||||
Free(doc_unsorted2);
|
||||
if (_df_flags)
|
||||
*_df_flags=df_flags;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#help_index "Cmd Line (Typically);Info"
|
||||
|
||||
+39
-39
@@ -185,7 +185,7 @@ U8 *BMPPaletteNew(CFileBMP *bmp)
|
||||
{
|
||||
I64 i,j,best,score,best_score;
|
||||
CBGR48 palette[NUM_COLORS];
|
||||
U8 *result=CAlloc(NUM_BMP_COLORS*sizeof(U8));
|
||||
U8 *res=CAlloc(NUM_BMP_COLORS*sizeof(U8));
|
||||
GrPaletteGet(palette);
|
||||
#assert NUM_COLORS==NUM_BMP_COLORS
|
||||
for (i=0;i<NUM_BMP_COLORS;i++) {
|
||||
@@ -200,39 +200,39 @@ U8 *BMPPaletteNew(CFileBMP *bmp)
|
||||
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};
|
||||
|
||||
I64 BMP24Color(CBGR24 *ptr,Bool dither_probability)
|
||||
{
|
||||
I64 result,k;
|
||||
I64 res,k;
|
||||
if (dither_probability) {
|
||||
k=RandU32;
|
||||
if (SqrI64(ptr->r)+SqrI64(ptr->g)+SqrI64(ptr->b)>=3*SqrI64(k.u8[0]))
|
||||
result=8;
|
||||
res=8;
|
||||
else
|
||||
result=0;
|
||||
if (ptr->r>=k.u8[1]) result|=RED;
|
||||
if (ptr->g>=k.u8[2]) result|=GREEN;
|
||||
if (ptr->b>=k.u8[3]) result|=BLUE;
|
||||
res=0;
|
||||
if (ptr->r>=k.u8[1]) res|=RED;
|
||||
if (ptr->g>=k.u8[2]) res|=GREEN;
|
||||
if (ptr->b>=k.u8[3]) res|=BLUE;
|
||||
} else {
|
||||
if (SqrI64(ptr->r)+SqrI64(ptr->g)+SqrI64(ptr->b)>=SqrI64(0x80)) {
|
||||
result=8;
|
||||
if (ptr->r>=0x80) result|=RED;
|
||||
if (ptr->g>=0x80) result|=GREEN;
|
||||
if (ptr->b>=0x80) result|=BLUE;
|
||||
res=8;
|
||||
if (ptr->r>=0x80) res|=RED;
|
||||
if (ptr->g>=0x80) res|=GREEN;
|
||||
if (ptr->b>=0x80) res|=BLUE;
|
||||
} else {
|
||||
result=0;
|
||||
if (ptr->r>=0x40) result|=RED;
|
||||
if (ptr->g>=0x40) result|=GREEN;
|
||||
if (ptr->b>=0x40) result|=BLUE;
|
||||
res=0;
|
||||
if (ptr->r>=0x40) res|=RED;
|
||||
if (ptr->g>=0x40) res|=GREEN;
|
||||
if (ptr->b>=0x40) res|=BLUE;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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;
|
||||
Bool rle;
|
||||
CFileBMP *bmp;
|
||||
CDC *result=NULL;
|
||||
CDC *res=NULL;
|
||||
if (ptr=FileRead(filename)) {
|
||||
bmp=ptr;
|
||||
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;
|
||||
if (bmp->compression==2)
|
||||
rle=TRUE;
|
||||
@@ -262,30 +262,30 @@ public CDC *BMPRead(U8 *filename,Bool dither_probability=FALSE,
|
||||
j=0;
|
||||
while (cnt=*ptr++) {
|
||||
if (cnt==1) {
|
||||
result->color=palette_map[*ptr++&15];
|
||||
GrPlot(result,j++,i);
|
||||
res->color=palette_map[*ptr++&15];
|
||||
GrPlot(res,j++,i);
|
||||
} else {
|
||||
if (cnt==2 && *ptr>>4!=*ptr&15) {
|
||||
result->color=palette_map[*ptr&15];
|
||||
GrPlot(result,j+1,i);
|
||||
result->color=palette_map[*ptr>>4];
|
||||
GrPlot(result,j,i);
|
||||
res->color=palette_map[*ptr&15];
|
||||
GrPlot(res,j+1,i);
|
||||
res->color=palette_map[*ptr>>4];
|
||||
GrPlot(res,j,i);
|
||||
ptr++;
|
||||
j+=2;
|
||||
} else {
|
||||
result->color=palette_map[*ptr++&15];
|
||||
res->color=palette_map[*ptr++&15];
|
||||
while (cnt--)
|
||||
GrPlot(result,j++,i);
|
||||
GrPlot(res,j++,i);
|
||||
}
|
||||
}
|
||||
}
|
||||
ptr++;
|
||||
} else
|
||||
for (j=0;j<(bmp->width+7)&~7;) {
|
||||
result->color=palette_map[*ptr&15];
|
||||
GrPlot(result,j+1,i);
|
||||
result->color=palette_map[*ptr>>4];
|
||||
GrPlot(result,j,i);
|
||||
res->color=palette_map[*ptr&15];
|
||||
GrPlot(res,j+1,i);
|
||||
res->color=palette_map[*ptr>>4];
|
||||
GrPlot(res,j,i);
|
||||
ptr++;
|
||||
j+=2;
|
||||
}
|
||||
@@ -294,8 +294,8 @@ public CDC *BMPRead(U8 *filename,Bool dither_probability=FALSE,
|
||||
} else if (bmp->bit_cnt==24) {
|
||||
for (i=bmp->height-1;i>=0;i--) {
|
||||
for (j=0;j<bmp->width;j++,ptr+=3) {
|
||||
result->color=BMP24Color(ptr,dither_probability);
|
||||
GrPlot(result,j,i);
|
||||
res->color=BMP24Color(ptr,dither_probability);
|
||||
GrPlot(res,j,i);
|
||||
}
|
||||
ptr+=bmp->width&3;
|
||||
}
|
||||
@@ -304,21 +304,21 @@ public CDC *BMPRead(U8 *filename,Bool dither_probability=FALSE,
|
||||
} else if (bmp->bit_cnt>=32) {
|
||||
for (i=bmp->height-1;i>=0;i--)
|
||||
for (j=0;j<bmp->width;j++,ptr+=4) {
|
||||
result->color=BMP24Color(ptr,dither_probability);
|
||||
GrPlot(result,j,i);
|
||||
res->color=BMP24Color(ptr,dither_probability);
|
||||
GrPlot(res,j,i);
|
||||
}
|
||||
if (!use_ms_paint_palette)
|
||||
Free(palette_map);
|
||||
} else {
|
||||
"Format Not Supported.\n";
|
||||
DCDel(result);
|
||||
result=NULL;
|
||||
DCDel(res);
|
||||
res=NULL;
|
||||
}
|
||||
} else
|
||||
"Invalid BMP File\n";
|
||||
Free(bmp);
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#help_index "Graphics/Sprite;Graphics/Windows BMP Files;"\
|
||||
|
||||
@@ -213,7 +213,7 @@ I64 FindWiz()
|
||||
CDoc *doc;
|
||||
U8 buf[32],*dir,*st;
|
||||
CFind *g=CAlloc(sizeof(CFind));
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
g->recurse=TRUE;
|
||||
StrCpy(g->filemask,FILEMASK_TXT);
|
||||
if (doc=DocPut) {
|
||||
@@ -248,10 +248,10 @@ I64 FindWiz()
|
||||
st=MStrPrint("\"$$$$WW+H,1$$$$\";Cd(\"%s\");"
|
||||
"Find(\"%Q\",\"%Q\",\"%Q\");UserTaskCont;",
|
||||
dir,g->find_text,g->filemask,buf);
|
||||
result=PopUp(st);
|
||||
res=PopUp(st);
|
||||
}
|
||||
Free(dir);
|
||||
}
|
||||
Free(g);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
#help_index "Debugging/Heap"
|
||||
#help_index "Debugging/Heap;Memory/Debugging"
|
||||
#help_file "::/Doc/HeapDbg"
|
||||
|
||||
#define HL_CALLER_DEPTH 5 //Feel free to change this.
|
||||
|
||||
+14
-14
@@ -3,7 +3,7 @@
|
||||
I64 LineRep1(CDirEntry *tempde)
|
||||
{
|
||||
CDoc *doc;
|
||||
I64 result=0,i;
|
||||
I64 res=0,i;
|
||||
while (tempde) {
|
||||
i=0;
|
||||
if (tempde->attr&RS_ATTR_DIR)
|
||||
@@ -15,10 +15,10 @@ I64 LineRep1(CDirEntry *tempde)
|
||||
DocDel(doc);
|
||||
}
|
||||
tempde->user_data=i;
|
||||
result+=i;
|
||||
res+=i;
|
||||
tempde=tempde->next;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
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)
|
||||
{//Source line-of-code count report.
|
||||
I64 fuf_flags=0,result=0;
|
||||
I64 fuf_flags=0,res=0;
|
||||
CDoc *doc=DocNew;
|
||||
CDirEntry *tempde1=NULL;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+S");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
if (tempde1=FilesFind(files_find_mask,fuf_flags)) {
|
||||
result=LineRep1(tempde1);
|
||||
DocPrint(doc,"%8,d $$TR+C,\"%s\"$$\n$$ID,2$$",result,files_find_mask);
|
||||
res=LineRep1(tempde1);
|
||||
DocPrint(doc,"%8,d $$TR+C,\"%s\"$$\n$$ID,2$$",res,files_find_mask);
|
||||
LineRep2(doc,tempde1);
|
||||
DocPrint(doc,"$$ID,-2$$");
|
||||
DirTreeDel(tempde1);
|
||||
}
|
||||
DocInsDoc(DocPut,doc);
|
||||
DocDel(doc);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
I64 SizeRep1(CDirEntry *tempde,I64 *_fuf_flags)
|
||||
{
|
||||
I64 result=0,i;
|
||||
I64 res=0,i;
|
||||
U8 buf[BLK_SIZE];
|
||||
CDrv *dv;
|
||||
while (tempde) {
|
||||
@@ -67,10 +67,10 @@ I64 SizeRep1(CDirEntry *tempde,I64 *_fuf_flags)
|
||||
i=(&buf)(CArcCompress *)->expanded_size;
|
||||
}
|
||||
tempde->user_data=i;
|
||||
result+=i;
|
||||
res+=i;
|
||||
tempde=tempde->next;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
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)
|
||||
{//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;
|
||||
CDirEntry *tempde1=NULL;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
if (tempde1=FilesFind(files_find_mask,fuf_flags&FUG_FILES_FIND)) {
|
||||
fuf_flags&=FUF_EXPAND;
|
||||
result=SizeRep1(tempde1,&fuf_flags);
|
||||
DocPrint(doc,"%10,d $$TR+C,\"%s\"$$\n$$ID,2$$",result,files_find_mask);
|
||||
res=SizeRep1(tempde1,&fuf_flags);
|
||||
DocPrint(doc,"%10,d $$TR+C,\"%s\"$$\n$$ID,2$$",res,files_find_mask);
|
||||
SizeRep2(doc,tempde1);
|
||||
DocPrint(doc,"$$ID,-2$$");
|
||||
DirTreeDel(tempde1);
|
||||
}
|
||||
DocInsDoc(DocPut,doc);
|
||||
DocDel(doc);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
@@ -6,7 +6,7 @@ I64 LinkChkDoc(CDoc *doc,I64 *_fuf_flags)
|
||||
Bool found,unlock=DocLock(doc);
|
||||
CDoc *old_doc;
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
while (doc_e!=doc) {
|
||||
if (ScanKey) {
|
||||
LBts(_fuf_flags,FUf_CANCEL);
|
||||
@@ -22,38 +22,38 @@ I64 LinkChkDoc(CDoc *doc,I64 *_fuf_flags)
|
||||
if (!found) {
|
||||
PutFileLink(doc->filename.name,doc_e->y);
|
||||
"$$RED$$ %04d:%s\n$$FG$$",doc_e->y,st;
|
||||
result++;
|
||||
res++;
|
||||
}
|
||||
Free(st);
|
||||
} else if (doc_e->type_u8==DOCT_ERROR) {
|
||||
PutFileLink(doc->filename.name,doc_e->y);
|
||||
"$$RED$$ Doc Error\n$$FG$$";
|
||||
result++;
|
||||
res++;
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
if (unlock) DocUnlock(doc);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
I64 LinkChkFile(U8 *filename,I64 *_fuf_flags)
|
||||
{
|
||||
CDoc *doc=DocRead(filename,DOCF_NO_CURSOR);
|
||||
I64 result=LinkChkDoc(doc,_fuf_flags);
|
||||
I64 res=LinkChkDoc(doc,_fuf_flags);
|
||||
DocDel(doc);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
public I64 LinkChk(U8 *files_find_mask="/*",U8 *fu_flags=NULL)
|
||||
{//Check documents for broken file links.
|
||||
I64 fuf_flags=0,result=0;
|
||||
I64 fuf_flags=0,res=0;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+T+f+F+O");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
||||
while (tempde && !Bt(&fuf_flags,FUf_CANCEL)) {
|
||||
result+=LinkChkFile(tempde->full_name,&fuf_flags);
|
||||
res+=LinkChkFile(tempde->full_name,&fuf_flags);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirTreeDel(tempde1);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
+19
-19
@@ -7,36 +7,36 @@ I64 TSSSize(CTSS *tss)
|
||||
|
||||
I64 PenBrushesSize()
|
||||
{
|
||||
I64 result=0,i;
|
||||
I64 res=0,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]);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
I64 ScreenZoomTablesSize()
|
||||
{
|
||||
I64 result=0,i;
|
||||
I64 res=0,i;
|
||||
for (i=1;i<=GR_MAX_SCREEN_ZOOM;i++)
|
||||
result+=MSize2(gr.screen_zoom_tables[i]);
|
||||
return result;
|
||||
res+=MSize2(gr.screen_zoom_tables[i]);
|
||||
return res;
|
||||
}
|
||||
|
||||
I64 TaskStkSize(CTask *task)
|
||||
{
|
||||
CTaskStk *temps=task->stk;
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
while (temps) {
|
||||
result+=MSize2(temps);
|
||||
res+=MSize2(temps);
|
||||
temps=temps->next_stk;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
I64 TaskQueSize(CTask *task)
|
||||
{
|
||||
CSrvCmd *tempc,*tempc1;
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&task->srv_ctrl.flags,SVCRf_LOCKED))
|
||||
@@ -45,25 +45,25 @@ I64 TaskQueSize(CTask *task)
|
||||
tempc1=&task->srv_ctrl.next_waiting;
|
||||
tempc=tempc1->next;
|
||||
while (tempc!=tempc1) {
|
||||
result+=MSize2(tempc)+MSize2(tempc->aux_str);
|
||||
res+=MSize2(tempc)+MSize2(tempc->aux_str);
|
||||
tempc=tempc->next;
|
||||
}
|
||||
|
||||
tempc1=&task->srv_ctrl.next_done;
|
||||
tempc=tempc1->next;
|
||||
while (tempc!=tempc1) {
|
||||
result+=MSize2(tempc)+MSize2(tempc->aux_str);
|
||||
res+=MSize2(tempc)+MSize2(tempc->aux_str);
|
||||
tempc=tempc->next;
|
||||
}
|
||||
|
||||
LBtr(&task->srv_ctrl.flags,SVCRf_LOCKED);
|
||||
POPFD
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
I64 BlkDevsSize()
|
||||
{
|
||||
I64 i,result=MSize2(blkdev.blkdevs);
|
||||
I64 i,res=MSize2(blkdev.blkdevs);
|
||||
CBlkDev *bd;
|
||||
for (i=0;i<NUM_BLKDEVS;i++) {
|
||||
bd=&blkdev.blkdevs[i];
|
||||
@@ -72,18 +72,18 @@ I64 BlkDevsSize()
|
||||
"RAMDsk %C\t:%010X Unused:%010X\n",
|
||||
bd->first_drv_let,(bd->max_blk+1)<<BLK_SIZE_BITS,
|
||||
UnusedDrvSpace(bd->first_drv_let);
|
||||
result+=MSize2(bd->dev_id_record);
|
||||
res+=MSize2(bd->dev_id_record);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
I64 DrvsSize()
|
||||
{
|
||||
I64 i,result=MSize2(blkdev.drvs);
|
||||
I64 i,res=MSize2(blkdev.drvs);
|
||||
for (i=0;i<NUM_DRVS;i++)
|
||||
result+=MSize2(blkdev.drvs[i].cur_fat_blk)+MSize2(blkdev.drvs[i].fis);
|
||||
return result;
|
||||
res+=MSize2(blkdev.drvs[i].cur_fat_blk)+MSize2(blkdev.drvs[i].fis);
|
||||
return res;
|
||||
}
|
||||
|
||||
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;
|
||||
CDoc *doc;
|
||||
CDocEntry *doc_e,*doc_e1,**a;
|
||||
I64 i,j,cnt=0,result;
|
||||
I64 i,j,cnt=0,res;
|
||||
|
||||
if (!_in_name) return 0;
|
||||
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);
|
||||
|
||||
result=0;
|
||||
res=0;
|
||||
st=NULL;
|
||||
for (i=0;i<cnt;) {
|
||||
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;
|
||||
DocPrint(doc,"\n");
|
||||
}
|
||||
result++;
|
||||
res++;
|
||||
} else
|
||||
for (j=0;j<entry_lines && i<cnt;j++,i++) {
|
||||
QueIns(a[i],doc->root.last);
|
||||
@@ -66,13 +66,13 @@ public I64 Sort(U8 *_in_name,U8 *_out_name=NULL,
|
||||
DocDel(doc);
|
||||
Free(in_name);
|
||||
Free(out_name);
|
||||
return result; //Num Entries
|
||||
return res; //Num Entries
|
||||
}
|
||||
|
||||
I64 DocWordsFile(CDoc *doc_out=NULL,U8 *filename,U32 *chars_bmp)
|
||||
{
|
||||
U8 *ptr,*ptr2;
|
||||
I64 result=0,ch;
|
||||
I64 res=0,ch;
|
||||
CDoc *doc_in=DocRead(filename);
|
||||
CDocEntry *doc_e=doc_in->root.next;
|
||||
while (doc_e!=doc_in) {
|
||||
@@ -90,7 +90,7 @@ I64 DocWordsFile(CDoc *doc_out=NULL,U8 *filename,U32 *chars_bmp)
|
||||
*ptr=0;
|
||||
if (*ptr2) {
|
||||
DocPrint(doc_out,"%s\n",ptr2);
|
||||
result++;
|
||||
res++;
|
||||
}
|
||||
*ptr=ch;
|
||||
}
|
||||
@@ -98,59 +98,59 @@ I64 DocWordsFile(CDoc *doc_out=NULL,U8 *filename,U32 *chars_bmp)
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
DocDel(doc_in);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
public I64 Words(U8 *files_find_mask="*",U32 *chars_bmp=chars_bmp_alpha,
|
||||
U8 *fu_flags=NULL)
|
||||
{//Break file into list of not-unique words.
|
||||
I64 fuf_flags=0,result=0;
|
||||
I64 fuf_flags=0,res=0;
|
||||
CDoc *doc_out=DocNew;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F+T");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
||||
while (tempde) {
|
||||
result+=DocWordsFile(doc_out,tempde->full_name,chars_bmp);
|
||||
res+=DocWordsFile(doc_out,tempde->full_name,chars_bmp);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirTreeDel(tempde1);
|
||||
DocInsDoc(NULL,doc_out);
|
||||
DocDel(doc_out);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
I64 LongLinesFile(U8 *filename,I64 cols)
|
||||
{
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
CDoc *doc=DocRead(filename);
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
if (doc_e->type_u8==DOCT_NEW_LINE && doc_e->x>=cols+1)
|
||||
result++;
|
||||
res++;
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
DocDel(doc);
|
||||
if (result) {
|
||||
"%04d ",result;
|
||||
if (res) {
|
||||
"%04d ",res;
|
||||
PutFileLink(filename);
|
||||
'\n';
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
public I64 LongLines(U8 *files_find_mask="*",I64 cols=80,U8 *fu_flags=NULL)
|
||||
{//Report files with lines of too many cols.
|
||||
I64 result=0,fuf_flags=0;
|
||||
I64 res=0,fuf_flags=0;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F+S");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
||||
while (tempde) {
|
||||
if (LongLinesFile(tempde->full_name,cols))
|
||||
result++;
|
||||
res++;
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirTreeDel(tempde1);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 SUFile(U8 *filename,I64 suf_flags,F64 indent_scale_factor)
|
||||
|
||||
@@ -26,21 +26,21 @@ public F64 tM()
|
||||
|
||||
public F64 Beat()
|
||||
{//Time in music beats.
|
||||
F64 result,cur_tM;
|
||||
F64 res,cur_tM;
|
||||
PUSHFD
|
||||
CLI
|
||||
if (mp_cnt>1)
|
||||
while (LBts(&sys_semas[SYS_SEMA_TMBEAT],0))
|
||||
PAUSE
|
||||
cur_tM=tM;
|
||||
result=music.last_Beat;
|
||||
res=music.last_Beat;
|
||||
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_Beat=result;
|
||||
music.last_Beat=res;
|
||||
LBtr(&sys_semas[SYS_SEMA_TMBEAT],0);
|
||||
POPFD
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
#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);
|
||||
"%h*c%s $$TX,\"%Q...\",SCX=16$$ Mem:%08X\n",indent,CH_SPACE,
|
||||
st,desc,TaskMemAlloced(task);
|
||||
"%h*cFlags:%04X:%04X Time:%0.2fm\n",indent+2,CH_SPACE,
|
||||
task->task_flags,task->display_flags,
|
||||
task->total_time/60.0/cnts.time_stamp_freq_initial;
|
||||
"%h*cFlags:%04X:%04X:%08X\n",indent+2,CH_SPACE,
|
||||
task->task_flags,task->display_flags,task->win_inhibit;
|
||||
Free(st);
|
||||
Free(desc);
|
||||
task1=task->next_child_task;
|
||||
|
||||
@@ -111,7 +111,7 @@ public U0 SettingsPop(CTask *task=NULL,I64 flags=0)
|
||||
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);
|
||||
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)
|
||||
{
|
||||
I64 i=9,k,c;
|
||||
U8 *st,*st2,*result,*ptr;
|
||||
U8 *st,*st2,*res,*ptr;
|
||||
CHashTable *old_hash=Fs->hash_table;
|
||||
st=ScanCode2KeyName(sc);
|
||||
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 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);
|
||||
Free(st);
|
||||
Free(st2);
|
||||
|
||||
ptr=result;
|
||||
ptr=res;
|
||||
while (*ptr) {
|
||||
if (*ptr==CH_SPACE)
|
||||
*ptr=CH_SHIFT_SPACE;
|
||||
ptr++;
|
||||
}
|
||||
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
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->last_calc_idle_time=tS;
|
||||
|
||||
@@ -252,7 +252,7 @@ public CTask *WinRefocus(CTask *task=NULL)
|
||||
I64 WinOnTopWindows()
|
||||
{
|
||||
CTask *task,*task1,*first_moved_fwd=NULL;
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
PUSHFD
|
||||
CLI //TODO Multiprocessor safe
|
||||
task=sys_winmgr_task->next_task;
|
||||
@@ -260,26 +260,26 @@ I64 WinOnTopWindows()
|
||||
task1=task->next_task;
|
||||
if (!TaskValidate(task)) {
|
||||
POPFD
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
if (Bt(&task->display_flags,DISPLAYf_WIN_ON_TOP) &&
|
||||
task!=sys_winmgr_task->last_task) {
|
||||
TaskQueRem(task);
|
||||
TaskQueIns(task,sys_winmgr_task);
|
||||
result++;
|
||||
res++;
|
||||
if (!first_moved_fwd)
|
||||
first_moved_fwd=task;
|
||||
}
|
||||
task=task1;
|
||||
}
|
||||
POPFD
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public I64 WinToTop(CTask *task=NULL,Bool update_z_buf=TRUE)
|
||||
{//Put task's win on top of window stack.
|
||||
CTask *task1;
|
||||
I64 result=0;
|
||||
I64 res=0;
|
||||
if (!task) task=Fs;
|
||||
if (!TaskValidate(task) || task->gs->num)
|
||||
return 0;
|
||||
@@ -295,27 +295,27 @@ public I64 WinToTop(CTask *task=NULL,Bool update_z_buf=TRUE)
|
||||
if (task!=sys_winmgr_task->last_task) {
|
||||
TaskQueRem(task);
|
||||
TaskQueIns(task,sys_winmgr_task);
|
||||
result++;
|
||||
res++;
|
||||
}
|
||||
if (!Bt(&task->win_inhibit,WIf_SELF_FOCUS))
|
||||
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;
|
||||
while (task1!=&task->next_child_task) {
|
||||
if (!TaskValidate(task1))
|
||||
break;
|
||||
result+=WinToTop(task1,FALSE);
|
||||
res+=WinToTop(task1,FALSE);
|
||||
task1=task1->next_sibling_task;
|
||||
}
|
||||
if (task->popup_task &&
|
||||
task->popup_task->parent_task==task)
|
||||
result+=WinToTop(task->popup_task,FALSE);
|
||||
res+=WinToTop(task->popup_task,FALSE);
|
||||
}
|
||||
POPFD
|
||||
result+=WinOnTopWindows;
|
||||
if (result && update_z_buf)
|
||||
res+=WinOnTopWindows;
|
||||
if (res && update_z_buf)
|
||||
WinZBufUpdate;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
ext[EXT_WIN_TO_TOP]=&WinToTop;
|
||||
|
||||
|
||||
+15
-15
@@ -270,7 +270,7 @@ I64 WinMgrSleep(Bool flush_msgs=FALSE)
|
||||
WinIPUpdate;
|
||||
|
||||
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);
|
||||
GrUpdateScreen;
|
||||
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 *result=NULL;
|
||||
CDoc *res=NULL;
|
||||
Bool unlock;
|
||||
I64 x0,y0;
|
||||
if (!task) task=Fs;
|
||||
if (WinInside(ipx,ipy,task)) {
|
||||
if ((result=DocDisplay(task)) && result->flags&DOCF_DONT_SHOW)
|
||||
result=NULL;
|
||||
if ((res=DocDisplay(task)) && res->flags&DOCF_DONT_SHOW)
|
||||
res=NULL;
|
||||
else if (set_cursor) {
|
||||
unlock=DocLock(result);
|
||||
if (result->doc_signature!=DOC_SIGNATURE_VAL)
|
||||
result=NULL;
|
||||
unlock=DocLock(res);
|
||||
if (res->doc_signature!=DOC_SIGNATURE_VAL)
|
||||
res=NULL;
|
||||
else {
|
||||
x0=result->line_start_col;
|
||||
y0=result->top_line_num;
|
||||
DocRecalc(result,RECALCF_HAS_CURSOR);
|
||||
result->x=(ipx-task->pix_left-task->scroll_x)/FONT_WIDTH +x0;
|
||||
result->y=(ipy-task->pix_top -task->scroll_y)/FONT_HEIGHT+y0;
|
||||
DocRecalc(result,RECALCt_FIND_CURSOR);
|
||||
x0=res->line_start_col;
|
||||
y0=res->top_line_num;
|
||||
DocRecalc(res,RECALCF_HAS_CURSOR);
|
||||
res->x=(ipx-task->pix_left-task->scroll_x)/FONT_WIDTH +x0;
|
||||
res->y=(ipy-task->pix_top -task->scroll_y)/FONT_HEIGHT+y0;
|
||||
DocRecalc(res,RECALCt_FIND_CURSOR);
|
||||
task->scroll_x=0;
|
||||
task->scroll_y=0;
|
||||
task->scroll_z=0;
|
||||
if (unlock)
|
||||
DocUnlock(result);
|
||||
DocUnlock(res);
|
||||
}
|
||||
}
|
||||
WinToTop(task);
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 WinChkMoveSize(CTask *task)
|
||||
|
||||
@@ -65,7 +65,7 @@ U0 HoldCourt()
|
||||
Bool TakeTurn()
|
||||
{
|
||||
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);
|
||||
if (num_people>MAX_PEOPLE)
|
||||
num_people=MAX_PEOPLE;
|
||||
@@ -96,7 +96,7 @@ Bool TakeTurn()
|
||||
DocBottom;
|
||||
|
||||
if (!(0<=i<T_QUIT))
|
||||
result=FALSE;
|
||||
res=FALSE;
|
||||
else {
|
||||
switch (i) {
|
||||
case T_BREAK_CAMP:
|
||||
@@ -130,11 +130,11 @@ Bool TakeTurn()
|
||||
PopUpOk("Add your own story-line...\nLike old school toys.\n");
|
||||
break;
|
||||
}
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
}
|
||||
WinMgrSync;
|
||||
Fs->song_task=NULL;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
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;
|
||||
while (tempb!=&b_root) {
|
||||
if (tempb->type!=BE_TEMPLATE_COPY) {
|
||||
tempb->credit_index=StrFileAdd(tempb->credit,
|
||||
tempb->credit_idx=StrFileAdd(tempb->credit,
|
||||
&accts_table_strs,accts_table);
|
||||
tempb->debit_index =StrFileAdd(tempb->debit,
|
||||
tempb->debit_idx =StrFileAdd(tempb->debit,
|
||||
&accts_table_strs,accts_table);
|
||||
}
|
||||
tempb=tempb->next;
|
||||
}
|
||||
tempt=t_root.next;
|
||||
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);
|
||||
tempt->b.debit_index =StrFileAdd(tempt->b.debit,
|
||||
tempt->b.debit_idx =StrFileAdd(tempt->b.debit,
|
||||
&accts_table_strs,accts_table);
|
||||
tempt=tempt->next;
|
||||
}
|
||||
@@ -54,7 +54,7 @@ I64 BgtAcctColor(U8 *st)
|
||||
U8 *BgtPopUpAcct(U8 *header=NULL,U8 *dft=NULL)
|
||||
{
|
||||
I64 i;
|
||||
U8 *result;
|
||||
U8 *res;
|
||||
CDoc *doc=DocNew;
|
||||
CDocEntry *doc_e,*doc_dft=NULL;
|
||||
CHashGeneric *temph;
|
||||
@@ -77,7 +77,7 @@ U8 *BgtPopUpAcct(U8 *header=NULL,U8 *dft=NULL)
|
||||
doc->cur_entry=doc_dft;
|
||||
doc->cur_col=0;
|
||||
}
|
||||
result=PopUpMenu(doc,DOF_DONT_HOME);
|
||||
res=PopUpMenu(doc,DOF_DONT_HOME);
|
||||
DocDel(doc);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
+12
-12
@@ -19,9 +19,9 @@ U0 BgtDataRead()
|
||||
for (i=0;i<cnt;i++) {
|
||||
tempb=CAlloc(sizeof(CBgtEntry));
|
||||
MemCpy(&tempb->start,ptr,BE_SIZE);
|
||||
tempb->credit=StrNew(s[tempb->credit_index]);
|
||||
tempb->debit =StrNew(s[tempb->debit_index]);
|
||||
tempb->desc =StrNew(s[tempb->desc_index]);
|
||||
tempb->credit=StrNew(s[tempb->credit_idx]);
|
||||
tempb->debit =StrNew(s[tempb->debit_idx]);
|
||||
tempb->desc =StrNew(s[tempb->desc_idx]);
|
||||
QueIns(tempb,b_root.last);
|
||||
ptr+=BE_SIZE;
|
||||
}
|
||||
@@ -33,9 +33,9 @@ U0 BgtDataRead()
|
||||
ptr+=BT_SIZE;
|
||||
MemCpy(&tempt->b.start,ptr,BE_SIZE);
|
||||
ptr+=BE_SIZE;
|
||||
tempt->b.credit=StrNew(s[tempt->b.credit_index]);
|
||||
tempt->b.debit =StrNew(s[tempt->b.debit_index]);
|
||||
tempt->b.desc =StrNew(s[tempt->b.desc_index]);
|
||||
tempt->b.credit=StrNew(s[tempt->b.credit_idx]);
|
||||
tempt->b.debit =StrNew(s[tempt->b.debit_idx]);
|
||||
tempt->b.desc =StrNew(s[tempt->b.desc_idx]);
|
||||
QueIns(tempt,t_root.last);
|
||||
}
|
||||
}
|
||||
@@ -67,9 +67,9 @@ U0 BgtDataWrite()
|
||||
cnt1=0;
|
||||
while (tempb!=&b_root) {
|
||||
if (tempb->type!=BE_TEMPLATE_COPY) {
|
||||
tempb->credit_index =StrFileAdd(tempb->credit,&num,table);
|
||||
tempb->debit_index =StrFileAdd(tempb->debit,&num,table);
|
||||
tempb->desc_index =StrFileAdd(tempb->desc,&num,table);
|
||||
tempb->credit_idx =StrFileAdd(tempb->credit,&num,table);
|
||||
tempb->debit_idx =StrFileAdd(tempb->debit,&num,table);
|
||||
tempb->desc_idx =StrFileAdd(tempb->desc,&num,table);
|
||||
cnt1++;
|
||||
}
|
||||
tempb=tempb->next;
|
||||
@@ -78,9 +78,9 @@ U0 BgtDataWrite()
|
||||
tempt=t_root.next;
|
||||
cnt2=0;
|
||||
while (tempt!=&t_root) {
|
||||
tempt->b.credit_index =StrFileAdd(tempt->b.credit,&num,table);
|
||||
tempt->b.debit_index =StrFileAdd(tempt->b.debit,&num,table);
|
||||
tempt->b.desc_index =StrFileAdd(tempt->b.desc,&num,table);
|
||||
tempt->b.credit_idx =StrFileAdd(tempt->b.credit,&num,table);
|
||||
tempt->b.debit_idx =StrFileAdd(tempt->b.debit,&num,table);
|
||||
tempt->b.desc_idx =StrFileAdd(tempt->b.desc,&num,table);
|
||||
cnt2++;
|
||||
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);
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
I64 i,max_num=0;
|
||||
U8 *ptr,**result,*colors;
|
||||
U8 *ptr,**res,*colors;
|
||||
|
||||
while (doc_e!=doc) {
|
||||
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;
|
||||
}
|
||||
|
||||
result=CAlloc(sizeof(U8 *)*(max_num+1));
|
||||
res=CAlloc(sizeof(U8 *)*(max_num+1));
|
||||
colors=CAlloc(sizeof(U8)*(max_num+1));
|
||||
doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
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;
|
||||
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;
|
||||
else
|
||||
Free(colors);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public U0 StrFileArrDel(U8 **a,I64 max_num)
|
||||
|
||||
@@ -17,7 +17,7 @@ class CBgtEntry
|
||||
U0 start;
|
||||
CDate date;
|
||||
U16 type,flags;
|
||||
U32 credit_index,debit_index,desc_index;
|
||||
U32 credit_idx,debit_idx,desc_idx;
|
||||
F64 amount;
|
||||
U0 end;
|
||||
|
||||
@@ -60,17 +60,17 @@ I64 accts_table_strs=0;
|
||||
CDate MyStr2Date(U8 *st)
|
||||
{
|
||||
CDateStruct ds;
|
||||
CDate result;
|
||||
CDate res;
|
||||
if (st&&*st) {
|
||||
if (StrOcc(st,'['))
|
||||
result=b_root.next->date;
|
||||
res=b_root.next->date;
|
||||
else if (StrOcc(st,']'))
|
||||
result=b_root.last->date;
|
||||
res=b_root.last->date;
|
||||
else
|
||||
result=Str2Date(st);
|
||||
res=Str2Date(st);
|
||||
} else
|
||||
result=Now;
|
||||
Date2Struct(&ds,result);
|
||||
res=Now;
|
||||
Date2Struct(&ds,res);
|
||||
if (ds.year>2050)
|
||||
ds.year-=100;
|
||||
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 result=b->tri_cnt++;
|
||||
b->t[result].color=c;
|
||||
b->t[result].nums[0]=n0;
|
||||
b->t[result].nums[1]=n1;
|
||||
b->t[result].nums[2]=n2;
|
||||
return result;
|
||||
I64 res=b->tri_cnt++;
|
||||
b->t[res].color=c;
|
||||
b->t[res].nums[0]=n0;
|
||||
b->t[res].nums[1]=n1;
|
||||
b->t[res].nums[2]=n2;
|
||||
return res;
|
||||
}
|
||||
|
||||
U8 *Ball2CSprite()
|
||||
{
|
||||
//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)
|
||||
+sprite_elem_base_sizes[SPT_END]),
|
||||
*dst=result;
|
||||
*dst=res;
|
||||
*dst++ =SPT_MESH;
|
||||
*dst(I32 *)++ =b->vertex_cnt;
|
||||
*dst(I32 *)++ =b->tri_cnt;
|
||||
@@ -70,12 +70,12 @@ U8 *Ball2CSprite()
|
||||
MemCpy(dst,&b->t,b->tri_cnt*sizeof(CMeshTri));
|
||||
dst+=b->tri_cnt*sizeof(CMeshTri);
|
||||
*dst++ =SPT_END;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public U8 *BallGen()
|
||||
{
|
||||
U8 *result;
|
||||
U8 *res;
|
||||
I64 i,j,n,m,c,p1,p2,p3,p4;
|
||||
BallDefineStruct bd1,bd2;
|
||||
F64 r,r1,r2,z1,z2,d_a1,d_a2;
|
||||
@@ -112,17 +112,17 @@ public U8 *BallGen()
|
||||
}
|
||||
}
|
||||
|
||||
result=Ball2CSprite;
|
||||
res=Ball2CSprite;
|
||||
"%h7c",'\n';
|
||||
Sprite(result,"\t\t$$SP,\"<1>\",BI=%d$$");
|
||||
Sprite(res,"\t\t$$SP,\"<1>\",BI=%d$$");
|
||||
"%h7c",'\n';
|
||||
"Vertices:%d\n",b->vertex_cnt;
|
||||
Free(b);
|
||||
"Do another";
|
||||
if (YorN)
|
||||
Free(result);
|
||||
Free(res);
|
||||
else
|
||||
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 result=m->vertex_cnt++;
|
||||
m->v[result].x=-x;
|
||||
m->v[result].y=-y-md->leg_len-md->foot_rad*2;
|
||||
m->v[result].z=-z;
|
||||
return result;
|
||||
I64 res=m->vertex_cnt++;
|
||||
m->v[res].x=-x;
|
||||
m->v[res].y=-y-md->leg_len-md->foot_rad*2;
|
||||
m->v[res].z=-z;
|
||||
return res;
|
||||
}
|
||||
|
||||
I64 AddTri(ManDefineStruct *,I64 c,I64 n0,I64 n1,I64 n2)
|
||||
{
|
||||
I64 result=m->tri_cnt++;
|
||||
m->t[result].color=c;
|
||||
m->t[result].nums[0]=n1;
|
||||
m->t[result].nums[1]=n0;
|
||||
m->t[result].nums[2]=n2;
|
||||
return result;
|
||||
I64 res=m->tri_cnt++;
|
||||
m->t[res].color=c;
|
||||
m->t[res].nums[0]=n1;
|
||||
m->t[res].nums[1]=n0;
|
||||
m->t[res].nums[2]=n2;
|
||||
return res;
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
//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)+
|
||||
sprite_elem_base_sizes[SPT_END]),
|
||||
*dst=result;
|
||||
*dst=res;
|
||||
*dst++ =SPT_MESH;
|
||||
*dst(I32 *)++ =m->vertex_cnt;
|
||||
*dst(I32 *)++ =m->tri_cnt;
|
||||
@@ -224,12 +224,12 @@ U8 *Man2CSprite()
|
||||
MemCpy(dst,&m->t,m->tri_cnt*sizeof(CMeshTri));
|
||||
dst+=m->tri_cnt*sizeof(CMeshTri);
|
||||
*dst++ =SPT_END;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
public U8 *ManGen()
|
||||
{
|
||||
U8 *result;
|
||||
U8 *res;
|
||||
I64 x,y,z,c1,c2,c3,c4;
|
||||
ManDefineStruct md1,md2;
|
||||
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.l_hip_a2,0,md2.l_ankle_a,&x,&y,&z);
|
||||
|
||||
result=Man2CSprite;
|
||||
res=Man2CSprite;
|
||||
"%h7c",'\n';
|
||||
Sprite(result,"\t\t$$SP,\"<1>\",BI=%d$$");
|
||||
Sprite(res,"\t\t$$SP,\"<1>\",BI=%d$$");
|
||||
"%h7c",'\n';
|
||||
Free(m);
|
||||
"Do another";
|
||||
if (YorN)
|
||||
Free(result);
|
||||
Free(res);
|
||||
else
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
@@ -279,9 +279,9 @@ U0 DrawObj(CDC *dc,Obj *o,F64 tt)
|
||||
if (o==ball)
|
||||
Sprite3(dc,o->x,(o->y-o->z)/2,GR_Z_ALL-o->y,$IB,"<1>",BI=1$);
|
||||
else {
|
||||
temps=SpriteInterpolate(imgs[o->last_img].img[o->team],
|
||||
imgs[o->next_img].img[o->team],
|
||||
(tt-o->last_t0)/(o->next_t0-o->last_t0));
|
||||
temps=SpriteInterpolate((tt-o->last_t0)/(o->next_t0-o->last_t0),
|
||||
imgs[o->last_img].img[o->team],
|
||||
imgs[o->next_img].img[o->team]);
|
||||
SpriteY3B(dc,o->x,(o->y-o->z)/2,GR_Z_ALL-o->y,temps,o->ay);
|
||||
Free(temps);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ U0 PsmNoteDel(PsmNote *tempo)
|
||||
|
||||
PsmNote *PsmNoteCopy(PsmNote *tempo)
|
||||
{
|
||||
PsmNote *tempo1=MAllocIdentical(tempo);
|
||||
PsmNote *tempo1=MAllocIdent(tempo);
|
||||
if (tempo->word)
|
||||
tempo1->word=StrNew(tempo->word);
|
||||
else
|
||||
|
||||
@@ -14,7 +14,7 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
||||
while (tempm1!=&ode->next_mass) {
|
||||
tempm2=tempm1->next;
|
||||
while (tempm2!=&ode->next_mass) {
|
||||
D3Sub(&tempm2->state->x,&tempm1->state->x,&p);
|
||||
D3Sub(&p,&tempm2->state->x,&tempm1->state->x);
|
||||
dd=D3NormSqr(&p);
|
||||
if (dd<=Sqr(tempm1->radius+tempm2->radius)) {
|
||||
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.y=ip.pos.y-task->pix_top-task->scroll_y;
|
||||
p2.z=0;
|
||||
D3Sub(&p2,&cursor_mass->state->x,&p);
|
||||
D3Sub(&p,&p2,&cursor_mass->state->x);
|
||||
d=10.0*D3NormSqr(&p);
|
||||
D3MulEqu(&p,d);
|
||||
D3AddEqu(&cursor_mass->DstateDt->DxDt,&p);
|
||||
|
||||
@@ -10,18 +10,18 @@ F64 Cost(CMathODE *ode)
|
||||
{
|
||||
MyMass *tempm;
|
||||
MySpring *temps;
|
||||
F64 result=0;
|
||||
F64 res=0;
|
||||
tempm=ode->next_mass;
|
||||
while (tempm!=&ode->next_mass) {
|
||||
result+=tempm->cost;
|
||||
res+=tempm->cost;
|
||||
tempm=tempm->next;
|
||||
}
|
||||
temps=ode->next_spring;
|
||||
while (temps!=&ode->next_spring) {
|
||||
result+=temps->cost;
|
||||
res+=temps->cost;
|
||||
temps=temps->next;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 DrawIt(CTask *task,CDC *dc)
|
||||
|
||||
@@ -25,7 +25,7 @@ U0 SpanDel(CMathODE *ode)
|
||||
U8 *SpanSave(CMathODE *ode,I64 *_size=NULL)
|
||||
{
|
||||
I64 cnt;
|
||||
U8 *result,*ptr;
|
||||
U8 *res,*ptr;
|
||||
MyMass *tempm;
|
||||
MySpring *temps;
|
||||
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;
|
||||
|
||||
ptr=result=MAlloc(cnt);
|
||||
ptr=res=MAlloc(cnt);
|
||||
MemCpy(ptr,&h,sizeof(SpanHeader));
|
||||
ptr+=sizeof(SpanHeader);
|
||||
|
||||
@@ -61,25 +61,25 @@ U8 *SpanSave(CMathODE *ode,I64 *_size=NULL)
|
||||
temps=temps->next;
|
||||
}
|
||||
if (_size) *_size=cnt;
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
Bool SpanWrite(CMathODE *ode)
|
||||
{
|
||||
U8 *name,*buf;
|
||||
I64 size;
|
||||
Bool result=FALSE,old_silent=Silent;
|
||||
Bool res=FALSE,old_silent=Silent;
|
||||
MkDir("::/Home/Span");
|
||||
Silent(old_silent);
|
||||
if (name=PopUpFileName("::/Home/Span/Game.DAT")) {
|
||||
if (buf=SpanSave(ode,&size)) {
|
||||
FileWrite(name,buf,size);
|
||||
Free(buf);
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
}
|
||||
Free(name);
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 SpanLoad(CMathODE *ode,U8 *src)
|
||||
|
||||
@@ -194,7 +194,7 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
||||
while (tempm1!=&ode->next_mass) {
|
||||
tempm2=tempm1->next;
|
||||
while (tempm2!=&ode->next_mass) {
|
||||
D3Sub(&tempm2->state->x,&tempm1->state->x,&p);
|
||||
D3Sub(&p,&tempm2->state->x,&tempm1->state->x);
|
||||
dd=D3NormSqr(&p);
|
||||
if (dd<=Sqr(2*RADIUS)) {
|
||||
d=Sqrt(dd)+0.0001;
|
||||
@@ -212,7 +212,7 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
||||
while (temps!=&ode->next_spring) {
|
||||
if (main_mode_button.state==MMD_PLAY && temps->type==EMD_THRUSTER &&
|
||||
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);
|
||||
D3MulEqu(&p,2000);
|
||||
D3AddEqu(&temps->end1->DstateDt->DxDt,&p);
|
||||
|
||||
@@ -198,7 +198,7 @@ U0 MPDrawMen(CDC *dc2)
|
||||
tt=4*Wrap(tempm->phase+5*ts,0)/(2*ă);
|
||||
}
|
||||
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);
|
||||
Free(temps);
|
||||
}
|
||||
|
||||
@@ -199,11 +199,11 @@ U0 Toward(I64 *_row,I64 *_col,I64 direction)
|
||||
|
||||
I64 FacingChg(I64 f1,I64 f2)
|
||||
{
|
||||
I64 result=(f1+6-f2)%6;
|
||||
if (result>=3)
|
||||
return 6-result;
|
||||
I64 res=(f1+6-f2)%6;
|
||||
if (res>=3)
|
||||
return 6-res;
|
||||
else
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 RowCol2XY(F64 *_x,F64 *_y,I64 row,I64 col)
|
||||
@@ -335,7 +335,7 @@ U0 RVMerge(I64 player)
|
||||
|
||||
Bool MPRecalcVisible(MPCtrl1 *job)
|
||||
{
|
||||
Bool result=FALSE,seen;
|
||||
Bool res=FALSE,seen;
|
||||
I64 i,j,row,col;
|
||||
F64 x1,y1,x2,y2,dd,range;
|
||||
Unit *ut0,*ut1;
|
||||
@@ -376,7 +376,7 @@ Bool MPRecalcVisible(MPCtrl1 *job)
|
||||
LOS(row,col,ut1->row,ut1->col)) {
|
||||
LBts(&visible_unit_bitmap[enemy_player],
|
||||
job->tempu->num+i*((MAX_UNITS+7)&~7));
|
||||
result=TRUE;
|
||||
res=TRUE;
|
||||
} else
|
||||
LBtr(&visible_unit_bitmap[enemy_player],
|
||||
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));
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
Bool RecalcVisible(I64 mode,Unit *tempu=NULL)
|
||||
{
|
||||
I64 i,hi,k,cnt;
|
||||
Bool result;
|
||||
Bool res;
|
||||
/*The compiler doesn't go out of it's way
|
||||
to know if something is const.;-) This
|
||||
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;
|
||||
}
|
||||
|
||||
result=FALSE;
|
||||
res=FALSE;
|
||||
for (i=0;i<cnt;i++)
|
||||
cmd[i]=JobQue(&MPRecalcVisible,&job[i],i,0);
|
||||
for (i=0;i<cnt;i++)
|
||||
if (JobResultGet(cmd[i]))
|
||||
result=TRUE;
|
||||
if (JobResGet(cmd[i]))
|
||||
res=TRUE;
|
||||
if (mode==RV_UPDATE_FRIENDLY_UNIT)
|
||||
RVMerge(cur_player);
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
class MPCtrl2
|
||||
@@ -512,30 +512,30 @@ U0 RecalcVisibleMap(I64 row,I64 col)
|
||||
for (i=0;i<cnt;i++)
|
||||
cmd[i]=JobQue(&MPRecalcVisibleMap,&job[i],i,0);
|
||||
for (i=0;i<cnt;i++)
|
||||
JobResultGet(cmd[i]);
|
||||
JobResGet(cmd[i]);
|
||||
}
|
||||
|
||||
I64 MoveCost(Unit *tempu,I64 r,I64 c,I64 facing)
|
||||
{
|
||||
I64 result;
|
||||
I64 res;
|
||||
if (tempu->infantry)
|
||||
result=0;
|
||||
res=0;
|
||||
else {
|
||||
result=FacingChg(facing,tempu->facing);
|
||||
if (result>0) result--;
|
||||
res=FacingChg(facing,tempu->facing);
|
||||
if (res>0) res--;
|
||||
}
|
||||
if (roads[r][c] && roads[tempu->row][tempu->col])
|
||||
result+=1;
|
||||
res+=1;
|
||||
else {
|
||||
if (tempu->infantry)
|
||||
result+=2;
|
||||
res+=2;
|
||||
else {
|
||||
result+=movement_costs[terrain[r][c]];
|
||||
res+=movement_costs[terrain[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)
|
||||
@@ -1633,7 +1633,7 @@ U0 TaskEndCB()
|
||||
|
||||
I64 DoPhase()
|
||||
{
|
||||
I64 result='ExitGame';
|
||||
I64 res='ExitGame';
|
||||
NewPhase;
|
||||
try {
|
||||
if (phase&~1==PHASE_PLOT)
|
||||
@@ -1643,15 +1643,15 @@ I64 DoPhase()
|
||||
else
|
||||
Call(fire_routines[cur_player]);
|
||||
} catch {
|
||||
result=Fs->except_ch;
|
||||
res=Fs->except_ch;
|
||||
Fs->catch_except=TRUE;
|
||||
}
|
||||
return result;
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 ToTheFront()
|
||||
{
|
||||
I64 result,ch;
|
||||
I64 res,ch;
|
||||
map_dc=DCNew(MAP_WIDTH,MAP_HEIGHT);
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
@@ -1697,8 +1697,8 @@ U0 ToTheFront()
|
||||
|
||||
try {
|
||||
do {
|
||||
result=DoPhase;
|
||||
if (result=='GameOver') {
|
||||
res=DoPhase;
|
||||
if (res=='GameOver') {
|
||||
while (TRUE) {
|
||||
msg_off_timeout=0;
|
||||
StrCpy(msg_buf,"Game Over");
|
||||
@@ -1709,18 +1709,18 @@ U0 ToTheFront()
|
||||
Init;
|
||||
break;
|
||||
} else if (ch==CH_ESC || ch==CH_SHIFT_ESC) {
|
||||
result='ExitGame';
|
||||
res='ExitGame';
|
||||
break;
|
||||
} else if (ch=='1')
|
||||
SetViewPlayer(0);
|
||||
else if (ch=='2')
|
||||
SetViewPlayer(1);
|
||||
}
|
||||
} else if (result=='NewGame') {
|
||||
} else if (res=='NewGame') {
|
||||
CleanUp;
|
||||
Init;
|
||||
}
|
||||
} while (result!='ExitGame');
|
||||
} while (res!='ExitGame');
|
||||
} catch
|
||||
PutExcept;
|
||||
ProgressBarsRst;
|
||||
|
||||
+362
-98
@@ -41,6 +41,7 @@ class MyMass:CMass
|
||||
F64 temperature;
|
||||
F64 radius;
|
||||
I64 color;
|
||||
Bool no_overlap;
|
||||
};
|
||||
|
||||
class MySpring:CSpring
|
||||
@@ -52,9 +53,26 @@ class MySpring:CSpring
|
||||
#define SPIN_GAIN 0.25
|
||||
#define MAX_MASSES 8
|
||||
#define MAX_SPRINGS 16
|
||||
#define MAX_MISSILES 2
|
||||
#define ST_HUMAN1 0
|
||||
#define ST_ENEMY1 1
|
||||
#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
|
||||
{
|
||||
Ship *next,*last;
|
||||
@@ -66,19 +84,20 @@ class Ship
|
||||
F64 die_time,die_timeout;
|
||||
I64 spacewalk_side;
|
||||
F64 laser_temperature;
|
||||
Missile missiles[MAX_MISSILES];
|
||||
Bool lasering,exploding,laser_overheat;
|
||||
} *human;
|
||||
} ship_root,*human;
|
||||
|
||||
F64 human_t_left,human_t_right,human_antispin;
|
||||
|
||||
class Shot
|
||||
{
|
||||
Shot *next,*last;
|
||||
F64 radius;
|
||||
F64 radius,explosion_radius;
|
||||
F64 fuse_time,die_timeout;
|
||||
MyMass p;
|
||||
Bool exploding;
|
||||
};
|
||||
} shot_root;
|
||||
|
||||
#define MAX_THRUST 200.0
|
||||
#define MAX_ANTISPIN 25.0
|
||||
@@ -95,8 +114,6 @@ Bool game_over,show_level_msg;
|
||||
#define NUM_STARS 100
|
||||
I64 stars_x[NUM_STARS],stars_y[NUM_STARS];
|
||||
|
||||
Ship ship_root;
|
||||
Shot shot_root;
|
||||
CMathODE *ode=NULL;
|
||||
I64 level,score,remaining;
|
||||
|
||||
@@ -114,6 +131,10 @@ $SP,"<5>",BI=5$
|
||||
|
||||
$SP,"<6>",BI=6$
|
||||
|
||||
$SP,"<7>",BI=7$
|
||||
|
||||
$SP,"<8>",BI=8$
|
||||
|
||||
$BG$
|
||||
//********************************** Ship
|
||||
Bool CheckOverlap()
|
||||
@@ -124,8 +145,8 @@ Bool CheckOverlap()
|
||||
while (tempm!=&ode->next_mass) {
|
||||
tempm1=ode->next_mass;
|
||||
while (tempm1!=&ode->next_mass) {
|
||||
if (tempm!=tempm1) {
|
||||
D3Sub(&tempm->x,&tempm1->x,&p);
|
||||
if (tempm!=tempm1 && !tempm->no_overlap && !tempm1->no_overlap) {
|
||||
D3Sub(&p,&tempm->x,&tempm1->x);
|
||||
if (D3NormSqr(&p)<=Sqr(tempm->radius+tempm1->radius))
|
||||
return TRUE;
|
||||
}
|
||||
@@ -136,6 +157,63 @@ Bool CheckOverlap()
|
||||
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)
|
||||
{
|
||||
I64 i;
|
||||
@@ -195,6 +273,8 @@ Ship *ShipNew(I64 x,I64 y,I64 type)
|
||||
tempsp->s[i].color=LTGRAY;
|
||||
QueIns(&tempsp->s[i],ode->last_spring);
|
||||
}
|
||||
MissileNew(tempsp,0);
|
||||
MissileNew(tempsp,1);
|
||||
remaining=0;
|
||||
|
||||
break;
|
||||
@@ -289,6 +369,19 @@ Ship *ShipNew(I64 x,I64 y,I64 type)
|
||||
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)
|
||||
{
|
||||
I64 i;
|
||||
@@ -297,6 +390,8 @@ U0 ShipDel(Ship *tempsp)
|
||||
QueRem(&tempsp->p[i]);
|
||||
for (i=0;i<tempsp->springs;i++)
|
||||
QueRem(&tempsp->s[i]);
|
||||
for (i=0;i<2;i++)
|
||||
MissileDel(&tempsp->missiles[i]);
|
||||
QueRem(tempsp);
|
||||
Free(tempsp);
|
||||
remaining--;
|
||||
@@ -323,12 +418,12 @@ I64 Tweaked()
|
||||
{
|
||||
CD3 p,p1,p2;
|
||||
if (human) {
|
||||
D3Sub(&human->p[0].x,&human->p[1].x,&p1);
|
||||
D3Sub(&human->p[0].x,&human->p[2].x,&p2);
|
||||
D3Add(&p1,&p2,&p);
|
||||
D3Sub(&p1,&human->p[0].x,&human->p[1].x);
|
||||
D3Sub(&p2,&human->p[0].x,&human->p[2].x);
|
||||
D3Add(&p,&p1,&p2);
|
||||
D3Unit(&p);
|
||||
D3Sub(&human->p[0].x,&human->p[3].x,&p1);
|
||||
D3Sub(&human->p[0].x,&human->p[4].x,&p2);
|
||||
D3Sub(&p1,&human->p[0].x,&human->p[3].x);
|
||||
D3Sub(&p2,&human->p[0].x,&human->p[4].x);
|
||||
D3Unit(&p1);
|
||||
D3Unit(&p2);
|
||||
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;
|
||||
Ship *tempsp;
|
||||
Shot *temps;
|
||||
Missile *tempmi;
|
||||
CD3 p,p1,p2;
|
||||
F64 t_left,t_right,spin,d,x,y;
|
||||
MySpring *tempsps;
|
||||
@@ -398,7 +494,7 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
|
||||
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;
|
||||
GrLine(dc,tempsps->end1->x,tempsps->end1->y,
|
||||
tempsps->end2->x,tempsps->end2->y);
|
||||
@@ -406,6 +502,28 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
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;
|
||||
while (tempsp!=&ship_root) {
|
||||
if (!tempsp->exploding)
|
||||
@@ -415,18 +533,18 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
t_left=0;
|
||||
t_right=0;
|
||||
} else {
|
||||
if (d=D3Norm(D3Sub(&tempsp->p[0].x,&tempsp->p[1].x,&p1))) {
|
||||
D3Sub(&tempsp->p[0].DxDt,&tempsp->p[1].DxDt,&p2);
|
||||
D3Cross(&p1,&p2,&p);
|
||||
if (d=D3Norm(D3Sub(&p1,&tempsp->p[0].x,&tempsp->p[1].x))) {
|
||||
D3Sub(&p2,&tempsp->p[0].DxDt,&tempsp->p[1].DxDt);
|
||||
D3Cross(&p,&p1,&p2);
|
||||
spin=p.z/d;
|
||||
} else
|
||||
spin=0;
|
||||
t_left =Clamp(human_t_left+SPIN_GAIN*spin*human_antispin,
|
||||
0,MAX_THRUST);
|
||||
|
||||
if (d=D3Norm(D3Sub(&tempsp->p[0].x,&tempsp->p[2].x,&p1))) {
|
||||
D3Sub(&tempsp->p[0].DxDt,&tempsp->p[2].DxDt,&p2);
|
||||
D3Cross(&p1,&p2,&p);
|
||||
if (d=D3Norm(D3Sub(&p1,&tempsp->p[0].x,&tempsp->p[2].x))) {
|
||||
D3Sub(&p2,&tempsp->p[0].DxDt,&tempsp->p[2].DxDt);
|
||||
D3Cross(&p,&p1,&p2);
|
||||
spin=p.z/d;
|
||||
} else
|
||||
spin=0;
|
||||
@@ -434,13 +552,13 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
0,MAX_THRUST);
|
||||
}
|
||||
|
||||
D3Sub(&tempsp->p[1].x,&tempsp->p[0].x,&p1);
|
||||
D3Sub(&tempsp->p[2].x,&tempsp->p[0].x,&p2);
|
||||
D3Unit(D3Add(&p1,&p2,&p));
|
||||
D3Sub(&p1,&tempsp->p[1].x,&tempsp->p[0].x);
|
||||
D3Sub(&p2,&tempsp->p[2].x,&tempsp->p[0].x);
|
||||
D3Unit(D3Add(&p,&p1,&p2));
|
||||
|
||||
if (!(tempsp->s[3].flags&SSF_INACTIVE)) {
|
||||
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);
|
||||
arg=Arg(p.x,p.y);
|
||||
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)) {
|
||||
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);
|
||||
arg=Arg(p.x,p.y);
|
||||
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);
|
||||
}
|
||||
case ST_ENEMY1:
|
||||
D3DivEqu(D3Sub(&tempsp->p[1].x,&tempsp->p[0].x,&p1),2.0);
|
||||
D3DivEqu(D3Sub(&tempsp->p[2].x,&tempsp->p[0].x,&p2),2.0);
|
||||
D3Unit(D3Add(&p1,&p2,&p));
|
||||
D3DivEqu(D3Sub(&p1,&tempsp->p[1].x,&tempsp->p[0].x),2.0);
|
||||
D3DivEqu(D3Sub(&p2,&tempsp->p[2].x,&tempsp->p[0].x),2.0);
|
||||
D3Unit(D3Add(&p,&p1,&p2));
|
||||
if (tS>tempsp->reload_timeout)
|
||||
img=$IB,"<gun_ready>",BI=2$;
|
||||
else
|
||||
@@ -562,9 +680,9 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
|
||||
temps=shot_root.next;
|
||||
while (temps!=&shot_root) {
|
||||
if (tS>temps->fuse_time) {
|
||||
if (temps->exploding) {
|
||||
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++) {
|
||||
if (i&1)
|
||||
dc->color=YELLOW;
|
||||
@@ -589,16 +707,26 @@ U0 DrawIt(CTask *task,CDC *dc)
|
||||
}
|
||||
|
||||
if (human && draw_laser_line) {
|
||||
D3Sub(&human->p[1].x,&human->p[0].x,&p1);
|
||||
D3Sub(&human->p[2].x,&human->p[0].x,&p2);
|
||||
D3Unit(D3Add(&p1,&p2,&p));
|
||||
D3Sub(&p1,&human->p[1].x,&human->p[0].x);
|
||||
D3Sub(&p2,&human->p[2].x,&human->p[0].x);
|
||||
D3Unit(D3Add(&p,&p1,&p2));
|
||||
dc->color=LTBLUE;
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
CD3 p1;
|
||||
@@ -606,8 +734,8 @@ U0 Explosion(MyMass *tempm1,F64 r)
|
||||
|
||||
tempm=ode->next_mass;
|
||||
while (tempm!=&ode->next_mass) {
|
||||
if (tempm!=tempm1) {
|
||||
D3Sub(&tempm->state->x,&tempm1->state->x,&p1);
|
||||
if (tempm!=tempm1 && tempm!=tempm2) {
|
||||
D3Sub(&p1,&tempm->state->x,&tempm1->state->x);
|
||||
d=D3NormSqr(&p1)-tempm->radius*tempm->radius;
|
||||
if (d<100.0*100.0) {
|
||||
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 *)
|
||||
{
|
||||
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;
|
||||
CD3 p,p1,p2;
|
||||
Shot *temps;
|
||||
Ship *tempsp;
|
||||
Shot *temps;
|
||||
Missile *tempmi;
|
||||
MyMass *tempm,*tempm1;
|
||||
|
||||
tempm=ode->next_mass;
|
||||
@@ -650,7 +806,7 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
||||
tempm1=ode->next_mass;
|
||||
while (tempm1!=&ode->next_mass) {
|
||||
if (tempm!=tempm1) {
|
||||
D3Sub(&tempm->state->x,&tempm1->state->x,&p);
|
||||
D3Sub(&p,&tempm->state->x,&tempm1->state->x);
|
||||
dd=D3NormSqr(&p);
|
||||
dd2=Sqr(tempm->radius+tempm1->radius);
|
||||
if (dd<=dd2) {
|
||||
@@ -669,7 +825,7 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
||||
while (tempsp!=&ship_root) {
|
||||
if (tempsp->exploding && tempsp->die_time<=tS<=tempsp->die_timeout)
|
||||
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) {
|
||||
case ST_HUMAN1:
|
||||
if (!tempsp->exploding) {
|
||||
@@ -678,7 +834,7 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
||||
t_right=0;
|
||||
d=1.0-(tempsp->spacewalk_timeout-tS)/SPACEWALK_TIME;
|
||||
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) {
|
||||
tempsp->p[3].DstateDt->DxDt-=10*MAX_THRUST*p.x;
|
||||
tempsp->p[3].DstateDt->DyDt-=10*MAX_THRUST*p.y;
|
||||
@@ -692,35 +848,35 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (d=D3Norm(D3Sub(&tempsp->p[0].state->x,
|
||||
&tempsp->p[1].state->x,&p1))) {
|
||||
D3Sub(&tempsp->p[0].state->DxDt,&tempsp->p[1].state->DxDt,&p2);
|
||||
D3Cross(&p1,&p2,&p);
|
||||
if (d=D3Norm(D3Sub(&p1,&tempsp->p[0].state->x,
|
||||
&tempsp->p[1].state->x))) {
|
||||
D3Sub(&p2,&tempsp->p[0].state->DxDt,&tempsp->p[1].state->DxDt);
|
||||
D3Cross(&p,&p1,&p2);
|
||||
spin=p.z/d;
|
||||
} else
|
||||
spin=0;
|
||||
t_left =Clamp(human_t_left+SPIN_GAIN*spin*human_antispin,
|
||||
0,MAX_THRUST);
|
||||
|
||||
if (d=D3Norm(D3Sub(&tempsp->p[0].state->x,
|
||||
&tempsp->p[2].state->x,&p1))) {
|
||||
D3Sub(&tempsp->p[0].state->DxDt,&tempsp->p[2].state->DxDt,&p2);
|
||||
D3Cross(&p1,&p2,&p);
|
||||
if (d=D3Norm(D3Sub(&p1,&tempsp->p[0].state->x,
|
||||
&tempsp->p[2].state->x))) {
|
||||
D3Sub(&p2,&tempsp->p[0].state->DxDt,&tempsp->p[2].state->DxDt);
|
||||
D3Cross(&p,&p1,&p2);
|
||||
spin=p.z/d;
|
||||
} else
|
||||
spin=0;
|
||||
t_right=Clamp(human_t_right-SPIN_GAIN*spin*human_antispin,
|
||||
0,MAX_THRUST);
|
||||
|
||||
D3Sub(&tempsp->p[0].state->x,&tempsp->p[1].state->x,&p1);
|
||||
D3Sub(&tempsp->p[0].state->x,&tempsp->p[2].state->x,&p2);
|
||||
D3Unit(D3Add(&p1,&p2,&p));
|
||||
D3Sub(&p1,&tempsp->p[0].state->x,&tempsp->p[1].state->x);
|
||||
D3Sub(&p2,&tempsp->p[0].state->x,&tempsp->p[2].state->x);
|
||||
D3Unit(D3Add(&p,&p1,&p2));
|
||||
if (!(tempsp->s[3].flags&SSF_INACTIVE)) {
|
||||
D3Mul(t_left,&p,&p1);
|
||||
D3Mul(&p1,t_left,&p);
|
||||
D3AddEqu(&tempsp->p[3].DstateDt->DxDt,&p1);
|
||||
}
|
||||
if (!(tempsp->s[5].flags&SSF_INACTIVE)) {
|
||||
D3Mul(t_right,&p,&p2);
|
||||
D3Mul(&p2,t_right,&p);
|
||||
D3AddEqu(&tempsp->p[4].DstateDt->DxDt,&p2);
|
||||
}
|
||||
}
|
||||
@@ -732,10 +888,44 @@ U0 MyDerivative(CMathODE *ode,F64,COrder2D3 *,COrder2D3 *)
|
||||
|
||||
temps=shot_root.next;
|
||||
while (temps!=&shot_root) {
|
||||
if (temps->fuse_time<=tS<=temps->die_timeout)
|
||||
Explosion(&temps->p,temps->radius);
|
||||
if (temps->exploding)
|
||||
Explosion(&temps->p,NULL,temps->explosion_radius);
|
||||
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()
|
||||
@@ -764,9 +954,9 @@ U0 CheckDamage()
|
||||
Snd(0);
|
||||
} else {
|
||||
human->laser_temperature+=1.0;
|
||||
D3Sub(&human->p[0].x,&human->p[1].x,&p1);
|
||||
D3Sub(&human->p[0].x,&human->p[2].x,&p2);
|
||||
D3Unit(D3Add(&p1,&p2,&p));
|
||||
D3Sub(&p1,&human->p[0].x,&human->p[1].x);
|
||||
D3Sub(&p2,&human->p[0].x,&human->p[2].x);
|
||||
D3Unit(D3Add(&p,&p1,&p2));
|
||||
p2.x=p.y;
|
||||
p2.y=-p.x;
|
||||
p2.z=0;
|
||||
@@ -774,7 +964,7 @@ U0 CheckDamage()
|
||||
best_distance=MAX_F64;
|
||||
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 &&
|
||||
D3Dot(&p1,&p)<0.0) {
|
||||
d=D3NormSqr(&p1);
|
||||
@@ -803,8 +993,13 @@ U0 CheckDamage()
|
||||
}
|
||||
} else
|
||||
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;
|
||||
if (i==4)
|
||||
MissileDel(&tempsp->missiles[0]);
|
||||
else if (i==5)
|
||||
MissileDel(&tempsp->missiles[1]);
|
||||
}
|
||||
if (tempsp->s[i].flags&SSF_INACTIVE) {
|
||||
if (i<3) {
|
||||
if (!tempsp->exploding) {
|
||||
@@ -856,33 +1051,47 @@ U0 CheckDamage()
|
||||
|
||||
//********************************** 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;
|
||||
Shot *temps;
|
||||
|
||||
temps=CAlloc(sizeof(Shot));
|
||||
D3Copy(&temps->p.x,&tempsp->p[g].x);
|
||||
temps->radius=r;
|
||||
D3Copy(&temps->p.x,&tempsp->p[n].x);
|
||||
temps->explosion_radius=temps->radius=r;
|
||||
temps->fuse_time=tS+1.5*fuse_time;
|
||||
temps->die_timeout=temps->fuse_time+0.125;
|
||||
temps->p.mass=0.3*r*r*r;
|
||||
D3Sub(&tempsp->p[0].x,&tempsp->p[1].x,&p1);
|
||||
D3Sub(&tempsp->p[0].x,&tempsp->p[2].x,&p2);
|
||||
D3Add(&p1,&p2,&p);
|
||||
D3AddEqu(&temps->p.x,
|
||||
D3MulEqu(D3Copy(&p1,D3Unit(&p)),r+tempsp->p[0].radius+5));
|
||||
D3AddEqu(D3MulEqu(&p,1000/(r+1)),&tempsp->p[g].DxDt);
|
||||
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(&temps->p.x,D3MulEqu(D3Copy(&p1,&p),r+tempsp->p[0].radius+5));
|
||||
D3AddEqu(D3MulEqu(&p,1000/(r+1)),&tempsp->p[n].DxDt);
|
||||
D3Copy(&temps->p.DxDt,&p);
|
||||
D3MulEqu(&p,temps->p.mass/tempsp->p[g].mass/100.0);
|
||||
D3SubEqu(&tempsp->p[g].DxDt,&p);
|
||||
D3MulEqu(&p,temps->p.mass/tempsp->p[n].mass/100.0);
|
||||
D3SubEqu(&tempsp->p[n].DxDt,&p);
|
||||
QueIns(&temps->p,ode->last_mass);
|
||||
QueIns(temps,shot_root.last);
|
||||
tempsp->reload_timeout=tS+r/tempsp->fire_rate;
|
||||
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,
|
||||
fuse_time=ToF64(ctrl_panel.fuse_time+1)/CTRL_PANEL_RANGE;
|
||||
@@ -902,21 +1111,26 @@ U0 HumanFireBegin()
|
||||
case 1:
|
||||
FireOneGun(human,0,r,fuse_time);
|
||||
break;
|
||||
default:
|
||||
human->lasering=TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
U0 HumanFireEnd()
|
||||
U0 HumanFireMissileBegin(I64 n)
|
||||
{
|
||||
if (human && !human->exploding)
|
||||
switch (level) {
|
||||
case 3:
|
||||
case 2:
|
||||
case 1:
|
||||
break;
|
||||
default:
|
||||
if (human && !human->exploding &&
|
||||
!human->spacewalk_side && tS>human->reload_timeout)
|
||||
FireOneMissile(human,n);
|
||||
}
|
||||
|
||||
U0 HumanFireLaserBegin()
|
||||
{
|
||||
if (human && !human->exploding &&
|
||||
!human->spacewalk_side && tS>human->reload_timeout)
|
||||
human->lasering=TRUE;
|
||||
}
|
||||
U0 HumanFireLaserEnd()
|
||||
{
|
||||
if (human && !human->exploding) {
|
||||
human->lasering=FALSE;
|
||||
Snd(0);
|
||||
}
|
||||
@@ -924,19 +1138,45 @@ U0 HumanFireEnd()
|
||||
|
||||
U0 ExpireShots()
|
||||
{
|
||||
Shot *temps=shot_root.next,*tempb1;
|
||||
Shot *temps=shot_root.next,*temps1;
|
||||
while (temps!=&shot_root) {
|
||||
tempb1=temps->next;
|
||||
if (tS>temps->fuse_time && !temps->exploding) {
|
||||
temps1=temps->next;
|
||||
if (!temps->exploding && tS>temps->fuse_time) {
|
||||
temps->exploding=TRUE;
|
||||
Noise(50,3000,6000);
|
||||
}
|
||||
if (tS>temps->die_timeout) {
|
||||
} else if (tS>temps->die_timeout) {
|
||||
QueRem(temps);
|
||||
QueRem(&temps->p);
|
||||
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;
|
||||
if (human && !human->exploding) {
|
||||
while (tempsp!=&ship_root) {
|
||||
D3Sub(&tempsp->p[0].x,&tempsp->p[1].x,&p1);
|
||||
D3Sub(&tempsp->p[0].x,&tempsp->p[2].x,&p2);
|
||||
D3Add(&p1,&p2,&p);
|
||||
D3Sub(&human->p[0].x,&tempsp->p[0].x,&p1);
|
||||
D3Sub(&p1,&tempsp->p[0].x,&tempsp->p[1].x);
|
||||
D3Sub(&p2,&tempsp->p[0].x,&tempsp->p[2].x);
|
||||
D3Add(&p,&p1,&p2);
|
||||
D3Sub(&p1,&human->p[0].x,&tempsp->p[0].x);
|
||||
if (D3Dot(D3Unit(&p),D3Unit(&p1))>0.995 &&
|
||||
tS>tempsp->reload_timeout) {
|
||||
FireOneGun(tempsp,0,1.5+.5,.4);
|
||||
@@ -983,8 +1223,9 @@ U0 Init()
|
||||
score=0;
|
||||
level=1;
|
||||
|
||||
ship_root.next=ship_root.last=&ship_root;
|
||||
shot_root.next=shot_root.last=&shot_root;
|
||||
QueInit(&ship_root);
|
||||
QueInit(&shot_root);
|
||||
QueInit(&missile_root);
|
||||
|
||||
for (i=0;i<NUM_STARS;i++) {
|
||||
stars_x[i]=RandU16%GR_WIDTH;
|
||||
@@ -1011,13 +1252,19 @@ U0 XCaliber()
|
||||
" Abort(,CH_SHIFT_ESC);"
|
||||
" Exit(,CH_ESC);"
|
||||
"}"
|
||||
"Play {"
|
||||
"Game {"
|
||||
" Restart(,'\n');"
|
||||
" LevelUp(,'+');"
|
||||
" LevelDown(,'-');"
|
||||
"}"
|
||||
"Play {"
|
||||
" Fire(,CH_SPACE);"
|
||||
" Thrust(,,SC_CURSOR_UP);"
|
||||
" StopSpin(,,SC_CURSOR_DOWN);"
|
||||
" Left(,,SC_CURSOR_LEFT);"
|
||||
" Right(,,SC_CURSOR_RIGHT);"
|
||||
" LeftMissile(,'l');"
|
||||
" RightMissile(,'r');"
|
||||
" Spackwalk(,'w');"
|
||||
" LongerFuse(,,SC_CURSOR_RIGHT|SCF_SHIFT);"
|
||||
" ShorterFuse(,,SC_CURSOR_LEFT|SCF_SHIFT);"
|
||||
@@ -1079,11 +1326,26 @@ U0 XCaliber()
|
||||
}
|
||||
break;
|
||||
case CH_SPACE:
|
||||
HumanFireBegin;
|
||||
if (level<4)
|
||||
HumanFireGunBegin;
|
||||
else
|
||||
HumanFireLaserBegin;
|
||||
break;
|
||||
case 'l':
|
||||
HumanFireMissileBegin(1);
|
||||
break;
|
||||
case 'r':
|
||||
HumanFireMissileBegin(0);
|
||||
break;
|
||||
case 'w':
|
||||
ctrl_panel.spacewalk=TRUE;
|
||||
break;
|
||||
case '+':
|
||||
level++;
|
||||
break;
|
||||
case '-':
|
||||
level--;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MSG_KEY_UP:
|
||||
@@ -1110,7 +1372,8 @@ U0 XCaliber()
|
||||
ch=0;
|
||||
break;
|
||||
case CH_SPACE:
|
||||
HumanFireEnd;
|
||||
if (level>=4)
|
||||
HumanFireLaserEnd;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -1118,6 +1381,7 @@ U0 XCaliber()
|
||||
}
|
||||
AI;
|
||||
ExpireShots;
|
||||
ExpireMissiles;
|
||||
CheckDamage;
|
||||
WinMgrSync; //msgs are only qued by winmngr
|
||||
if (show_level_msg) {
|
||||
@@ -1196,4 +1460,4 @@ U0 XCaliber()
|
||||
| ||||