Sie sind auf Seite 1von 6

AstroPatterns - 1

Option Explicit
' Different Range Types
Public Const AP_INTERVAL_RANGE
Public Const AP_ASPECT_RANGE
Public Const AP_TRANSIT_RANGE
Public Const AP_INGRESS_RANGE
Public Const AP_CARDINAL_INGRESS_RANGE
Public Const AP_SYZYGY_RANGE
Public Const AP_NEW_MOON_RANGE
Public Const AP_FULL_MOON_RANGE
Public Const AP_PARALLEL_RANGE
Public Const AP_RISING_RANGE
Public Const AP_EQUATOR_CROSSING_RANGE
Public Const AP_ECLIPTIC_CROSSING_RANGE
Public Const AP_EXTREMAL_DISTANCE_RANGE

As
As
As
As
As
As
As
As
As
As
As
As
As

Public Const AP_LIST_RANGE

As Long = 16

Long
Long
Long
Long
Long
Long
Long
Long
Long
Long
Long
Long
Long

=
=
=
=
=
=
=
=
=
=
=
=
=

1
2
3
4
5
6
7
8
9
10
11
12
13

Public Const AP_SOLAR_RANGE


As Long = 51
Public Const AP_LUNAR_RANGE
As Long = 52
Public Const AP_DIURNAL_HOROSCOPE_RANGE As Long = 53
Public Const AP_PATTERN_ALWAYS_TRUE
Public Const AP_PATTERN_ELEMENT
Public Const AP_PATTERN_RESONANCE

As Long = 1
As Long = 2
As Long = 3

' The pattern "constellation" is not a real pattern of the API lib
' but only refers to the "ConstellationPattern" worksheet
Public Const CONSTELLATION_PATTERN
As Long = 100
' The following API patterns usually are the constituents of the
' "ConstellationPattern"
Public Const AP_PATTERN_HOUSE_POS
As Long = 4
Public Const AP_PATTERN_SIGN_POS
As Long = 5
Public Const AP_PATTERN_ASPECT
As Long = 6
Public Const AP_PATTERN_PLANET_IN_ARC As Long = 7
Public Const AP_PATTERN_CLUSTER
As Long = 8
Public Const AP_PATTERN_CYCLIC_INDEX
As Long = 9
Public Const AP_PATTERN_AND
As Long = 10
Public Const AP_PATTERN_OR
As Long = 11
Public Const AP_PATTERN_WEIGHTED_SUM
As Long = 12
Public Const AP_NEGATED_PATTERN
As Long = 13
' Free pattern
' The function reference that evaluates the score is injected into the DLL
Public Const AP_FREE_PATTERN
As Long = 14
' Pattern type Standard = find top N horoscopes wrt score function
Public Const AP_PATTERN_TYPE_STANDARD As Long = 0
' Pattern type Boolean
' collect all horoscopes for which the pattern is satisfied
Public Const AP_PATTERN_TYPE_BOOL
As Long = 1
' The bare information that is needed to cast a horoscope:
Public Type t_horo
jd_et As Double
lon
As Double
lat
As Double
End Type
Public Type t_planet
se_ipl
As Long
essential_strength As Double
orb_base As Double
short_name As String * 2
name
As String
End Type

AstroPatterns - 2
Public Type t_aspect
angle As Double
orb
As Double
short_name As String * 3
name As String
End Type
' Data structure of ap_get_detail_for_pattern of type resonance
Public Type t_resonance
t As Long
planet1 As Long
planet2 As Long
dummy_for_alignment As Long
' since the C struct statements is automatically aligned to 8 by
tes
strength As Double
End Type
' Reference horoscope as needed for some range kinds
Public Declare Function ap_set_reference_horoscope _
Lib "astropatterns.dll" _
Alias "ap_set_reference_horoscope@24" ( _
ByVal jd_et As Double, _
ByVal lon As Double, _
ByVal lat As Double _
) As Long
Public Declare Function ap_reset_reference_horoscope _
Lib "astropatterns.dll" _
Alias "ap_reset_reference_horoscope@0" () As Long
' Set a current place
Public Declare Function ap_set_place _
Lib "astropatterns.dll" _
Alias "ap_set_place@16" ( _
ByVal lon As Double, _
ByVal lat As Double _
) As Long
' set the current range
Public Declare Function ap_set_range _
Lib "astropatterns.dll" _
Alias "ap_set_range@24" ( _
ByVal range_type As Long, _
ByVal jd_start As Double, _
ByVal jd_end As Double, _
ByVal opt_arg As String _
) As Long
' go on evaluating the current range
Public Declare Function ap_has_more _
Lib "astropatterns.dll" _
Alias "ap_has_more@0" ( _
) As Long
' Start loop
Public Declare Function ap_start_loop _
Lib "astropatterns.dll" _
Alias "ap_start_loop@0" ( _
) As Long
' retrieve the next date from current range
Public Declare Function ap_get_next _
Lib "astropatterns.dll" _
Alias "ap_get_next@4" ( _
ByRef h As t_horo _
) As Long

