|
|
|
@ -16,7 +16,7 @@ Bool RegCache()
|
|
|
|
|
return TRUE; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Bool RegSetDftEntry(U8 *path,U8 *val,Bool is_adam_entry=FALSE) |
|
|
|
|
public Bool RegDft(U8 *path,U8 *val,Bool is_adam_entry=FALSE) |
|
|
|
|
{//Add code doc tree branch to registry. |
|
|
|
|
Bool res,unlock_doc; |
|
|
|
|
RegCache; |
|
|
|
@ -40,13 +40,13 @@ public Bool RegSetDftEntry(U8 *path,U8 *val,Bool is_adam_entry=FALSE)
|
|
|
|
|
return res; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public I64 RegExeBranch(U8 *path) |
|
|
|
|
public I64 RegExe(U8 *path) |
|
|
|
|
{//Execute doc tree branch in registry. |
|
|
|
|
RegCache; |
|
|
|
|
return DocTreeBranchExe(sys_registry_doc,path); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Bool RegWriteBranch(U8 *path,U8 *fmt,...) |
|
|
|
|
public Bool RegWrite(U8 *path,U8 *fmt,...) |
|
|
|
|
{//Rewrite doc tree branch in registry. |
|
|
|
|
Bool res,unlock_doc; |
|
|
|
|
CDocEntry *tree_branch,*start_indent,*end_indent; |
|
|
|
@ -65,6 +65,46 @@ public Bool RegWriteBranch(U8 *path,U8 *fmt,...)
|
|
|
|
|
Free(buf); |
|
|
|
|
return res; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public I64 RegCnt(U8 *path) |
|
|
|
|
{//Tree branch cnt 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) { |
|
|
|
|
res++; |
|
|
|
|
start_indent=start_indent->next; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (unlock_doc) |
|
|
|
|
DocUnlock(sys_registry_doc); |
|
|
|
|
return res; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Bool RegAppend(U8 *path,U8 *fmt,...) |
|
|
|
|
{//Rewrite doc tree branch in registry. |
|
|
|
|
Bool res,unlock_doc; |
|
|
|
|
CDocEntry *tree_branch,*start_indent,*end_indent; |
|
|
|
|
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv); |
|
|
|
|
RegCache; |
|
|
|
|
unlock_doc=DocLock(sys_registry_doc); |
|
|
|
|
if (res=DocTreeFind(sys_registry_doc,path, |
|
|
|
|
&tree_branch,&start_indent,&end_indent)) { |
|
|
|
|
sys_registry_doc->cur_entry=end_indent; |
|
|
|
|
sys_registry_doc->cur_col=sys_registry_doc->cur_entry->min_col; |
|
|
|
|
} else |
|
|
|
|
DocTreeMake(sys_registry_doc,path); |
|
|
|
|
DocPrint(sys_registry_doc,"%s",buf); |
|
|
|
|
if (DrvIsWritable(*sys_registry_doc->filename.name)) |
|
|
|
|
DocWrite(sys_registry_doc); |
|
|
|
|
if (unlock_doc) |
|
|
|
|
DocUnlock(sys_registry_doc); |
|
|
|
|
Free(buf); |
|
|
|
|
return res; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Bool OneTimePopUp(U8 *_flags,I64 flag_num,U8 *msg) |
|
|
|
|
{//See $LK,"::/Apps/X-Caliber/X-Caliber.HC"$. |
|
|
|
@ -87,7 +127,7 @@ public Bool OneTimePopUp(U8 *_flags,I64 flag_num,U8 *msg)
|
|
|
|
|
U0 RegOneTimePopUp(I64 flag_num,U8 *msg) |
|
|
|
|
{//You're not supposed to make system pop-up flags, only me. |
|
|
|
|
if (OneTimePopUp(sys_msg_flags,flag_num,msg)) |
|
|
|
|
RegWriteBranch("Adam/SysMsgFlags","sys_msg_flags[0]=0x%X;\n", |
|
|
|
|
RegWrite("Adam/SysMsgFlags","sys_msg_flags[0]=0x%X;\n", |
|
|
|
|
sys_msg_flags[0]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -95,12 +135,74 @@ U0 RegInit()
|
|
|
|
|
{ |
|
|
|
|
U8 buf[STR_LEN]; |
|
|
|
|
Bool version_present; |
|
|
|
|
RegSetDftEntry("Adam/SysMsgFlags","sys_msg_flags[0]=0;\n",TRUE); |
|
|
|
|
RegDft("Adam/SysMsgFlags","sys_msg_flags[0]=0;\n",TRUE); |
|
|
|
|
StrPrint(buf,"registry_version=%4.3f;\n",sys_os_version); |
|
|
|
|
version_present=RegSetDftEntry("Adam/SysRegVer",buf,TRUE); |
|
|
|
|
RegExeBranch("Adam"); |
|
|
|
|
version_present=RegDft("Adam/SysRegVer",buf,TRUE); |
|
|
|
|
RegExe("Adam"); |
|
|
|
|
if (registry_version!=sys_os_version) { |
|
|
|
|
RegWriteBranch("Adam/SysRegVer",buf); |
|
|
|
|
RegExeBranch("Adam"); |
|
|
|
|
RegWrite("Adam/SysRegVer",buf); |
|
|
|
|
RegExe("Adam"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#help_index "Boot/Once;Misc/Once" |
|
|
|
|
|
|
|
|
|
public U0 AOnceFlush() |
|
|
|
|
{//Flush AOnce() buf. |
|
|
|
|
RegWrite("Once/Adam",""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public U0 OnceFlush() |
|
|
|
|
{//Flush Once() buf. |
|
|
|
|
RegWrite("Once/User",""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public U0 AOnce(U8 *fmt,...) |
|
|
|
|
{//Writes Adam code to $LK,"Registry",A="FI:~/Registry.HC"$ to be executed next boot. |
|
|
|
|
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv); |
|
|
|
|
RegAppend("Once/Adam","%s\n",buf); |
|
|
|
|
Free(buf); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public U0 Once(U8 *fmt,...) |
|
|
|
|
{//Writes User code to $LK,"Registry",A="FI:~/Registry.HC"$ to be executed next boot. |
|
|
|
|
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv); |
|
|
|
|
RegAppend("Once/User","%s\n",buf); |
|
|
|
|
Free(buf); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public U0 AOnceDrv(U8 drv_let=0,U8 *fmt,...) |
|
|
|
|
{//Writes Adam code to drv $LK,"Registry",A="FI:~/Registry.HC"$ to be executed next boot. |
|
|
|
|
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv); |
|
|
|
|
I64 old_drv_let=*sys_registry_doc->filename.name; |
|
|
|
|
if (drv_let) |
|
|
|
|
*sys_registry_doc->filename.name=drv_let; |
|
|
|
|
RegAppend("Once/Adam","%s\n",buf); |
|
|
|
|
Free(buf); |
|
|
|
|
*sys_registry_doc->filename.name=old_drv_let; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public U0 OnceDrv(U8 drv_let=0,U8 *fmt,...) |
|
|
|
|
{//Writes User code to drv $LK,"Registry",A="FI:~/Registry.HC"$ to be executed next boot. |
|
|
|
|
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv); |
|
|
|
|
I64 old_drv_let=*sys_registry_doc->filename.name; |
|
|
|
|
if (drv_let) |
|
|
|
|
*sys_registry_doc->filename.name=drv_let; |
|
|
|
|
RegAppend("Once/User","%s\n",buf); |
|
|
|
|
Free(buf); |
|
|
|
|
*sys_registry_doc->filename.name=old_drv_let; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public U0 OnceExe() |
|
|
|
|
{//Execute Once code. This goes in $LK,"~/Once.HC"$. |
|
|
|
|
RegDft("Once/Adam",""); |
|
|
|
|
if (RegCnt("Once/Adam")>2) { |
|
|
|
|
Adam("RegExe(\"Once/Adam\");"); |
|
|
|
|
AOnceFlush; |
|
|
|
|
} |
|
|
|
|
RegDft("Once/User",""); |
|
|
|
|
if (RegCnt("Once/User")>2) { |
|
|
|
|
RegExe("Once/User"); |
|
|
|
|
OnceFlush; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|