/*  @(#) $Header: /usr/local/scalawags_cvs/Scalawags/Frc2006/sim/ifibyte_t.c,v 1.1 2006/01/28 23:21:32 abrown Exp $
 *
 * Test Philosophy:
 *    Try a wide selection of numbers to convert.  Include errors.
 * Author:
 *	Allen Brown  http://brown.armoredpenguin.com/~abrown/contact.html
 */

#include <stdio.h>
#define MAIN
#include "../ifi_aliases.h"
#include "../ifi_default.h"
#include "../ifibyte.h"
#include "../user_routines.h"
tx_data_record txdata;
rx_data_record rxdata;

int main (void)
{
  int in1, in2, scanfreturn, lineno;
  char inpline[80], *returnval;

  returnval = inpline;
  lineno = 0;
  while( NULL !=		// Check if this is the end of the file.
	 (fgets(inpline, sizeof(inpline), stdin))) // Read a line of text
  {
    int result1;
    unsigned char result2;

    lineno++;
    scanfreturn = sscanf(inpline, "%d%d", &in1, &in2); // Parse the input line.
    if( scanfreturn != 2)
    { // Number of scanned vars must match what we expect.
      printf("ifibyte2int_t: wrong # values line %d: '%s'\n", lineno, inpline);
    } else {
      result1 = ifibyte2int((unsigned char)in1,in2);
      fflush(stdout);
      printf("ifibyte2int(%d,%d) -> %d\n", in1, in2, result1);
      fflush(stdout);
      result2 = int2ifibyte(in1,in2);      
      fflush(stdout);
      printf("int2ifibyte(%d,%d) -> %d\n", in1, in2, result2);
      fflush(stdout);
    } // else
  } // while
  return 0;
} // main
/*
 * $Log: ifibyte_t.c,v $
 * Revision 1.1  2006/01/28 23:21:32  abrown
 * Create ifibyte to replace byte2int.
 *
 */


syntax highlighted by Code2HTML, v. 0.9.1