Пример #1
0
const char *name_identifier(int i) {
	static const char *cp_val = "data()", *cp_area = "area";
	switch (i) {
		case ID_OF_VALDATA:
			return cp_val;
		case ID_OF_AREA:
			return cp_area;
		default:
			if (i >= get_n_vars() || i < 0) {
				pr_warning("i = %d", i);
				ErrMsg(ER_RANGE, "name_identifier(i): i outside range");
			}
			return ids[i];
	}
}
Пример #2
0
static rc_t delete_tmp_files( const sorter_params * params, uint32_t count )
{
    rc_t rc = 0;
    char buffer[ 4096 ];
    uint32_t i;
    for ( i = 0; rc == 0 && i < count; ++ i )
    {
        make_pool_src_filename( params, i + 1, buffer, sizeof buffer );
        if ( rc == 0 )
            rc = KDirectoryRemove( params->dir, true, "%s", buffer );
        if ( rc != 0 )
            ErrMsg( "KDirectoryRemove( 'tmp_%d.dat' ) -> %R", rc );
    }
    return rc;
}
Пример #3
0
/* we have an output-dir and NO output-file */
static rc_t make_output_filename_from_dir_and_accession( tool_ctx_t * tool_ctx )
{
    size_t num_writ;
    bool es = ends_in_slash( tool_ctx -> output_dirname ); /* helper.c */
    rc_t rc = string_printf( tool_ctx -> dflt_output, sizeof tool_ctx -> dflt_output,
                        &num_writ,
                        es ? "%s%s.fastq" : "%s/%s.fastq",
                        tool_ctx -> output_dirname,
                        tool_ctx -> accession_short );
    if ( rc != 0 )
        ErrMsg( "string_printf( output-filename ) -> %R", rc );
    else
        tool_ctx -> output_filename = tool_ctx -> dflt_output;
    return rc;
}
Пример #4
0
void *ecalloc(size_t nobj, size_t size) {
	void *p = NULL;

	if (size == 0) {
		pr_warning("ecalloc(): size 0 requested");
		return NULL;
	}
	p = (void *) calloc(nobj, size);
	if (p == NULL) {
		if (DEBUG_DUMP)
			message("calloc(%u,%u) returned NULL", nobj, size);
		ErrMsg(ER_MEMORY, "");
	}
	return p;
}
Пример #5
0
/* we have NO output-dir and NO output-file */
static rc_t make_output_filename_from_accession( tool_ctx_t * tool_ctx )
{
    /* we DO NOT have a output-directory : build output-filename from the accession */
    /* generate the full path of the output-file, if not given */
    size_t num_writ;        
    rc_t rc = string_printf( &tool_ctx -> dflt_output[ 0 ], sizeof tool_ctx -> dflt_output,
                        &num_writ,
                        "%s.fastq",
                        tool_ctx -> accession_short );
    if ( rc != 0 )
        ErrMsg( "string_printf( output-filename ) -> %R", rc );
    else
        tool_ctx -> output_filename = tool_ctx -> dflt_output;
    return rc;
}
Пример #6
0
/*
 * this function should be changed--the mask map stack is misused as
 * to define the topology of variogram maps.
 *
 * use min/max coordinates for block diagonal as maximum cutoff
 * Returns: about 1/3 the max. dist between any two points in data. 
 */
