SparrowOSTS_121127.ISO
This commit is contained in:
1 parent
0e9364ff4c
commit
e57428affb
1218 files changed
+247142
-165507
No files matched your search
@@ -0,0 +1,93 @@
|
||||
U8 *tSCB(CDoc *,CDocEntry *,CTask *mem_task)
|
||||
{
|
||||
//This routine is called by the window
|
||||
//mgr things would get corrupted
|
||||
//if the window mgr used it's own
|
||||
//heap, so we use the owning task's heap.
|
||||
U8 *st=MAlloc(64,mem_task);
|
||||
CDate ltdt=tS*CDATE_FREQ;
|
||||
//Doesn't have to be fixed width!!
|
||||
SPrintF(st,"%d=%h11T",ltdt,ltdt);
|
||||
return st;
|
||||
}
|
||||
|
||||
U8 *CurTimeCB(CDoc *,CDocEntry *,CTask *mem_task)
|
||||
{
|
||||
U8 *st=MAlloc(64,mem_task);
|
||||
CDate ltdt=GetCurTimeCDate;
|
||||
SPrintF(st,"%h0D %h0T",ltdt,ltdt);
|
||||
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.
|
||||
CDocEntry *doc_e;
|
||||
|
||||
// We don't want an update between
|
||||
// creating the CDocEntry and defining the
|
||||
// callback, so we turn-off preemption.
|
||||
|
||||
Bool old_preempt=Preempt(OFF);
|
||||
|
||||
DocBottom(aux); //Ins at the bottom
|
||||
DocPutS(aux,"$$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,\" \"$$");
|
||||
// The TC flag is "has tag callback".
|
||||
|
||||
// Flags are explained here:
|
||||
// $LK,"::/SparrowOS/Doc/CtrlL.TXT.Z","FI:::/SparrowOS/Doc/CtrlL.TXT.Z"$
|
||||
// $LK,"::/SparrowOS/Doc/Dollar.TXT.Z","FI:::/SparrowOS/Doc/Dollar.TXT.Z"$
|
||||
// $LK,"Dollar Flags","MN:DOCEf1_AUX_STR"$
|
||||
// $LK,"ST_DOC_FLAGS","FF:::/SparrowOS/Adam/Doc/Doc.CPP.Z,ST_DOC_FLAGS"$
|
||||
|
||||
doc_e->tag_cb=&tSCB;
|
||||
DocPutS(aux,"$$FG$$");
|
||||
|
||||
//$BK,1$WARNING:$BK,0$ If you use the last_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.
|
||||
|
||||
DocPutS(cur,"$$FG,LTRED$$");
|
||||
doc_e=DocPutS(cur,"$$TX+TC,\" \"$$");
|
||||
doc_e->tag_cb=&CurTimeCB;
|
||||
DocPutS(cur,"$$FG$$");
|
||||
|
||||
Preempt(old_preempt);
|
||||
|
||||
//Send carriage return, new line, so
|
||||
//that the timer string is not part
|
||||
//of the next cmd on the cmd line.
|
||||
NewLine;
|
||||
}
|
||||
|
||||
|
||||
|
||||
U0 UndoIt()
|
||||
{
|
||||
//Clear-out entries without a +H hold flag.
|
||||
DocBottom(Fs->next_doc);
|
||||
DocPutS(Fs->next_doc,"$$CL$$");
|
||||
}
|
||||
|
||||
|
||||
DoIt;
|
||||
|
||||
// See $LK,"::/SparrowOS/Demo/Doc/CallBackAux2.CPP.Z","FI:::/SparrowOS/Demo/Doc/CallBackAux2.CPP.Z"$ for another way.
|
||||
@@ -0,0 +1,35 @@
|
||||
//See $LK,"::/SparrowOS/Demo/Doc/CallBack.CPP.Z","FI:::/SparrowOS/Demo/Doc/CallBack.CPP.Z"$ first.
|
||||
|
||||
U8 *tSCB(CDoc *,CDocEntry *,CTask *mem_task)
|
||||
{
|
||||
U8 *st=MAlloc(64,mem_task);
|
||||
CDate ltdt=tS*CDATE_FREQ;
|
||||
SPrintF(st,"%d=%h11T",ltdt,ltdt);
|
||||
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;
|
||||
@@ -0,0 +1,38 @@
|
||||
U0 CursorMovementDemo()
|
||||
{
|
||||
I64 i;
|
||||
for (i=0;i<100;i++) {
|
||||
"%03d ",i;
|
||||
"$$CM,-4,1$$";
|
||||
if (i%10==9)
|
||||
"$$CM,4,-10$$";
|
||||
}
|
||||
|
||||
//+LX is relative to left side.
|
||||
//See <CTRL-L> with cursor-movement for all the flags.
|
||||
//Check "Quote" to set-up a cmd for in quotes.
|
||||
"$$CM+LX,0,+10$$\n";
|
||||
}
|
||||
|
||||
CursorMovementDemo;
|
||||
|
||||
//The word-wrap Off and On cmds are
|
||||
//$$WW,0$$ and $$WW,1$$.
|
||||
|
||||
//You might need $LK,"DocMax","MN:DocMax"$() to adjust
|
||||
//the cmd line window buf size.
|
||||
//It counts cmds, not lines.
|
||||
|
||||
//The +H flag will hold-onto an entry
|
||||
//so it doesn't get pushed-out of the document.
|
||||
//This is useful for a $$WW+H,1$$ cmd.
|
||||
|
||||
//See $LK,"::/SparrowOS/Doc/Dollar.TXT.Z","FI:::/SparrowOS/Doc/Dollar.TXT.Z"$ for documentation on
|
||||
//all flags and cmds.
|
||||
|
||||
|
||||
//Note: the default page length is 66 lines
|
||||
//and branching back more than the page length
|
||||
//will rst the column to 1. So, set page
|
||||
//length to a large number if you want to
|
||||
//branch back a long distance.
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
$$DA is the data widget.
|
||||
-T flag is for var
|
||||
width fields with a terminator
|
||||
character.
|
||||
+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
|
||||
want to turn-it-off. Strings
|
||||
use I64.
|
||||
,32 sets the tag string width.
|
||||
See $LK,"Data Tag Width","FA:::/SparrowOS/Adam/Doc/DocPlain.CPP.Z,DataTagWidth"$.
|
||||
-P Means it is a string var, basically.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
I32 i;
|
||||
U8 buf[8];
|
||||
|
||||
U0 UpdateGlblTask(I64)
|
||||
{
|
||||
while (TRUE) {
|
||||
i++;
|
||||
Sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
U0 DataDemo()
|
||||
{
|
||||
CDocEntry *doc_e;
|
||||
|
||||
//This is the command line document.
|
||||
CDoc *doc=DocCur;
|
||||
|
||||
//We do this to prevent access to
|
||||
//doc_e->data before it is set.
|
||||
Bool unlock=DocLock(doc);
|
||||
|
||||
//You might set the $LK,"DOCF_FORM","MN:DOCF_FORM"$ flag.
|
||||
// doc->flags|=DOCF_FORM
|
||||
//if you wish.
|
||||
|
||||
Spawn(&UpdateGlblTask,NULL,"Update Glbl",Fs);
|
||||
|
||||
"Enter editor overstrike mode\n"
|
||||
"and you can modify the val.\n"
|
||||
"However, changes happen immediately,\n"
|
||||
"so it's tricky.\n\n";
|
||||
//Use <CTRL-L> for the $$DA,$$ format.
|
||||
doc_e=DocPutS(doc,"$$DA-T+RD+UD-I64+U32,32,\"%12d\"$$\n");
|
||||
doc_e->data=&i;
|
||||
|
||||
StrCpy(buf,"Terry");
|
||||
doc_e=DocPutS(doc,"$$DA-P+RD+UD,7,\"Str:%s\"$$\n");
|
||||
doc_e->data=buf;
|
||||
|
||||
if (unlock)
|
||||
DocUnlock(doc);
|
||||
}
|
||||
|
||||
DataDemo;
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
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
|
||||
documentation.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
DefineLoad("COMPANY","Trivial Solutions");
|
||||
"Company: $$TX+D,\"\",\"COMPANY\"$$\n";
|
||||
|
||||
DefinePrintF("COMPANY_TIME","%T",GetCurTimeCDate);
|
||||
|
||||
#exe {
|
||||
StreamPrintF(
|
||||
"#define COMPANY_AGE %h56D\n",GetCurTimeCDate-A2CDate("8/1/2003"));
|
||||
};
|
||||
|
||||
|
||||
"Age : $$TX+D,\"\",\"COMPANY_AGE\"$$ years\n";
|
||||
"Time: $$TX+D,\"\",\"COMPANY_TIME\"$$\n";
|
||||
Binary file not shown.
@@ -0,0 +1,68 @@
|
||||
public U0 DocProfile(U8 *filename,I64 flags)
|
||||
{
|
||||
I64 i,*cmd_stats=CAlloc(sizeof(I64)*DOCT_NUM_TYPES),
|
||||
*flags_stats=CAlloc(sizeof(I64)*64),
|
||||
*type_flags_stats=CAlloc(sizeof(I64)*64);
|
||||
//Note, word wrap is determined by
|
||||
//doc->win_task when a $LK,"CDoc","MN:CDoc"$ is recalculated
|
||||
//use $LK,"DocRecalc","MN:DocRecalc"$().
|
||||
CDoc *doc=DocRead(filename,flags);
|
||||
|
||||
//doc->root which is equal to doc is the
|
||||
//header of the CQue and represents the end-of-file marker.
|
||||
CDocEntry *doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
cmd_stats[doc_e->type_u8]++;
|
||||
for (i=0;i<64;i++)
|
||||
if (Bt(&doc_e->flags1,i))
|
||||
flags_stats[i]++;
|
||||
for (i=16;i<32;i++)
|
||||
if (Bt(&doc_e->type,i))
|
||||
type_flags_stats[i]++;
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
DocDel(doc);
|
||||
|
||||
"$$FG,PURPLE$$-------%s-------\n",filename;
|
||||
"$$FG,GREEN$$The lowest byte of the 32-bit 'doc_e->type', '$$FG,PURPLE$$doc_e->type.u8[0]$$FG,GREEN$$', is cmd and accessed with the union '$$FG,PURPLE$$doc_e->type_u8$$FG,GREEN$$'. "
|
||||
"See $$LK,\"CDocEntry\",\"MN:CDocEntry\"$$, "
|
||||
"$$LK,\"Doc Type Defines\",\"MN:DOCT_TEXT\"$$ and $$LK,\"Doc Type Codes\",\"FF:::/SparrowOS/Adam/Doc/Doc.CPP.Z,ST_DOC_CMDS\"$$.\n$$FG$$";
|
||||
for (i=0;i<DOCT_NUM_TYPES;i++)
|
||||
if (cmd_stats[i])
|
||||
"%4Z:%d\n",i,"ST_DOC_CMDS",cmd_stats[i];
|
||||
|
||||
"\n$$FG,GREEN$$'$$FG,PURPLE$$doc_e->type.u8[1]$$FG,GREEN$$' is the screen color attr of the entry. "
|
||||
"'$$FG,PURPLE$$doc_e->type.u16[1]$$FG,GREEN$$' is some flags for blinking and stuff. "
|
||||
"See $$LK,\"Doc Type Flag Defines\",\"MN:DOCET_BLINK\"$$.\n$$FG$$";
|
||||
|
||||
for (i=16;i<32;i++)
|
||||
if (type_flags_stats[i])
|
||||
"%4d:%d\n",i,type_flags_stats[i];
|
||||
|
||||
"$$FG,GREEN$$\n'$$FG,PURPLE$$doc_e->flags1$$FG,GREEN$$' is 64-bit. "
|
||||
"See $$LK,\"Doc Flag Defines\",\"MN:DOCEf1_AUX_STR\"$$ and $$LK,\"Doc Flag Codes\",\"FF:::/SparrowOS/Adam/Doc/Doc.CPP.Z,ST_DOC_FLAGS\"$$.\n$$FG$$";
|
||||
for (i=0;i<64;i++)
|
||||
if (flags_stats[i])
|
||||
"%4Z:%d\n",i,"ST_DOC_FLAGS",flags_stats[i];
|
||||
|
||||
Free(cmd_stats);
|
||||
Free(flags_stats);
|
||||
PressAKey;
|
||||
NewLine;
|
||||
}
|
||||
|
||||
|
||||
//See $LK,"TipOfDay","MN:TipOfDay"$.
|
||||
|
||||
//Note: Not all $LK,"CDocEntry","MN:CDocEntry"$'s are full-sized nodes.
|
||||
//Some are $LK,"MAlloc","MN:MAlloc"$ed with a smaller size to save
|
||||
//mem. They all have at least the size $LK,"CDocEntryBase","MN:CDocEntryBase"$.
|
||||
|
||||
//Note: $LK,"CDocEntry","MN:CDocEntry"$'s should be allocated from the
|
||||
//heap of the owning task, doc->mem_task.
|
||||
|
||||
//The flag arrays $LK,"doc_tag_types","MN:doc_tag_types"$, $LK,"doc_form_types","MN:doc_form_types"$, etc
|
||||
//are useful.
|
||||
|
||||
DocProfile("::/SparrowOS/Doc/ChangeLog.TXT.Z",0);
|
||||
DocProfile("::/SparrowOS/Doc/ChangeLog.TXT.Z",DOCF_PLAIN_TEXT);
|
||||
@@ -0,0 +1,44 @@
|
||||
class DStruct
|
||||
{
|
||||
//Use <CTRL-L> and select "Data" to generate the fmtstrs
|
||||
|
||||
//The number is the field from after the ':' to the end.
|
||||
// See $LK,"Data Tag Width","FA:::/SparrowOS/Adam/Doc/DocPlain.CPP.Z,DataTagWidth"$.
|
||||
|
||||
F64 num1 fmtstr "$$DA-T,32,\"F64 1:%12.8f\"$$\n";
|
||||
F64 num2 fmtstr "$$DA-T,32,\"F64 2:%12e\"$$\n";
|
||||
I64 num3 fmtstr "$$DA-T,32,\"I64 1:0x%016X\"$$\n";
|
||||
I64 num4 fmtstr "$$DA-T,32,\"I64 2:%12d\"$$\n";
|
||||
U8 name[32] fmtstr "$$DA-P,31,\"Name :%s\"$$\n";
|
||||
CDate datetime fmtstr "$$DA-T,32,\"Date :%8D\"$$\n";
|
||||
};
|
||||
|
||||
U0 FormDemo()
|
||||
{
|
||||
DStruct gtl;
|
||||
CDate ltdt;
|
||||
|
||||
gtl.num1=12.3e-4; //Set defaults
|
||||
gtl.num2=4.5e3;
|
||||
gtl.num3=0x1234;
|
||||
gtl.num4=-567;
|
||||
StrCpy(>l.name,"John");
|
||||
ltdt=GetCurTimeCDate;
|
||||
gtl.datetime=ltdt;
|
||||
if (DocFormDo(>l,"DStruct")) {
|
||||
"#1=%e\n",gtl.num1;
|
||||
"#2=%e\n",gtl.num2;
|
||||
"#3=%d\n",gtl.num3;
|
||||
"#4=%d\n",gtl.num4;
|
||||
"Name=%s\n",gtl.name;
|
||||
"Date=%D\n",gtl.datetime;
|
||||
} else
|
||||
"Cancel\n";
|
||||
|
||||
"\n\nClassRep Example\n";
|
||||
ClassRep("DStruct",>l);
|
||||
|
||||
//See also $LK,"ClassRepD","MN:ClassRepD"$().
|
||||
}
|
||||
|
||||
FormDemo;
|
||||
@@ -0,0 +1,76 @@
|
||||
//This example shows buttons. Buttons return a menu val
|
||||
//unless you rig them to send macros. Menu entries are
|
||||
//about the same as buttons, but don't have a border.
|
||||
|
||||
|
||||
I64 PopUpFreq()
|
||||
{ //See also $LK,"PopUpRangeI64","MN:PopUpRangeI64"$()
|
||||
I64 i;
|
||||
CDoc *doc=DocNew;
|
||||
DocPutS(doc,"$$TX+CX,\"Set Freq\"$$\n" //Centered text
|
||||
"$$CM+LX,2,4$$$$BT,\"100 Hz\",100$$"
|
||||
"$$CM+LX,18,0$$$$BT,\"200 Hz\",200$$"
|
||||
"$$CM+LX,2,4$$$$BT,\"400 Hz\",400$$"
|
||||
"$$CM+LX,18,0$$$$BT,\"800 Hz\",800$$\n");
|
||||
i=PopUpMenu(doc);
|
||||
if (i<0) i=0; // <SHIFT-ESC>
|
||||
DocDel(doc);
|
||||
return i;
|
||||
}
|
||||
|
||||
#define MU_NOTHING 0
|
||||
#define MU_SET_FREQ 1
|
||||
#define MU_SND_ON 2
|
||||
#define MU_SND_OFF 3
|
||||
|
||||
U0 MenuButton()
|
||||
{
|
||||
Bool done=FALSE;
|
||||
I64 i,j=0,freq=100;
|
||||
I64 old_flags=DocCur->flags;
|
||||
//This allows keyboard navigation to skip nonselectible entries.
|
||||
DocCur->flags|=DOCF_FORM;
|
||||
do {
|
||||
DocClear;
|
||||
//Use <CTRL-L> to generate cursor movement expressions and check "Quote".
|
||||
"$$CM+CX-RE,-4$$Menu Demo\n\n";
|
||||
"$$LM,8$$"; //Set left margin
|
||||
//These are buttons that return a val from a menu selection.
|
||||
if (!j)
|
||||
"\n$$BT,\"Snd On\",MU_SND_ON$$\n\n\n";
|
||||
else
|
||||
"\n$$BT,\"Snd Off\",MU_SND_OFF$$\n\n\n";
|
||||
"\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);
|
||||
DocBottom;
|
||||
switch (i) {
|
||||
case MU_NOTHING:
|
||||
break;
|
||||
case MU_SND_ON:
|
||||
j=freq;
|
||||
Snd(j);
|
||||
break;
|
||||
case MU_SND_OFF:
|
||||
j=0;
|
||||
Snd(j);
|
||||
break;
|
||||
case MU_SET_FREQ:
|
||||
freq=PopUpFreq;
|
||||
if (j) {
|
||||
j=freq;
|
||||
Snd(j);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
done=TRUE;
|
||||
}
|
||||
} while (!done);
|
||||
DocCur->flags=DocCur->flags&~DOCF_FORM |
|
||||
old_flags & DOCF_FORM;
|
||||
DocClear;
|
||||
Snd(0);
|
||||
}
|
||||
|
||||
MenuButton;
|
||||
Binary file not shown.
@@ -0,0 +1,24 @@
|
||||
"\nSuper : 3$$SY,-3$$2$$SY,0$$=9\n\n"
|
||||
"Sub : H$$SY,3$$2$$SY,0$$O\n\n"
|
||||
"Color : $$FG,RED$$Test$$FG$$\n\n"
|
||||
"Blink : $$BK,1$$Test$$BK,0$$\n\n"
|
||||
"Invert : $$IV,1$$Test$$IV,0$$\n\n"
|
||||
"UnderLine: $$UL,1$$Test$$UL,0$$\n\n"
|
||||
"Link : $$LK,\"Genesis,1:1\",\"BF:Genesis,1:1\"$$\n\n\n"
|
||||
|
||||
|
||||
"Button : $$BT-X,\"OKAY\",1$$\n\n\n\n";
|
||||
|
||||
//You can do it this way if you like.
|
||||
"\nSuper : 3$SY,-3$2$SY,0$=9\n\n"
|
||||
"Sub : H$SY,3$2$SY,0$O\n\n"
|
||||
//Can't see color because of syntax highlighting. Press <CTRL-T>
|
||||
"Color : $FG,4$Test$FG$\n\n"
|
||||
"Blink : $BK,1$Test$BK,0$\n\n"
|
||||
"Invert : $IV,1$Test$IV,0$\n\n"
|
||||
"UnderLine: $UL,1$Test$UL,0$\n\n"
|
||||
//<CTRL-SHIFT-T> on this link to toggle individual commands.
|
||||
"Link : $LK,"Genesis,1:1","BF:Genesis,1:1"$\n\n\n"
|
||||
|
||||
|
||||
"Button : $BT,"OKAY",1$\n\n\n\n";
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
This uses DocPutS/DocPrintF because updates
|
||||
to within a tree while a tree is collapsed get
|
||||
messed-up if "live"(like using ordinary PrintF/PutS.)
|
||||
The insert point is confused by hiding of
|
||||
data in collapsed trees. Therefore, the window main
|
||||
Doc is taken off-line by disabling preemption so there
|
||||
are no screen updates until all data has been inserted.
|
||||
|
||||
There is a special Doc function which is also
|
||||
available to take an Doc off-line. See $LK,"DocInsSafe","MN:DocInsSafe"$.
|
||||
For this example, however, I wanted to use DocPrintF
|
||||
and disabled Preemption myself.
|
||||
*/
|
||||
|
||||
#include "/SparrowOS/Demo/Shared/TreeDemoJoin"
|
||||
|
||||
U0 TreeDemo()
|
||||
{
|
||||
I64 fuf_flags=0;
|
||||
CDoc *doc=DocNew;
|
||||
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
|
||||
DocPutS(doc,"$$TR-C+AL,\"\"$$\n");
|
||||
DocPutS(doc,"$$ID,+2$$");
|
||||
TreeSub(doc,FilesFind("/SparrowOS/*",fuf_flags));
|
||||
DocPutS(doc,"$$ID,-2$$");
|
||||
DocInsDoc(DocCur,doc);
|
||||
DocDel(doc);
|
||||
}
|
||||
|
||||
TreeDemo;
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
This scans the sym table and checks
|
||||
each $LK,"HTT_DEFINE_STR","MN:HTT_DEFINE_STR"$ entry to see if
|
||||
it only occurs once in files.
|
||||
|
||||
It's a brute force solution, but
|
||||
gets the job done... slowly.
|
||||
|
||||
$LK,"Grep","MN:Grep"$() returns a count of matches.
|
||||
|
||||
$LK,"FileOcc","MN:FileOcc"$() is $LK,"Grep","MN:Grep"$() with
|
||||
output $LK,"Silent","MN:Silent"$().
|
||||
|
||||
*/
|
||||
|
||||
U0 UnusedDefineScan()
|
||||
{
|
||||
CDoc *old_doc=DocCur,*doc;
|
||||
I64 cnt=0;
|
||||
CHashTable *tempht;
|
||||
CHash *temph;
|
||||
CDocEntry *doc_e,*doc_e2;
|
||||
Bool old_silent=IsSilent;
|
||||
|
||||
//Technically, we might want to
|
||||
//turn-off preemption in case the
|
||||
//table was modified.
|
||||
|
||||
try {
|
||||
tempht=Fs->hash_table;
|
||||
while (tempht) {
|
||||
temph=tempht->next_added;
|
||||
while (temph!=tempht) {
|
||||
if (temph->type&HTT_DEFINE_STR)
|
||||
cnt++;
|
||||
temph=temph->next_added;
|
||||
}
|
||||
tempht=tempht->next;
|
||||
}
|
||||
|
||||
progress1=0;
|
||||
progress1_max=cnt;
|
||||
StrCpy(progress1_desc,"Define Scan");
|
||||
|
||||
tempht=Fs->hash_table;
|
||||
while (tempht) {
|
||||
temph=tempht->next_added;
|
||||
while (temph!=tempht) {
|
||||
if (temph->type&HTT_DEFINE_STR) {
|
||||
progress1++;
|
||||
if (FileOcc(temph->str,"/SparrowOS/"TEXT_FILE_MASK,"+l-i")==1) {
|
||||
doc=DocNew;
|
||||
DocQueRem(old_doc);
|
||||
DocQueIns(doc,Fs->last_doc);
|
||||
Grep(temph->str,"/SparrowOS/"TEXT_FILE_MASK,"+l-i");
|
||||
DocQueRem(doc);
|
||||
DocQueIns(old_doc,Fs->last_doc);
|
||||
doc_e=doc->root.next;
|
||||
while (doc_e!=doc) {
|
||||
if (doc_e->type_u8==DOCT_LINK) {
|
||||
NewLine;
|
||||
"" temph->str;
|
||||
doc_e2=DocEntryCopy(doc,doc_e);
|
||||
DocIns(old_doc,doc_e2);
|
||||
NewLine;
|
||||
}
|
||||
doc_e=doc_e->next;
|
||||
}
|
||||
DocDel(doc);
|
||||
}
|
||||
}
|
||||
temph=temph->next_added;
|
||||
}
|
||||
tempht=tempht->next;
|
||||
}
|
||||
} catch
|
||||
CatchAll;
|
||||
|
||||
Silent(old_silent);
|
||||
NewLine;
|
||||
ProgressBarsRst;
|
||||
}
|
||||
|
||||
UnusedDefineScan;
|
||||
Reference in new issue
Block a user