AstroPatterns - 3

Public Declare Function ap_set_pattern _


Lib "astropatterns.dll" _
Alias "ap_set_pattern@16" ( _
ByVal pattern As Long, _
ByVal pattern_type As Long, _
ByVal max_size As Long, _
ByVal optarg As String _
) As Long
Public Declare Function ap_get_score _
Lib "astropatterns.dll" _
Alias "ap_get_score@4" ( _
ByRef h As t_horo _
) As Double
Public Declare Function ap_get_score_for_pattern _
Lib "astropatterns.dll" _
Alias "ap_get_score_for_pattern@8" ( _
ByRef h As t_horo, _
ByVal pattern_handle As Long _
) As Double
Public Declare Function ap_get_pattern_details _
Lib "astropatterns.dll" _
Alias "ap_get_pattern_details@8" ( _
ByVal pattern As Long, _
ByRef data As Long _
) As Long ' data is a pointer containing a reference to pattern details after the cal
l
Public Declare Function ap_set_verbose_mode _
Lib "astropatterns.dll" _
Alias "ap_set_verbose_mode@4" ( _
ByVal verbose_mode As Long _
) As Long
Public Declare Function ap_get_log _
Lib "astropatterns.dll" _
Alias "ap_get_log@0" ( _
) As Long ' pointer to char*
Public Declare Function ap_get_last_error _
Lib "astropatterns.dll" _
Alias "ap_get_last_error@0" ( _
) As Long ' pointer to char*
Public Declare Sub ap_clear_error _
Lib "astropatterns.dll" _
Alias "ap_clear_error@0" ()
Public Declare Function ap_log_add _
Lib "astropatterns.dll" _
Alias "ap_log_add@4" ( _
ByVal s As String) As Long
Public Declare Function ap_clear_log _
Lib "astropatterns.dll" _
Alias "ap_clear_log@0" () As Long
Public Declare Function ap_add_date_to_list_range _
Lib "astropatterns.dll" _
Alias "ap_add_date_to_list_range@12" ( _
ByVal jd_et As Double, _
ByVal label As String) As Long

AstroPatterns - 4

Public Declare Function ap_add_horo_to_list_range _


Lib "astropatterns.dll" _
Alias "ap_add_horo_to_list_range@8" ( _
ByRef h As t_horo, _
ByVal label As String) As Long
Public Declare Function ap_clear_list_range _
Lib "astropatterns.dll" _
Alias "ap_clear_list_range@0" ( _
) As Long
Public Declare Function ap_get_label _
Lib "astropatterns.dll" _
Alias "ap_get_label@4" ( _
ByRef h As t_horo _
) As Long ' pointer to char*
Public Declare Function ap_set_list_range_from_file _
Lib "astropatterns.dll" _
Alias "ap_set_list_range_from_file@4" ( _
ByVal filename As String _
) As Long
Public Declare Function ap_set_sweph_opt _
Lib "astropatterns.dll" _
Alias "ap_set_sweph_opt@4" ( _
ByVal options As Long _
) As Long
Public Declare Function ap_set_house_system _
Lib "astropatterns.dll" _
Alias "ap_set_house_system@4" ( _
ByVal house_system As Long _
) As Long
Public Declare Function ap_add_planet _
Lib "astropatterns.dll" _
Alias "ap_add_planet@4" ( _
ByRef planet As t_planet _
) As Long
' This version of ap_add_planet is dedicated for handicapped languages like VBA
' which have problems passing structured data types as parameters
Public Declare Function ap_add_planetA _
Lib "astropatterns.dll" _
Alias "ap_add_planetA@28" ( _
ByVal se_ipl As Long, _
ByVal essential_strength As Double, _
ByVal orb_base As Double, _
ByVal short_name As String, _
ByVal name As String _
) As Long
Public Declare Function ap_clear_planets _
Lib "astropatterns.dll" _
Alias "ap_clear_planets@0" ( _
) As Long
Public Declare Function ap_add_aspect _
Lib "astropatterns.dll" _
Alias "ap_add_aspect@4" ( _
ByRef aspect As t_aspect _
) As Long
' This version of ap_add_aspect is dedicated for handicapped languages like VBA
' which have problems passing structured data types as parameters

