#include <stdio.h>
#include "datamat.h"
#include "block.h"
#include "logical.h"
#include "valcnt.h" /*debug*/

static char *test07id = "$Id: test08.c,v 1.1 1996/12/29 23:42:23 galway Exp galway $";

/* ******************************************************************** */
/*  

    Copyright (C) 2004  Lionel A. Galway

    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 2 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.

    For a copy of the GNU General Public License write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

*/
/* ******************************************************************** */


extern struct datamat *read_datamat();
extern void print_block();
extern struct block **get_blk_ary();
extern struct block *origblock();
extern struct block *compblk();

extern struct valcnt *col_freq(); /*debug*/

main(argc,argv)
int argc; char *argv[];
{
  struct datamat *mydata; FILE *fp;int i,j;
  struct block **blks;int BSIZE=10;

  int k;struct valcnt *tmpv; /*debug*/

  if (argc != 2) {printf("Usage: test0x datafile\n");exit(-1);};
  fp = fopen(argv[1],"r");
  if (fp==NULL) {printf("Can't open file %s\n",argv[1]);exit(-1);};
  mydata = read_datamat(fp);

  print_datamat(mydata);
  blks=get_blk_ary(BSIZE);
  blks[0]=origblock(mydata);
  print_block(blks[0],NULL);print_blkind(mydata);
  i=1;
  while (i<BSIZE && blks[i-1]->blkcnt >3) {
    blks[i]=compblk(mydata,i);
    i++;
    print_blkind(mydata,TRUE); /*debug*/
  };
  for (j=0; j<i;j++) print_block(blks[j],mydata);
  print_blkind(mydata,TRUE);
  exit(0);
}
