From 0d2da60dabcb4bff4d095b3bc97024f0d6daa774 Mon Sep 17 00:00:00 2001 From: Bill-Gray Date: Fri, 15 Sep 2017 12:36:12 -0400 Subject: [PATCH] Now providing a function to reset the 'cospar.txt' file name/path. Useful if multiple programs are attempting to access the same 'cospar.txt' file. --- cospar.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/cospar.cpp b/cospar.cpp index 4b20488..6b26ed6 100644 --- a/cospar.cpp +++ b/cospar.cpp @@ -115,7 +115,9 @@ static int get_cospar_data_from_text_file( int object_number, cospar_text[line] = NULL; } fclose( ifile); - } + if( !pole_ra) /* just loading coefficients; not actually */ + return( 0); /* computing orientations quite yet (see */ + } /* load_cospar_file( ) below) */ *is_retrograde = false; for( line = 0; cospar_text[line] && !done && !err; line++) { @@ -254,6 +256,24 @@ static int get_cospar_data_from_text_file( int object_number, return( err); } +/* Some programs (e.g., Find_Orb) put 'cospar.txt' in some directory +other than the working one. They can use the following function to +unload the COSPAR data (if any) and then direct that it be loaded from +a specified file. */ + +int DLL_FUNC load_cospar_file( const char *filename) +{ + const char *temp_name = cospar_filename; + int rval, pass; + + cospar_filename = filename; + for( pass = 0; pass < 2; pass++) + rval = get_cospar_data_from_text_file( (pass ? 0 : FREE_INTERNAL_DATA), + 0, 0., NULL, NULL, NULL, NULL); + cospar_filename = temp_name; + return( rval); +} + /* The returned matrix contains three J2000 equatorial unit vectors : matrix[0, 1, 2] = vector in direction of lat=0, lon=0;