int ap_set_range( int range_type, double jd_start, double jd_end, char *opt_arg);Sets the current Range to use. For a selection of usable Ranges, see the doc on Ranges. The Range will be instantiated and prepared for later use in the main loop.
int ap_set_list_range_from_file( char* filename );Uses a CSV file for direct input of ListRanges. For the file format, see the discussion in the User's Guide. Returns the number of records that could be parsed. If an error occurred, a call of ap_get_last_error will give detailed information.
int ap_add_date_to_list_range( double jd_et, char* label );Make a new entry in the ListRange with the specified date and label. The geographic latitude and longitude can be taken from the general setting via ap_set_place. If you need different locations for each entry, use ap_add_horo_to_list_range instead.
int ap_add_horo_to_list_range( t_horo *h, char* label );Adds a new entry to the ListRange with the specified triple (Julian Date, Longitude, Latitude) and a label.
int ap_clear_list_range( );Removes all entries that might be present in the ListRange memory from former calls of the above functions.
char* ap_get_label( t_horo* h );Retrieves the label for the given horoscope. The h->jd_et value must be precisely the value that has been specified with ap_add_to_list_range, or the value that has been retrieved from the main loop with ap_get_next. This is because the floating point number h->jd_et is used directly as key for an index of labels. Only if you don't manipulate the horoscope record and pass it to ap_get_label as you received it, this function will give the expected result.
int ap_set_pattern( int pattern, int pattern_type, size_t max_size, char* optarg );Sets the current Pattern, to be used in the main loop. For the possible values of pattern and optarg, see the Table of Patterns in the reference guide. There are two Pattern types, the standard Pattern (pattern_type = 0) and the Boolean Pattern (pattern_type = 1). Standard Patterns perform a sorted insert into the hitlist, with the Pattern's score as sort criteria. With the Boolean Pattern type, only those horoscopes having a positive score will be inserted into the result list. This makes a difference: If the Range produces sufficiently many horoscopes, the hit list of a standard Pattern will always be filled up to the max size: Even horoscopes with score 0 will be inserted into the result list. On the other hand, the hit list of a Boolean Pattern can be smaller than the maximum size and even can be empty. The return value is an integer called the Pattern handle. It is used for building combined Patterns, see below.
int ap_set_and_pattern( int pattern_handles[], size_t num_patterns);Combine the Patterns given by the list of integers to an And Pattern. The score of an And Pattern is defined to be the minimum value of all scores of its members. Thus, if there is only one member Pattern yielding the value 0, the result will be 0. For Boolean Patterns, this is precisely the semantics of the and operator. The return value is the Pattern handle of the new Pattern.
int ap_set_or_pattern( int pattern_handles[], size_t num_patterns );Combine the Patterns given by the list of integers to an Or Pattern. The score of an Or Pattern is defined to be the maximum value of all scores of its members. Thus, if there is only one member Pattern yielding a nonzero value, the result will be nonzero too. For Boolean Patterns, this is precisely the semantics of the and operator. The return value is the Pattern handle of the new Pattern.
int ap_set_negated_pattern( int pattern_handle );Negates the given Pattern: If the given Pattern yields a nonzero value, the negated Pattern will result to zero. If the given Pattern yields 0, the negated Pattern will result to 1. The return value is the Pattern handle of the negated Pattern.
int ap_set_combined_pattern( int combination_type, int pattern_type, size_t max_size, ... );In effect, this function works the same as ap_set_and_pattern and ap_set_or_pattern, but it has a vararg interface, so that you don't need to populate an array of Pattern handles. Instead, you can pass the Pattern handles one after another as function arguments. To indicate the end list, you need to add AP_STOP = -1 as last integer of your argument list. This function is useful if you have a predefined and therefore fixed number of Patterns that you want to combine. The return value is the Pattern handle of the new Pattern.
int ap_set_weighted_sum_pattern( size_t max_size, size_t num_patterns, int pattern_handles[], double weights[] );Define a new Pattern by forming the weighted sum of the score functions of the given Patterns.
int ap_set_free_pattern( int type,size_t max_size, double (*scoreFunction)(t_horo*) );Pass the reference to a score function into the AstroPatterns library. Returns the Pattern handle.
int ap_start_loop( );After having set the configurations (planets, aspects, mundane positions) as well as the Range and Pattern to be used, the function ap_start_loop() is called to start the computations. When using a Pattern, this function call implicitly already performs the main loop, building the hit list for the Range/Pattern combination. If no Pattern is used, only some preparations are performed, but the production of the horoscopes will be delegated to the ap_get_next() call, see below.
int ap_get_next( t_horo *h );Returns 1 if there is another horoscope in the result set. It returns 0 if there are no more horoscopes. If there still are horoscopes, the next horoscope will be copied into the location to which the variable h points. If a Pattern has been set, the Range rule is used to produce the next horoscope. If there is a Pattern, this function simply retrieves the next horoscope from the hit list that has already been computed formerly in the ap_start_loop() call.
double ap_get_score( t_horo *h );Retrieves the score of the horoscope h, valuated with the current Pattern.
double ap_get_score_for_pattern( t_horo *h, int pattern_handle );Calls the evaluation of the specified Pattern (which doesn't need to be the current Pattern) for a single horoscope. Returns the score.
int ap_set_place( double lon, double lat);Sets a default location which is used by the ListRange, if one location is valid for all elements of the list.
int ap_set_reference_horoscope( double jd_et, double lon, double lat );Sets the reference horoscope which is needed for some Ranges (like SolarRange) and Patterns (like ResonancePattern).
t_horo* ap_get_reference_horoscope( );Retrieves the reference horoscope data that had been set formerly with the call of ap_set_reference_horoscope().
int ap_reset_reference_horoscope( );Resets the reference horoscope. After this, the library will behave as if no reference horoscope had been set.
void ap_set_sweph_opt( int options );Sets the options for all further calls of the Swiss Ephemeris. The integer is what is called the iflag in the Swiss Ephemeris documentation.
void ap_clear_planets( );Clears the list of configured planets.
void ap_set_planets_default( );Sets the default list of planets (SO, MO and the eight planets ME to PL, with strengths according to W. Koch, Aspektlehre nach Kepler).
void ap_add_planet( t_planet* planet );Adds a planet to the list. The structure t_planet is defined as follows:
typedef struct { int se_ipl; // Planet number in Swiss Ephemeris double essential_strength; double orb_base; // Used for orb determination char short_name[3]; // Its two-letter acronym char* name; } t_planet;If a planet with the given se_ipl number already exists, its properties will be overwritten by the data passed in t_planet. Returns the number of the planet in the list, starting with 0 for the first planet.
int ap_add_planetA( int se_ipl, double essential_strength, double orb_base, char* short_name, char* name );Some platforms are not able to pass a user defined type like t_planet in an API call. For those platforms, we have the API function ap_add_planetA which works like ap_add_planet but with all the properties passed one by one as arguments of elementary type.
void ap_set_planets( t_planet* planets, size_t size );Other platforms are much more powerful: In such languages, you can even pass a complete array with a user defined row type to the API function. Languages having this advantage (VBA not being one of them) can use this API function to set all the planets of the configuration at once.
void ap_clear_aspects( );Clears the list of aspect settings.
void ap_set_aspects_default( );Sets the list of aspect settings to the default list.
void ap_add_aspect( t_aspect* aspect );Adds a new aspect to the configuration. The structure t_aspect is defined as follows:
typedef struct { double angle; double orb; char short_name[4]; char* name; } t_aspect;
void ap_add_aspectA( double angle, double orb, char *short_name, char* name );Some platforms are not able to pass a user defined type like t_aspect in an API call. For those platforms, we have the API function ap_add_aspectA which works like ap_add_aspect but with all the properties passed one by one as arguments of elementary type.
void ap_set_aspects( t_aspect* aspects, size_t size );Other platforms are much more powerful: In such languages, you can even pass a complete array with a user defined row type to the API function. Languages having this advantage (VBA not being one of them) can use this API function to set all the aspects of the configuration at once.
void ap_set_aspect_parameters( char* par );Currently, there is only one additional parameter which is valid generally for aspects: The minimum strength. You may pass this parameter in the character representation (%lf%) of a floating-point number. This function may be extended in future releases, by passing more than one parameter in a CSV format.
void ap_get_planets(t_horo *h, double *longitude);Computes the longitudes of all currently configured planets for the horoscope h. longitude must be the pointer to an array of doubles large enough to hold the longitudes of all currently used planets.
void ap_get_planet(int i, double jd_et, double *longitude);Computes the longitude of a particular planet, its number in the current planets configuration being i.
void ap_get_houses(t_horo *h, double *cusps);Computes all the house cusps according to the currently customized system of houses. cusps must point to an array large enough to keep 13 doubles. As in Swiss Ephemeris, the first element is unused: we start with index 1 so that cusps[i] really holds the cusp of house i
void ap_get_solar(double jd_et, t_horo *radix, t_horo *solar, double* planets, double * cusps );Computes the solar horoscope for reference horoscope radix which is valid for the date jd_et. Date and place of the solar horoscope are retrieved in solar. If you don't pass NULL for planets and/or cusps, the planetary and/or house cusp positions of the solar horoscope will be computed.
void ap_get_lunar( double jd_et, t_horo *radix, t_horo *lunar, double* planets, double * houses );Computes the lunar horoscope for reference horoscope radix which is valid for the date jd_et. Date and place of the lunar horoscope are retrieved in lunar. If you don't pass NULL for planets and/or cusps, the planetary and/or house cusp positions of the lunar horoscope will be computed.
void ap_set_verbose_mode( int iVerbose_mode = 1);Set a degree of verbosity, ranging from 0 (silent) to 9 (maximum verbosity). The verbosity controls how much information will be written into the log.
int* ap_get_verbose_mode( );Retrieves the verbosity as a pointer, thus allowing the caller to change it value directly, without any further API call.
void ap_clear_log( );Clears the log.
void ap_log_add( char* s);Adds a message to the log.
char* ap_dump( char* objid );Exposes the internal data of an object. Currently, for objid the literals PlanetsCust, AspectsCust and CurrentPattern are possible.
int ap_get_pattern_details( int pattern_handle, void **data );Retrieves a data structure of the current patten evaluation which can be evaluated programmatically.
char* ap_get_log( );Retrieves all the text that has been collected in the log.
char* ap_get_last_error( );If an API call led to an error, this function call will retrieve the corresponding error description.
void ap_clear_error();For clearing the error text externally.
void ap_set_house_system( int house_system );You can set one of the systems Placidus (P), Koch (K), Regiomontanus (R), Campanus (C), equal (A) and Vehlow (V).
void ap_set_mundane_positions( t_double_pair* data, size_t size );Sets the nodes for an interpolating periodic spline which will be used to compute the mundane position of a planet. t_double_pair is indeed a pair of double-precision numbers (for the x and y value of the node). In size, you pass the length of the array data.
void ap_set_house_strengths( double* strength );Alternatively to the spline model, you can assign a strength to each house. strength has to be an array of 13 doubles, the first element (with index 0) being unused.
double ap_get_mundane_strength( double m );Compute the mundane strength for the mundane position m, according to the current configuration.