/* Nucleotide Sequence Generator - seq-gen, version 1.2.5 */ /* (c) Copyright 1996-2001, Andrew Rambaut & Nick Grassly */ /* Department of Zoology, University of Oxford */ #include #include #include #include #include "global.h" int verbose=0, verboseMemory=0, quiet=0, userSeed; long totalMem=0; int randomSeed; /* functions */ /*************************************/ void *AllocMem(long n, char *name, char *func, int showInfo) { void *P; if ( (P=malloc(n))==NULL ) { fprintf(stderr, "Out of memory allocating '%s': %s()\n", name, func); exit(0); } totalMem+=n; if (showInfo && verboseMemory) fprintf(stderr, "%s in %s() - %ld bytes\n", name, func, n); return P; } /*************************************/ void *CAllocMem(long n, char *name, char *func, int showInfo) { void *P; if ( (P=calloc(n, 1))==NULL ) { fprintf(stderr, "Out of memory allocating '%s': %s()\n", name, func); exit(0); } totalMem+=n; if (showInfo && verboseMemory) fprintf(stderr, "%s in %s() - %ld bytes\n", name, func, n); return P; } /*************************************/ int GetDoubleParams(int argc, char **argv, int *argn, char *pos, int numParams, double *params) { int i; char *st, buf[256]; i=0; strcpy(buf, pos); st=strtok(buf, "\t,/"); do { if (st==NULL) { if ((*argn)+1