TempleOSCD_140715.ISO
This commit is contained in:
1 parent
7ef616a20e
commit
64f679eeb9
1095 files changed
+24814
-221011
No files matched your search
@@ -0,0 +1,12 @@
|
||||
U0 BlkDevRep()
|
||||
{//Block Device Report.
|
||||
I64 i;
|
||||
for (i=0;i<NUM_BLKDEVS;i++)
|
||||
if (dsk.blkdevs[i].bd_signature==BD_SIGNATURE_VAL)
|
||||
ClassRep(&dsk.blkdevs[i]);//$LK,"ClassRep",A="MN:ClassRep"$() dumps any structure, automatically.
|
||||
//The lastclass arg tells ClassRep the datatype.
|
||||
//lastclass is a language feature of $LK,"HolyC",A="FI:::/Doc/HolyC.TXT"$.
|
||||
//See $LK,"::/Demo/LastClass.CPP"$.
|
||||
}
|
||||
|
||||
BlkDevRep;
|
||||
+6
-10
@@ -3,29 +3,25 @@
|
||||
#define DB_ACCT_BLKS 1
|
||||
|
||||
class Acct
|
||||
{ //Use <CTRL-L> to help generate fmtstrs.
|
||||
{//Use <CTRL-l> to help generate fmtstrs.
|
||||
U8 name[32] fmtstr "$$DA-P,32,A=\"Name:%s\"$$\n";
|
||||
U8 addr[64] fmtstr "$$DA-P,64,A=\"Addr:%s\"$$\n";
|
||||
U8 pad[DB_ACCT_BLKS*BLK_SIZE-64-32];
|
||||
};
|
||||
|
||||
|
||||
U0 InitDatabase()
|
||||
{
|
||||
CFile *f;
|
||||
//Write new contiguous file
|
||||
f=FOpen(DB_FILENAME,"w",DB_MAX_ACCT*DB_ACCT_BLKS);
|
||||
{ //Write new contiguous file
|
||||
CFile *f=FOpen(DB_FILENAME,"w",DB_MAX_ACCT*DB_ACCT_BLKS);
|
||||
FClose(f);
|
||||
}
|
||||
|
||||
|
||||
U0 WriteAcct()
|
||||
{
|
||||
CFile *f;
|
||||
Acct a;
|
||||
I64 acctnum;
|
||||
|
||||
acctnum=PmtI64("Acct #",-1);
|
||||
acctnum=GetI64("Acct #",-1);
|
||||
if (0<=acctnum<DB_MAX_ACCT) {
|
||||
MemSet(&a,0,BLK_SIZE);
|
||||
if (DocFormDo(&a)) {
|
||||
@@ -42,7 +38,7 @@ U0 ReadAcct()
|
||||
Acct a;
|
||||
I64 acctnum;
|
||||
|
||||
acctnum=PmtI64("Acct #",-1);
|
||||
acctnum=GetI64("Acct #",-1);
|
||||
if (0<=acctnum<DB_MAX_ACCT) {
|
||||
f=FOpen(DB_FILENAME,"r");
|
||||
FRBlks(f,&a,acctnum*DB_ACCT_BLKS,DB_ACCT_BLKS);
|
||||
@@ -59,7 +55,7 @@ U0 DatabaseDemo()
|
||||
do {
|
||||
"$$GREEN$$R$$FG$$ead acct, $$GREEN$$W$$FG$$rite acct or $$GREEN$$<SHIFT-ESC>$$FG$$:";
|
||||
ch=ToUpper(GetChar);
|
||||
NewLine;
|
||||
'\n';
|
||||
if (ch=='R') ReadAcct;
|
||||
if (ch=='W') WriteAcct;
|
||||
} while (ch!=CH_SHIFT_ESC && ch!=CH_ESC);
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ U0 RawAccess(I64 drv_let=0)
|
||||
p->size=bdev->max_blk-bdev->min_blk+1;
|
||||
|
||||
try {
|
||||
blk=PmtI64("Blk to Read: ",old_offset,bdev->min_blk,bdev->max_blk);
|
||||
blk=GetI64("Blk to Read: ",old_offset,bdev->min_blk,bdev->max_blk);
|
||||
RBlks(p,buf,blk,1);
|
||||
D(buf,BLK_SIZE);
|
||||
} catch
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* There is no FPrintF type function and no
|
||||
/*There is no FPrintF type function and no
|
||||
way to grow files. Therefore, use mem to
|
||||
hold the file until you are done. The $LK,"CDoc",A="MN:CDoc"$
|
||||
framework is convenient for this.
|
||||
@@ -9,7 +9,7 @@ U0 TreeSub(CDoc *doc,CDirEntry *tempde)
|
||||
CDirEntry *tempde1;
|
||||
while (tempde) {
|
||||
tempde1=tempde->next;
|
||||
if (tempde->attr & _ATTR_DIR) {
|
||||
if (tempde->attr & RS_ATTR_DIR) {
|
||||
DocPrint(doc,"$$TR,\"\"$$");
|
||||
DocPrint(doc,"$$MA,T=\"%s\",LM=\"Cd(\\\"%s\\\");Dir;\n\"$$\n",
|
||||
tempde->name,tempde->full_name);
|
||||
@@ -23,7 +23,7 @@ U0 TreeSub(CDoc *doc,CDirEntry *tempde)
|
||||
tempde->name,tempde->full_name);
|
||||
//Note there is also a routine
|
||||
//to delete an entire CDirEntry tree.
|
||||
//See $LK,"DirLstDel",A="MN:DirLstDel"$().
|
||||
//See $LK,"DirTreeDel",A="MN:DirTreeDel"$().
|
||||
DirEntryDel(tempde);
|
||||
tempde=tempde1;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*You probably don't need this. It makes a directory
|
||||
tree into a flat contiguous memory chunk, suitable for
|
||||
serial communication and rebuilds it into a tree on the
|
||||
other end.
|
||||
*/
|
||||
|
||||
U0 SerializeTree()
|
||||
{
|
||||
CDirEntry *tempde=FilesFind("/Demo/*.TXT*",FUF_RECURSE);
|
||||
I64 size;
|
||||
U8 *ptr;
|
||||
CArcCompress *ac;
|
||||
|
||||
LineRep1(tempde); //We have $LK,"CDirEntry",A="MN:CDirEntry"$.fullname
|
||||
LineRep2(DocPut,tempde);
|
||||
"$$GREEN$$***************$$FG$$\n";
|
||||
ptr=DirTreeSerialize(tempde,&size);
|
||||
DirTreeDel(tempde);
|
||||
D(ptr,size);
|
||||
"$$GREEN$$***************:%7d$$FG$$\n",size;
|
||||
ac=CompressBuf(ptr,size);
|
||||
Free(ptr);
|
||||
D(ac,ac->compressed_size);
|
||||
"$$GREEN$$***************:%7d$$FG$$\n",size;
|
||||
ptr=ExpandBuf(ac);
|
||||
size=ac->expanded_size;
|
||||
Free(ac);
|
||||
D(ptr,size);
|
||||
"$$GREEN$$***************:%7d$$FG$$\n",size;
|
||||
tempde=DirTreeUnserialize(ptr);
|
||||
LineRep2(DocPut,tempde); //We don't have $LK,"CDirEntry",A="MN:CDirEntry"$.fullname
|
||||
DirTreeDel(tempde);
|
||||
}
|
||||
|
||||
SerializeTree;
|
||||
Reference in new issue
Block a user