tissue.c
/* Parse the string token defining tissue types. */
Parse the string token defining tissue types.
Parse the string token defining tissue types .
int parsetype (material *mat, int nmat, char *str) {
	char *val, *sep = ",";
	int i;
	if (!(val = strtok (str, sep))) return -1;
	for (i = 0; i < nmat; ++i) {
		mat[i].c = atof (val);
		if (!(val = strtok (NULL, sep))) return -1;
		mat[i].a = atof (val);
		if (!(val = strtok (NULL, sep))) return -1;
		mat[i].r = atof (val);
		if (!(val = strtok (NULL, sep))) return -1;
	}
	return 0;
}
int parsetype ( material * mat , int nmat , char * str ) { char * val , * sep = " " ; int i ; if ( ! ( val = strtok ( str , sep ) ) ) return -1 ; for ( i = 0 ; i < nmat ; ++ i ) { mat [ i ] . c = atof ( val ) ; if ( ! ( val = strtok ( NULL , sep ) ) ) return -1 ; mat [ i ] . a = atof ( val ) ; if ( ! ( val = strtok ( NULL , sep ) ) ) return -1 ; mat [ i ] . r = atof ( val ) ; if ( ! ( val = strtok ( NULL , sep ) ) ) return -1 ; } return 0 ; }
Parse the string token defining tissue types.
Parse the string token defining tissue types .
/* Initialize to the first token. */ /* Keep breaking up the string to assign values to the materials. */