/*
 ViewALS300data
 Copyright (C) 2010 Martin Štrympl
 
 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public
 License as published by the Free Software Foundation; either
 version 3.0 of the License, or (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 General Public License for more details.
 
 You should have received a copy of the GNU General Public
 License along with this program.
 
 Martin Štrympl
 xstrym00@stud.feec.vutbr.cz
 */

#include "Headers.h"

#include "data.h"

int main (int argc, const char * argv[])
{
  char *t_file;
  
  if (argc<2)
  {
    printf("Usage:\nViewALS300data file [from] [to]\n");
    return 0;
  }
  
  t_file=LoadData(argv[1]);
  
  if (t_file)
  {
    struct sArray_TextArray *ps_array;
    
    ps_array=DataToArray(t_file);
    free(t_file);
    
    if (ps_array)
    {
      uint32_t u4_from, u4_to;
      
      u4_from=0;
      u4_to=0xFFFFFFFF;
      
      if (argc>=3) u4_from = atoi(argv[2]);
      if (argc>=4) u4_to = atoi(argv[3]);
      else u4_to=u4_from-1;
      
      ViewData(ps_array, u4_from, u4_to);
      
      Array_TextArray_Destruct(ps_array);
      
      printf("Complete file reading.\n");
    }
    else printf("Create array failed.\n");
  }
  else printf("Opening file failed.\n");
    
  return 0;
}