void fill_cutoff_width(DATA *data /* pointer to DATA structure to derive
		the values from */,
		VARIOGRAM *v /* pointer to VARIOGRAM structure */)
{
	double d = 0.0;
	int i;
	GRIDMAP *m;
	SAMPLE_VGM *ev;

	assert(data);
	assert(v);

	ev = v->ev;
	if (get_n_masks() > 0) {
		m = new_map();
		m->is_write = 0;
		m->filename = get_mask_name(0);
		if ((m = map_read(m)) == NULL)
			ErrMsg(ER_READ, "cannot open map");
		ev->iwidth = 1.0;
		ev->cutoff = m->rows * m->cols; 
			/* not a real cutoff, but rather the size of the container array */
		ev->map = m;
	} else if (gl_bounds != NULL) {
		i = 0;
		while (gl_bounds[i] >= 0.0) /* count length */
			i++;
		ev->cutoff = gl_bounds[i-1];
		ev->iwidth = ev->cutoff / i;
	} else {
		if (is_mv_double(&(ev->cutoff))) {
			if (gl_cutoff < 0.0) {
				d = data_block_diagonal(data);
				if (d == 0.0)
					ev->cutoff = 1.0; /* ha ha ha */
				else
					ev->cutoff = d * gl_fraction;
			} else
				ev->cutoff = gl_cutoff;
		}
		if (is_mv_double(&(ev->iwidth))) {
			if (gl_iwidth < 0.0)
				ev->iwidth = ev->cutoff / gl_n_intervals;
			else
				ev->iwidth = gl_iwidth;
		}
	}
}
Пример #7
0
void *erealloc(void *p, size_t size) {
	if (size == 0) {
		pr_warning("erealloc(): size 0 requested");
		return NULL;
	}
	if (p == NULL) {
		p = (void *) malloc(size);
	} else
		p = (void *) realloc(p, size);
	if (p == NULL) {
		if (DEBUG_DUMP)
			message("realloc(%u) returned NULL\n", size);
		ErrMsg(ER_MEMORY, "");
	}
	return p;
}
Пример #8
0
static rc_t make_reply_obj_list( struct reply_obj_list ** list )
{
    rc_t rc = 0;
    reply_obj_list * l = calloc( 1, sizeof * l );
    if ( l == NULL )
    {
        rc = RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
        ErrMsg( "calloc( %d ) -> %R", ( sizeof * l ), rc );
    }
    else
    {
        VectorInit( &l->v, 0, 5 );
        *list = l;
    }
    return rc;
}
Пример #9
0
DEFAULT ExeRtP()		/* execute right parenthesis command */
{
	DBGFEN(1,"ExeRtP",NULL);

/*
 * if no numeric arg.  or not a number
 */
	if ((EStTop == EStBot) || (EStack[EStTop].ElType != OPERAND)) {
		ErrMsg(ERR_NAP);		/* no argument before ) */
		DBGFEX(1,DbgFNm,"FAILURE");
		return FAILURE;
	}

	DBGFEX(1,DbgFNm,"PushEx(')')");
	return PushEx((LONG)')', OPERATOR);
}
Пример #10
0
void do_synthesis()
{
  int nframe;
  int shift_start, shift_end;

  shift_start = mhead->totalduration - 
    ((int )(SILENCE_LENGTH / FRAME_RATE));
  shift_end = mtail->totalduration - 
    ((int )(SILENCE_LENGTH / FRAME_RATE));
  totalframe -= shift_end;
  
  wave.rate = SAMPLE_RATE;
  wave.nsample = SAMPLE_RATE * FRAME_RATE * (totalframe - shift_start) / 1000;

  if ((wave.data = (short *) calloc (wave.nsample, sizeof (short))) == NULL)
    {
      ErrMsg("Memory allocation error !\n");
      restart(1);
    }

#ifdef AUTO_DA
  nsample_frame = SAMPLE_RATE * FRAME_RATE  / 1000;
  synthesized_nsample = SAMPLE_RATE * FRAME_RATE * shift_start / 1000;
#endif

  already_talked = 0;

  for(nframe = shift_start; nframe < totalframe; nframe++)
    {
/* for power modification */ 
      coeff[nframe][0] = power.data[nframe];

/* MLSA filter */
      vocoder(f0.data[nframe],coeff[nframe],mceppst.order,alpha.data[nframe],speaker[spid].postfilter_coef);

#ifdef AUTO_DA
      synthesized_nsample += nsample_frame;
      if( nframe == shift_start && slot_Auto_play == YES )  {
        strcpy( slot_Speak_stat, "SPEAKING" );
        if( prop_Speak_stat == AutoOutput )  inqSpeakStat();
        do_auto_output();
      }
#endif
    }
  synthesized_nsample = wave.nsample;
  totalframe -= shift_start;
}
Пример #11
0
void PrintUsage()
{
	ErrMsg("\n");
	ErrMsg("CountName [Input] [Column]\n\n");

	ErrMsg("[Input]         STRING\n");
	ErrMsg("[Column]        INTEGER     The column to count.\n\n");

	ErrMsg("Example: Count the number of occurrences of each 'Subject id' in the blast result.\n");
	ErrMsg("CountName result.blast 2 > result.conut\n\n");
}
Пример #12
0
void PrintUsage()
{
	ErrMsg("\n");
	ErrMsg("RmAmbiMapping [SAM] [Cut]\n\n");

	ErrMsg("[SAM]           FILE        A SAM file.\n\n");
	ErrMsg("[Cut]           INT         Chimera AS - co-linear AS > cut.\n\n");

	ErrMsg("Example:\n");
	ErrMsg("cat C3.sam | ./RmAmbiMapping C3.ref.sam > result.sam\n\n");
}
Пример #13
0
void PrintUsage()
{
	ErrMsg("\n");
	ErrMsg("ChimeraParser.CS50 [Junction Site]\n\n");

	ErrMsg("Only for 50bp color space sequences.\n");
	ErrMsg("[Junction Site] FILE        A fasta format sequences of junction sites.\n\n");

	ErrMsg("Example:\n");
	ErrMsg("cat Reads_vs_JS.sam | ./ChimeraParser.CS50 JS.fa 90 10 > result.sam\n\n");
}
Пример #14
0
/*****************************************************************************
	ExeCom()
	This function executes a , (comma argument separator) command.
*****************************************************************************/
#include "zport.h"		/* define portability identifiers */
#include "tecoc.h"		/* define general identifiers */
#include "defext.h"		/* define external global variables */
#include "deferr.h"		/* define identifiers for error messages */
DEFAULT ExeCom()		/* execute a , (comma) command */
{
	DBGFEN(1,"ExeCom",NULL);
	if (EStTop == EStBot) {			/* if no numeric argument */
		ErrMsg(ERR_NAC);		/* no arg before , */
		DBGFEX(1,DbgFNm,"FAILURE");
		return FAILURE;
	}
	if (GetNmA() == FAILURE) {
		DBGFEX(1,DbgFNm,"FAILURE");
		return FAILURE;
	}
	MArgmt = NArgmt;
	CmdMod |= MARGIS;
	DBGFEX(1,DbgFNm,"SUCCESS");
	return SUCCESS;
}
Пример #15
0
void do_output_pros(char *ffile)
{
	FILE *fp;
	int dur;
	PHONEME *phoneme;
	MORPH *morph;
	int i;
	int shift_start;
	
	shift_start = mhead->totalduration - 
	  ((int )(SILENCE_LENGTH / FRAME_RATE));
	
	fp = fopen( ffile, "w" );
	if( fp == NULL )  {
		ErrMsg( "* File Open Error ... %s\n", ffile );
		return;
	}
	if( input_text[0] )  {
		fprintf( fp, "input_text: %s\n", input_text );
		fprintf( fp, "spoken_text: %s\n", spoken_text );
	} else {
		/* ParsedText での入力のとき */
		for( morph=mphead; morph; morph=morph->next )  {
			if( strncmp(morph->kanji,"sil",3)==0 )  continue;
			fprintf( fp, "%s", morph->kanji );
		}
		fprintf( fp, "\n" );
	}
	fprintf( fp, "number_of_phonemes: %d\n", slot_n_phonemes );
	fprintf( fp, "total_duration: %d\n", slot_total_dur );
	fprintf( fp, "-----\n" );
	phoneme = phhead;
	while( phoneme )  {
		dur = (int)(phoneme->time);
		fprintf( fp, "%s [%d]\n", phoneme->phoneme, dur );
		phoneme = phoneme->next;
	}
	fprintf( fp, "-----\n" );
	fprintf( fp, "total_frame: %d\n", totalframe );
	fprintf( fp, "-----\n" );
	for( i=0; i<totalframe; ++i )  {
		fprintf( fp, "%d: %lf %lf\n", i, f0.data[i+shift_start], power.data[i+shift_start] );
	}
	fprintf( fp, "-----\n" );
	fclose( fp );
}
Пример #16
0
void setup_data_minmax(DATA *d) {

	if (fix_minmax)
		ErrMsg(ER_NULL, "min and max should be fixed");

	if (d->id == 0) {
		min.x = d->minX; min.y = d->minY; min.z = d->minZ;
		max.x = d->maxX; max.y = d->maxY; max.z = d->maxZ;
	} else {
		min.x = MIN(min.x, d->minX);
		min.y = MIN(min.y, d->minY);
		min.z = MIN(min.z, d->minZ);
		max.x = MAX(max.x, d->maxX);
		max.y = MAX(max.y, d->maxY);
		max.z = MAX(max.z, d->maxZ);
	}
}
Пример #17
0
/*** Open the clipboard using iffparse library***/
static BOOL CBOpen(ULONG unit)
{
	extern struct Library * IFFParseBase;

	if( IFFParseBase != NULL && (clip = (APTR) AllocIFF() ) )
	{
		if( (clip->iff_Stream = (ULONG) OpenClipboard(unit)) )
		{
			InitIFFasClip(clip);

			return TRUE;
		}
		FreeIFF( clip );
	}
	ThrowError(Wnd, ErrMsg(ERR_OPENCLIP));
	return FALSE;
}
Пример #18
0
void setErr( char *rel, char *filename )
{
	if( strcmp(rel,"=")==0 )  {
		if( fp_err && strcmp(slot_Err_file,"CONSOLE")!=0 )  fclose( fp_err );
		strcpy( slot_Err_file, filename );
		if( strcmp(filename,"CONSOLE")==0 ) {
			fp_err = stderr;
		} else {
			fp_err = fopen( filename, "a" );
			if( fp_err == NULL )   {
			  ErrMsg( "error log file open error ... '%s'\n", filename );
			}
		}
	} else {
		unknown_com();
	}
}
Пример #19
0
static rc_t full_table_seek( struct lookup_reader * reader, uint64_t key_to_find, uint64_t * key_found )
{
    /* we have no index! search the whole thing... */
    uint64_t offset = 0;
    rc_t rc = loop_until_key_found( reader, key_to_find, key_found, &offset );
    if ( rc == 0 )
    {
        if ( keys_equal( key_to_find, *key_found ) )
            reader->pos = offset;
        else
        {
            rc = RC( rcVDB, rcNoTarg, rcReading, rcId, rcNotFound );
            ErrMsg( "seek_lookup_reader( key: %ld ) -> %R", key_to_find, rc );
        }
    }
    return rc;
}
Пример #20
0
int main(int argc, char **argv)
{
	int *IntArr;
	FILE *infile = NULL;
	int i;
	int cut;

	if( argc < 2 ) {	PrintUsage();	return 1;	}

	if( argc > 2 )
		cut = atoi(argv[2]);

	if(	( infile = fopen(argv[1], "r") ) == NULL ){	ErrMsg("Error: fopen failed.\n");	return 1;	}

	IntArr = new int [ArrSize];

	for(i=0; i<ArrSize; i++)
		IntArr[i] = -1;
	
	Str2IntMap themap;
	themap.AddIntoMap(argv[1], 0);

	for( SamOutput theSam; theSam.Get(infile); )
	{
		if( ( i = themap.IndexTheMap(theSam.qName) ) >= 0 )
			if(IntArr[i] < theSam.AS)
				IntArr[i] = theSam.AS;
	}

	for( SamOutput theSam; theSam.Get(); )
	{
		if( ( i = themap.IndexTheMap(theSam.qName) ) >= 0 )
			if(IntArr[i] >= (theSam.AS - cut) )
				continue;

		theSam.Print();
	}

	delete [] IntArr;
	
	if( infile != NULL )
		fclose(infile);

	return 0;
}
Пример #21
0
bool TestCommonData::CheckErrors()
{
//    Exceptions.Read();
    auto& mem = cpu::CpuMemory::Instance().M1;

    QString str_errs = ErrMsg();

    if ( str_errs.isEmpty() )
        return true;

    std::mutex mutex;
    std::unique_lock< std::mutex > lock( mutex );
    Launcher( std::bind( &TestCommonData::ShowErrors, this, str_errs ) );

    CondVar.wait( lock );
    mem.SetKvitir_Osch( true );
    return false;
}
Пример #22
0
void *edcalloc(size_t nobj, size_t size, char *file, int line) {
	void *p = NULL;

#ifdef RECORD_MALLOC
	printlog("%s:%d: calloc(%u)\n", file, line, size);
#endif
	p = (void *) calloc(nobj, size);
	if (p == NULL) {
		message("\n%s%s%s%d%s%u\n", "calloc(): out of memory in FILE: ", file,
				" LINE: ", line, " SIZE : ", size);
		ErrMsg(ER_MEMORY, "");
	}
	/*
	if (errno)
		perror(strerror(errno));
	*/
	return p;
}
Пример #23
0
void
ARY_Init_List ( LNK_LST_ARY *ary, INT32 n_elems )
{
  register INT32 i;
  register LNK_LST *lst;

  Is_True (n_elems >= 1,
     ("ARY_Init_List: attempt to allocate array of size %d", n_elems) );

  if ((lst=(LNK_LST *)lnk_lst_malloc(sizeof(LNK_LST)*n_elems)) == NULL)
    ErrMsg ( EC_No_Mem, "ARY_Init_List" );

  LST_lists(ary) = lst;
  ARY_LST_n_elems(ary) = n_elems;

  for (i=0; i<n_elems; ++i, ++lst)
    Init_List( lst );
}
Пример #24
0
static DEFAULT ExeFR()			/* execute an FR command */
{
	DBGFEN(1,"ExeFR",NULL);

	if ((GapBeg-RefLen) < EBfBeg) {		/* if out of range */
		ErrMsg(ERR_DTB);		/* DTB = "delete too big" */
		DBGFEX(1,DbgFNm,"FAILURE");
		return FAILURE;
	}

	GapBeg += RefLen;			/* delete */

	CmdMod = (CmdMod & COLON);		/* retain only colon bit */
	EStTop = EStBot;			/* clear expression stack */

	DBGFEX(1,DbgFNm,"ExeI()");
	return ExeI();
}
Пример #25
0
static rc_t adjust_output_filename_by_dir( tool_ctx_t * tool_ctx )
{
    size_t num_writ;
    bool es = ends_in_slash( tool_ctx -> output_dirname ); /* helper.c */
    rc_t rc = string_printf( tool_ctx -> dflt_output, sizeof tool_ctx -> dflt_output,
                        &num_writ,
                        es ? "%s%s" : "%s/%s",
                        tool_ctx -> output_dirname,
                        tool_ctx -> output_filename );
    if ( rc != 0 )
        ErrMsg( "string_printf( output-filename ) -> %R", rc );
    else
    {
        tool_ctx -> output_filename = tool_ctx -> dflt_output;
        rc = optionally_create_paths_in_output_filename( tool_ctx );
    }
    return rc;
}
Пример #26
0
int which_identifier(const char *id) {
	assert(id);

	for (int i = 0; i < n_vars; i++) {
		if (ids[i] == NULL)
			ErrMsg(ER_IMPOSVAL, "which_identifier(): ids[i] == NULL");
		if (strcmp(ids[i], id) == 0)
			return i;
	}
	/* else: extend data space */
	n_vars++;
	ids = (char **) erealloc(ids, n_vars * sizeof(char *));
	int Length = strlen(id) + 1;
	ids[n_vars - 1] = (char *) emalloc(Length * sizeof(char));
	snprintf(ids[n_vars - 1], Length, "%s", id);
	init_gstat_data(n_vars);
	return n_vars - 1;
}
Пример #27
0
int is_valid_strata_map(const char *name, int n_vars) {
	GRIDMAP *mp;
	int check_failed = 1;

	mp = new_map(READ_ONLY);
	mp->filename = name;
	if ((mp = map_read(mp)) == NULL)
		ErrMsg(ER_READ, name);
	/* 
	 * check min/max: enough strata? this check was:
	 * check_failed = (mp->cellmax - mp->cellmin < n_vars - 1);
	 */
	check_failed = (mp->cellmax - mp->cellmin < 1.0);
	if (! check_failed && mp->cellmax - mp->cellmin < n_vars - 1)
		pr_warning("fewer mask map categories than data variables present");
	map_free(mp);
	return (check_failed == 0);
}
Пример #28
0
/*****************************************************************************
	GetAra()
	This function is used by commands which can be preceded by two
arguments which specify an "area" of the edit buffer.  For instance,  the "T"
command can have the form "m,nT",  which will cause the characters between the
mth and nth character of the edit buffer to be typed on the terminal screen.
All commands which support m,n arguments call this function to compute the
addresses of the m and nth characters.  The resulting addresses are left
in the global variables AraBeg and AraEnd.
*****************************************************************************/
#include "zport.h"		/* define portability identifiers */
#include "tecoc.h"		/* define general identifiers */
#include "defext.h"		/* define external global variables */
#include "deferr.h"		/* define identifiers for error messages */
DEFAULT GetAra()		/* get m,n addresses */
{
	LONG	TmpLng;
#if DEBUGGING
	static char *DbgFNm = "GetAra";
	sprintf(DbgSBf,"MArgmt = %ld, NArgmt = %ld", MArgmt, NArgmt);
	DbgFEn(4,DbgFNm,DbgSBf);
#endif
	if (MArgmt < 0) {			/* if negative m */
		ErrMsg(ERR_NCA);		/* negative argument to , */
		DBGFEX(4,DbgFNm,"FAILURE, negative m");
		return FAILURE;
	}
	if (NArgmt < 0)	{			/* if negative n */
		ErrStr(ERR_POP, ErrTxt);	/* POP = pointer off page */
		DBGFEX(4,DbgFNm,"FAILURE, negative n");
		return FAILURE;
	}
	if (MArgmt > NArgmt) {			/* if wrong order */
		TmpLng = NArgmt;
		NArgmt = MArgmt;
		MArgmt = TmpLng;
	}
	AraBeg = EBfBeg + MArgmt;		/* compute area beginning */
	if (AraBeg > GapBeg-1) {		/* if past start of gap */
		AraBeg += (GapEnd-GapBeg) + 1;	/* correct for gap */
	}
	AraEnd = (EBfBeg + NArgmt) - 1;		/* compute area end */
	if (AraEnd > GapBeg-1) {		/* if before end of gap */
		AraEnd += (GapEnd-GapBeg) + 1;	/* correct for gap */
	}
	if ((AraBeg > EBfEnd) ||		/* if m or n too large */
	    (AraEnd > EBfEnd)) {
		ErrStr(ERR_POP, ErrTxt);	/* POP = pointer off page */
		DBGFEX(4,DbgFNm,"FAILURE");
		return FAILURE;
	}
#if DEBUGGING
	sprintf(DbgSBf,"SUCCESS, AraBeg = %ld, AraEnd = %ld",
		Zcp2ul(AraBeg), Zcp2ul(AraEnd));
	DbgFEx(4,DbgFNm,DbgSBf);
#endif
	return SUCCESS;
}
Пример #29
0
/*** Remove the char before the cursor ***/
void back_space(Project p, BYTE word)
{
	if(p->nbc!=0)
	{
		ULONG nbc = word ? backward_word(p->edited,p->nbc-1) : p->nbc-1;
		rem_chars(&p->undo, p->edited, nbc, p->nbc-1);

		/* Set cursor position and redraws it */
		inv_curs(p,FALSE);
		REDRAW_CURLINE(p);
		p->nbrwc = p->nbrc = x2pos(p->edited, p->nbc=nbc);
		p->xcurs = (p->nbrc-p->left_pos)*XSIZE + gui.left;
		if( (nbc = center_horiz(p)) != p->left_pos )
			scroll_xy(p, nbc, p->top_line, FALSE);
		inv_curs(p,TRUE);
		draw_info( p );
	}	else if(p->edited->prev != NULL) {

		p->edited = p->edited->prev;
		p->nbc    = p->edited->size;
		/* Join previous and current line */
		if( join_lines(&p->undo, p->edited, p->edited->next) )
		{
			/* Move cursor to the end of previous line */
			p->nbrwc = p->nbrc = x2pos(p->edited, p->nbc);

			p->max_lines--; p->nbl--;
			/* Require to scroll the display? */
			inv_curs(p, FALSE);
			if(p->ycurs>gui.topcurs)
				scroll_up(p, p->edited->next, p->ycurs-=YSIZE, center_horiz(p));
			else
				p->top_line--, p->show = p->edited,
				p->xcurs = (p->nbrc-p->left_pos)*XSIZE + gui.left;

			SetAPen(RP, pen.fg);
			REDRAW_CURLINE(p);
			/* Redraw the cursor: */
			inv_curs(p,TRUE);
			draw_info(p);
			prop_adj(p);
		}	else ThrowError(Wnd, ErrMsg(ERR_NOMEM));
	}
}
Пример #30
0
double calc_polynomial(DPOINT *p, int colX) {
/*
 * fills polynomial field (x, y, z, x2, y2, z2, xy, xz, yz) 
 * with standardized values
 *
 * Counting on the following behaviour:
 * first, all data + valdata are passed through setup_data_minmax(), in 
 * order to get the right values into min and max;
 * then, the routines calc_polynomial* are called.
 * changing min or max inbetween would result in rubbish.
 */
	double x, y, z;

	if (fix_minmax == 0)
		fix_minmax = 1; /* stop touching it */

	x = ((min.x==max.x) ? p->x : (p->x - min.x)/(max.x - min.x));
	y = ((min.y==max.y) ? p->y : (p->y - min.y)/(max.y - min.y));
	z = ((min.z==max.z) ? p->z : (p->z - min.z)/(max.z - min.z));
	switch(colX) {
 		case POLY_X:   return (x); 
 		case POLY_X2:  return (x * x);
 		case POLY_X3:  return (x * x * x);
 		case POLY_Y:   return (y);
 		case POLY_Y2:  return (y * y);
 		case POLY_Y3:  return (y * y * y);
 		case POLY_Z:   return (z);
 		case POLY_Z2:  return (z * z);
 		case POLY_Z3:  return (z * z * z);
 		case POLY_XY:  return (x * y);
 		case POLY_XZ:  return (x * z);
 		case POLY_YZ:  return (y * z);
 		case POLY_X2Y: return (x * x * y);
 		case POLY_XY2: return (x * y * y);
 		case POLY_X2Z: return (x * x * z);
 		case POLY_XZ2: return (x * z * z);
 		case POLY_Y2Z: return (y * y * z);
 		case POLY_YZ2: return (y * z * z);
 		default:      
 			ErrMsg(ER_IMPOSVAL, "unknown polynomial number");
 			break;
 	}
 	return 1.0; /* will never happen */
}