TempleOSCDV5.02.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:48:21 +02:00
1 parent 320c7ee98a
commit 4b32f058d5
137 files changed
+3474 -3293

No files matched your search

+38 -36
View File
@@ -1,19 +1,19 @@
#help_index "DolDoc/Clipboard"
#help_index "DolDoc/Clip"
sys_clipboard_doc=DocNew;
sys_clip_doc=DocNew;
public U0 ClipboardDel()
{//Delete everything on clipboard.
DocRst(sys_clipboard_doc,TRUE);
public U0 ClipDel()
{//Delete everything on clip.
DocRst(sys_clip_doc,TRUE);
}
public U0 EdCopyToClipboard(CDoc *doc)
{//Copy $LK,"DOCET_SEL",A="MN:DOCET_SEL"$ flagged entries to clipboard.
CDoc *doc2=sys_clipboard_doc;
public U0 ClipCopy(CDoc *doc)
{//Copy $LK,"DOCET_SEL",A="MN:DOCET_SEL"$ flagged entries to clip.
CDoc *doc2=sys_clip_doc;
Bool unlock_doc=DocLock(doc),
unlock_doc2=DocLock(doc2);
CDocEntry *doc_e=doc->head.next,*doc_ne;
ClipboardDel;
ClipDel;
while (doc_e!=doc) {
if (doc_e->type & DOCET_SEL) {
doc_e->type&=~DOCET_SEL;
@@ -30,13 +30,13 @@ public U0 EdCopyToClipboard(CDoc *doc)
DocUnlock(doc);
}
public U0 EdCutToClipboard(CDoc *doc)
{//Remove sel entries and place on clipboard.
CDoc *doc2=sys_clipboard_doc;
public U0 ClipCut(CDoc *doc)
{//Remove sel entries and place on clip.
CDoc *doc2=sys_clip_doc;
Bool unlock_doc=DocLock(doc),
unlock_doc2=DocLock(doc2);
CDocEntry *doc_e=doc->head.next,*doc_e1,*doc_ne,*doc_e2=NULL;
ClipboardDel;
ClipDel;
while (doc_e!=doc) {
doc_e1=doc_e->next;
if (doc_e->type & DOCET_SEL) {
@@ -62,9 +62,9 @@ public U0 EdCutToClipboard(CDoc *doc)
DocUnlock(doc);
}
public U0 EdPasteClipboard(CDoc *doc)
{//Insert copy of clipboard at insert pt, cur_entry.
CDoc *doc2=sys_clipboard_doc;
public U0 ClipPaste(CDoc *doc)
{//Insert copy of clip at insert pt, cur_entry.
CDoc *doc2=sys_clip_doc;
Bool unlock_doc=DocLock(doc),
unlock_doc2=DocLock(doc2);
CDocEntry *doc_ce=doc->cur_entry,*doc_e;
@@ -87,17 +87,18 @@ public U0 DocCut(CDoc *doc,CDocEntry *start,CDocEntry *end)
{//Del start to end entry, including end points.
Bool unlock_doc=DocLock(doc);
CDocEntry *doc_e1;
while (start!=doc) {
doc_e1=start->next;
if (start==doc->cur_entry) {
doc->cur_entry=start->next;
doc->cur_col=doc->cur_entry->min_col;
}
DocEntryDel(doc,start);
if (start==end)
break;
start=doc_e1;
}
if (start!=doc && (start->last!=end || end==doc))
do {
doc_e1=start->next;
if (start==doc->cur_entry) {
doc->cur_entry=start->next;
doc->cur_col=doc->cur_entry->min_col;
}
DocEntryDel(doc,start);
if (start==end)
break;
start=doc_e1;
} while (start!=doc);
DocRemSoftNewLines(doc,NULL);
if (unlock_doc)
DocUnlock(doc);
@@ -108,15 +109,16 @@ public CDoc *DocCopy(CDoc *doc,CDocEntry *start,CDocEntry *end)
CDoc *doc2=DocNew;
Bool unlock_doc=DocLock(doc);
CDocEntry *doc_ne;
while (start!=doc) {
if (!Bt(doldoc.type_flags_data,start->type_u8)) {
doc_ne=DocEntryCopy(doc2,start);
QueIns(doc_ne,doc2->head.last);
}
if (start==end)
break;
start=start->next;
}
if (start!=doc && (start->last!=end || end==doc))
do {
if (!Bt(doldoc.type_flags_data,start->type_u8)) {
doc_ne=DocEntryCopy(doc2,start);
QueIns(doc_ne,doc2->head.last);
}
if (start==end)
break;
start=start->next;
} while (start!=doc);
if (unlock_doc)
DocUnlock(doc);
return doc2;
+5 -5
View File
@@ -440,7 +440,7 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action,Bool beep=TRUE)
DocFlagsToggle(doc,DOCF_PLAIN_TEXT);
DocWrite(doc);
task=Spawn(&SrvCmdLine,NULL,"Srv",,Fs);
st2=CurDir;
st2=DirCur;
st=MStrPrint("Cd(\"%s\");",st2);
tmpc=TaskExe(task,Fs,st,1<<JOBf_WAKE_MASTER|1<<JOBf_FOCUS_MASTER);
Free(st2);
@@ -504,7 +504,7 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action,Bool beep=TRUE)
case EF_REINDENT:
start_y=doc->cur_entry->y;
EdReplaceTroubleAll(doc,TRUE,FALSE);
DocLineNumGoTo(doc,start_y+1);
DocGoToLine(doc,start_y+1);
if (EdGoToFun(doc,FALSE,FALSE)) {
start_y=doc->cur_entry->y;
indent=EdRICode(doc);
@@ -516,7 +516,7 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action,Bool beep=TRUE)
}
DocLock(doc);
EdRemFunLeadingSpace(doc);
DocLineNumGoTo(doc,start_y+1);
DocGoToLine(doc,start_y+1);
doc_e=doc->cur_entry;
end_y=start_y+indent->total_cnt;
while (start_y<=doc_e->y<end_y) {
@@ -562,7 +562,7 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action,Bool beep=TRUE)
}
start_y=doc->cur_entry->y;
EdReplaceTroubleAll(doc,FALSE,FALSE);
DocLineNumGoTo(doc,start_y+1);
DocGoToLine(doc,start_y+1);
break;
case EF_RENUM_ASM:
if (EdGoToFun(doc,FALSE,TRUE)) {
@@ -588,7 +588,7 @@ U0 EdCodeTools2(CDoc *doc,I64 tool_action,Bool beep=TRUE)
}
DocRecalc(doc);
DocLineNumGoTo(doc,goto_line_num);
DocGoToLine(doc,goto_line_num);
DocUnlock(doc);
if (!unlock)
+3 -3
View File
@@ -1,6 +1,6 @@
#help_index "DolDoc/Editor"
public Bool DocLineNumGoTo(CDoc *doc,I64 line_num) //one based
public Bool DocGoToLine(CDoc *doc,I64 line_num) //one based
{//Nearest to specified line num. Move cur_entry & center.
Bool res=FALSE,unlock;
if (doc) {
@@ -30,7 +30,7 @@ U8 *needle,I64 match=1)
res=TRUE;
doc_e=haystack_doc->head.next;
} else {
res=DocLineNumGoTo(haystack_doc,start_line_num);
res=DocGoToLine(haystack_doc,start_line_num);
doc_e=haystack_doc->cur_entry;
}
if (res) {
@@ -580,5 +580,5 @@ U0 EdGoToLine(CDoc *doc)
CEdLineGoTo gtl;
gtl.line=1;
if (DocForm(&gtl))
DocLineNumGoTo(doc,gtl.line);
DocGoToLine(doc,gtl.line);
}
+1 -1
View File
@@ -127,7 +127,7 @@ Bool DocFileEd(I64 _type,U8 *filename,
if (res || other_found)
switch (type) {
case LK_FILE_LINE:
res=DocLineNumGoTo(doc,*_num);
res=DocGoToLine(doc,*_num);
break;
case LK_FILE_ANCHOR:
res=DocAnchorFind(doc,needle_str);
+10 -16
View File
@@ -8,22 +8,16 @@ public CTask *PopUpViewDoc(CDoc *doc,I64 dof_flags=0)
return task;
}
U0 PopUpViewPrintEndCB()
{
DocDel(FramePtr("ViewStrFrame"));
Exit;
}
public CTask *PopUpViewPrint(U8 *fmt,...)
{//View Print stmt in PopUp win task.
CTask *task;
CTask *task=Spawn(&SrvCmdLine,NULL,"View",,Fs);
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
CDoc *doc=DocNew;
CDoc *doc=DocNew(,task);
DocPrint(doc,buf);
Free(buf);
task=PopUpViewDoc(doc);
FramePtrAdd("ViewStrFrame",doc,task);
task->task_end_cb=&PopUpViewPrintEndCB;
buf=MStrPrint("DocEd(0x%X);",doc);
TaskExe(task,NULL,buf,1<<JOBf_EXIT_ON_COMPLETE|1<<JOBf_FREE_ON_COMPLETE);
Free(buf);
return task;
}
@@ -34,7 +28,7 @@ public U8 *PopUpPickFile(U8 *dir=NULL)
if (dir)
st=MStrPrint("Cd(\"%Q\");FileMgr(FM_PICK_FILE,Fs->parent_task);",dir);
else {
st2=CurDir;
st2=DirCur;
st=MStrPrint("Cd(\"%Q\");FileMgr(FM_PICK_FILE,Fs->parent_task);",st2);
Free(st2);
}
@@ -49,7 +43,7 @@ public U8 *PopUpPickDir(U8 *dir=NULL)
if (dir)
st=MStrPrint("Cd(\"%Q\");FileMgr(FM_PICK_DIR,Fs->parent_task);",dir);
else {
st2=CurDir;
st2=DirCur;
st=MStrPrint("Cd(\"%Q\");FileMgr(FM_PICK_DIR,Fs->parent_task);",st2);
Free(st2);
}
@@ -270,7 +264,7 @@ public I64 AdamFile(U8 *filename,Bool warn_ext=TRUE)
{//Make adam_task execute file.
Bool okay=TRUE;
U8 *name=FileNameAbs(filename),
*name2=DftExt(name,"HC.Z");
*name2=ExtDft(name,"HC.Z");
I64 res=0;
if (warn_ext &&
!FilesFindMatch(name2,FILEMASK_JIT) &&
@@ -288,7 +282,7 @@ public I64 PopUpFile(U8 *filename,Bool warn_ext=TRUE,
{//$LK,"ExeFile2",A="MN:ExeFile2"$() in $LK,"PopUp",A="MN:PopUp"$ task. Cont as User.
Bool okay=TRUE;
U8 *st,*name=FileNameAbs(filename),
*name2=DftExt(name,"HC.Z");
*name2=ExtDft(name,"HC.Z");
I64 res=0;
if (warn_ext &&
!FilesFindMatch(name2,FILEMASK_JIT) &&
@@ -310,7 +304,7 @@ public I64 PopUpFile(U8 *filename,Bool warn_ext=TRUE,
public I64 PopUpRunFile(U8 *filename,I64 ccf_flags=0,...)
{//$LK,"ExeFile",A="MN:ExeFile"$() with args using $LK,"LastFun",A="MN:LastFun"$() in $LK,"PopUp",A="MN:PopUp"$ task.
U8 *st,*name=FileNameAbs(filename),
*name2=DftExt(name,"HC.Z");
*name2=ExtDft(name,"HC.Z");
I64 res=0;
st=MStrPrint(
"\"$$$$WW+H,1$$$$\";ExeFile2(\"%s\",0x%X);LastFun(0x%X,0x%X);",
+12 -12
View File
@@ -182,12 +182,12 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
if (!(sc&SCF_CTRL)) {
if (sc&SCF_KEY_DESC) {
if (sc&SCF_SHIFT)
KeyDescSet("Edit/Cut To Clipboard");
KeyDescSet("Edit/Cut To Clip");
else
KeyDescSet("Char /Delete");
} else {
if (sc&SCF_SHIFT)
EdCutToClipboard(doc);
ClipCut(doc);
else
EdCharDel(doc);
}
@@ -197,16 +197,16 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
if (sc&(SCF_SHIFT|SCF_CTRL)!=(SCF_SHIFT|SCF_CTRL)) {
if (sc&SCF_KEY_DESC) {
if (sc&SCF_SHIFT)
KeyDescSet("Edit/Paste Clipboard");
KeyDescSet("Edit/Paste Clip");
else if (sc&SCF_CTRL)
KeyDescSet("Edit/Copy to Clipboard");
KeyDescSet("Edit/Copy to Clip");
else
KeyDescSet("Edit/Toggle Overstrike");
} else {
if (sc&SCF_SHIFT)
EdPasteClipboard(doc);
ClipPaste(doc);
else if (sc&SCF_CTRL)
EdCopyToClipboard(doc);
ClipCopy(doc);
else
doc->flags^=DOCF_OVERSTRIKE;
}
@@ -383,9 +383,9 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
case CH_CTRLC:
if (!(sc&SCF_SHIFT)) {
if (sc&SCF_KEY_DESC)
KeyDescSet("Edit/Copy to Clipboard");
KeyDescSet("Edit/Copy to Clip");
else
EdCopyToClipboard(doc);
ClipCopy(doc);
}
break;
case CH_CTRLD:
@@ -616,9 +616,9 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
case CH_CTRLV:
if (!(sc&SCF_SHIFT)) {
if (sc&SCF_KEY_DESC)
KeyDescSet("Edit/Paste Clipboard");
KeyDescSet("Edit/Paste Clip");
else
EdPasteClipboard(doc);
ClipPaste(doc);
}
break;
case CH_CTRLW:
@@ -637,9 +637,9 @@ public U0 DocPutKey(CDoc *doc,I64 ch=0,I64 sc=0)
case CH_CTRLX:
if (!(sc&SCF_SHIFT)) {
if (sc&SCF_KEY_DESC)
KeyDescSet("Edit/Cut To Clipboard");
KeyDescSet("Edit/Cut To Clip");
else
EdCutToClipboard(doc);
ClipCut(doc);
}
break;
case CH_CTRLY:
+85 -9
View File
@@ -1,9 +1,9 @@
#help_index "DolDoc"
#help_index "DolDoc/Tree"
public Bool DocTreeFind(CDoc *haystack_doc,U8 *needle_path,
CDocEntry **_tree_entry=NULL,
CDocEntry **_start_indent=NULL, CDocEntry **_end_indent=NULL)
{//Find registry-like tree widget start and end.
{//Find tree widget start and end.
I64 i=0,k=0;
U8 *st1=StrNew(needle_path),*st2=MAlloc(StrLen(needle_path)+1);
Bool res=FALSE,unlock_doc=DocLock(haystack_doc);
@@ -58,8 +58,16 @@ ft_done:
return res;
}
public Bool DocTreeFFind(U8 *name,U8 *path)
{//Find tree widget in file.
CDoc *doc=DocRead(name);
Bool res=DocTreeFind(doc,path);
DocDel(doc);
return res;
}
public Bool DocTreeMake(CDoc *doc,U8 *path)
{//Make registry-like tree widget.
{//Make tree widget.
I64 i=0,j=I64_MIN,k=0;
U8 *st1=StrNew(path),
*st2=MAlloc(StrLen(path)+1),
@@ -113,6 +121,73 @@ mt_done:
return res;
}
Bool DocTreeWriteJoin(CDoc *doc,U8 *path,Bool write,U8 *fmt,I64 argc,I64 *argv)
{//Rewrite doc tree branch.
CDocEntry *tree_branch,*start_indent,*end_indent;
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
Bool res,unlock_doc=DocLock(doc);
if (res=DocTreeFind(doc,path,
&tree_branch,&start_indent,&end_indent)) {
DocCut(doc,start_indent->next,end_indent->last);
doc->cur_entry=start_indent->next;
doc->cur_col=doc->cur_entry->min_col;
} else
DocTreeMake(doc,path);
DocPrint(doc,"%s",buf);
if (write && DrvIsWritable(*doc->filename.name))
DocWrite(doc);
if (unlock_doc)
DocUnlock(doc);
Free(buf);
return res;
}
Bool DocTreeAppendJoin(CDoc *doc,U8 *path,Bool write,U8 *fmt,I64 argc,I64 *argv)
{//Append to doc tree branch.
CDocEntry *tree_branch,*start_indent,*end_indent;
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
Bool res,unlock_doc=DocLock(doc);
if (res=DocTreeFind(doc,path,
&tree_branch,&start_indent,&end_indent)) {
doc->cur_entry=end_indent;
doc->cur_col=doc->cur_entry->min_col;
} else
DocTreeMake(doc,path);
DocPrint(doc,"%s",buf);
if (write && DrvIsWritable(*doc->filename.name))
DocWrite(doc);
if (unlock_doc)
DocUnlock(doc);
Free(buf);
return res;
}
public Bool DocTreeWrite(CDoc *doc,U8 *path,Bool write=TRUE,U8 *fmt,...)
{//Rewrite doc tree branch.
return DocTreeWriteJoin(doc,path,write,fmt,argc,argv);
}
public Bool DocTreeAppend(CDoc *doc,U8 *path,Bool write=TRUE,U8 *fmt,...)
{//Append to doc tree branch.
return DocTreeAppendJoin(doc,path,write,fmt,argc,argv);
}
public Bool DocTreeFWrite(U8 *name,U8 *path,U8 *fmt,...)
{//Rewrite doc tree branch in file.
CDoc *doc=DocRead(name);
Bool res=DocTreeWriteJoin(doc,path,TRUE,fmt,argc,argv);
DocDel(doc);
return res;
}
public Bool DocTreeFAppend(U8 *name,U8 *path,U8 *fmt,...)
{//Append to doc tree branch in file.
CDoc *doc=DocRead(name);
Bool res=DocTreeAppendJoin(doc,path,TRUE,fmt,argc,argv);
DocDel(doc);
return res;
}
#help_index "DolDoc/Compiler;Compiler"
public I64 ExeDoc(CDoc *doc,I64 ccf_flags=0)
{//JIT Compile and execute a document.
@@ -141,8 +216,9 @@ public I64 ExeDoc(CDoc *doc,I64 ccf_flags=0)
return res;
}
public I64 DocTreeBranchExe(CDoc *doc,U8 *path)
{//JIT Compile and execute code in doc tree branch.
#help_index "DolDoc/Tree;DolDoc/Compiler;Compiler"
public I64 DocTreeExe(CDoc *doc,U8 *path)
{//Execute doc tree branch.
CDoc *doc2;
Bool unlock_doc=DocLock(doc);
CDocEntry *tree_branch,*start_indent,*end_indent;
@@ -157,11 +233,11 @@ public I64 DocTreeBranchExe(CDoc *doc,U8 *path)
return res;
}
public I64 ExeTreeBranch(U8 *registry_file,U8 *path)
{//JIT Compile and execute a specified branch in a specified file.
public I64 DocTreeFExe(U8 *name,U8 *path)
{//Execute doc tree branch in file.
I64 res;
CDoc *doc=DocRead(registry_file);
res=DocTreeBranchExe(doc,path);
CDoc *doc=DocRead(name);
res=DocTreeExe(doc,path);
DocDel(doc);
return res;
}