MCPcopy Create free account
hub / github.com/CruiserOne/Astrolog / swe_fixstar

Function swe_fixstar

sweph.cpp:7899–7958  ·  view source on GitHub ↗

* get fixstar positions * parameters: * star name of star or line number in star file * (start from 1, don't count comment). * If no error occurs, the name of the star is returned * in the format trad_name, nomeclat_name * * tjd absolute julian day * iflag s. swecalc(); speed bit does not function * x pointer for returning the ecliptic coordinates * serr error return

Source from the content-addressed store, hash-verified

7897 * serr error return string
7898**********************************************************/
7899int32 CALL_CONV swe_fixstar(char *star, double tjd, int32 iflag,
7900 double *xx, char *serr)
7901{
7902 int i;
7903 char sstar[SWI_STAR_LENGTH + 1];
7904 static TLS char slast_stardata[AS_MAXCH];
7905 static TLS char slast_starname[AS_MAXCH];
7906 char srecord[AS_MAXCH + 20], *sp; /* 20 byte for SE_STARFILE */
7907 int retc;
7908 if (serr != NULL)
7909 *serr = '\0';
7910#ifdef TRACE
7911 swi_open_trace(serr);
7912 trace_swe_fixstar(1, star, tjd, iflag, xx, serr);
7913#endif /* TRACE */
7914 retc = fixstar_format_search_name(star, sstar, serr);
7915 if (retc == ERR)
7916 goto return_err;
7917 if (*sstar == ',') {
7918 ; // is Bayer designation
7919 } else if (isdigit((int) *sstar)) {
7920 ; // is a sequential star number
7921 } else {
7922 if ((sp = strchr(sstar, ',')) != NULL) // cut off Bayer, if trad. name
7923 *sp = '\0';
7924 }
7925 /* star elements from last call: */
7926 if (*slast_stardata != '\0' && strcmp(slast_starname, sstar) == 0) {
7927 strcpy(srecord, slast_stardata);
7928 goto found;
7929 }
7930 if (get_builtin_star(star, sstar, srecord)) {
7931 goto found;
7932 }
7933 /******************************************************
7934 * Star file
7935 * close to the beginning, a few stars selected by Astrodienst.
7936 * These can be accessed by giving their number instead of a name.
7937 * All other stars can be accessed by name.
7938 * Comment lines start with # and are ignored.
7939 ******************************************************/
7940 if ((retc = swi_fixstar_load_record(star, srecord, NULL, NULL, NULL, serr)) != OK)
7941 goto return_err;
7942 found:
7943 strcpy(slast_stardata, srecord);
7944 strcpy(slast_starname, sstar);
7945 if ((retc = swi_fixstar_calc_from_record(srecord, tjd, iflag, star, xx, serr)) == ERR)
7946 goto return_err;
7947#ifdef TRACE
7948 trace_swe_fixstar(2, star, tjd, iflag, xx, serr);
7949#endif
7950 return iflag;
7951 return_err:
7952 for (i = 0; i <= 5; i++)
7953 xx[i] = 0;
7954#ifdef TRACE
7955 trace_swe_fixstar(2, star, tjd, iflag, xx, serr);
7956#endif

Callers 6

swi_get_ayanamsa_exFunction · 0.85
swe_fixstar_utFunction · 0.85
calc_planet_starFunction · 0.85
swe_rise_trans_true_horFunction · 0.85
calc_mer_transFunction · 0.85
swe_gauquelin_sectorFunction · 0.85

Calls 6

swi_open_traceFunction · 0.85
trace_swe_fixstarFunction · 0.85
get_builtin_starFunction · 0.85
swi_fixstar_load_recordFunction · 0.85

Tested by

no test coverage detected