source: tags/ms_r16q4/TREEGEN/sim.c

Last change on this file was 9899, checked in by epruesse, 12 years ago

pass down argc/argv to AW_root::AW_root (for GTK)
GTK will pick its parameters (e.g. —g-fatal-warnings) from argv and
remove them, hence argv must not be const and AW_root() should
be called before command line parsing (if possible).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1021 bytes
Line 
1#include "rns.h"
2#include <time.h>
3#include <stdlib.h>
4
5int ARB_main(int argc, char *argv[]) {
6    RNS origin;
7
8    if (argc!=4) error("Usage: arb_treegen <cfg> <tree> <seq>\n"
9                       "An evolution simulator - (C) 1995 by Ralf Westram\n"
10                       "\n"
11                       "Environment specification is read from <cfg> (will be generated if missing)\n"
12                       "\n"
13                       "<tree> file were the simulated phylogeny is saved to (as tree)\n"
14                       "<seq>  file were the simulated species are saved to (as sequences)\n"
15                       );
16
17    srand((unsigned)time(NULL));
18    initBaseLookups();
19
20    readSimCfg(argv[1]);
21    origin = createOriginRNS();
22
23    topo = fopen(argv[2], "w"); if (!topo) { perror(argv[2]); exit(1); }
24    seq = fopen(argv[3], "w"); if (!seq) { perror(argv[3]); exit(1); }
25
26    splitRNS(-1, origin, 0.0, timeSteps, 0);
27    dumpDepths();
28
29    fclose(seq);
30    fclose(topo);
31
32    free(origin);
33    return 0;
34}
35
36
37
Note: See TracBrowser for help on using the repository browser.