From 3cad15d8fde439239877c2d3d56986532baeb498 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 16 Mar 2011 11:15:33 +0100 Subject: Remove old stream functions for good --- src/stream.c | 87 ------------------------------------------------------------ src/stream.h | 2 -- 2 files changed, 89 deletions(-) diff --git a/src/stream.c b/src/stream.c index f0c56111..7aaa74fd 100644 --- a/src/stream.c +++ b/src/stream.c @@ -111,37 +111,6 @@ int count_patterns(FILE *fh) } -static UnitCell *read_orientation_matrix(FILE *fh) -{ - float u, v, w; - struct rvec as, bs, cs; - UnitCell *cell; - char line[1024]; - - if ( fgets(line, 1023, fh) == NULL ) return NULL; - if ( sscanf(line, "astar = %f %f %f", &u, &v, &w) != 3 ) { - ERROR("Couldn't read a-star\n"); - return NULL; - } - as.u = u*1e9; as.v = v*1e9; as.w = w*1e9; - if ( fgets(line, 1023, fh) == NULL ) return NULL; - if ( sscanf(line, "bstar = %f %f %f", &u, &v, &w) != 3 ) { - ERROR("Couldn't read b-star\n"); - return NULL; - } - bs.u = u*1e9; bs.v = v*1e9; bs.w = w*1e9; - if ( fgets(line, 1023, fh) == NULL ) return NULL; - if ( sscanf(line, "cstar = %f %f %f", &u, &v, &w) != 3 ) { - ERROR("Couldn't read c-star\n"); - return NULL; - } - cs.u = u*1e9; cs.v = v*1e9; cs.w = w*1e9; - cell = cell_new_from_axes(as, bs, cs); - - return cell; -} - - static int read_reflections(FILE *fh, struct image *image) { char *rval = NULL; @@ -432,62 +401,6 @@ int read_chunk(FILE *fh, struct image *image) } -int find_chunk(FILE *fh, UnitCell **cell, char **filename, double *ev) -{ - char line[1024]; - char *rval = NULL; - int have_ev = 0; - int have_cell = 0; - int have_filename = 0; - long start_of_chunk = 0; - - do { - - const long start_of_line = ftell(fh); - - rval = fgets(line, 1023, fh); - if ( rval == NULL ) continue; - - chomp(line); - - if ( strncmp(line, "Reflections from indexing", 25) == 0 ) { - - *filename = strdup(line+29); - *cell = NULL; - *ev = 0.0; - have_cell = 0; - have_ev = 0; - have_filename = 1; - start_of_chunk = ftell(fh); - - } - - if ( !have_filename ) continue; - - if ( strncmp(line, "astar = ", 8) == 0 ) { - fseek(fh, start_of_line, 0); - *cell = read_orientation_matrix(fh); - have_cell = 1; - } - - if ( strncmp(line, "photon_energy_eV = ", 19) == 0 ) { - *ev = atof(line+19); - have_ev = 1; - } - - if ( strlen(line) == 0 ) { - if ( have_filename && have_cell && have_ev ) { - fseek(fh, start_of_chunk, 0); - return 0; - } - } - - } while ( rval != NULL ); - - return 1; -} - - int skip_some_files(FILE *fh, int n) { char *rval = NULL; diff --git a/src/stream.h b/src/stream.h index 64bd9529..c0343b2a 100644 --- a/src/stream.h +++ b/src/stream.h @@ -32,8 +32,6 @@ enum extern int count_patterns(FILE *fh); -extern int find_chunk(FILE *fh, UnitCell **cell, char **filename, double *ev); - extern void write_chunk(FILE *ofh, struct image *image, int flags); extern int parse_stream_flags(const char *a); -- cgit v1.2.3