TempleOSTS_130707.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:45:45 +02:00
1 parent 17b71f1a2d
commit 1343005a29
617 files changed
+14399 -25130

No files matched your search

+17 -32
View File
@@ -5,36 +5,24 @@ U8 *tSCB(CDoc *,CDocEntry *,CTask *mem_task)
//if the window mgr used it's own
//heap, so we use the owning task's heap.
U8 *st=MAlloc(64,mem_task);
CDate spdt=tS*CDATE_FREQ;
CDate cdt=tS*CDATE_FREQ;
//Doesn't have to be fixed width!!
SPrintF(st,"%d=%h11T",spdt,spdt);
SPrintF(st,"%d=%h11T",cdt,cdt);
return st;
}
U8 *CurTimeCB(CDoc *,CDocEntry *,CTask *mem_task)
{
U8 *st=MAlloc(64,mem_task);
CDate spdt=GetCurTimeCDate;
SPrintF(st,"%h0D %h0T",spdt,spdt);
CDate cdt=GetCurTimeDate;
SPrintF(st,"%h0D %h0T",cdt,cdt);
return st;
}
U0 DoIt()
{
/* The main window is kept at Fs->last_doc.
A second framework is kept at Fs->next_doc.
Normally, the next_doc is used for updating
the border, primarily.
See $LK,"UseTermDoc","MN:UseTermDoc"$().
See $LK,"DocUpdateTaskDocs","MN:DocUpdateTaskDocs"$().
Note: the next_doc is not to be confused
with the aux_str, a member of the $LK,"CDocEntry","MN:CDocEntry"$.
*/
CDoc *aux=DocAux, //Fetches Fs->next_doc basically.
*cur=DocCur; //Fetches Fs->last_doc basically.
CDoc *bdoc=DocBorder,
*pdoc=DocPut;
CDocEntry *doc_e;
// We don't want an update between
@@ -43,32 +31,32 @@ with the aux_str, a member of the $LK,"CDocEntry","MN:CDocEntry"$.
Bool old_preempt=Preempt(OFF);
DocBottom(aux); //Ins at the bottom
DocPutS(aux,"$$FG,RED$$$$CM+BY+LX,5,-3$$");
DocBottom(bdoc); //Ins at the bottom
DocPutS(bdoc,"$$FG,RED$$$$CM+BY+LX,5,-3$$");
// The $LK,"DocPutS","MN:DocPutS"$() routine returns the addr of the last entry.
doc_e=DocPutS(aux,"$$TX+TC,\" \"$$");
doc_e=DocPutS(bdoc,"$$TX+TC,\" \"$$");
// The TC flag is "has tag callback".
// Flags are explained here:
// $LK-A,"::/TempleOS/Doc/CtrlL.TXT"$
// $LK-A,"::/TempleOS/Doc/Widget.TXT"$
// $LK-A,"::/TempleOS/Doc/Dollar.TXT"$
// $LK,"Dollar Flags","MN:DOCEf1_AUX_STR"$
// $LK,"ST_DOC_FLAGS","FF:::/TempleOS/Adam/Doc/Doc.CPP,ST_DOC_FLAGS"$
doc_e->tag_cb=&tSCB;
DocPutS(aux,"$$FG$$");
DocPutS(bdoc,"$$FG$$");
//$BK,1$WARNING:$BK,0$ If you use the last_doc you
//$BK,1$WARNING:$BK,0$ If you use the put_doc you
//run the risk of the user pressing
//<CTRL-T> or using the clipboard, both
//of which will crash. So, you might want
//to use the next_doc.
//to use the border_doc.
DocPutS(cur,"$$FG,LTRED$$");
doc_e=DocPutS(cur,"$$TX+TC,\" \"$$");
DocPutS(pdoc,"$$FG,LTRED$$");
doc_e=DocPutS(pdoc,"$$TX+TC,\" \"$$");
doc_e->tag_cb=&CurTimeCB;
DocPutS(cur,"$$FG$$");
DocPutS(pdoc,"$$FG$$");
Preempt(old_preempt);
@@ -83,11 +71,8 @@ with the aux_str, a member of the $LK,"CDocEntry","MN:CDocEntry"$.
U0 UndoIt()
{
//Clear-out entries without a +H hold flag.
DocBottom(Fs->next_doc);
DocPutS(Fs->next_doc,"$$CL$$");
DocClear(Fs->border_doc);
}
DoIt;
// See $LK-A,"::/TempleOS/Demo/Doc/CallBackAux2.CPP"$ for another way.
-35
View File
@@ -1,35 +0,0 @@
//See $LK-A,"::/TempleOS/Demo/Doc/CallBack.CPP"$ first.
U8 *tSCB(CDoc *,CDocEntry *,CTask *mem_task)
{
U8 *st=MAlloc(64,mem_task);
CDate spdt=tS*CDATE_FREQ;
SPrintF(st,"%d=%h11T",spdt,spdt);
return st;
}
U0 DoIt()
{
CDocEntry *doc_e;
CDoc *aux2=DocNew;
aux2->flags|=DOCF_AUX_DOC;
DocPutS(aux2,"$$FG,RED$$$$CM+BY+LX,5,-3$$");
doc_e=DocPutS(aux2,"$$TX+TC,\" \"$$");
doc_e->tag_cb=&tSCB;
DocPutS(aux2,"$$FG$$");
DocQueInsRev(aux2,DocAux);
NewLine;
}
U0 UndoIt()
{
CDoc *aux2=DocAux;
DocQueRem(aux2);
DocDel(aux2);
}
DoIt;
+6 -4
View File
@@ -6,9 +6,9 @@
+RD refreshes the data.
+UD updates the val when you edit it.
+U32 means the val is 4 bytes.
-I64 I64 is the default so we might
-U64 U64 is the default so we might
want to turn-it-off. Strings
use I64.
use U64.
,32 sets the tag string width.
See $LK,"Data Tag Width","FA:::/TempleOS/Adam/Doc/DocPlain.CPP,DataTagWidth"$.
-P Means it is a string var, basically.
@@ -33,7 +33,7 @@ U0 DataDemo()
CDocEntry *doc_e;
//This is the command line document.
CDoc *doc=DocCur;
CDoc *doc=DocPut;
//We do this to prevent access to
//doc_e->data before it is set.
@@ -43,7 +43,7 @@ U0 DataDemo()
// doc->flags|=DOCF_FORM
//if you wish.
Spawn(&UpdateGlblTask,NULL,"Update Glbl",Fs);
Spawn(&UpdateGlblTask,NULL,"Update Glbl",,Fs);
"Enter editor overstrike mode\n"
"and you can modify the val.\n"
@@ -62,3 +62,5 @@ U0 DataDemo()
}
DataDemo;
//See $LK,"PopUpExtents","MN:PopUpExtents"$().
+4 -4
View File
@@ -2,8 +2,8 @@
The +D flag causes a define-string
look-up and substitution.
It is available in the <CTRL-L> menu
under text entries for use in
It is available in the <CTRL-L> text-widget
menu under text entries for use in
documentation.
*/
@@ -12,11 +12,11 @@ documentation.
DefineLoad("COMPANY","Trivial Solutions");
"Company: $$TX+D,\"\",\"COMPANY\"$$\n";
DefinePrintF("COMPANY_TIME","%T",GetCurTimeCDate);
DefinePrintF("COMPANY_TIME","%T",GetCurTimeDate);
#exe {
StreamPrintF(
"#define COMPANY_AGE %h56D\n",GetCurTimeCDate-A2CDate("8/1/2003"));
"#define COMPANY_AGE %h56D\n",GetCurTimeDate-A2Date("8/1/2003"));
};
+3 -3
View File
@@ -16,15 +16,15 @@ class DStruct
U0 FormDemo()
{
DStruct gtl;
CDate spdt;
CDate cdt;
gtl.num1=12.3e-4; //Set defaults
gtl.num2=4.5e3;
gtl.num3=0x1234;
gtl.num4=-567;
StrCpy(&gtl.name,"John");
spdt=GetCurTimeCDate;
gtl.datetime=spdt;
cdt=GetCurTimeDate;
gtl.datetime=cdt;
if (DocFormDo(&gtl,"DStruct")) {
"#1=%e\n",gtl.num1;
"#2=%e\n",gtl.num2;
+4 -4
View File
@@ -27,9 +27,9 @@ U0 MenuButton()
{
Bool done=FALSE;
I64 i,j=0,freq=100;
I64 old_flags=DocCur->flags;
I64 old_flags=DocPut->flags;
//This allows keyboard navigation to skip nonselectible entries.
DocCur->flags|=DOCF_FORM;
DocPut->flags|=DOCF_FORM;
do {
DocClear;
//Use <CTRL-L> to generate cursor movement expressions and check "Quote".
@@ -43,7 +43,7 @@ U0 MenuButton()
"\n$$BT,\"Set Freq\",MU_SET_FREQ$$\n\n\n"
"\n$$BT,\"Nothing\",MU_NOTHING$$\n\n\n"
"\n$$BT,\"Done\",DOCM_CANCEL$$\n\n\n";
i=DocMenuDo(DocCur);
i=DocMenuDo(DocPut);
DocBottom;
switch (i) {
case MU_NOTHING:
@@ -67,7 +67,7 @@ U0 MenuButton()
done=TRUE;
}
} while (!done);
DocCur->flags=DocCur->flags&~DOCF_FORM |
DocPut->flags=DocPut->flags&~DOCF_FORM |
old_flags & DOCF_FORM;
DocClear;
Snd(0);
Binary file not shown.
+26 -2
View File
@@ -13,7 +13,31 @@ For this example, however, I wanted to use DocPrintF
and disabled Preemption myself.
*/
#include "/TempleOS/Demo/Shared/TreeDemoJoin"
U0 TreeSub(CDoc *doc,CDirEntry *tempm)
{
CDirEntry *tempm1;
while (tempm) {
tempm1=tempm->next;
if (tempm->attr & _ATTR_DIR) {
DocPutS(doc,"$$TR,\"\"$$");
DocPrintF(doc,"$$MA+A,\"%s\",\"Cd(\\\"%s\\\");Dir;\n\"$$\n",
tempm->name,tempm->full_name);
if (tempm->sub) {
DocPutS(doc,"$$ID,+2$$");
TreeSub(doc,tempm->sub);
DocPutS(doc,"$$ID,-2$$");
}
} else {
DocPrintF(doc,"$$LK,\"%s\",\"FI:%s\"$$\n",
tempm->name,tempm->full_name);
}
//Note there is also a routine
//to delete an entire CDirEntry tree.
//See $LK,"CDirLstDel","MN:CDirLstDel"$().
CDirEntryDel(tempm);
tempm=tempm1;
}
}
U0 TreeDemo()
{
@@ -24,7 +48,7 @@ U0 TreeDemo()
DocPutS(doc,"$$ID,+2$$");
TreeSub(doc,FilesFind("/TempleOS/*",fuf_flags));
DocPutS(doc,"$$ID,-2$$");
DocInsDoc(DocCur,doc);
DocInsDoc(DocPut,doc);
DocDel(doc);
}
+8 -8
View File
@@ -15,7 +15,7 @@ output $LK,"Silent","MN:Silent"$().
U0 UnusedDefineScan()
{
CDoc *old_doc=DocCur,*doc;
CDoc *old_put_doc,*old_display_doc,*doc;
I64 cnt=0;
CHashTable *tempht;
CHash *temph;
@@ -50,18 +50,18 @@ U0 UnusedDefineScan()
progress1++;
if (FileOcc(temph->str,"/TempleOS/"FILENAME_MASK_TXT,"+l-i")==1) {
doc=DocNew;
DocQueRem(old_doc);
DocQueIns(doc,Fs->last_doc);
old_put_doc=DocPut;
old_display_doc=DocDisplay;
Fs->put_doc=Fs->display_doc=doc;
Grep(temph->str,"/TempleOS/"FILENAME_MASK_TXT,"+l-i");
DocQueRem(doc);
DocQueIns(old_doc,Fs->last_doc);
Fs->put_doc=old_put_doc;
Fs->display_doc=old_display_doc;
doc_e=doc->root.next;
while (doc_e!=doc) {
if (doc_e->type_u8==DOCT_LINK) {
NewLine;
"" temph->str;
"%s ",temph->str;
doc_e2=DocEntryCopy(doc,doc_e);
DocIns(old_doc,doc_e2);
DocIns(old_put_doc,doc_e2);
NewLine;
}
doc_e=doc_e->next;