AstroPatterns - 5
Public Declare Function ap_add_aspectA _
Lib "astropatterns.dll" _
Alias "ap_add_aspectA@24" ( _
ByVal angle As Double, _
ByVal orb As Double, _
ByVal short_name As String, _
ByVal name As String _
) As Long
Public Declare Function ap_set_aspect_parameters _
Lib "astropatterns.dll" _
Alias "ap_set_aspect_parameters@4" ( _
ByVal par As String _
) As Long
Public Declare Function ap_clear_aspects _
Lib "astropatterns.dll" _
Alias "ap_clear_aspects@0" ( _
) As Long
' Mundane positions interpolated continuously from the data array
' using a spline with periodic boundary condition
Public Declare Function ap_set_mundane_positions _
Lib "astropatterns.dll" _
Alias "ap_set_mundane_positions@8" ( _
ByRef data As Double, _
ByVal size As Long _
) As Long
' Like the swisseph library, we sacrifice a storage place of a double (8 bytes)
' for better readability:
' The array of house strengths to be passed has 13 elements,
' the first element of this array is ignored
' So we have strength(1) = strength of house 1, etc.
' I know that in VBA an array can start at an arbitrary index,
' but the API function is for usage with other languages as well
Public Declare Function ap_set_house_strengths _
Lib "astropatterns.dll" _
Alias "ap_set_house_strengths@4" ( _
ByRef strength As Double _
) As Long
Public Declare Function ap_get_mundane_strength _
Lib "astropatterns.dll" _
Alias "ap_get_mundane_strength@8" ( _
ByVal mp As Double _
) As Double
Public Declare Function ap_dump _
Lib "astropatterns.dll" _
Alias "ap_dump@4" ( _
ByVal objid As String _
) As Long ' pointer to result
' APIFUNC( void ) ap_set_aspect_parameters( const char* par );
Public Declare Function ap_set_free_pattern _
Lib "astropatterns.dll" _
Alias "ap_set_free_pattern@12" ( _
ByVal PatternType As Long, _
ByVal MaxSize As Long, _
ByVal ScoreFunction As Long _
) As Long
Public Declare Function ap_set_and_pattern _
Lib "astropatterns.dll" _
Alias "ap_set_and_pattern@8" ( _
ByRef patterns As Long, _

AstroPatterns - 6
ByVal num_patterns As Long) As Long
Public Declare Function ap_set_or_pattern _
Lib "astropatterns.dll" _
Alias "ap_set_or_pattern@8" ( _
ByRef patterns As Long, _
ByVal num_patterns As Long) As Long
Public Declare Function ap_set_negated_pattern _
Lib "astropatterns.dll" _
Alias "ap_set_negated_pattern@4" ( _
ByVal pattern_handle As Long) As Long
Public Declare Function ap_set_weighted_sum_pattern _
Lib "astropatterns.dll" _
Alias "ap_set_weighted_sum_pattern@16" ( _
ByVal max_size As Long, _
ByVal num_patterns As Long, _
ByRef patterns As Long, _
ByRef weights As Double) As Long
'// --- Utility functions, e.g. for own custom patterns
Public Declare Function ap_get_planets _
Lib "astropatterns.dll" _
Alias "ap_get_planets@8" ( _
ByRef h As t_horo, _
ByRef longitude As Double) As Long
Public Declare Function ap_get_houses _
Lib "astropatterns.dll" _
Alias "ap_get_houses@8" ( _
ByRef h As t_horo, _
ByRef cusps As Double) As Long
' In the Parameters 'planets' and 'cusps' you may either pass the start address of an array of d
oubles
' or you simply Pass "ByVal 0" if you are not interested in these data
' Because of this alternative, we have to declare the arguments with type any (instead of "ByRef
Double" for an array)
Public Declare Function ap_get_solar _
Lib "astropatterns.dll" _
Alias "ap_get_solar@24" ( _
ByVal jd_et As Double, _
ByRef radix As t_horo, _
ByRef solar As t_horo, _
ByRef Planets As Any, _
ByRef cusps As Any) As Long