hschumann2/TempleOS-Source-Code
0847
1 2public U0 DocProfile(U8 *filename,I64 flags)3{4 I64 i,*cmd_stats=CAlloc(sizeof(I64)*DOCT_TYPES_NUM),5 *flags_stats=CAlloc(sizeof(I64)*64),6 *type_flags_stats=CAlloc(sizeof(I64)*64);7//Note: word wrap is determined by8 //doc->win_task when a CDoc is recalculated9 //use DocRecalc().10 CDoc *doc=DocRead(filename,flags);11 12 //doc->head which is equ to doc is the13 //header of the CQue and represents the end-of-file marker.14 CDocEntry *doc_e=doc->head.next;15 while (doc_e!=doc) {16 cmd_stats[doc_e->type_u8]++;17 for (i=0;i<64;i++)18 if (Bt(&doc_e->de_flags,i))19 flags_stats[i]++;20 for (i=16;i<32;i++)21 if (Bt(&doc_e->type,i))22 type_flags_stats[i]++;23 doc_e=doc_e->next;24 }25 DocDel(doc);26 27 "$PURPLE$-------%s-------\n",filename;28 "$GREEN$The lowest byte of the 32-bit 'doc_e->type', "29 "'$PURPLE$doc_e->type.u8[0]$GREEN$', "30 "is cmd and accessed with the union "31 "'$PURPLE$doc_e->type_u8$GREEN$'. "32 "See $LK,\"CDocEntry\",A=\"MN:CDocEntry\"$, "33 "$LK,\"Doc Type Defines\",A=\"MN:DOCT_TEXT\"$ and "34 "$LK,\"Doc Type Codes\","35 "A=\"FF:::/Adam/DolDoc/DocInit.HC,ST_DOC_CMDS\"$.\n"36 "$FG$";37 for (i=0;i<DOCT_TYPES_NUM;i++)38 if (cmd_stats[i])39 "%4Z:%d\n",i,"ST_DOC_CMDS",cmd_stats[i];40 41 "\n$GREEN$'$PURPLE$doc_e->type.u8[1]$GREEN$' is "42 "the scrn color attr of the "43 "entry. '$PURPLE$doc_e->type.u16[1]"44 "$GREEN$' is some flags for blinking and "45 "stuff. See $LK,\"Doc Type Flag "46 "Defines\",A=\"MN:DOCET_BLINK\"$.\n$FG$";47 48 for (i=16;i<32;i++)49 if (type_flags_stats[i])50 "%4d:%d\n",i,type_flags_stats[i];51 52 "$GREEN$\n'$PURPLE$doc_e->de_flags$GREEN$' is 64-bit. "53 "See $LK,\"Doc Flag Defines\",A=\"MN:DOCEf_TAG\"$ and "54 "$LK,\"Doc Flag Codes\","55 "A=\"FF:::/Adam/DolDoc/DocInit.HC,ST_DOC_FLAGS\"$.\n"56 "$FG$";57 for (i=0;i<64;i++)58 if (flags_stats[i])59 "%4Z:%d\n",i,"ST_DOC_FLAGS",flags_stats[i];60 61 Free(cmd_stats);62 Free(flags_stats);63 PressAKey;64 '\n';65}66 67/*See TipOfDay.68 69Note: Not all CDocEntry's are full-sized nodes.70Some are MAlloced with a smaller size to save71mem. They all have at least the size CDocEntryBase.72 73Note: CDocEntry's should be alloced from the74heap of the owning task, doc->mem_task.75 76The flag arrays doldoc.type_flags_form, etc77are useful.78*/79 80DocProfile("::/Doc/ChgLog.DD",0);81DocProfile("::/Doc/ChgLog.DD",DOCF_PLAIN_TEXT);82 