DFsSection *DFsScript::NewSection(const char *brace) { int n = section_hash(brace); DFsSection *newsec = new DFsSection; newsec->start_index = MakeIndex(brace); newsec->next = sections[n]; sections[n] = newsec; GC::WriteBarrier(this, newsec); return newsec; }
DFsSection *DFsScript::FindSectionStart(const char *brace) { int n = section_hash(brace); DFsSection *current = sections[n]; // use the hash table: check the appropriate hash chain while(current) { if(SectionStart(current) == brace) return current; current = current->next; } return NULL; // not found }
// find a section_t from the location of the starting { brace section_t *find_section_start(char *brace) { int n = section_hash(brace); section_t *current; current = current_script->sections[n]; // use the hash table: check the appropriate hash chain while(current) { if(current->start == brace) return current; current = current->next; } return NULL; // not found }
section_t *new_section(char *brace) { int n; section_t *newsec; // create section // make level so its cleared at start of new level newsec = Z_Malloc(sizeof(section_t), PU_LEVEL, 0); newsec->start = brace; // hook it into the hashchain n = section_hash(brace); newsec->next = current_script->sections[n]; current_script->sections[n] = newsec; return newsec; }