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

+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;
}