@typescriptify/sweph 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/package.json +6 -2
  2. package/originalCode/.eslintrc.json +0 -124
  3. package/originalCode/.gitattributes +0 -2
  4. package/originalCode/.github/FUNDING.yml +0 -5
  5. package/originalCode/.github/workflows/test.yml +0 -35
  6. package/originalCode/LICENSE +0 -840
  7. package/originalCode/README.md +0 -91
  8. package/originalCode/binding.gyp +0 -41
  9. package/originalCode/constants.js +0 -366
  10. package/originalCode/docs.gif +0 -0
  11. package/originalCode/index.d.ts +0 -5115
  12. package/originalCode/index.js +0 -7
  13. package/originalCode/index.mjs +0 -109
  14. package/originalCode/package.json +0 -55
  15. package/originalCode/src/functions/azalt.cpp +0 -39
  16. package/originalCode/src/functions/azalt_rev.cpp +0 -35
  17. package/originalCode/src/functions/calc.cpp +0 -29
  18. package/originalCode/src/functions/calc_pctr.cpp +0 -31
  19. package/originalCode/src/functions/calc_ut.cpp +0 -29
  20. package/originalCode/src/functions/close.cpp +0 -6
  21. package/originalCode/src/functions/cotrans.cpp +0 -26
  22. package/originalCode/src/functions/cotrans_sp.cpp +0 -26
  23. package/originalCode/src/functions/cs2degstr.cpp +0 -19
  24. package/originalCode/src/functions/cs2lonlatstr.cpp +0 -23
  25. package/originalCode/src/functions/cs2timestr.cpp +0 -23
  26. package/originalCode/src/functions/csnorm.cpp +0 -15
  27. package/originalCode/src/functions/csroundsec.cpp +0 -15
  28. package/originalCode/src/functions/d2l.cpp +0 -15
  29. package/originalCode/src/functions/date_conversion.cpp +0 -30
  30. package/originalCode/src/functions/day_of_week.cpp +0 -15
  31. package/originalCode/src/functions/degnorm.cpp +0 -15
  32. package/originalCode/src/functions/deltat.cpp +0 -15
  33. package/originalCode/src/functions/deltat_ex.cpp +0 -24
  34. package/originalCode/src/functions/difcs2n.cpp +0 -19
  35. package/originalCode/src/functions/difcsn.cpp +0 -19
  36. package/originalCode/src/functions/difdeg2n.cpp +0 -19
  37. package/originalCode/src/functions/difdegn.cpp +0 -19
  38. package/originalCode/src/functions/fixstar.cpp +0 -32
  39. package/originalCode/src/functions/fixstar2.cpp +0 -32
  40. package/originalCode/src/functions/fixstar2_mag.cpp +0 -28
  41. package/originalCode/src/functions/fixstar2_ut.cpp +0 -32
  42. package/originalCode/src/functions/fixstar_mag.cpp +0 -28
  43. package/originalCode/src/functions/fixstar_ut.cpp +0 -32
  44. package/originalCode/src/functions/gauquelin_sector.cpp +0 -44
  45. package/originalCode/src/functions/get_ayanamsa.cpp +0 -15
  46. package/originalCode/src/functions/get_ayanamsa_ex.cpp +0 -27
  47. package/originalCode/src/functions/get_ayanamsa_ex_ut.cpp +0 -27
  48. package/originalCode/src/functions/get_ayanamsa_name.cpp +0 -19
  49. package/originalCode/src/functions/get_ayanamsa_ut.cpp +0 -15
  50. package/originalCode/src/functions/get_current_file_data.cpp +0 -28
  51. package/originalCode/src/functions/get_library_path.cpp +0 -8
  52. package/originalCode/src/functions/get_orbital_elements.cpp +0 -29
  53. package/originalCode/src/functions/get_planet_name.cpp +0 -19
  54. package/originalCode/src/functions/get_tid_acc.cpp +0 -7
  55. package/originalCode/src/functions/heliacal_pheno_ut.cpp +0 -52
  56. package/originalCode/src/functions/heliacal_ut.cpp +0 -52
  57. package/originalCode/src/functions/helio_cross.cpp +0 -33
  58. package/originalCode/src/functions/helio_cross_ut.cpp +0 -33
  59. package/originalCode/src/functions/house_name.cpp +0 -20
  60. package/originalCode/src/functions/house_pos.cpp +0 -36
  61. package/originalCode/src/functions/houses.cpp +0 -35
  62. package/originalCode/src/functions/houses_armc.cpp +0 -38
  63. package/originalCode/src/functions/houses_armc_ex2.cpp +0 -47
  64. package/originalCode/src/functions/houses_ex.cpp +0 -37
  65. package/originalCode/src/functions/houses_ex2.cpp +0 -46
  66. package/originalCode/src/functions/jdet_to_utc.cpp +0 -38
  67. package/originalCode/src/functions/jdut1_to_utc.cpp +0 -38
  68. package/originalCode/src/functions/julday.cpp +0 -25
  69. package/originalCode/src/functions/lat_to_lmt.cpp +0 -27
  70. package/originalCode/src/functions/lmt_to_lat.cpp +0 -27
  71. package/originalCode/src/functions/lun_eclipse_how.cpp +0 -34
  72. package/originalCode/src/functions/lun_eclipse_when.cpp +0 -31
  73. package/originalCode/src/functions/lun_eclipse_when_loc.cpp +0 -39
  74. package/originalCode/src/functions/lun_occult_when_glob.cpp +0 -35
  75. package/originalCode/src/functions/lun_occult_when_loc.cpp +0 -43
  76. package/originalCode/src/functions/lun_occult_where.cpp +0 -34
  77. package/originalCode/src/functions/mooncross.cpp +0 -26
  78. package/originalCode/src/functions/mooncross_node.cpp +0 -30
  79. package/originalCode/src/functions/mooncross_node_ut.cpp +0 -30
  80. package/originalCode/src/functions/mooncross_ut.cpp +0 -26
  81. package/originalCode/src/functions/nod_aps.cpp +0 -42
  82. package/originalCode/src/functions/nod_aps_ut.cpp +0 -42
  83. package/originalCode/src/functions/orbit_max_min_true_distance.cpp +0 -37
  84. package/originalCode/src/functions/pheno.cpp +0 -29
  85. package/originalCode/src/functions/pheno_ut.cpp +0 -29
  86. package/originalCode/src/functions/radnorm.cpp +0 -15
  87. package/originalCode/src/functions/refrac.cpp +0 -23
  88. package/originalCode/src/functions/refrac_extended.cpp +0 -32
  89. package/originalCode/src/functions/revjul.cpp +0 -33
  90. package/originalCode/src/functions/rise_trans.cpp +0 -44
  91. package/originalCode/src/functions/rise_trans_true_hor.cpp +0 -46
  92. package/originalCode/src/functions/set_delta_t_userdef.cpp +0 -14
  93. package/originalCode/src/functions/set_ephe_path.cpp +0 -14
  94. package/originalCode/src/functions/set_jpl_file.cpp +0 -14
  95. package/originalCode/src/functions/set_sid_mode.cpp +0 -20
  96. package/originalCode/src/functions/set_tid_acc.cpp +0 -14
  97. package/originalCode/src/functions/set_topo.cpp +0 -20
  98. package/originalCode/src/functions/sidtime.cpp +0 -15
  99. package/originalCode/src/functions/sidtime0.cpp +0 -21
  100. package/originalCode/src/functions/sol_eclipse_how.cpp +0 -34
  101. package/originalCode/src/functions/sol_eclipse_when_glob.cpp +0 -31
  102. package/originalCode/src/functions/sol_eclipse_when_loc.cpp +0 -39
  103. package/originalCode/src/functions/sol_eclipse_where.cpp +0 -30
  104. package/originalCode/src/functions/solcross.cpp +0 -26
  105. package/originalCode/src/functions/solcross_ut.cpp +0 -26
  106. package/originalCode/src/functions/split_deg.cpp +0 -35
  107. package/originalCode/src/functions/time_equ.cpp +0 -25
  108. package/originalCode/src/functions/utc_time_zone.cpp +0 -48
  109. package/originalCode/src/functions/utc_to_jd.cpp +0 -37
  110. package/originalCode/src/functions/version.cpp +0 -8
  111. package/originalCode/src/functions/vis_limit_mag.cpp +0 -50
  112. package/originalCode/src/sweph.cpp +0 -150
  113. package/originalCode/src/sweph.h +0 -119
  114. package/originalCode/swisseph/swecl.c +0 -6428
  115. package/originalCode/swisseph/swedate.c +0 -588
  116. package/originalCode/swisseph/swedate.h +0 -81
  117. package/originalCode/swisseph/swehel.c +0 -3511
  118. package/originalCode/swisseph/swehouse.c +0 -3143
  119. package/originalCode/swisseph/swehouse.h +0 -98
  120. package/originalCode/swisseph/swejpl.c +0 -958
  121. package/originalCode/swisseph/swejpl.h +0 -103
  122. package/originalCode/swisseph/swemmoon.c +0 -1930
  123. package/originalCode/swisseph/swemplan.c +0 -967
  124. package/originalCode/swisseph/swemptab.h +0 -10640
  125. package/originalCode/swisseph/swenut2000a.h +0 -2819
  126. package/originalCode/swisseph/sweodef.h +0 -326
  127. package/originalCode/swisseph/sweph.c +0 -8614
  128. package/originalCode/swisseph/sweph.h +0 -849
  129. package/originalCode/swisseph/swephexp.h +0 -1020
  130. package/originalCode/swisseph/swephlib.c +0 -4634
  131. package/originalCode/swisseph/swephlib.h +0 -189
