167 lines
4.0 KiB
C
167 lines
4.0 KiB
C
#include "pair.h" /* pair */
|
|
#include "journal.h" /* size_t, date32, line64 */
|
|
|
|
/* Date-line to index in array map. */
|
|
#define TREE_NAME linemap
|
|
#define TREE_KEY union line64
|
|
#define TREE_VALUE size_t
|
|
#define TREE_HEAD
|
|
#include "../src/tree.h"
|
|
#define TREE_NAME linepair
|
|
#define TREE_KEY union line64
|
|
#define TREE_VALUE struct pair
|
|
#define TREE_HEAD
|
|
#include "../src/tree.h"
|
|
|
|
/* Eg, source array. */
|
|
struct kvpair { struct pair key, value; };
|
|
#define ARRAY_NAME kvpair
|
|
#define ARRAY_TYPE struct kvpair
|
|
#define ARRAY_HEAD
|
|
#include "../src/array.h"
|
|
#define TREE_NAME linekvpair
|
|
#define TREE_KEY union line64
|
|
#define TREE_VALUE struct kvpair
|
|
#define TREE_HEAD
|
|
#include "../src/tree.h"
|
|
struct kvdate { union date32 key; struct pair value; };
|
|
#define TREE_NAME linekvdate
|
|
#define TREE_KEY union line64
|
|
#define TREE_VALUE struct kvdate
|
|
#define TREE_HEAD
|
|
#include "../src/tree.h"
|
|
enum currency {
|
|
NONE,
|
|
CAD, /* Canadian $. */
|
|
USD, /* US Dollar $usd. */
|
|
EUR, /* Euro €. */
|
|
GBP, /* Pound £. */
|
|
MXN, /* Mexican pesos $mxn. */
|
|
CUP, /* Cuban pesos, (US) $cup. */
|
|
CUC, /* Cuban convertible $cuc. */
|
|
};
|
|
#include <stdint.h>
|
|
struct money { int64_t cents; enum currency currency; };
|
|
struct kvmoney { struct pair key; struct money value; };
|
|
#define TREE_NAME linekvmoney
|
|
#define TREE_KEY union line64
|
|
#define TREE_VALUE struct kvmoney
|
|
#define TREE_HEAD
|
|
#include "../src/tree.h"
|
|
|
|
/* Place array. */
|
|
struct place { struct pair name; double x, y; };
|
|
#define ARRAY_NAME place
|
|
#define ARRAY_TYPE struct place
|
|
#define ARRAY_HEAD
|
|
#include "../src/array.h"
|
|
|
|
/* Score array. */
|
|
struct score {
|
|
struct pair key, name;
|
|
union date32 date, last/* update; need to compare leading value */;
|
|
unsigned edges, score/* update */;
|
|
};
|
|
#define ARRAY_NAME score
|
|
#define ARRAY_TYPE struct score
|
|
#define ARRAY_HEAD
|
|
#include "../src/array.h"
|
|
|
|
/* Edit array. */
|
|
struct edit {
|
|
union date32 edit;
|
|
struct pair desc;
|
|
};
|
|
#define ARRAY_NAME edit
|
|
#define ARRAY_TYPE struct edit
|
|
#define ARRAY_HEAD
|
|
#include "../src/array.h"
|
|
|
|
|
|
/* Glider array. */
|
|
#define LAUNCH_TYPE \
|
|
X(MotorCarTow),\
|
|
X(Winch),\
|
|
X(AeroTow)
|
|
#define X(type) type
|
|
enum launch_type { LAUNCH_TYPE };
|
|
#undef X
|
|
#define X(type) #type
|
|
static const char *launch_type_string[] = { LAUNCH_TYPE };
|
|
#undef X
|
|
#undef LAUNCH_TYPE
|
|
struct glider {
|
|
struct pair type, reg, launch, landing;
|
|
enum launch_type how;
|
|
unsigned height_ft, pilot_min, dual_min, instr_min;
|
|
struct pair remarks;
|
|
};
|
|
#define TREE_NAME glider
|
|
#define TREE_KEY union line64
|
|
#define TREE_VALUE struct glider
|
|
#define TREE_HEAD
|
|
#include "../src/tree.h"
|
|
|
|
|
|
/* Flight array. */
|
|
struct flight {
|
|
struct pair type, reg, launch, landing, pilot, copilot;
|
|
unsigned dual_min, pilot_min, ifrsim_min, ifr_min;
|
|
struct pair remarks;
|
|
};
|
|
#define TREE_NAME flight
|
|
#define TREE_KEY union line64
|
|
#define TREE_VALUE struct flight
|
|
#define TREE_HEAD
|
|
#include "../src/tree.h"
|
|
|
|
|
|
#include "kjv.h"
|
|
#define TREE_NAME kjv
|
|
#define TREE_KEY union line64
|
|
#define TREE_VALUE struct kjvrange
|
|
#define TREE_HEAD
|
|
#include "../src/tree.h"
|
|
|
|
|
|
struct scan {
|
|
struct {
|
|
struct kvpair_array array;
|
|
struct pairmap_table map;
|
|
struct linemap_tree dates;
|
|
} sources, documents;
|
|
struct {
|
|
struct place_array array;
|
|
struct pairmap_table map;
|
|
struct linemap_tree dates;
|
|
} places;
|
|
struct {
|
|
struct score_array array;
|
|
struct pairmap_table map;
|
|
struct linemap_tree dates;
|
|
} scores;
|
|
struct {
|
|
struct edit_array array;
|
|
struct pairmap_table map;
|
|
struct linemap_tree dates;
|
|
} edits;
|
|
struct linepair_tree dreams;
|
|
struct linekvpair_tree contacts, books, tvs, movies, ideas,
|
|
vaccines, medications, labs, mails, couches;
|
|
struct linekvdate_tree froms;
|
|
struct linekvmoney_tree taxes, incomes;
|
|
struct glider_tree gliders;
|
|
struct flight_tree flights;
|
|
struct kjv_tree kjvs;
|
|
};
|
|
|
|
void scan_(struct scan *);
|
|
struct scan scan(struct journal *);
|
|
const struct kvpair *scan_source_lookup(struct scan *, const union line64);
|
|
void scan_score_graph(struct scan *);
|
|
void scan_labs_graph(struct scan *);
|
|
void scan_glider_graph(struct scan *);
|
|
void scan_flight_graph(struct scan *);
|
|
void scan_kjv_graph(struct scan *);
|
|
void scan_dream_graph(struct scan *);
|