void NameValueTable::detach(ActRec* fp) { assert(m_fp == fp); m_fp = nullptr; const auto func = fp->m_func; const Id numNames = func->numNamedLocals(); TypedValue* loc = frame_local(fp, 0); for (Id i = 0; i < numNames; ++i, --loc) { assert(func->lookupVarId(func->localVarName(i)) == i); auto elm = findElm(func->localVarName(i)); assert(elm && elm->m_tv.m_type == KindOfNamedLocal); tvCopy(*loc, elm->m_tv); tvDebugTrash(loc); } }
void insertData(List &L) { address P; infotype x; cout<<"Masukkan ID yang ingin anda masukkan untuk di cek : "; cin>>x.id; cout<<"Masukkan nama yang ingin anda masukkan untuk di cek : "; cin>>x.nama; cout<<endl; P = findElm(L,x); if (P == NULL) { cout<<"Data belum ada "<<endl; inputData(x); P=alokasi(x); insertFirst(L,P); } else { cout<<"Data sudah ada"<<endl; } }
TypedValue* NameValueTable::lookup(const StringData* name) { Elm* elm = findElm(name); if (!elm) return nullptr; TypedValue* tv = derefNamedLocal(&elm->m_tv); return tv->m_type == KindOfUninit ? nullptr : tv; }
void NameValueTable::unset(const StringData* name) { Elm* elm = findElm(name); if (!elm) return; tvUnset(derefNamedLocal(&elm->m_tv)); }