X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.db-live.git;a=blobdiff_plain;f=yarrg%2Frscommon.h;h=ab92fa587af412b890db8cafccc0976baa9e4093;hp=0a6f30697fb43d84cd3ab137c02f0fccfe55a751;hb=20bea992a857ea1f03f19d81f7164b113a560e83;hpb=85fced6311966d8533ce8186f4f98ff8b6303619 diff --git a/yarrg/rscommon.h b/yarrg/rscommon.h index 0a6f306..ab92fa5 100644 --- a/yarrg/rscommon.h +++ b/yarrg/rscommon.h @@ -10,13 +10,16 @@ DF(search) \ DF(filter) \ DF(check) \ + DF(tableau) \ DF(lp) -#define debug stdout -#define DEBUG_DEV "/dev/stdout" +#define debug debug_file #include "common.h" +extern FILE *debug_file; +#define DEBUG_DEV "/dev/stdout" /* just for glpk */ + #define COUNTER_LIST \ CTR(commodities_loaded) \ @@ -30,23 +33,24 @@ CTR(routes_stratelim) \ CTR(routes_valued) \ CTR(routes_wrongfinal) \ - CTR(newbests_strat_absolute) \ - CTR(newbests_strat_perleague) \ + CTRA(newbests_strat,2) \ CTR(subroute_tails_valued) \ CTR(subroutes_valued) \ CTR(subroutes_nonempty) -#define CTR(x) extern int ctr_##x; +#define CTR(x) extern int ctr_##x; +#define CTRA(x,n) extern int ctr_##x[n]; COUNTER_LIST #undef CTR +#undef CTRA #define SQL_MUST( call ) ({ \ /* `call' is an expression returning result, using const char *sqe; \ * chk1 and chk2 are blocks using sqe and int sqr; */ \ const char *sql_must_call_string= #call; \ int sqr; \ - if (DEBUGP(sql2)) fprintf(stderr,"SQL %s", sql_must_call_string); \ + if (DEBUGP(sql2)) fprintf(debug,"SQL %s", sql_must_call_string); \ sqr= (call); \ - if (DEBUGP(sql2)) fprintf(stderr," = %d\n", sqr); \ + if (DEBUGP(sql2)) fprintf(debug," = %d\n", sqr); \ if (sqr) sql_fatal("(unknown)", sqr, sql_must_call_string); \ }) \ @@ -108,9 +112,13 @@ IslandPair *ipair_get_maybe(int si, int di); double value_route(int nislands, const int *islands, int exclude_arbitrage); void setup_value(void); +#define AP 2 /* 0=absolute, 1=perleague */ +#define A 0 +#define P 1 + typedef struct { - double absolute, perleague; - int absolute_ports[MAX_ROUTELEN], perleague_ports[MAX_ROUTELEN]; + double value[AP]; + int ports[AP][MAX_ROUTELEN]; } PotentialResult; void setup_search(void); @@ -131,6 +139,9 @@ extern char **archnames; extern int *islandid2arch; +extern FILE *output; + + #define NEW(ptr) ((ptr)= mmalloc(sizeof(*ptr))) #define MCALLOC(array, count) ((array)= mcalloc(sizeof(*(array)) * (count))) @@ -150,9 +161,8 @@ typedef struct { PotentialResult *pr; } HighScoreEntry; -extern int nhighscores_absolute, nhighscores_perleague; -extern HighScoreEntry *highscores_absolute; -extern HighScoreEntry *highscores_perleague; +extern int nhighscores[AP]; +extern HighScoreEntry *highscores[AP]; #define ONDEMAND(pointer_lvalue, calloc_size_count) \