Esempio n. 1
0
decode_table *
load_decode_table(char *file_name,
		  int hi_bit_nr)
{
  table *file = table_open(file_name, nr_decode_fields, 0);
  table_entry *entry;
  decode_table *table = NULL;
  decode_table **curr_rule = &table;
  while ((entry = table_entry_read(file)) != NULL) {
    decode_table *new_rule = ZALLOC(decode_table);
    new_rule->type = name2i(entry->fields[op_options], decode_type_map);
    new_rule->gen = (overriding_gen_type != invalid_gen
		     ? overriding_gen_type
		     : name2i(entry->fields[op_options], decode_gen_map));
    new_rule->force_slash = name2i(entry->fields[op_options], decode_slash_map);
    new_rule->first = target_a2i(hi_bit_nr, entry->fields[op_first]);
    new_rule->last = target_a2i(hi_bit_nr, entry->fields[op_last]);
    new_rule->force_first = (strlen(entry->fields[op_force_first])
			     ? target_a2i(hi_bit_nr, entry->fields[op_force_first])
			     : new_rule->last + 1);
    new_rule->force_last = (strlen(entry->fields[op_force_last])
			    ? target_a2i(hi_bit_nr, entry->fields[op_force_last])
			    : new_rule->first - 1);
    new_rule->force_expansion = entry->fields[op_force_expansion];
    new_rule->special_mask = a2i(entry->fields[op_special_mask]);
    new_rule->special_value = a2i(entry->fields[op_special_value]);
    new_rule->special_constant = a2i(entry->fields[op_special_constant]);
    *curr_rule = new_rule;
    curr_rule = &new_rule->next;
  }
  return table;
}
Esempio n. 2
0
cache_entry *
load_cache_table (char *file_name)
{
  cache_entry *cache = NULL;
  cache_entry **last = &cache;
  table *file = table_open (file_name);
  table_entry *entry;
  while ((entry = table_read (file)) != NULL)
    {
      cache_entry *new_rule = ZALLOC (cache_entry);
      new_rule->line = entry->line;
      new_rule->entry_type = name2i (entry->field[ca_type], cache_type_map);
      new_rule->name = entry->field[ca_derived_name];
      filter_parse (&new_rule->original_fields, entry->field[ca_field_name]);
      new_rule->type = entry->field[ca_type_def];
      /* expression is the concatenation of the remaining fields */
      if (entry->nr_fields > ca_expression)
	{
	  int len = 0;
	  int chi;
	  for (chi = ca_expression; chi < entry->nr_fields; chi++)
	    {
	      len += strlen (" : ") + strlen (entry->field[chi]);
	    }
	  new_rule->expression = NZALLOC (char, len);
	  strcpy (new_rule->expression, entry->field[ca_expression]);
	  for (chi = ca_expression + 1; chi < entry->nr_fields; chi++)
	    {
	      strcat (new_rule->expression, " : ");
	      strcat (new_rule->expression, entry->field[chi]);
	    }
	}
      /* insert it */
      *last = new_rule;
      last = &new_rule->next;
    }
Esempio n. 3
0
void
force_decode_gen_type(const char *type)
{
  overriding_gen_type = name2i(type, decode_gen_map);
}