TempleOSCDV4.06.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:47:19 +02:00
1 parent 6fe38d2d9d
commit b632ab9a4f
261 files changed
+6282 -5801

No files matched your search

+2 -2
View File
@@ -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)
+5 -5
View File
@@ -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)
+17 -17
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
+9 -9
View File
@@ -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
View File
@@ -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;
}
}
+3 -3
View File
@@ -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 -2
View File
@@ -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
View File
@@ -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;
}
+3 -3
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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;
}
+4 -1
View File
@@ -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");
+5 -5
View File
@@ -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
View File
@@ -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;
+3 -3
View File
@@ -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
View File
@@ -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
View File
@@ -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
View File
@@ -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;
}
+18 -18
View File
@@ -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,&quote,_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)