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