mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-25 23:10:32 +00:00
spacing and formatting
This commit is contained in:
parent
0293e0d373
commit
f4d859dce0
4 changed files with 199 additions and 161 deletions
Binary file not shown.
|
@ -23,6 +23,8 @@ StartOS.CC
|
|||
ZHash.CC
|
||||
ZMath.CC
|
||||
ZMathODE.CC
|
||||
ZMemory.CC
|
||||
ZRegistry.CC
|
||||
ZMouse.CC
|
||||
|
||||
ZBlkDev/
|
||||
|
|
|
@ -1,111 +1,128 @@
|
|||
#help_index "Memory/Task"
|
||||
public I64 TaskMemAlloced(CTask *task=NULL,Bool override_validate=FALSE)
|
||||
public I64 TaskMemAlloced(CTask *task=NULL, Bool override_validate=FALSE)
|
||||
{//Count of bytes alloced to a task, used+unused.
|
||||
I64 res;
|
||||
if (!task) task=Fs;
|
||||
if (override_validate || TaskValidate(task)) {
|
||||
res=task->code_heap->alloced_u8s;
|
||||
if (task->code_heap!=task->data_heap)
|
||||
res+=task->data_heap->alloced_u8s;
|
||||
if (!task)
|
||||
task = Fs;
|
||||
if (override_validate || TaskValidate(task))
|
||||
{
|
||||
res = task->code_heap->alloced_u8s;
|
||||
if (task->code_heap != task->data_heap)
|
||||
res += task->data_heap->alloced_u8s;
|
||||
return res;
|
||||
} else
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
public I64 TaskMemUsed(CTask *task=NULL,Bool override_validate=FALSE)
|
||||
public I64 TaskMemUsed(CTask *task=NULL, Bool override_validate=FALSE)
|
||||
{//Count of bytes alloced to a task and in use.
|
||||
I64 res;
|
||||
if (!task) task=Fs;
|
||||
if (override_validate || TaskValidate(task)) {
|
||||
res=task->code_heap->used_u8s;
|
||||
if (task->data_heap!=task->code_heap)
|
||||
res+=task->data_heap->used_u8s;
|
||||
if (!task)
|
||||
task = Fs;
|
||||
if (override_validate || TaskValidate(task))
|
||||
{
|
||||
res = task->code_heap->used_u8s;
|
||||
if (task->data_heap != task->code_heap)
|
||||
res += task->data_heap->used_u8s;
|
||||
return res;
|
||||
} else
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
#help_index "Memory/Task;Debugging/Heap;Memory/Debugging"
|
||||
public Bool HeapRep(CTask *task)
|
||||
{//Report status of task's heap.
|
||||
I64 i,count;
|
||||
I64 i, count;
|
||||
CMemUnused *uum;
|
||||
|
||||
if (!task || task==Fs) {
|
||||
if (!task || task == Fs)
|
||||
{
|
||||
"Task can't HeapRep on self.\n";
|
||||
return FALSE;
|
||||
}
|
||||
if (!TaskValidate(task)) return FALSE;
|
||||
if (!TaskValidate(task))
|
||||
return FALSE;
|
||||
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&task->code_heap->locked_flags,HClf_LOCKED))
|
||||
while (LBts(&task->code_heap->locked_flags, HClf_LOCKED))
|
||||
PAUSE
|
||||
if (task->data_heap!=task->code_heap)
|
||||
while (LBts(&task->data_heap->locked_flags,HClf_LOCKED))
|
||||
if (task->data_heap != task->code_heap)
|
||||
while (LBts(&task->data_heap->locked_flags, HClf_LOCKED))
|
||||
PAUSE
|
||||
|
||||
for (i=0;i<MEM_HEAP_HASH_SIZE>>3;i++) {
|
||||
count=0;
|
||||
uum=task->code_heap->heap_hash[i];
|
||||
while (uum) {
|
||||
count+=uum->size;
|
||||
uum=uum->next;
|
||||
for (i = 0; i < MEM_HEAP_HASH_SIZE >> 3; i++)
|
||||
{
|
||||
count = 0;
|
||||
uum = task->code_heap->heap_hash[i];
|
||||
while (uum)
|
||||
{
|
||||
count += uum->size;
|
||||
uum = uum->next;
|
||||
}
|
||||
if (task->data_heap!=task->code_heap) {
|
||||
uum=task->data_heap->heap_hash[i];
|
||||
while (uum) {
|
||||
count+=uum->size;
|
||||
uum=uum->next;
|
||||
if (task->data_heap != task->code_heap)
|
||||
{
|
||||
uum = task->data_heap->heap_hash[i];
|
||||
while (uum)
|
||||
{
|
||||
count += uum->size;
|
||||
uum = uum->next;
|
||||
}
|
||||
}
|
||||
if (count)
|
||||
"%03X:%08X\n",i<<3,count;
|
||||
"%03X:%08X\n", i << 3, count;
|
||||
}
|
||||
'\n';
|
||||
|
||||
uum=task->code_heap->malloc_free_list;
|
||||
while (uum) {
|
||||
"%X, ",uum->size;
|
||||
uum=uum->next;
|
||||
uum = task->code_heap->malloc_free_list;
|
||||
while (uum)
|
||||
{
|
||||
"%X, ", uum->size;
|
||||
uum = uum->next;
|
||||
}
|
||||
if (task->data_heap!=task->code_heap) {
|
||||
uum=task->data_heap->malloc_free_list;
|
||||
while (uum) {
|
||||
"%X, ",uum->size;
|
||||
uum=uum->next;
|
||||
if (task->data_heap != task->code_heap)
|
||||
{
|
||||
uum = task->data_heap->malloc_free_list;
|
||||
while (uum)
|
||||
{
|
||||
"%X, ", uum->size;
|
||||
uum = uum->next;
|
||||
}
|
||||
}
|
||||
|
||||
if (task->data_heap!=task->code_heap)
|
||||
LBtr(&task->data_heap->locked_flags,HClf_LOCKED);
|
||||
LBtr(&task->code_heap->locked_flags,HClf_LOCKED);
|
||||
if (task->data_heap != task->code_heap)
|
||||
LBtr(&task->data_heap->locked_flags, HClf_LOCKED);
|
||||
LBtr(&task->code_heap->locked_flags, HClf_LOCKED);
|
||||
POPFD
|
||||
|
||||
'\n';
|
||||
}
|
||||
|
||||
#help_index "Memory/HeapCtrl;Debugging/Heap;Memory/Debugging"
|
||||
public Bool IsInHeapCtrl(U8 *a,CHeapCtrl *hc,Bool lock=TRUE)
|
||||
public Bool IsInHeapCtrl(U8 *a, CHeapCtrl *hc, Bool lock=TRUE)
|
||||
{//Check addr if in HeapCtrl.
|
||||
CMemBlk *m;
|
||||
PUSHFD
|
||||
CLI
|
||||
if (lock)
|
||||
while (LBts(&hc->locked_flags,HClf_LOCKED))
|
||||
while (LBts(&hc->locked_flags, HClf_LOCKED))
|
||||
PAUSE
|
||||
m=hc->next_mem_blk;
|
||||
while (m!=&hc->next_mem_blk) {
|
||||
if (a>=m && a<m(U8 *)+m->pags<<MEM_PAG_BITS) {
|
||||
while (m != &hc->next_mem_blk)
|
||||
{
|
||||
if (a >= m && a < m(U8 *) + m->pags << MEM_PAG_BITS)
|
||||
{
|
||||
if (lock)
|
||||
LBtr(&hc->locked_flags,HClf_LOCKED);
|
||||
LBtr(&hc->locked_flags, HClf_LOCKED);
|
||||
POPFD
|
||||
return TRUE;
|
||||
}
|
||||
m=m->next;
|
||||
m = m->next;
|
||||
}
|
||||
if (lock)
|
||||
LBtr(&hc->locked_flags,HClf_LOCKED);
|
||||
LBtr(&hc->locked_flags, HClf_LOCKED);
|
||||
POPFD
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -117,52 +134,57 @@ public Bool HeapCtrlWalk(CHeapCtrl *hc)
|
|||
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&hc->locked_flags,HClf_LOCKED))
|
||||
while (LBts(&hc->locked_flags, HClf_LOCKED))
|
||||
PAUSE
|
||||
|
||||
for (i=0;i<MEM_HEAP_HASH_SIZE>>3;i++) {
|
||||
uum=hc->heap_hash[i];
|
||||
while (uum) {
|
||||
if (!IsInHeapCtrl(uum,hc,FALSE))
|
||||
for (i = 0; i < MEM_HEAP_HASH_SIZE >> 3; i++)
|
||||
{
|
||||
uum = hc->heap_hash[i];
|
||||
while (uum)
|
||||
{
|
||||
if (!IsInHeapCtrl(uum, hc, FALSE))
|
||||
goto hc_false;
|
||||
uum=uum->next;
|
||||
uum = uum->next;
|
||||
}
|
||||
}
|
||||
uum=hc->malloc_free_list;
|
||||
while (uum) {
|
||||
if (!IsInHeapCtrl(uum,hc,FALSE))
|
||||
uum = hc->malloc_free_list;
|
||||
while (uum)
|
||||
{
|
||||
if (!IsInHeapCtrl(uum, hc, FALSE))
|
||||
goto hc_false;
|
||||
uum=uum->next;
|
||||
uum = uum->next;
|
||||
}
|
||||
|
||||
#if _CONFIG_HEAP_DEBUG
|
||||
CMemUsed *um,*um1;
|
||||
um1=(&hc->next_um)(U8 *)-offset(CMemUsed.next);
|
||||
um=um1->next;
|
||||
while (um!=um1) {
|
||||
if (!IsInHeapCtrl(um,hc,FALSE))
|
||||
CMemUsed *um, *um1;
|
||||
um1 = (&hc->next_um)(U8 *) - offset(CMemUsed.next);
|
||||
um = um1->next;
|
||||
while (um != um1)
|
||||
{
|
||||
if (!IsInHeapCtrl(um, hc, FALSE))
|
||||
goto hc_false;
|
||||
um=um->next;
|
||||
um = um->next;
|
||||
}
|
||||
#endif
|
||||
|
||||
LBtr(&hc->locked_flags,HClf_LOCKED);
|
||||
LBtr(&hc->locked_flags, HClf_LOCKED);
|
||||
POPFD
|
||||
return TRUE;
|
||||
|
||||
hc_false:
|
||||
LBtr(&hc->locked_flags,HClf_LOCKED);
|
||||
LBtr(&hc->locked_flags, HClf_LOCKED);
|
||||
POPFD
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#help_index "Memory/Task;Debugging/Heap;Memory/Debugging"
|
||||
public Bool IsInHeap(U8 *a,CTask *task=NULL,Bool lock=TRUE)
|
||||
public Bool IsInHeap(U8 *a, CTask *task=NULL, Bool lock=TRUE)
|
||||
{//Check addr if in task's heaps.
|
||||
if (!task) task=Fs;
|
||||
if (TaskValidate(task) && (IsInHeapCtrl(a,task->code_heap,lock)||
|
||||
task->data_heap!=task->code_heap &&
|
||||
IsInHeapCtrl(a,task->data_heap,lock)))
|
||||
if (!task)
|
||||
task = Fs;
|
||||
if (TaskValidate(task) && (IsInHeapCtrl(a, task->code_heap, lock) ||
|
||||
task->data_heap != task->code_heap &&
|
||||
IsInHeapCtrl(a, task->data_heap, lock)))
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
|
@ -170,9 +192,9 @@ public Bool IsInHeap(U8 *a,CTask *task=NULL,Bool lock=TRUE)
|
|||
|
||||
public Bool HeapWalk(CTask *task=NULL)
|
||||
{//Check integrity of task's heaps.
|
||||
if (!task) task=Fs;
|
||||
if (!TaskValidate(task) || !HeapCtrlWalk(task->code_heap) ||
|
||||
task->data_heap!=task->code_heap && !HeapCtrlWalk(task->data_heap))
|
||||
if (!task)
|
||||
task = Fs;
|
||||
if (!TaskValidate(task) || !HeapCtrlWalk(task->code_heap) || task->data_heap != task->code_heap && !HeapCtrlWalk(task->data_heap))
|
||||
return FALSE;
|
||||
else
|
||||
return TRUE;
|
||||
|
|
|
@ -1,40 +1,46 @@
|
|||
#help_index "Registry"
|
||||
#define REGISTRY_FILENAME "~/Registry.CC"
|
||||
CDoc *sys_registry_doc=NULL;
|
||||
I64 sys_message_flags[1]={0};
|
||||
|
||||
CDoc *sys_registry_doc = NULL;
|
||||
I64 sys_message_flags[1] = {0};
|
||||
F64 registry_version;
|
||||
|
||||
Bool RegCache()
|
||||
{
|
||||
Bool old_silent;
|
||||
if (!sys_registry_doc) {
|
||||
old_silent=Silent;
|
||||
sys_registry_doc=DocRead(REGISTRY_FILENAME);
|
||||
if (!sys_registry_doc)
|
||||
{
|
||||
old_silent = Silent;
|
||||
sys_registry_doc = DocRead(REGISTRY_FILENAME);
|
||||
Silent(old_silent);
|
||||
return FALSE;
|
||||
} else
|
||||
}
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
public Bool RegDefault(U8 *path,U8 *val,Bool is_zenith_entry=FALSE)
|
||||
public Bool RegDefault(U8 *path, U8 *val, Bool is_zenith_entry=FALSE)
|
||||
{//Add code doc tree branch to registry.
|
||||
Bool res,unlock_doc;
|
||||
Bool res, unlock_doc;
|
||||
RegCache;
|
||||
unlock_doc=DocLock(sys_registry_doc);
|
||||
if (!DocTreeFind(sys_registry_doc,path)) {
|
||||
DocTreeMake(sys_registry_doc,path);
|
||||
DocPrint(sys_registry_doc,"%s",val);
|
||||
if (is_zenith_entry) {
|
||||
if (Fs==zenith_task)
|
||||
ExePrint("%s",val);
|
||||
unlock_doc = DocLock(sys_registry_doc);
|
||||
if (!DocTreeFind(sys_registry_doc, path))
|
||||
{
|
||||
DocTreeMake(sys_registry_doc, path);
|
||||
DocPrint(sys_registry_doc, "%s", val);
|
||||
if (is_zenith_entry)
|
||||
{
|
||||
if (Fs == zenith_task)
|
||||
ExePrint("%s", val);
|
||||
else
|
||||
Zenith("%s",val);
|
||||
Zenith("%s", val);
|
||||
}
|
||||
if (DriveIsWritable(*sys_registry_doc->filename.name))
|
||||
DocWrite(sys_registry_doc);
|
||||
res=FALSE;
|
||||
} else
|
||||
res=TRUE;
|
||||
res = FALSE;
|
||||
}
|
||||
else
|
||||
res = TRUE;
|
||||
if (unlock_doc)
|
||||
DocUnlock(sys_registry_doc);
|
||||
return res;
|
||||
|
@ -43,28 +49,29 @@ public Bool RegDefault(U8 *path,U8 *val,Bool is_zenith_entry=FALSE)
|
|||
public I64 RegExe(U8 *path)
|
||||
{//Execute doc tree branch in registry.
|
||||
RegCache;
|
||||
return DocTreeExe(sys_registry_doc,path);
|
||||
return DocTreeExe(sys_registry_doc, path);
|
||||
}
|
||||
|
||||
public Bool RegWrite(U8 *path,U8 *format,...)
|
||||
public Bool RegWrite(U8 *path, U8 *format, ...)
|
||||
{//Rewrite doc tree branch in registry.
|
||||
Bool res;
|
||||
RegCache;
|
||||
res=DocTreeWriteJoin(sys_registry_doc,path,TRUE,format,argc,argv);
|
||||
res = DocTreeWriteJoin(sys_registry_doc, path, TRUE, format, argc, argv);
|
||||
return res;
|
||||
}
|
||||
|
||||
public I64 RegCount(U8 *path)
|
||||
{//Tree branch count in registry.
|
||||
I64 res=0;
|
||||
CDocEntry *tree_branch,*start_indent,*end_indent;
|
||||
Bool unlock_doc=DocLock(sys_registry_doc);
|
||||
if (DocTreeFind(sys_registry_doc,path,
|
||||
&tree_branch,&start_indent,&end_indent)) {
|
||||
end_indent=end_indent->next;
|
||||
while (start_indent!=end_indent) {
|
||||
I64 res = 0;
|
||||
CDocEntry *tree_branch, *start_indent, *end_indent;
|
||||
Bool unlock_doc = DocLock(sys_registry_doc);
|
||||
if (DocTreeFind(sys_registry_doc, path, &tree_branch, &start_indent, &end_indent))
|
||||
{
|
||||
end_indent = end_indent->next;
|
||||
while (start_indent != end_indent)
|
||||
{
|
||||
res++;
|
||||
start_indent=start_indent->next;
|
||||
start_indent = start_indent->next;
|
||||
}
|
||||
}
|
||||
if (unlock_doc)
|
||||
|
@ -72,49 +79,52 @@ public I64 RegCount(U8 *path)
|
|||
return res;
|
||||
}
|
||||
|
||||
public Bool RegAppend(U8 *path,U8 *format,...)
|
||||
public Bool RegAppend(U8 *path, U8 *format, ...)
|
||||
{//Append to doc tree branch in registry.
|
||||
Bool res;
|
||||
RegCache;
|
||||
res=DocTreeAppendJoin(sys_registry_doc,path,TRUE,format,argc,argv);
|
||||
res = DocTreeAppendJoin(sys_registry_doc, path, TRUE, format, argc, argv);
|
||||
return res;
|
||||
}
|
||||
|
||||
public Bool OneTimePopUp(U8 *_flags,I64 flag_num,U8 *message)
|
||||
public Bool OneTimePopUp(U8 *_flags, I64 flag_num, U8 *message)
|
||||
{//See $LK,"::/Apps/X-Caliber/X-Caliber.CC"$.
|
||||
Bool res=FALSE;
|
||||
CDoc *doc=DocNew;
|
||||
Bool res = FALSE;
|
||||
CDoc *doc = DocNew;
|
||||
CDocEntry *doc_e;
|
||||
if (!Bt(_flags,flag_num)) {
|
||||
if (message) DocPrint(doc,"%s",message);
|
||||
doc_e=DocPrint(doc,"\n$$CB,\"Do not show this message again.\",LE=1$$");
|
||||
DocPrint(doc,"$$CM+CX,0,4$$$$BT,\"OKAY\",LE=1$$\n");
|
||||
if (PopUpMenu(doc)==1 && doc_e->de_flags&DOCEF_CHECKED_COLLAPSED) {
|
||||
LBts(_flags,flag_num);
|
||||
res=TRUE;
|
||||
if (!Bt(_flags, flag_num))
|
||||
{
|
||||
if (message)
|
||||
DocPrint(doc, "%s", message);
|
||||
doc_e = DocPrint(doc, "\n$$CB,\"Do not show this message again.\",LE=1$$");
|
||||
DocPrint(doc, "$$CM+CX,0,4$$$$BT,\"OKAY\",LE=1$$\n");
|
||||
if (PopUpMenu(doc) == 1 && doc_e->de_flags & DOCEF_CHECKED_COLLAPSED)
|
||||
{
|
||||
LBts(_flags, flag_num);
|
||||
res = TRUE;
|
||||
}
|
||||
DocDel(doc);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
U0 RegOneTimePopUp(I64 flag_num,U8 *message)
|
||||
U0 RegOneTimePopUp(I64 flag_num, U8 *message)
|
||||
{//You're not supposed to make system pop-up flags, only me.
|
||||
if (OneTimePopUp(sys_message_flags,flag_num,message))
|
||||
RegWrite("Zenith/SysMessageFlags","sys_message_flags[0]=0x%X;\n",
|
||||
sys_message_flags[0]);
|
||||
if (OneTimePopUp(sys_message_flags, flag_num,message))
|
||||
RegWrite("Zenith/SysMessageFlags", "sys_message_flags[0]=0x%X;\n", sys_message_flags[0]);
|
||||
}
|
||||
|
||||
U0 RegInit()
|
||||
{
|
||||
U8 buf[STR_LEN];
|
||||
Bool version_present;
|
||||
RegDefault("Zenith/SysMessageFlags","sys_message_flags[0]=0;\n",TRUE);
|
||||
StrPrint(buf,"registry_version=%4.3f;\n",sys_os_version);
|
||||
version_present=RegDefault("Zenith/SysRegVer",buf,TRUE);
|
||||
RegDefault("Zenith/SysMessageFlags", "sys_message_flags[0]=0;\n", TRUE);
|
||||
StrPrint(buf, "registry_version=%4.3f;\n", sys_os_version);
|
||||
version_present = RegDefault("Zenith/SysRegVer", buf, TRUE);
|
||||
RegExe("Zenith");
|
||||
if (registry_version!=sys_os_version) {
|
||||
RegWrite("Zenith/SysRegVer",buf);
|
||||
if (registry_version != sys_os_version)
|
||||
{
|
||||
RegWrite("Zenith/SysRegVer", buf);
|
||||
RegExe("Zenith");
|
||||
}
|
||||
}
|
||||
|
@ -124,80 +134,84 @@ U0 RegInit()
|
|||
|
||||
public U0 ZOnceFlush()
|
||||
{//Flush ZOnce() buf.
|
||||
RegWrite("Once/Zenith","");
|
||||
RegWrite("Once/Zenith", "");
|
||||
}
|
||||
|
||||
public U0 OnceFlush()
|
||||
{//Flush Once() buf.
|
||||
RegWrite("Once/User","");
|
||||
RegWrite("Once/User", "");
|
||||
}
|
||||
|
||||
public U0 ZOnce(U8 *format,...)
|
||||
public U0 ZOnce(U8 *format, ...)
|
||||
{//Add Zenith code to $LK,"~/Registry.CC"$, executed next boot.
|
||||
U8 *buf=StrPrintJoin(NULL,format,argc,argv);
|
||||
if (!Bt(&sys_run_level,RLf_ONCE_ZENITH))
|
||||
U8 *buf = StrPrintJoin(NULL, format, argc, argv);
|
||||
if (!Bt(&sys_run_level, RLf_ONCE_ZENITH))
|
||||
ZOnceFlush;
|
||||
RegAppend("Once/Zenith","%s\n",buf);
|
||||
RegAppend("Once/Zenith", "%s\n", buf);
|
||||
Free(buf);
|
||||
}
|
||||
|
||||
public U0 Once(U8 *format,...)
|
||||
public U0 Once(U8 *format, ...)
|
||||
{//Add User code to $LK,"~/Registry.CC"$, executed next boot.
|
||||
U8 *buf=StrPrintJoin(NULL,format,argc,argv);
|
||||
if (!Bt(&sys_run_level,RLf_ONCE_USER))
|
||||
U8 *buf = StrPrintJoin(NULL, format, argc, argv);
|
||||
if (!Bt(&sys_run_level, RLf_ONCE_USER))
|
||||
OnceFlush;
|
||||
RegAppend("Once/User","%s\n",buf);
|
||||
RegAppend("Once/User", "%s\n", buf);
|
||||
Free(buf);
|
||||
}
|
||||
|
||||
public U0 ZOnceDrive(U8 drv_let=0,U8 *format,...)
|
||||
public U0 ZOnceDrive(U8 drv_let=0, U8 *format, ...)
|
||||
{//Add Zenith code to drv $LK,"~/Registry.CC"$, executed next boot.
|
||||
U8 *buf=StrPrintJoin(NULL,format,argc,argv);
|
||||
I64 old_drive_let=*sys_registry_doc->filename.name;
|
||||
U8 *buf = StrPrintJoin(NULL, format, argc, argv);
|
||||
I64 old_drive_let = *sys_registry_doc->filename.name;
|
||||
if (drv_let)
|
||||
*sys_registry_doc->filename.name=drv_let;
|
||||
if (!Bt(&sys_run_level,RLf_ONCE_ZENITH))
|
||||
*sys_registry_doc->filename.name = drv_let;
|
||||
if (!Bt(&sys_run_level, RLf_ONCE_ZENITH))
|
||||
ZOnceFlush;
|
||||
RegAppend("Once/Zenith","%s\n",buf);
|
||||
RegAppend("Once/Zenith", "%s\n", buf);
|
||||
Free(buf);
|
||||
*sys_registry_doc->filename.name=old_drive_let;
|
||||
*sys_registry_doc->filename.name = old_drive_let;
|
||||
}
|
||||
|
||||
public U0 OnceDrive(U8 drv_let=0,U8 *format,...)
|
||||
public U0 OnceDrive(U8 drv_let=0, U8 *format, ...)
|
||||
{//Add User code to drv $LK,"~/Registry.CC"$, executed next boot.
|
||||
U8 *buf=StrPrintJoin(NULL,format,argc,argv);
|
||||
I64 old_drive_let=*sys_registry_doc->filename.name;
|
||||
U8 *buf = StrPrintJoin(NULL, format, argc, argv);
|
||||
I64 old_drive_let = *sys_registry_doc->filename.name;
|
||||
if (drv_let)
|
||||
*sys_registry_doc->filename.name=drv_let;
|
||||
if (!Bt(&sys_run_level,RLf_ONCE_USER))
|
||||
*sys_registry_doc->filename.name = drv_let;
|
||||
if (!Bt(&sys_run_level, RLf_ONCE_USER))
|
||||
OnceFlush;
|
||||
RegAppend("Once/User","%s\n",buf);
|
||||
RegAppend("Once/User", "%s\n", buf);
|
||||
Free(buf);
|
||||
*sys_registry_doc->filename.name=old_drive_let;
|
||||
*sys_registry_doc->filename.name = old_drive_let;
|
||||
}
|
||||
|
||||
public U0 OnceExe()
|
||||
{//Execute Once code. Call goes in $LK,"~/Once.CC"$.
|
||||
try {
|
||||
|
||||
RegDefault("Once/Zenith","");
|
||||
if (RegCount("Once/Zenith")>2) {
|
||||
RegDefault("Once/Zenith", "");
|
||||
if (RegCount("Once/Zenith") > 2)
|
||||
{
|
||||
Zenith("RegExe(\"Once/Zenith\");");
|
||||
ZOnceFlush;
|
||||
}
|
||||
LBts(&sys_run_level,RLf_ONCE_ZENITH);
|
||||
LBts(&sys_run_level, RLf_ONCE_ZENITH);
|
||||
|
||||
RegDefault("Once/User","");
|
||||
if (RegCount("Once/User")>2) {
|
||||
RegDefault("Once/User", "");
|
||||
if (RegCount("Once/User") > 2)
|
||||
{
|
||||
RegExe("Once/User");
|
||||
OnceFlush;
|
||||
}
|
||||
LBts(&sys_run_level,RLf_ONCE_USER);
|
||||
LBts(&sys_run_level, RLf_ONCE_USER);
|
||||
|
||||
} catch {
|
||||
}
|
||||
catch
|
||||
{
|
||||
ZOnceFlush;
|
||||
LBts(&sys_run_level,RLf_ONCE_ZENITH);
|
||||
LBts(&sys_run_level, RLf_ONCE_ZENITH);
|
||||
OnceFlush;
|
||||
LBts(&sys_run_level,RLf_ONCE_USER);
|
||||
LBts(&sys_run_level, RLf_ONCE_USER);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue