void HSH_init() { /************************************** * * H S H _ i n i t * ************************************** * * Functional description * Initialize the hash table. This mostly involves * inserting all known keywords. * **************************************/ SYM symbol; int i; SSHORT length; for (i = 0; i < FB_NELEM(keywords); i++) { const char* string = keywords[i].keyword; for (length = 0; string[length] != '\0'; length++); symbol = (SYM) DDL_alloc(SYM_LEN); symbol->sym_type = SYM_keyword; symbol->sym_length = length; symbol->sym_string = keywords[i].keyword; symbol->sym_keyword = (int) keywords[i].id; HSH_insert(symbol); symbol->sym_object = (DUDLEY_CTX) key_symbols; key_symbols = symbol; } }
void HSH_init() { /************************************** * * H S H _ i n i t * ************************************** * * Functional description * Initialize the hash table. This mostly involves * inserting all known keywords. * **************************************/ const qli_kword* qword = keywords; for (int i = 0; i < FB_NELEM(keywords); i++, qword++) { qli_symbol* symbol = (qli_symbol*) ALLOCPV(type_sym, 0); symbol->sym_type = SYM_keyword; symbol->sym_length = strlen(qword->keyword); symbol->sym_string = qword->keyword; symbol->sym_keyword = qword->id; HSH_insert(symbol, true); symbol->sym_object = (BLK) key_symbols; key_symbols = symbol; } }
void JRDMET_init( gpre_dbb* db) { const int* relfld = relfields; while (relfld[RFLD_R_NAME]) { gpre_rel* relation = (gpre_rel*) MSC_alloc(REL_LEN); relation->rel_database = db; relation->rel_next = db->dbb_relations; relation->rel_id = relfld[RFLD_R_ID]; db->dbb_relations = relation; gpre_sym* symbol = (gpre_sym*) MSC_alloc(SYM_LEN); relation->rel_symbol = symbol; symbol->sym_type = SYM_relation; symbol->sym_object = (gpre_ctx*) relation; symbol->sym_string = names[relfld[RFLD_R_NAME]]; HSH_insert(symbol); const int* fld = relfld + RFLD_RPT; for (int n = 0; fld[RFLD_F_NAME]; ++n, fld += RFLD_F_LENGTH) { const gfld* gfield = &gfields[fld[RFLD_F_ID]]; gpre_fld* field = (gpre_fld*) MSC_alloc(FLD_LEN); relation->rel_fields = field; field->fld_relation = relation; field->fld_next = relation->rel_fields; field->fld_id = n; field->fld_length = gfield->gfld_length; field->fld_dtype = gfield->gfld_dtype; field->fld_sub_type = gfield->gfld_sub_type; if (field->fld_dtype == dtype_varying || field->fld_dtype == dtype_text) { field->fld_dtype = dtype_cstring; field->fld_flags |= FLD_text; if (gfield->gfld_sub_type == dsc_text_type_metadata) { if (gpreGlob.sw_language == lang_internal) field->fld_flags |= FLD_charset; else field->fld_length *= 4; field->fld_charset_id = CS_METADATA; field->fld_collate_id = COLLATE_NONE; field->fld_ttype = ttype_metadata; } else { if (gpreGlob.sw_language == lang_internal) field->fld_flags |= FLD_charset; field->fld_charset_id = CS_NONE; field->fld_collate_id = COLLATE_NONE; field->fld_ttype = ttype_none; } ++field->fld_length; } else if (field->fld_dtype == dtype_blob) { field->fld_dtype = dtype_blob; field->fld_flags |= FLD_blob; if (gfield->gfld_sub_type == isc_blob_text) field->fld_charset_id = CS_METADATA; } field->fld_symbol = symbol = (gpre_sym*) MSC_alloc(SYM_LEN); symbol->sym_type = SYM_field; symbol->sym_object = (gpre_ctx*) field; symbol->sym_string = names[fld[RFLD_F_NAME]]; HSH_insert(symbol); field->fld_global = symbol = (gpre_sym*) MSC_alloc(SYM_LEN); symbol->sym_type = SYM_field; symbol->sym_object = (gpre_ctx*) field; symbol->sym_string = names[gfield->gfld_name]; } relfld = fld + 1; } for (const rtyp* rtype = types; rtype->rtyp_name; rtype++) { field_type* type = (field_type*) MSC_alloc(TYP_LEN); gpre_sym* symbol = (gpre_sym*) MSC_alloc(SYM_LEN); type->typ_symbol = symbol; type->typ_value = rtype->rtyp_value; symbol->sym_type = SYM_type; symbol->sym_object = (gpre_ctx*) type; symbol->sym_string = rtype->rtyp_name; HSH_insert(symbol); } }