Skip to content

Commit

Permalink
Now providing a function to reset the 'cospar.txt' file name/path. Us…
Browse files Browse the repository at this point in the history
…eful if multiple programs are attempting to access the same 'cospar.txt' file.
  • Loading branch information
Bill-Gray committed Sep 15, 2017
1 parent 57d51f8 commit 0d2da60
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion cospar.cpp
Expand Up @@ -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++)
{
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 0d2da60

Please sign in to comment.