Logo Search packages:      
Sourcecode: ygraph version File versions  Download package

gint dataset_read_subtract_files ( gchar *  file0,
gchar *  file1 

Read a pair of files and subtract individual data values.

Each of the files is read in turn and added to the global_data_set_list. A new DataSet is created corresponding to the subtraction of individual frames of file0-file1. A new data set name is created based on the names of the given data sets (basically "label0 - label1"), and given to the new DataSet. The new DataSet is given the type YG_SUBTRACT, and the cmpt_set contains index references to the two DataSets which were used to generate the new DataSet.

file0 The name of the first file.
file1 The name of the file which is to be subtracted from the first.
The index of the new DataSet within the global_data_set_list if the operation was successful. Otherwise FAIL.

Definition at line 121 of file special_fn.c.

References _DataSet::cmpt_set, data_set_init(), dataset_read_from_file(), global_data_set_list, _DataSet::name, option_read_skip_step, and _DataSet::type.

Referenced by cmd_line_process(), and file_subtract().

  DataSet* data_set_0;
  DataSet* data_set_1;
  DataSet* subtract_data_set;
  gint data_set_idx_0;
  gint data_set_idx_1;
  gint subtract_data_set_idx;
  gint name_len;

  data_set_idx_0 = dataset_read_from_file(file0, option_read_skip_step);
  data_set_idx_1 = dataset_read_from_file(file1, option_read_skip_step);

  if ((data_set_idx_0 == FAIL) || (data_set_idx_1 == FAIL))
    return FAIL;
  data_set_0 = g_array_index(global_data_set_list, DataSet*, data_set_idx_0);
  data_set_1 = g_array_index(global_data_set_list, DataSet*, data_set_idx_1);

  subtract_data_set = data_set_init(NULL);
  subtract_data_set->type = YG_SUBTRACT;
  /* 6 = "( - )" */
  name_len = strlen(data_set_0->name) + strlen(data_set_1->name) + 6;
  subtract_data_set->name = g_malloc(name_len*sizeof(gchar));

  g_snprintf(subtract_data_set->name, name_len, "(%s - %s)", data_set_0->name,

  g_array_append_val(subtract_data_set->cmpt_set, data_set_idx_0);
  g_array_append_val(subtract_data_set->cmpt_set, data_set_idx_1);


  subtract_data_set_idx = global_data_set_list_append(subtract_data_set);

  return subtract_data_set_idx;

Generated by  Doxygen 1.6.0   Back to index