/* Author: Ram Samudrala (me@ram.org)
 * Version: O1.0
 * Detail: <http://www.ram.org/computing/sc/sc.html>
 * November 22, 1995; Copyright (c) 1995 by Ram Samudrala.
 *
 * See the URL above for terms of use and general help.
 */

#ifndef __ITEMS__
#define __ITEMS__

/******************************************************************/
/* Structures */

typedef struct
{
  char name[ITEM_DESCRIPTION_STRING_LENGTH];
  char description[ITEM_DESCRIPTION_STRING_LENGTH];
  int ql;  /* lower value in the quantity range */
  int qh;  /* higher value in the quantity range */
  double price_per_unit;
  double shipping_per_unit;
} item;

/******************************************************************/
/* Some macros */

#define item_name(i) ((i)->name)
#define item_description(i) ((i)->description)
#define item_ql(i) ((i)->ql)
#define item_qh(i) ((i)->qh)
#define item_price(i) ((i)->price_per_unit)
#define item_shipping_price(i) ((i)->shipping_per_unit)
#define total_items(i) ((i[0])->ql)

/******************************************************************/
/* Function declarations */

extern void read_items(char filename[], item items[]);
extern int get_item_desc_price(char name[], int quantity, double *price, double *shipping_price,
			       char description[], item items[]);

/******************************************************************/

#endif /* __ITEMS__ */
