TempleOSCD_140715.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:46:09 +02:00
1 parent 7ef616a20e
commit 64f679eeb9
1095 files changed
+24814 -221011

No files matched your search

+19 -87
View File
@@ -1,72 +1,6 @@
CHashSrcSym *HashEntryImportCopy(CHashSrcSym *temph)
{ //Actually this imports, not copies!!
CHashSrcSym *result=MAllocIdentical(temph);
result->str=MAllocIdentical(temph->str);
result->use_cnt=0;
result->src_link=NULL;
result->index=NULL;
result->ie_lst=NULL;
result->debug=NULL;
if (temph->type & (HTT_FUN | HTT_CLASS)) {
result(CHashClass *)->member_lst =MemberLstCopy(temph);
result(CHashClass *)->member_lst2=temph(CHashClass *)->member_lst2;
if (temph->type & HTT_FUN) {
if (Bt(&temph(CHashFun *)->flags,Ff_INTERNAL)) {
result->import_name=NULL;
LBtr(&result(CHashFun *)->flags,Cf_EXTERN);
} else {
result->import_name=MAllocIdentical(temph->import_name);
result->type|=HTF_IMPORT;
LBts(&result(CHashFun *)->flags,Cf_EXTERN);
}
}
} else if (temph->type & (HTT_EXPORT_SYS_SYM | HTT_GLBL_VAR)) {
result->import_name=MAllocIdentical(temph->import_name);
result->type|=HTF_IMPORT;
if (temph->type&HTT_EXPORT_SYS_SYM) {
result->type|=HTF_UNRESOLVED;
result(CHashExport *)->val=0;
} else {
result(CHashGlblVar *)->dim.next=LinkedLstCopy(temph(CHashGlblVar *)->dim.next);
result(CHashGlblVar *)->flags|=GVF_IMPORT|GVF_ALIAS;
if (temph(CHashGlblVar *)->fun_ptr)
result(CHashGlblVar *)->fun_ptr=HashEntryImportCopy(temph(CHashGlblVar *)->fun_ptr-temph(CHashGlblVar *)->fun_ptr->ptr_cnt)(CHashFun *)+temph(CHashGlblVar *)->fun_ptr->ptr_cnt;
}
} else if (temph->type&HTT_DEFINE_STR)
result(CHashDefineStr *)->data=MAllocIdentical(temph(CHashDefineStr *)->data);
return result;
}
U0 HashTableImport(CHashTable *src,CHashTable *dst)
{
I64 i;
CHashSrcSym *temph,*temph1,*temph2;
if (!src) return;
for (i=0;i<=src->mask;i++) {
temph=src->body[i];
while (temph) {
if (temph->type & HTG_SRC_SYM) {
//Only add first in lst
temph2=src->body[i];
while (temph2!=temph)
if (!StrCmp(temph->str,temph2->str) &&
temph2->type & temph->type & HTG_SRC_SYM ||
temph->type & HTT_EXPORT_SYS_SYM)
break;
else
temph2=temph2->next;
if (temph2==temph && (temph1=HashEntryImportCopy(temph)))
HashAdd(temph1,dst);
}
temph=temph->next;
}
}
}
I64 HashEntrySize(CHashSrcSym *temph)
{
CDbgInfo *dbg;
{//Logical size of a std system hash entry.
CDbgInfo *dbg_info;
CBinFile *bfh;
switch (HashTypeNum(temph)) {
case HTt_DEFINE_STR:
@@ -76,8 +10,8 @@ I64 HashEntrySize(CHashSrcSym *temph)
case HTt_INTERNAL_TYPE:
return temph(CHashClass *)->size;
case HTt_FUN:
if (dbg=temph->debug)
return dbg->body[dbg->max_line+1-dbg->min_line]-dbg->body[0];
if (dbg_info=temph->dbg_info)
return dbg_info->body[dbg_info->max_line+1-dbg_info->min_line]-dbg_info->body[0];
else
return -1;
case HTt_FILE:
@@ -96,8 +30,8 @@ I64 HashEntrySize(CHashSrcSym *temph)
}
I64 HashEntrySize2(CHashSrcSym *temph)
{
CDbgInfo *dbg;
{//Memory size of a std system hash entry.
CDbgInfo *dbg_info;
I64 result=MSize2(temph);
if (!(temph->type&HTT_DICT_WORD))
result+=MSize2(temph->str);
@@ -107,14 +41,14 @@ I64 HashEntrySize2(CHashSrcSym *temph)
result+=MSize2(temph->import_name);
result+=LinkedLstSize(temph->ie_lst);
if (temph->type & (HTT_FUN | HTT_EXPORT_SYS_SYM))
result+=MSize2(temph->debug);
result+=MSize2(temph->dbg_info);
if (temph->type & HTT_CLASS)
result+=MemberLstSize(temph);
else if (temph->type & HTT_FUN) {
result+=MemberLstSize(temph);
if (dbg=temph->debug)
if (dbg_info=temph->dbg_info)
//This should be $LK,"MSize",A="MN:MSize"$() but it would crash on AOT .BIN.Z file funs.
result+=dbg->body[dbg->max_line+1-dbg->min_line]-dbg->body[0];
result+=dbg_info->body[dbg_info->max_line+1-dbg_info->min_line]-dbg_info->body[0];
} else if (temph->type&HTT_DEFINE_STR)
result+=MSize2(temph(CHashDefineStr *)->data);
else if (temph->type & HTT_GLBL_VAR) {
@@ -132,20 +66,18 @@ I64 HashEntrySize2(CHashSrcSym *temph)
return result;
}
I64 HashTableSize2(CHashTable *tempht)
{
I64 i,result=0;
I64 HashTableSize2(CHashTable *table)
{//Memory size of std system hash table and all entries.
I64 result=0;
CHashSrcSym *temph;
if (!tempht)
if (!table)
return 0;
for (i=0;i<=tempht->mask;i++) {
temph=tempht->body[i];
while (temph) {
result+=HashEntrySize2(temph);
temph=temph->next;
}
temph=table->next_added;
while (temph!=table) {
result+=HashEntrySize2(temph);
temph=temph->next_added;
}
result+=MSize2(tempht->body);
result+=MSize2(tempht);
result+=MSize2(table->body);
result+=MSize2(table);
return result;
}