/* Title: arrl.h
 * Author: Jed Marti KI7NNP
 * Description: Prototypes and data structures for the ARRL equation coefficients.
 * Revision History: (Created Mon Jan 22 20:32:04 2024)
 */


#ifndef arrl_h
#define arrl_h

// Release 1 does RMS error.
#define VERSION 2
#define RELEASE 1
#define PATCH   2

// Measured inductances and their mean or median values. See ../perm/*.csv for details.
typedef struct {
  void    *next;                 // For lists.
  double  L;                     // Measured inductance (mean) u Henries.
  double  D;                     // Diameter in inches.,
  double  W;                     // Wire Radius in meters.
  int32_t G;                     // Wire gauge.
  double  LEN;                   // Length in inches.
  int32_t N;                     // Number of turns.
  char    *FN;                   // File name.
  double  goodness;              // For sorting at end.
  double  computed;              // The computed inductance.
} anInductor;


// See readind.c - Reads test inductor CSV file.
void readTestInductors(char *fname);

// Read the variable ranges from a file and look them up in the symnbol table.
void readVariables(char *fn);
double lookup(char *var);

// These are the ranges.
typedef struct {
  char   *name;                   // Symbol name, case insensitive.
  double value;                   // A value.
} symtab;

// The process table.
typedef struct {
  char     *ifname;               // When present, means a  result to test.
  char     *rmifname;             // How to remove the file.
  char     *fname;                // The result file goes here.
  char     *rmfname;              // How to remove the result file.
  uint8_t  status;                // idle or busy.
} procDetail;

// Process control.
enum {
      idle,
      busy
};

// See process.c
void initProcs(void);
void terminateProcs(void);
void runNum(double num);
double originalARRL(void);

#endif


// EOF
