TempleOSCDV4.12.ISO
This commit is contained in:
1 parent
93ca216483
commit
b84bbff6db
381 files changed
+18356
-18798
No files matched your search
+84
-84
@@ -1,18 +1,18 @@
|
||||
I64 HashTypeNum(CHash *temph)
|
||||
I64 HashTypeNum(CHash *tmph)
|
||||
{//Return bit num of hash type, limited to just types.
|
||||
if (temph)
|
||||
return Bsf(temph->type&HTG_TYPE_MASK);
|
||||
if (tmph)
|
||||
return Bsf(tmph->type&HTG_TYPE_MASK);
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
I64 HashVal(CHash *temph)
|
||||
I64 HashVal(CHash *tmph)
|
||||
{//Returns most likely desired value.
|
||||
switch [HashTypeNum(temph)] {
|
||||
switch [HashTypeNum(tmph)] {
|
||||
case HTt_EXPORT_SYS_SYM:
|
||||
return temph(CHashExport *)->val;
|
||||
return tmph(CHashExport *)->val;
|
||||
case HTt_IMPORT_SYS_SYM:
|
||||
return temph(CHashImport *)->module_base;
|
||||
return tmph(CHashImport *)->module_base;
|
||||
case HTt_DEFINE_STR:
|
||||
case HTt_CLASS:
|
||||
case HTt_INTERNAL_TYPE:
|
||||
@@ -20,25 +20,25 @@ I64 HashVal(CHash *temph)
|
||||
case HTt_DICT_WORD:
|
||||
case HTt_OPCODE:
|
||||
case HTt_HELP_FILE:
|
||||
return temph;
|
||||
return tmph;
|
||||
case HTt_GLBL_VAR:
|
||||
if (temph(CHashGlblVar *)->flags&GVF_EXTERN)
|
||||
return &temph(CHashGlblVar *)->data_addr;
|
||||
if (tmph(CHashGlblVar *)->flags&GVF_EXTERN)
|
||||
return &tmph(CHashGlblVar *)->data_addr;
|
||||
else
|
||||
return temph(CHashGlblVar *)->data_addr;
|
||||
return tmph(CHashGlblVar *)->data_addr;
|
||||
case HTt_FUN:
|
||||
if (Bt(&temph(CHashFun *)->flags,Cf_EXTERN))
|
||||
return temph;
|
||||
if (Bt(&tmph(CHashFun *)->flags,Cf_EXTERN))
|
||||
return tmph;
|
||||
else
|
||||
return temph(CHashFun *)->exe_addr;
|
||||
return tmph(CHashFun *)->exe_addr;
|
||||
case HTt_REG:
|
||||
return temph(CHashReg *)->reg_num|temph(CHashReg *)->reg_type<<8;
|
||||
return tmph(CHashReg *)->reg_num|tmph(CHashReg *)->reg_type<<8;
|
||||
case HTt_KEYWORD:
|
||||
case HTt_ASM_KEYWORD:
|
||||
case HTt_MODULE:
|
||||
case HTt_FILE:
|
||||
case HTt_FRAME_PTR:
|
||||
return temph(CHashGeneric *)->user_data0;
|
||||
return tmph(CHashGeneric *)->user_data0;
|
||||
|
||||
case -1: //nobound switch
|
||||
case HTt_NUM_TYPES: //nobound switch
|
||||
@@ -56,48 +56,48 @@ CHashTable *HashTableNew(I64 size,CTask *mem_task=NULL)
|
||||
return table;
|
||||
}
|
||||
|
||||
U0 HashDel(CHashSrcSym *temph)
|
||||
U0 HashDel(CHashSrcSym *tmph)
|
||||
{//Free a std TempleOS system hash entry.
|
||||
if (!temph) return;
|
||||
if (!(temph->type&HTT_DICT_WORD))
|
||||
Free(temph->str);
|
||||
if (temph->type & HTG_SRC_SYM) {
|
||||
Free(temph->src_link);
|
||||
Free(temph->idx);
|
||||
Free(temph->import_name);
|
||||
LinkedLstDel(temph->ie_lst);
|
||||
if (temph->type & (HTT_FUN | HTT_EXPORT_SYS_SYM))
|
||||
Free(temph->dbg_info);
|
||||
if (temph->type & (HTT_FUN | HTT_CLASS))
|
||||
if (!tmph) return;
|
||||
if (!(tmph->type&HTT_DICT_WORD))
|
||||
Free(tmph->str);
|
||||
if (tmph->type & HTG_SRC_SYM) {
|
||||
Free(tmph->src_link);
|
||||
Free(tmph->idx);
|
||||
Free(tmph->import_name);
|
||||
LinkedLstDel(tmph->ie_lst);
|
||||
if (tmph->type & (HTT_FUN | HTT_EXPORT_SYS_SYM))
|
||||
Free(tmph->dbg_info);
|
||||
if (tmph->type & (HTT_FUN | HTT_CLASS))
|
||||
//Assumes code not on heap, so doesn't Free.
|
||||
//$LK,"ClassMemberLstDel",A="MN:ClassMemberLstDel"$() is an import to the Kernel module
|
||||
ClassMemberLstDel(temph);
|
||||
else if (temph->type&HTT_DEFINE_STR)
|
||||
Free(temph(CHashDefineStr *)->data);
|
||||
else if (temph->type & HTT_GLBL_VAR) {
|
||||
if (!(temph(CHashGlblVar *)->flags&GVF_ALIAS))
|
||||
Free(temph(CHashGlblVar *)->data_addr);
|
||||
LinkedLstDel(temph(CHashGlblVar *)->dim.next);
|
||||
if (temph(CHashGlblVar *)->fun_ptr)
|
||||
HashDel(temph(CHashGlblVar *)->fun_ptr
|
||||
-temph(CHashGlblVar *)->fun_ptr->ptr_stars_cnt);
|
||||
ClassMemberLstDel(tmph);
|
||||
else if (tmph->type&HTT_DEFINE_STR)
|
||||
Free(tmph(CHashDefineStr *)->data);
|
||||
else if (tmph->type & HTT_GLBL_VAR) {
|
||||
if (!(tmph(CHashGlblVar *)->flags&GVF_ALIAS))
|
||||
Free(tmph(CHashGlblVar *)->data_addr);
|
||||
LinkedLstDel(tmph(CHashGlblVar *)->dim.next);
|
||||
if (tmph(CHashGlblVar *)->fun_ptr)
|
||||
HashDel(tmph(CHashGlblVar *)->fun_ptr
|
||||
-tmph(CHashGlblVar *)->fun_ptr->ptr_stars_cnt);
|
||||
}
|
||||
} else if (temph->type & HTT_FILE)
|
||||
Free(temph(CHashGeneric *)->user_data0);
|
||||
Free(temph);
|
||||
} else if (tmph->type & HTT_FILE)
|
||||
Free(tmph(CHashGeneric *)->user_data0);
|
||||
Free(tmph);
|
||||
}
|
||||
|
||||
U0 HashTableDel(CHashTable *table)
|
||||
{//Free std system hash table, calling $LK,"HashDel",A="MN:HashDel"$() on entries.
|
||||
I64 i;
|
||||
CHashSrcSym *temph,*temph1;
|
||||
CHashSrcSym *tmph,*tmph1;
|
||||
if (!table) return;
|
||||
for (i=0;i<=table->mask;i++) {
|
||||
temph=table->body[i];
|
||||
while (temph) {
|
||||
temph1=temph->next;
|
||||
HashDel(temph);
|
||||
temph=temph1;
|
||||
tmph=table->body[i];
|
||||
while (tmph) {
|
||||
tmph1=tmph->next;
|
||||
HashDel(tmph);
|
||||
tmph=tmph1;
|
||||
}
|
||||
}
|
||||
Free(table->body);
|
||||
@@ -107,30 +107,30 @@ U0 HashTableDel(CHashTable *table)
|
||||
I64 HashTablePurge(CHashTable *table)
|
||||
{//Eliminate ExportSysSyms that have been usurped.
|
||||
I64 i,res=0;
|
||||
CHashSrcSym *temph,*temph1,*temph2;
|
||||
CHashSrcSym *tmph,*tmph1,*tmph2;
|
||||
if (!table) return 0;
|
||||
PUSHFD
|
||||
CLI //Precaution
|
||||
for (i=0;i<=table->mask;i++) {
|
||||
temph=table->body[i];
|
||||
while (temph) {
|
||||
temph1=temph->next; //We delete only older ones
|
||||
if (temph->type&(HTT_FUN|HTT_GLBL_VAR)) {
|
||||
temph2=temph->next; //Older always later in chain
|
||||
while (temph2) {
|
||||
if ((temph2->type&HTT_EXPORT_SYS_SYM ||
|
||||
temph2->type&HTG_TYPE_MASK==HTT_INVALID) &&
|
||||
!StrCmp(temph2->str,temph->str)) {
|
||||
if (temph2->type&HTG_TYPE_MASK==HTT_INVALID)
|
||||
temph2->type=HTT_KEYWORD;//Won't delete HTT_INVALID
|
||||
HashRemDel(temph2,table);
|
||||
tmph=table->body[i];
|
||||
while (tmph) {
|
||||
tmph1=tmph->next; //We delete only older ones
|
||||
if (tmph->type&(HTT_FUN|HTT_GLBL_VAR)) {
|
||||
tmph2=tmph->next; //Older always later in chain
|
||||
while (tmph2) {
|
||||
if ((tmph2->type&HTT_EXPORT_SYS_SYM ||
|
||||
tmph2->type&HTG_TYPE_MASK==HTT_INVALID) &&
|
||||
!StrCmp(tmph2->str,tmph->str)) {
|
||||
if (tmph2->type&HTG_TYPE_MASK==HTT_INVALID)
|
||||
tmph2->type=HTT_KEYWORD;//Won't delete HTT_INVALID
|
||||
HashRemDel(tmph2,table);
|
||||
res++;
|
||||
break;
|
||||
}
|
||||
temph2=temph2->next;
|
||||
tmph2=tmph2->next;
|
||||
}
|
||||
}
|
||||
temph=temph1;
|
||||
tmph=tmph1;
|
||||
}
|
||||
}
|
||||
POPFD
|
||||
@@ -153,11 +153,11 @@ CHashGeneric *HashGenericAdd(U8 *name,I64 type,
|
||||
|
||||
U0 HashSrcFileSet(CCmpCtrl *cc,CHashSrcSym *h,I64 line_num_offset=0)
|
||||
{//Set $LK,"CHashSrcSym",A="MN:CHashSrcSym"$ link and help_index by cur cc pos.
|
||||
CLexFile *tempf=cc->lex_include_stk;
|
||||
I64 line_num=tempf->line_num+line_num_offset;
|
||||
CLexFile *tmpf=cc->lex_include_stk;
|
||||
I64 line_num=tmpf->line_num+line_num_offset;
|
||||
if (line_num<1) line_num=1;
|
||||
Free(h->src_link);
|
||||
h->src_link=MStrPrint("FL:%s,%d",tempf->full_name,line_num);
|
||||
h->src_link=MStrPrint("FL:%s,%d",tmpf->full_name,line_num);
|
||||
if (Bt(&cc->opts,OPTf_KEEP_PRIVATE))
|
||||
h->type|=HTF_PRIVATE;
|
||||
Free(h->idx);
|
||||
@@ -185,18 +185,18 @@ CHashGeneric *HashPublic(U8 *st,I64 mask,Bool val=TRUE)
|
||||
I64 HashLstAdd(U8 *lst,I64 type,CHashTable *table)
|
||||
{//Add a list to a hash table.
|
||||
I64 i=0;
|
||||
CHashGeneric *temph;
|
||||
CHashGeneric *tmph;
|
||||
if (lst) {
|
||||
while (*lst) {
|
||||
if (*lst=='@')
|
||||
lst++;
|
||||
else
|
||||
i++;
|
||||
temph=CAlloc(sizeof(CHashGeneric));
|
||||
temph->user_data0=i-1;
|
||||
temph->str=StrNew(lst);
|
||||
temph->type=type;
|
||||
HashAdd(temph,table);
|
||||
tmph=CAlloc(sizeof(CHashGeneric));
|
||||
tmph->user_data0=i-1;
|
||||
tmph->str=StrNew(lst);
|
||||
tmph->type=type;
|
||||
HashAdd(tmph,table);
|
||||
while (*lst++);
|
||||
}
|
||||
}
|
||||
@@ -205,19 +205,19 @@ I64 HashLstAdd(U8 *lst,I64 type,CHashTable *table)
|
||||
|
||||
I64 HashDefineLstAdd(U8 *dname,I64 type,CHashTable *table)
|
||||
{//Add define list to a hash table. See $LK,"::/Adam/DolDoc/DocInit.HC",A="FF:::/Adam/DolDoc/DocInit.HC,HashDefineLstAdd"$.
|
||||
CHashDefineStr *temph;
|
||||
if (temph=HashFind(dname,Fs->hash_table,HTT_DEFINE_STR))
|
||||
return HashLstAdd(temph->data,type,table);
|
||||
CHashDefineStr *tmph;
|
||||
if (tmph=HashFind(dname,Fs->hash_table,HTT_DEFINE_STR))
|
||||
return HashLstAdd(tmph->data,type,table);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
I64 FramePtr(U8 *name,CTask *task=NULL)
|
||||
{//Find entry in task->hash_table, Return user_data.
|
||||
CHashGeneric *temph;
|
||||
CHashGeneric *tmph;
|
||||
if (!task) task=Fs;
|
||||
if (temph=HashFind(name,task->hash_table,HTT_FRAME_PTR))
|
||||
return temph->user_data0;
|
||||
if (tmph=HashFind(name,task->hash_table,HTT_FRAME_PTR))
|
||||
return tmph->user_data0;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
@@ -229,22 +229,22 @@ CHashGeneric *FramePtrAdd(U8 *name,I64 val=0,CTask *task=NULL)
|
||||
|
||||
I64 FramePtrSet(U8 *name,I64 val,CTask *task=NULL)
|
||||
{//Find hash entry in task->hash_table. Change user_data0.
|
||||
CHashGeneric *temph;
|
||||
CHashGeneric *tmph;
|
||||
if (!task) task=Fs;
|
||||
if (temph=HashFind(name,task->hash_table,HTT_FRAME_PTR))
|
||||
return LXchgI64(&temph->user_data0,val);
|
||||
if (tmph=HashFind(name,task->hash_table,HTT_FRAME_PTR))
|
||||
return LXchgI64(&tmph->user_data0,val);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
I64 FramePtrDel(U8 *name,CTask *task=NULL)
|
||||
{//Remove entry and delete.
|
||||
CHashGeneric *temph;
|
||||
CHashGeneric *tmph;
|
||||
I64 res=0;
|
||||
if (!task) task=Fs;
|
||||
if (temph=HashFind(name,task->hash_table,HTT_FRAME_PTR)) {
|
||||
res=temph->user_data0;
|
||||
HashRemDel(temph,task->hash_table);
|
||||
if (tmph=HashFind(name,task->hash_table,HTT_FRAME_PTR)) {
|
||||
res=tmph->user_data0;
|
||||
HashRemDel(tmph,task->hash_table);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
Reference in new issue
Block a user