@@ -1,31 +0,0 @@
1
- #include <sweph.h>
2
-
3
- constexpr std::pair<int, const char*> args[] = {
4
- { 4, "Expecting 4 arguments: tjd_start, ifl, ifltype, backward" },
5
- { NUMBER, "Argument 1 should be a number - julian day in universal time" },
6
- { NUMBER, "Argument 2 should be a number - target object ID" },
7
- { NUMBER, "Argument 3 should be a number - eclipse type" },
8
- { TRUEFALSE, "Argument 4 should be a boolean - backwards search" }
9
- };
10
-
11
- Napi::Value sweph_sol_eclipse_when_glob(const Napi::CallbackInfo& info) {
12
- Napi::Env env = info.Env();
13
- if(!sweph_type_check(args, info)) {
14
- return env.Null();
15
- }
16
- double ret [10];
17
- char serr [AS_MAXCH] = "";
18
- int32 flag = swe_sol_eclipse_when_glob(
19
- info[0].As<Napi::Number>().DoubleValue(),
20
- info[1].As<Napi::Number>().Int32Value(),
21
- info[2].As<Napi::Number>().Int32Value(),
22
- ret,
23
- info[3].As<Napi::Boolean>(),
24
- serr
25
- );
26
- Napi::Object obj = Napi::Object::New(env);
27
- obj["flag"] = flag;
28
- obj["error"] = serr;
29
- obj["data"] = sweph_js_array_converter(ret, 10, env);
30
- return obj;
31
- }
@@ -1,39 +0,0 @@
1
- #include <sweph.h>
2
-
3
- constexpr std::pair<int, const char*> args[] = {
4
- { 4, "Expecting 4 arguments: tjd_start, ifl, geopos, backward" },
5
- { NUMBER, "Argument 1 should be a number - julian day in universal time" },
6
- { NUMBER, "Argument 2 should be a number - target object ID" },
7
- { ARRAY, "Argument 3 should be an array of 3 numbers - geographic coordinates [longitude, latitude, elevation]" },
8
- { TRUEFALSE, "Argument 4 should be a boolean - backwards search" }
9
- };
10
-
11
- Napi::Value sweph_sol_eclipse_when_loc(const Napi::CallbackInfo& info) {
12
- Napi::Env env = info.Env();
13
- if(!sweph_type_check(args, info)) {
14
- return env.Null();
15
- }
16
- double geopos [3];
17
- if(!sweph_double_array_converter(geopos, 3, info[2])) {
18
- Napi::TypeError::New(env, args[3].second).ThrowAsJavaScriptException();
19
- return env.Null();
20
- }
21
- double ret [10];
22
- double attr [20];
23
- char serr [AS_MAXCH] = "";
24
- int32 flag = swe_sol_eclipse_when_loc(
25
- info[0].As<Napi::Number>().DoubleValue(),
26
- info[1].As<Napi::Number>().Int32Value(),
27
- geopos,
28
- ret,
29
- attr,
30
- info[3].As<Napi::Boolean>(),
31
- serr
32
- );
33
- Napi::Object obj = Napi::Object::New(env);
34
- obj["flag"] = flag;
35
- obj["error"] = serr;
36
- obj["data"] = sweph_js_array_converter(ret, 7, env);
37
- obj["attributes"] = sweph_js_array_converter(attr, 11, env);
38
- return obj;
39
- }
@@ -1,30 +0,0 @@
1
- #include <sweph.h>
2
-
3
- constexpr std::pair<int, const char*> args[] = {
4
- { 2, "Expecting 2 arguments: tjd_ut, ifl" },
5
- { NUMBER, "Argument 1 should be a number - julian day in universal time" },
6
- { NUMBER, "Argument 2 should be a number - target object ID" }
7
- };
8
-
9
- Napi::Value sweph_sol_eclipse_where(const Napi::CallbackInfo& info) {
10
- Napi::Env env = info.Env();
11
- if(!sweph_type_check(args, info)) {
12
- return env.Null();
13
- }
14
- double geopos [10];
15
- double attr [20];
16
- char serr [AS_MAXCH] = "";
17
- int32 flag = swe_sol_eclipse_where(
18
- info[0].As<Napi::Number>().DoubleValue(),
19
- info[1].As<Napi::Number>().Int32Value(),
20
- geopos,
21
- attr,
22
- serr
23
- );
24
- Napi::Object obj = Napi::Object::New(env);
25
- obj["flag"] = flag;
26
- obj["error"] = serr;
27
- obj["data"] = sweph_js_array_converter(geopos, 10, env);
28
- obj["attributes"] = sweph_js_array_converter(attr, 11, env);
29
- return obj;
30
- }
@@ -1,26 +0,0 @@
1
- #include <sweph.h>
2
-
3
- constexpr std::pair<int, const char*> args[] = {
4
- { 3, "Expecting 3 arguments: x2cross, jd_et, flag" },
5
- { NUMBER, "Argument 1 should be a number - longitude position to search for" },
6
- { NUMBER, "Argument 2 should be a number - start time in julian day in ephemeris/terrestrial time" },
7
- { NUMBER, "Argument 3 should be a number - calculation flag" }
8
- };
9
-
10
- Napi::Value sweph_solcross(const Napi::CallbackInfo& info) {
11
- Napi::Env env = info.Env();
12
- if(!sweph_type_check(args, info)) {
13
- return env.Null();
14
- }
15
- char serr [AS_MAXCH] = "";
16
- double jd_et = swe_solcross(
17
- info[0].As<Napi::Number>().DoubleValue(),
18
- info[1].As<Napi::Number>().DoubleValue(),
19
- info[2].As<Napi::Number>().Int32Value(),
20
- serr
21
- );
22
- Napi::Object obj = Napi::Object::New(env);
23
- obj["date"] = jd_et;
24
- obj["error"] = serr;
25
- return obj;
26
- }
@@ -1,26 +0,0 @@
1
- #include <sweph.h>
2
-
3
- constexpr std::pair<int, const char*> args[] = {
4
- { 3, "Expecting 3 arguments: x2cross, jd_ut, flag" },
5
- { NUMBER, "Argument 1 should be a number - longitude position to search for" },
6
- { NUMBER, "Argument 2 should be a number - start time in julian day in universal time" },
7
- { NUMBER, "Argument 3 should be a number - calculation flag" }
8
- };
9
-
10
- Napi::Value sweph_solcross_ut(const Napi::CallbackInfo& info) {
11
- Napi::Env env = info.Env();
12
- if(!sweph_type_check(args, info)) {
13
- return env.Null();
14
- }
15
- char serr [AS_MAXCH] = "";
16
- double jd_ut = swe_solcross_ut(
17
- info[0].As<Napi::Number>().DoubleValue(),
18
- info[1].As<Napi::Number>().DoubleValue(),
19
- info[2].As<Napi::Number>().Int32Value(),
20
- serr
21
- );
22
- Napi::Object obj = Napi::Object::New(env);
23
- obj["date"] = jd_ut;
24
- obj["error"] = serr;
25
- return obj;
26
- }
@@ -1,35 +0,0 @@
1
- #include <sweph.h>
2
-
3
- constexpr std::pair<int, const char*> args[] = {
4
- { 2, "Expecting 2 arguments: ddeg, roundflag" },
5
- { NUMBER, "Argument 1 should be a number - decimal degrees" },
6
- { NUMBER, "Argument 2 should be a number - rounding flag" }
7
- };
8
-
9
- Napi::Value sweph_split_deg(const Napi::CallbackInfo& info) {
10
- Napi::Env env = info.Env();
11
- if(!sweph_type_check(args, info)) {
12
- return env.Null();
13
- }
14
- int deg;
15
- int min;
16
- int sec;
17
- double fraction;
18
- int sign;
19
- swe_split_deg(
20
- info[0].As<Napi::Number>().DoubleValue(),
21
- info[1].As<Napi::Number>().Int32Value(),
22
- &deg,
23
- &min,
24
- &sec,
25
- &fraction,
26
- &sign
27
- );
28
- Napi::Object obj = Napi::Object::New(env);
29
- obj["degree"] = deg;
30
- obj["minute"] = min;
31
- obj["second"] = sec;
32
- obj["fraction"] = fraction;
33
- obj["sign"] = sign;
34
- return obj;
35
- }
@@ -1,25 +0,0 @@
1
- #include <sweph.h>
2
-
3
- constexpr std::pair<int, const char*> args[] = {
4
- { 1, "Expecting 1 arguments: tjd_ut" },
5
- { NUMBER, "Argument 1 should be a number - julian day in universal time" }
6
- };
7
-
8
- Napi::Value sweph_time_equ(const Napi::CallbackInfo& info) {
9
- Napi::Env env = info.Env();
10
- if(!sweph_type_check(args, info)) {
11
- return env.Null();
12
- }
13
- double e;
14
- char serr [AS_MAXCH] = "";
15
- int32 flag = swe_time_equ(
16
- info[0].As<Napi::Number>().DoubleValue(),
17
- &e,
18
- serr
19
- );
20
- Napi::Object obj = Napi::Object::New(env);
21
- obj["flag"] = flag;
22
- obj["error"] = serr;
23
- obj["data"] = e;
24
- return obj;
25
- }
@@ -1,48 +0,0 @@
1
- #include <sweph.h>
2
-
3
- constexpr std::pair<int, const char*> args[] = {
4
- { 7, "Expecting 7 arguments: iyear, imonth, iday, ihour, imin, dsec, d_timezone" },
5
- { NUMBER, "Argument 1 should be a number - full year" },
6
- { NUMBER, "Argument 2 should be a number - month 1-12" },
7
- { NUMBER, "Argument 3 should be a number - day 1-31" },
8
- { NUMBER, "Argument 4 should be a number - hour 0-23" },
9
- { NUMBER, "Argument 5 should be a number - minutes 0-59" },
10
- { NUMBER, "Argument 6 should be a number - seconds 0-59.999" },
11
- { NUMBER, "Argument 7 should be a number - timezone offset" }
12
- };
13
-
14
- Napi::Value sweph_utc_time_zone(const Napi::CallbackInfo& info) {
15
- Napi::Env env = info.Env();
16
- if(!sweph_type_check(args, info)) {
17
- return env.Null();
18
- }
19
- int year;
20
- int month;
21
- int day;
22
- int hour;
23
- int minute;
24
- double seconds;
25
- swe_utc_time_zone(
26
- info[0].As<Napi::Number>().Int32Value(),
27
- info[1].As<Napi::Number>().Int32Value(),
28
- info[2].As<Napi::Number>().Int32Value(),
29
- info[3].As<Napi::Number>().Int32Value(),
30
- info[4].As<Napi::Number>().Int32Value(),
31
- info[5].As<Napi::Number>().DoubleValue(),
32
- info[6].As<Napi::Number>().DoubleValue(),
33
- &year,
34
- &month,
35
- &day,
36
- &hour,
37
- &minute,
38
- &seconds
39
- );
40
- Napi::Object obj = Napi::Object::New(env);
41
- obj["year"] = year;
42
- obj["month"] = month;
43
- obj["day"] = day;
44
- obj["hour"] = hour;
45
- obj["minute"] = minute;
46
- obj["second"] = seconds;
47
- return obj;
48
- }
@@ -1,37 +0,0 @@
1
- #include <sweph.h>
2
-
3
- constexpr std::pair<int, const char*> args[] = {
4
- { 7, "Expecting 7 arguments: iyear, imonth, iday, ihour, imin, dsec, gregflag" },
5
- { NUMBER, "Argument 1 should be a number - full year" },
6
- { NUMBER, "Argument 2 should be a number - month 1-12" },
7
- { NUMBER, "Argument 3 should be a number - day 1-31" },
8
- { NUMBER, "Argument 4 should be a number - hour 0-23" },
9
- { NUMBER, "Argument 5 should be a number - minutes 0-59" },
10
- { NUMBER, "Argument 6 should be a number - seconds 0-59.999" },
11
- { NUMBER, "Argument 7 should be a number - calendar system, 1 for SE_GREG_CAL, 0 for SE_JUL_CAL" }
12
- };
13
-
14
- Napi::Value sweph_utc_to_jd(const Napi::CallbackInfo& info) {
15
- Napi::Env env = info.Env();
16
- if(!sweph_type_check(args, info)) {
17
- return env.Null();
18
- }
19
- double ret [2];
20
- char serr [AS_MAXCH] = "";
21
- int32 flag = swe_utc_to_jd(
22
- info[0].As<Napi::Number>().Int32Value(),
23
- info[1].As<Napi::Number>().Int32Value(),
24
- info[2].As<Napi::Number>().Int32Value(),
25
- info[3].As<Napi::Number>().Int32Value(),
26
- info[4].As<Napi::Number>().Int32Value(),
27
- info[5].As<Napi::Number>().DoubleValue(),
28
- info[6].As<Napi::Number>().Int32Value(),
29
- ret,
30
- serr
31
- );
32
- Napi::Object obj = Napi::Object::New(env);
33
- obj["flag"] = flag;
34
- obj["error"] = serr;
35
- obj["data"] = sweph_js_array_converter(ret, 2, env);
36
- return obj;
37
- }
@@ -1,8 +0,0 @@
1
- #include <sweph.h>
2
-
3
- Napi::String sweph_version(const Napi::CallbackInfo& info) {
4
- Napi::Env env = info.Env();
5
- char version [AS_MAXCH];
6
- swe_version(version);
7
- return Napi::String::New(env, version);
8
- }
@@ -1,50 +0,0 @@
1
- #include <sweph.h>
2
-
3
- constexpr std::pair<int, const char*> args[] = {
4
- { 6, "Expecting 6 arguments: tjd_ut, dgeo, datm, dobs, objectname, helflag" },
5
- { NUMBER, "Argument 1 should be a number - full year" },
6
- { ARRAY, "Argument 2 should be an array of 3 numbers - geographic coordinates [longitude, latitude, elevation]" },
7
- { ARRAY, "Argument 3 should be an array of 4 numbers - atmospheric conditions [pressure, temperature, humidity, meteorological range]" },
8
- { ARRAY, "Argument 4 should be an array of 6 numbers - observer description [age, sellen ratio, optical type, optical magnification, optical aperture, optical transmission]" },
9
- { STRING, "Argument 5 should be a string - object name" },
10
- { NUMBER, "Argument 6 should be a number - calculation flag" }
11
- };
12
-
13
- Napi::Value sweph_vis_limit_mag(const Napi::CallbackInfo& info) {
14
- Napi::Env env = info.Env();
15
- if(!sweph_type_check(args, info)) {
16
- return env.Null();
17
- }
18
- double dgeo [3];
19
- if(!sweph_double_array_converter(dgeo, 3, info[1])) {
20
- Napi::TypeError::New(env, args[2].second).ThrowAsJavaScriptException();
21
- return env.Null();
22
- }
23
- double datm [4];
24
- if(!sweph_double_array_converter(datm, 4, info[2])) {
25
- Napi::TypeError::New(env, args[3].second).ThrowAsJavaScriptException();
26
- return env.Null();
27
- }
28
- double dobs [6];
29
- if(!sweph_double_array_converter(dobs, 6, info[3])) {
30
- Napi::TypeError::New(env, args[4].second).ThrowAsJavaScriptException();
31
- return env.Null();
32
- }
33
- char serr [AS_MAXCH] = "";
34
- double ret [8];
35
- int32 flag = swe_vis_limit_mag(
36
- info[0].As<Napi::Number>().DoubleValue(),
37
- dgeo,
38
- datm,
39
- dobs,
40
- (char*)info[4].As<Napi::String>().Utf8Value().c_str(),
41
- info[5].As<Napi::Number>().Int32Value(),
42
- ret,
43
- serr
44
- );
45
- Napi::Object obj = Napi::Object::New(env);
46
- obj["flag"] = flag;
47
- obj["error"] = serr;
48
- obj["data"] = sweph_js_array_converter(ret, 8, env);
49
- return obj;
50
- }
@@ -1,150 +0,0 @@
1
- #include <sweph.h>
2
-
3
- Napi::Object Init(Napi::Env env, Napi::Object exports) {
4
- exports["close"] = Napi::Function::New(env, sweph_close);
5
- exports["set_delta_t_userdef"] = Napi::Function::New(env, sweph_set_delta_t_userdef);
6
- exports["set_ephe_path"] = Napi::Function::New(env, sweph_set_ephe_path);
7
- exports["set_jpl_file"] = Napi::Function::New(env, sweph_set_jpl_file);
8
- exports["set_sid_mode"] = Napi::Function::New(env, sweph_set_sid_mode);
9
- exports["set_tid_acc"] = Napi::Function::New(env, sweph_set_tid_acc);
10
- exports["set_topo"] = Napi::Function::New(env, sweph_set_topo);
11
- exports["version"] = Napi::Function::New(env, sweph_version);
12
- exports["get_library_path"] = Napi::Function::New(env, sweph_get_library_path);
13
- exports["get_tid_acc"] = Napi::Function::New(env, sweph_get_tid_acc);
14
- exports["get_planet_name"] = Napi::Function::New(env, sweph_get_planet_name);
15
- exports["get_current_file_data"] = Napi::Function::New(env, sweph_get_current_file_data);
16
- exports["get_orbital_elements"] = Napi::Function::New(env, sweph_get_orbital_elements);
17
- exports["get_ayanamsa_name"] = Napi::Function::New(env, sweph_get_ayanamsa_name);
18
- exports["get_ayanamsa_ex_ut"] = Napi::Function::New(env, sweph_get_ayanamsa_ex_ut);
19
- exports["get_ayanamsa_ex"] = Napi::Function::New(env, sweph_get_ayanamsa_ex);
20
- exports["get_ayanamsa_ut"] = Napi::Function::New(env, sweph_get_ayanamsa_ut);
21
- exports["get_ayanamsa"] = Napi::Function::New(env, sweph_get_ayanamsa);
22
- exports["calc"] = Napi::Function::New(env, sweph_calc);
23
- exports["calc_ut"] = Napi::Function::New(env, sweph_calc_ut);
24
- exports["calc_pctr"] = Napi::Function::New(env, sweph_calc_pctr);
25
- exports["fixstar"] = Napi::Function::New(env, sweph_fixstar);
26
- exports["fixstar_ut"] = Napi::Function::New(env, sweph_fixstar_ut);
27
- exports["fixstar_mag"] = Napi::Function::New(env, sweph_fixstar_mag);
28
- exports["fixstar2"] = Napi::Function::New(env, sweph_fixstar2);
29
- exports["fixstar2_ut"] = Napi::Function::New(env, sweph_fixstar2_ut);
30
- exports["fixstar2_mag"] = Napi::Function::New(env, sweph_fixstar2_mag);
31
- exports["nod_aps"] = Napi::Function::New(env, sweph_nod_aps);
32
- exports["nod_aps_ut"] = Napi::Function::New(env, sweph_nod_aps_ut);
33
- exports["orbit_max_min_true_distance"] = Napi::Function::New(env, sweph_orbit_max_min_true_distance);
34
- exports["sol_eclipse_when_loc"] = Napi::Function::New(env, sweph_sol_eclipse_when_loc);
35
- exports["sol_eclipse_when_glob"] = Napi::Function::New(env, sweph_sol_eclipse_when_glob);
36
- exports["sol_eclipse_how"] = Napi::Function::New(env, sweph_sol_eclipse_how);
37
- exports["sol_eclipse_where"] = Napi::Function::New(env, sweph_sol_eclipse_where);
38
- exports["lun_occult_when_loc"] = Napi::Function::New(env, sweph_lun_occult_when_loc);
39
- exports["lun_occult_when_glob"] = Napi::Function::New(env, sweph_lun_occult_when_glob);
40
- exports["lun_occult_where"] = Napi::Function::New(env, sweph_lun_occult_where);
41
- exports["lun_eclipse_when_loc"] = Napi::Function::New(env, sweph_lun_eclipse_when_loc);
42
- exports["lun_eclipse_when"] = Napi::Function::New(env, sweph_lun_eclipse_when);
43
- exports["lun_eclipse_how"] = Napi::Function::New(env, sweph_lun_eclipse_how);
44
- exports["rise_trans"] = Napi::Function::New(env, sweph_rise_trans);
45
- exports["rise_trans_true_hor"] = Napi::Function::New(env, sweph_rise_trans_true_hor);
46
- exports["pheno"] = Napi::Function::New(env, sweph_pheno);
47
- exports["pheno_ut"] = Napi::Function::New(env, sweph_pheno_ut);
48
- exports["azalt"] = Napi::Function::New(env, sweph_azalt);
49
- exports["azalt_rev"] = Napi::Function::New(env, sweph_azalt_rev);
50
- exports["refrac"] = Napi::Function::New(env, sweph_refrac);
51
- exports["refrac_extended"] = Napi::Function::New(env, sweph_refrac_extended);
52
- exports["heliacal_ut"] = Napi::Function::New(env, sweph_heliacal_ut);
53
- exports["vis_limit_mag"] = Napi::Function::New(env, sweph_vis_limit_mag);
54
- exports["heliacal_pheno_ut"] = Napi::Function::New(env, sweph_heliacal_pheno_ut);
55
- exports["julday"] = Napi::Function::New(env, sweph_julday);
56
- exports["date_conversion"] = Napi::Function::New(env, sweph_date_conversion);
57
- exports["revjul"] = Napi::Function::New(env, sweph_revjul);
58
- exports["utc_time_zone"] = Napi::Function::New(env, sweph_utc_time_zone);
59
- exports["utc_to_jd"] = Napi::Function::New(env, sweph_utc_to_jd);
60
- exports["jdet_to_utc"] = Napi::Function::New(env, sweph_jdet_to_utc);
61
- exports["jdut1_to_utc"] = Napi::Function::New(env, sweph_jdut1_to_utc);
62
- exports["time_equ"] = Napi::Function::New(env, sweph_time_equ);
63
- exports["lmt_to_lat"] = Napi::Function::New(env, sweph_lmt_to_lat);
64
- exports["lat_to_lmt"] = Napi::Function::New(env, sweph_lat_to_lmt);
65
- exports["deltat"] = Napi::Function::New(env, sweph_deltat);
66
- exports["deltat_ex"] = Napi::Function::New(env, sweph_deltat_ex);
67
- exports["house_name"] = Napi::Function::New(env, sweph_house_name);
68
- exports["houses"] = Napi::Function::New(env, sweph_houses);
69
- exports["houses_armc"] = Napi::Function::New(env, sweph_houses_armc);
70
- exports["houses_armc_ex2"] = Napi::Function::New(env, sweph_houses_armc_ex2);
71
- exports["houses_ex"] = Napi::Function::New(env, sweph_houses_ex);
72
- exports["houses_ex2"] = Napi::Function::New(env, sweph_houses_ex2);
73
- exports["house_pos"] = Napi::Function::New(env, sweph_house_pos);
74
- exports["gauquelin_sector"] = Napi::Function::New(env, sweph_gauquelin_sector);
75
- exports["sidtime"] = Napi::Function::New(env, sweph_sidtime);
76
- exports["sidtime0"] = Napi::Function::New(env, sweph_sidtime0);
77
- exports["cotrans"] = Napi::Function::New(env, sweph_cotrans);
78
- exports["cotrans_sp"] = Napi::Function::New(env, sweph_cotrans_sp);
79
- exports["degnorm"] = Napi::Function::New(env, sweph_degnorm);
80
- exports["radnorm"] = Napi::Function::New(env, sweph_radnorm);
81
- exports["split_deg"] = Napi::Function::New(env, sweph_split_deg);
82
- exports["csnorm"] = Napi::Function::New(env, sweph_csnorm);
83
- exports["difcsn"] = Napi::Function::New(env, sweph_difcsn);
84
- exports["difdegn"] = Napi::Function::New(env, sweph_difdegn);
85
- exports["difcs2n"] = Napi::Function::New(env, sweph_difcs2n);
86
- exports["difdeg2n"] = Napi::Function::New(env, sweph_difdeg2n);
87
- exports["csroundsec"] = Napi::Function::New(env, sweph_csroundsec);
88
- exports["d2l"] = Napi::Function::New(env, sweph_d2l);
89
- exports["day_of_week"] = Napi::Function::New(env, sweph_day_of_week);
90
- exports["cs2timestr"] = Napi::Function::New(env, sweph_cs2timestr);
91
- exports["cs2lonlatstr"] = Napi::Function::New(env, sweph_cs2lonlatstr);
92
- exports["cs2degstr"] = Napi::Function::New(env, sweph_cs2degstr);
93
- exports["solcross"] = Napi::Function::New(env, sweph_solcross);
94
- exports["solcross_ut"] = Napi::Function::New(env, sweph_solcross_ut);
95
- exports["mooncross"] = Napi::Function::New(env, sweph_mooncross);
96
- exports["mooncross_ut"] = Napi::Function::New(env, sweph_mooncross_ut);
97
- exports["mooncross_node"] = Napi::Function::New(env, sweph_mooncross_node);
98
- exports["mooncross_node_ut"] = Napi::Function::New(env, sweph_mooncross_node_ut);
99
- exports["helio_cross"] = Napi::Function::New(env, sweph_helio_cross);
100
- exports["helio_cross_ut"] = Napi::Function::New(env, sweph_helio_cross_ut);
101
- return exports;
102
- }
103
-
104
- bool sweph_is_type(int type, Napi::Value data) {
105
- switch (type) {
106
- case NUMBER: return data.IsNumber();
107
- case STRING: return data.IsString();
108
- case STRINGNULL: return data.IsString() || data.IsNull();
109
- case ARRAY: return data.IsArray();
110
- case TRUEFALSE: return data.IsBoolean();
111
- default: return false;
112
- }
113
- }
114
-
115
- bool sweph_type_check(const std::pair<int, const char*> types[], const Napi::CallbackInfo& info) {
116
- Napi::Env env = info.Env();
117
- if((int)info.Length() < types[0].first) {
118
- Napi::TypeError::New(env, types[0].second).ThrowAsJavaScriptException();
119
- return false;
120
- }
121
- for(int i = 0; i < types[0].first; i++) {
122
- if(!sweph_is_type(types[i+1].first, info[i])) {
123
- Napi::TypeError::New(env, types[i+1].second).ThrowAsJavaScriptException();
124
- return false;
125
- }
126
- }
127
- return true;
128
- }
129
-
130
- bool sweph_double_array_converter(double *target, int size, Napi::Value data) {
131
- Napi::Array x = data.As<Napi::Array>();
132
- for(int i = 0; i < size; i++) {
133
- Napi::Value v = x[i];
134
- if(!v.IsNumber()) {
135
- return false;
136
- }
137
- target[i] = v.As<Napi::Number>().DoubleValue();
138
- }
139
- return true;
140
- }
141
-
142
- Napi::Array sweph_js_array_converter(double *src, int size, Napi::Env env) {
143
- Napi::Array array = Napi::Array::New(env);
144
- for(int i = 0; i < size; i++) {
145
- array[i] = Napi::Number::New(env, src[i]);
146
- }
147
- return array;
148
- }
149
-
150
- NODE_API_MODULE(NODE_GYP_MODULE_NAME, Init);
@@ -1,119 +0,0 @@
1
- #pragma once
2
- #ifndef SWEPH_H
3
- #define SWEPH_H
4
-
5
- #include <napi.h>
6
- #include <swephexp.h>
7
-
8
- void sweph_close(const Napi::CallbackInfo& info);
9
- void sweph_set_delta_t_userdef(const Napi::CallbackInfo& info);
10
- void sweph_set_ephe_path(const Napi::CallbackInfo& info);
11
- void sweph_set_jpl_file(const Napi::CallbackInfo& info);
12
- void sweph_set_sid_mode(const Napi::CallbackInfo& info);
13
- void sweph_set_tid_acc(const Napi::CallbackInfo& info);
14
- void sweph_set_topo(const Napi::CallbackInfo& info);
15
- Napi::String sweph_version(const Napi::CallbackInfo& info);
16
- Napi::String sweph_get_library_path(const Napi::CallbackInfo& info);
17
- Napi::Number sweph_get_tid_acc(const Napi::CallbackInfo& info);
18
- Napi::Value sweph_get_planet_name(const Napi::CallbackInfo& info);
19
- Napi::Value sweph_get_current_file_data(const Napi::CallbackInfo& info);
20
- Napi::Value sweph_get_orbital_elements(const Napi::CallbackInfo& info);
21
- Napi::Value sweph_get_ayanamsa(const Napi::CallbackInfo& info);
22
- Napi::Value sweph_get_ayanamsa_ut(const Napi::CallbackInfo& info);
23
- Napi::Value sweph_get_ayanamsa_ex(const Napi::CallbackInfo& info);
24
- Napi::Value sweph_get_ayanamsa_ex_ut(const Napi::CallbackInfo& info);
25
- Napi::Value sweph_get_ayanamsa_name(const Napi::CallbackInfo& info);
26
- Napi::Value sweph_calc(const Napi::CallbackInfo& info);
27
- Napi::Value sweph_calc_ut(const Napi::CallbackInfo& info);
28
- Napi::Value sweph_calc_pctr(const Napi::CallbackInfo& info);
29
- Napi::Value sweph_fixstar(const Napi::CallbackInfo& info);
30
- Napi::Value sweph_fixstar_ut(const Napi::CallbackInfo& info);
31
- Napi::Value sweph_fixstar_mag(const Napi::CallbackInfo& info);
32
- Napi::Value sweph_fixstar2(const Napi::CallbackInfo& info);
33
- Napi::Value sweph_fixstar2_ut(const Napi::CallbackInfo& info);
34
- Napi::Value sweph_fixstar2_mag(const Napi::CallbackInfo& info);
35
- Napi::Value sweph_nod_aps(const Napi::CallbackInfo& info);
36
- Napi::Value sweph_nod_aps_ut(const Napi::CallbackInfo& info);
37
- Napi::Value sweph_orbit_max_min_true_distance(const Napi::CallbackInfo& info);
38
- Napi::Value sweph_sol_eclipse_when_loc(const Napi::CallbackInfo& info);
39
- Napi::Value sweph_sol_eclipse_when_glob(const Napi::CallbackInfo& info);
40
- Napi::Value sweph_sol_eclipse_how(const Napi::CallbackInfo& info);
41
- Napi::Value sweph_sol_eclipse_where(const Napi::CallbackInfo& info);
42
- Napi::Value sweph_lun_occult_when_loc(const Napi::CallbackInfo& info);
43
- Napi::Value sweph_lun_occult_when_glob(const Napi::CallbackInfo& info);
44
- Napi::Value sweph_lun_occult_where(const Napi::CallbackInfo& info);
45
- Napi::Value sweph_lun_eclipse_when(const Napi::CallbackInfo& info);
46
- Napi::Value sweph_lun_eclipse_when_loc(const Napi::CallbackInfo& info);
47
- Napi::Value sweph_lun_eclipse_how(const Napi::CallbackInfo& info);
48
- Napi::Value sweph_rise_trans(const Napi::CallbackInfo& info);
49
- Napi::Value sweph_rise_trans_true_hor(const Napi::CallbackInfo& info);
50
- Napi::Value sweph_pheno(const Napi::CallbackInfo& info);
51
- Napi::Value sweph_pheno_ut(const Napi::CallbackInfo& info);
52
- Napi::Value sweph_azalt(const Napi::CallbackInfo& info);
53
- Napi::Value sweph_azalt_rev(const Napi::CallbackInfo& info);
54
- Napi::Value sweph_refrac(const Napi::CallbackInfo& info);
55
- Napi::Value sweph_refrac_extended(const Napi::CallbackInfo& info);
56
- Napi::Value sweph_vis_limit_mag(const Napi::CallbackInfo& info);
57
- Napi::Value sweph_heliacal_ut(const Napi::CallbackInfo& info);
58
- Napi::Value sweph_heliacal_pheno_ut(const Napi::CallbackInfo& info);
59
- Napi::Value sweph_julday(const Napi::CallbackInfo& info);
60
- Napi::Value sweph_revjul(const Napi::CallbackInfo& info);
61
- Napi::Value sweph_date_conversion(const Napi::CallbackInfo& info);
62
- Napi::Value sweph_utc_time_zone(const Napi::CallbackInfo& info);
63
- Napi::Value sweph_utc_to_jd(const Napi::CallbackInfo& info);
64
- Napi::Value sweph_jdet_to_utc(const Napi::CallbackInfo& info);
65
- Napi::Value sweph_jdut1_to_utc(const Napi::CallbackInfo& info);
66
- Napi::Value sweph_time_equ(const Napi::CallbackInfo& info);
67
- Napi::Value sweph_lmt_to_lat(const Napi::CallbackInfo& info);
68
- Napi::Value sweph_lat_to_lmt(const Napi::CallbackInfo& info);
69
- Napi::Value sweph_deltat(const Napi::CallbackInfo& info);
70
- Napi::Value sweph_deltat_ex(const Napi::CallbackInfo& info);
71
- Napi::Value sweph_house_name(const Napi::CallbackInfo& info);
72
- Napi::Value sweph_houses(const Napi::CallbackInfo& info);
73
- Napi::Value sweph_houses_ex(const Napi::CallbackInfo& info);
74
- Napi::Value sweph_houses_ex2(const Napi::CallbackInfo& info);
75
- Napi::Value sweph_houses_armc(const Napi::CallbackInfo& info);
76
- Napi::Value sweph_houses_armc_ex2(const Napi::CallbackInfo& info);
77
- Napi::Value sweph_house_pos(const Napi::CallbackInfo& info);
78
- Napi::Value sweph_gauquelin_sector(const Napi::CallbackInfo& info);
79
- Napi::Value sweph_sidtime(const Napi::CallbackInfo& info);
80
- Napi::Value sweph_sidtime0(const Napi::CallbackInfo& info);
81
- Napi::Value sweph_cotrans(const Napi::CallbackInfo& info);
82
- Napi::Value sweph_cotrans_sp(const Napi::CallbackInfo& info);
83
- Napi::Value sweph_degnorm(const Napi::CallbackInfo& info);
84
- Napi::Value sweph_radnorm(const Napi::CallbackInfo& info);
85
- Napi::Value sweph_csnorm(const Napi::CallbackInfo& info);
86
- Napi::Value sweph_split_deg(const Napi::CallbackInfo& info);
87
- Napi::Value sweph_difcsn(const Napi::CallbackInfo& info);
88
- Napi::Value sweph_difcs2n(const Napi::CallbackInfo& info);
89
- Napi::Value sweph_difdegn(const Napi::CallbackInfo& info);
90
- Napi::Value sweph_difdeg2n(const Napi::CallbackInfo& info);
91
- Napi::Value sweph_csroundsec(const Napi::CallbackInfo& info);
92
- Napi::Value sweph_d2l(const Napi::CallbackInfo& info);
93
- Napi::Value sweph_day_of_week(const Napi::CallbackInfo& info);
94
- Napi::Value sweph_cs2timestr(const Napi::CallbackInfo& info);
95
- Napi::Value sweph_cs2lonlatstr(const Napi::CallbackInfo& info);
96
- Napi::Value sweph_cs2degstr(const Napi::CallbackInfo& info);
97
- Napi::Value sweph_solcross(const Napi::CallbackInfo& info);
98
- Napi::Value sweph_solcross_ut(const Napi::CallbackInfo& info);
99
- Napi::Value sweph_mooncross(const Napi::CallbackInfo& info);
100
- Napi::Value sweph_mooncross_ut(const Napi::CallbackInfo& info);
101
- Napi::Value sweph_mooncross_node(const Napi::CallbackInfo& info);
102
- Napi::Value sweph_mooncross_node_ut(const Napi::CallbackInfo& info);
103
- Napi::Value sweph_helio_cross(const Napi::CallbackInfo& info);
104
- Napi::Value sweph_helio_cross_ut(const Napi::CallbackInfo& info);
105
-
106
- bool sweph_is_type(int type, Napi::Value data);
107
- bool sweph_type_check(const std::pair<int, const char*> types[], const Napi::CallbackInfo& info);
108
- bool sweph_double_array_converter(double *target, int size, Napi::Value data);
109
- Napi::Array sweph_js_array_converter(double *src, int size, Napi::Env env);
110
-
111
- enum TYPES {
112
- NUMBER,
113
- STRING,
114
- STRINGNULL,
115
- ARRAY,
116
- TRUEFALSE
117
- };
118
-
119
- #endif