home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / hypercar / science / almanac.sit / Almanac.sw / stack_-1.xml < prev   
Encoding:
Extensible Markup Language  |  1991-04-23  |  12.0 KB  |  16 lines

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE stack PUBLIC "-//Apple, Inc.//DTD stack V 2.0//EN" "" >
  3. <stack>
  4.     <name>in.sw</name>
  5.     <id>-1</id>
  6.     <cardCount>16</cardCount>
  7.     <cardID>2966</cardID>
  8.     <listID>7378</listID>
  9.     <cantModify><false /></cantModify>
  10.     <cantDelete><false /></cantDelete>
  11.     <cantAbort><false /></cantAbort>
  12.     <cardSize>
  13.         <width>512</width>
  14.         <height>342</height>
  15.     </cardSize>
  16.     <script>on openStack
  17. global force,intl,total
  18. put false into c1
  19. if the number of this cd Γëá 1 then
  20. push cd
  21. put true into c1
  22. go first cd
  23. end if
  24. createMenu
  25. put 0 into total
  26. set lockscreen to true
  27. set lockmessages to true
  28. push cd
  29. go second cd
  30. if number of cd flds >0 then put 1 into total
  31. pop cd
  32. set lockscreen to false
  33. set lockmessages to false
  34. put 0 into force
  35. hide message box
  36. put the seconds/86400 + 16480.5 + DSTCheck()/24 into jd2
  37. put trunc(jd2+24000000) +1 into jd
  38. get the long date
  39. if first word of cd fld daily is not in it then
  40. beep
  41. put "Polynomials are outdated..."
  42. wait 1 sec
  43. hide message box
  44. end if
  45. -- international stuff
  46. put "Dimanche,Lundi,Mardi,Mercredi,Jeudi,Vendredi,Samedi" into frdays
  47. put empty into intl
  48. if first word of it is in frdays then put "Fr" into intl
  49. get the date
  50. if it contains "." then put "De" into intl
  51. if char 1 of second word of the long date is in "0123456789" and ┬¼
  52. intl is empty then put "Au" into intl
  53. convert it to dateItems
  54. put item 2 of it into m
  55. put item 3 of it into d
  56. -- end intl determination
  57. put false into val
  58. if intl = "Au" then
  59. if m<=4 or m>10 then put true into val
  60. put trunc(jd-7*trunc(jd/7)) into w
  61. if m=10 and d>=w-1 then put true into val
  62. if m=4 and (d-w)>=25 then put false into val
  63. end if
  64. if intl is empty then
  65. if m>4 and m<=10 then put true into val
  66. put trunc(jd-7*trunc(jd/7)) into w
  67. if m=4 and d>=w-1 then put true into val
  68. if m=10 and (d-w)>=25 then put false into val
  69. end if
  70. set hilite of bkgnd button "DST" of cd origin to val
  71. if val then
  72. put "D" into char 3 of last word of cd fld coords of cd origin
  73. else
  74. put "S" into char 3 of last word of cd fld coords of cd origin
  75. end if
  76. if the short name of this cd is "origin" then
  77. put line 2 of cd fld "Algol" into ecl
  78. repeat
  79. if ecl > jd2 then exit repeat
  80. add 2.8673075 to ecl
  81. end repeat
  82. set numberFormat to "0.0"
  83. put "Next minimum of Algol occurs in" && (ecl-jd2)*24 &&┬¼
  84. "hours at JD=" into line 1 of cd fld Algol
  85. set numberFormat to "0.###"
  86. put ecl+2400000 after line 1 of cd fld Algol
  87. put ecl into line 2 of cd fld Algol
  88. end if
  89. if c1 then pop cd
  90. end openStack
  91.  
  92. on closeStack
  93. if "Object" is in the menus then delete menu "Object"
  94. pass closeStack
  95. end closeStack
  96.  
  97. function nDate Uflag,Jflag,n
  98. -- Uflag =0 for no UT, 1 for UT
  99. -- Jflag =12 for JT, 0 for no JT
  100. -- n = # days after given date
  101. global intl
  102. get the seconds
  103. add 86400*n+3600*(Jflag+Uflag*DSTcheck()) to it
  104. convert it to long date
  105. if intl = "De" then
  106. put char 1 to (offset(".",second word of it)-1) of second word of it ┬¼
  107. && third word of it && last word of it into he
  108. else if intl = "Fr" or intl = "Au" then
  109. put second word of it && third word of it && last word of it into he
  110. else
  111. put char 1 to (offset(",",third word of it)-1) of third word of it ┬¼
  112. && second word of it && last word of it into he
  113. end if
  114. return he
  115. end nDate
  116.  
  117. on createMenu
  118. if there is a menu "Object" then exit createMenu
  119. create menu "Object"
  120. put createMenuItems() into menu "Object" with menuMsg createMenuMsgs()
  121. end createMenu
  122.  
  123. function createMenuItems
  124. return "Sun" & return & "Moon" & return & "Mercury" & return & ┬¼
  125. "Venus" & return & "Mars" & return & "Jupiter" & return & ┬¼
  126. "Saturn" & return & "Uranus" & return & "Neptune" & return
  127. end createMenuItems
  128.  
  129. function createMenuMsgs
  130. return "go cd sun" & return & "go cd moon" & return & "go cd mercury" ┬¼
  131. & return & "go cd venus" & return & "go cd mars" & return & ┬¼
  132. "go cd jupiter" & return &  "go cd saturn" & return & "go cd uranus" ┬¼
  133. & return & "go cd neptune"
  134. end createMenuMsgs
  135.  
  136. function rnd10 x
  137. return round(x*10)/10
  138. end rnd10
  139.  
  140. function DSTcheck
  141. get first word of line 4 of cd fld Coords of cd origin
  142. if hilite of bkgnd button "DST" of cd origin
  143. then put it-1 into temp
  144. else put it into temp
  145. return temp
  146. end DSTcheck
  147.  
  148. function frac x
  149. return x-trunc(x)
  150. end frac
  151.  
  152. function sgn x
  153. if x<0 then
  154. get -1
  155. else if x=0 then
  156. get 0
  157. else if x>0 then
  158. get 1
  159. end if
  160. return it
  161. end sgn
  162.  
  163. function sind n
  164. return sin((n mod 360)*pi/180)
  165. end sind
  166.  
  167. function cosd n
  168. return cos((n mod 360)*pi/180)
  169. end cosd
  170.  
  171. function tand n
  172. return tan((n mod 360)*pi/180)
  173. end tand
  174.  
  175. on dayOfYear
  176. -- returns day, dayUT as number of day in year
  177. global dayUT,day,daySecs,intl
  178. put the date into daysecs
  179. if intl is "De" then
  180. put "31.12." into pJan0
  181. else if intl is "Fr" or intl = "Au" then
  182. put "31/12/" into pJan0
  183. else
  184. put "12/31/" into pJan0
  185. end if
  186. get number of chars of the date
  187. put pJan0 & (char it-1 to it of the date)-1 into Jan0
  188. convert daySecs to seconds
  189. convert Jan0 to seconds
  190. put (daySecs-Jan0)/86400 into day
  191. put (daySecs-Jan0+3600*DSTcheck())/86400 into dayUT
  192. end dayOfYear
  193.  
  194. on cheb a,b,c
  195. global x,xa,xb
  196. put 2*x*a-b+c into temp
  197. put a into xb
  198. put temp into xa
  199. end cheb
  200.  
  201. on UT
  202. global day,daySecs,x,xa,xb,m
  203. dayOfYear -- gets daySecs
  204. get ((the seconds-daySecs)/3600+DSTcheck())mod 24
  205. put trunc(it) into h
  206. put trunc(60*(it-h)) into m
  207. if m<10 then put "0" before m
  208. if h=0 then put "0" before h
  209. put "Universal Time = "& h &":" & m into line 1 of fld UT
  210. put it into line 2 of fld UT
  211. end UT
  212.  
  213. on ST
  214. global day,daySecs,x,xa,xb,dayUT
  215. dayOfYear -- gets day
  216. put (dayUT-1)/183-1 into x
  217. put 0 into a
  218. put 0 into b
  219. put 7 into i
  220. repeat until i=0
  221. cheb a,b,word i+1 of cd fld "Sidereal Cheb" of cd origin
  222. put xa into a
  223. put xb into b
  224. subtract 1 from i
  225. end repeat
  226. put xb into b2
  227. cheb a,b,word 1 of cd fld "Sidereal Cheb" of cd origin
  228. get ((xa-b2)/2+((the seconds-daySecs)/3600+DSTcheck())*1.00273791+┬¼
  229. (line 2 of cd fld "coords" of cd origin)/15+24) mod 24
  230. put trunc(it) into h
  231. put trunc(60*(it-h)) into m
  232. if m<10 then put "0" before m
  233. if h=0 then put "0" before h
  234. put "Sidereal Time = "& h &":" & m into line 1 of fld ST
  235. put it into line 2 of fld ST
  236. end ST
  237.  
  238. on hm decv,arg
  239. global h,m
  240. put trunc(arg) into h
  241. put trunc(60*(arg-h)) into m
  242. if decv then put abs(m) into m
  243. if m<10 then put "0" before m
  244. end hm
  245.  
  246. function atanq x,y
  247. get atan(y/x)
  248. if x>0 then add pi to it
  249. return it mod (2*pi)
  250. end atanq
  251.  
  252. on moonpos
  253. global t,dra,decra,dec,fac
  254. set cursor to busy
  255. put 218.32+481267.883*t+6.29*sind(134.9+477198.85*t)-1.27*┬¼
  256. sind(259.2-413335.38*t)+.66*sind(235.7+890534.23*t)+.21*sind(¬
  257. 269.9+954397.7*t)-.19*sind(357.5+35999.05*t)-.11*sind(186.6+¬
  258. 966404.05*t) into lambda
  259. put 5.13*sind(93.3+483202.03*t)+.28*sind(228.2+960400.87*t)┬¼
  260. -.28*sind(318.3+6003.18*t)-.17*sind(217.6-407332.2*t) into beta
  261. put cosd(beta)*cosd(lambda) into l
  262. set cursor to busy
  263. put .9175*cosd(beta)*sind(lambda)-.3978*sind(beta) into m
  264. put .3978*cosd(beta)*sind(lambda)+.9175*sind(beta) into n
  265. put (180+atanq(l,m)/fac) mod 360 into dra
  266. put dra/15 into decra
  267. put atan(n/sqrt(1-n*n))/fac into dec
  268. end moonpos
  269.  
  270. on calc num,force
  271. global day,daySecs,x,xa,xb,dayUT,it,h,m,mode,t,dec,decra,dra,fac,cdata
  272. -- calcs ra and dec, force =1 means do it anyway
  273. set cursor to 1001
  274. dayOfYear -- gets day,dayUT
  275. put pi/180 into fac
  276. get line 3 of fld UT
  277. put line 1 of cd fld "Coords" of cd origin into lat
  278. if (it=trunc(dayUT) and the optionkey is up) and force=0 then
  279. put line 5 of fld Pos into dra
  280. put line 6 of fld Pos into dec
  281. put line 3 of fld rise into arg
  282. else
  283. set cursor to 1002
  284. put trunc(dayUT) into line 3 of fld UT
  285. if short name of this cd is "Moon" then
  286. -- Moon calcs from A.A.
  287. put ((last word of line 1 of fld JD)-2451545)/36525 into t
  288. moonpos
  289. -- lines for asteroid calcs
  290. else if number of this cd >10 and number of this cd <13 then
  291. -- get the vars, put into decra and dec
  292. ccalc
  293. put char 24 to 25 of cdata into rh
  294. put char 27 to 30 of cdata into rm
  295. put char 35 to 36 of cdata into dh
  296. put char 38 to 39 of cdata into dm
  297. put "Magnitude = "&last word of cdata into cd fld mag
  298. put rh+rm/60 into decra
  299. put decra*15 into dra
  300. put dh+dm/60 into dec
  301. if char 34 of cdata is "-" then
  302. put -dec into dec
  303. end if
  304. else
  305. put (dayUT+((the seconds-daySecs)/3600+DSTcheck())/24-1)/183-1 ┬¼
  306. into x
  307. put 0 into a
  308. put 0 into b
  309. put num into i
  310. repeat until i=0
  311. set cursor to busy
  312. cheb a,b,word i+1 of fld "ra cheb"
  313. put xa into a
  314. put xb into b
  315. subtract 1 from i
  316. end repeat
  317. put xb into b2
  318. cheb a,b,word 1 of fld "ra cheb"
  319. put (((xa-b2)/2+48) mod 24) *15 into dra
  320. put dra/15 into decra
  321. put 0 into a
  322. put 0 into b
  323. put num into i
  324. repeat until i=0
  325. set cursor to busy
  326. cheb a,b,word i+1 of fld "dec cheb"
  327. put xa into a
  328. put xb into b
  329. subtract 1 from i
  330. end repeat
  331. put xb into b2
  332. cheb a,b,word 1 of fld "dec cheb"
  333. get (xa-b2)/2
  334. put it into dec
  335. --addition for distance
  336. put 0 into a
  337. put 0 into b
  338. put num into i
  339. repeat until i=0
  340. set cursor to busy
  341. cheb a,b,word i+1 of fld "dist cheb"
  342. put xa into a
  343. put xb into b
  344. subtract 1 from i
  345. end repeat
  346. put xb into b2
  347. cheb a,b,word 1 of fld "dist cheb"
  348. get (xa-b2)/2
  349. put it into line 3 of fld dmag
  350. put trunc(1000*it) into dist
  351. get number of chars of dist
  352. put char 1 to (it-3) of dist & "." & char (it-2) to it of dist ┬¼
  353. into dist
  354. put "Earth -"&&short name of this cd&&"Distance ="&&dist&&"A.U."┬¼
  355. into line 1 of fld DMag
  356. end if
  357. if "Sun" is in short name of this cd then
  358. --1.9 now give the user a choice
  359. repeat with ii=20 to 22
  360. if hilite of btn id ii then put ii-19 into argt
  361. end repeat
  362. put item argt of "-.104528,-.207912,-.309017" into val
  363. get (val-sind(lat)*sind(dec))/(cosd(lat)*cosd(dec))
  364. put abs(atan(sqrt(1-it*it)/it)) into ang
  365. if -.20791<sind(lat)*sind(dec) then put pi-ang into ang
  366. put ang/fac/15 into delta
  367. put (dra/15+(line 2 of fld UT)-line 2 of fld 2+24-DSTcheck()) ┬¼
  368. mod 24 into arg
  369. get arg-delta
  370. put it into line 3 of cd fld twilight
  371. hm false,it
  372. ampm
  373. put "Twilight begins at "& h &":" & m && mode into line 1 of┬¼
  374. cd fld twilight
  375. get arg+delta
  376. put it into line 4 of cd fld twilight
  377. hm false,it
  378. ampm
  379. put "Twilight ends    at "& h &":" & m && mode into line 2 of ┬¼
  380. cd fld twilight
  381. end if
  382. put dra into line 5 of fld Pos
  383. hm false,decra
  384. put short name of this cd &" R.A. = "& h &"h " & m &"m"into┬¼
  385. line 1 of fld Pos
  386. put dec into line 6 of fld Pos
  387. put empty into sign
  388. if dec<0 and dec>-1 then put "-" into sign
  389. if dec>0 then put "+" into sign
  390. hm true,dec
  391. put short name of this cd&" Dec.  = "&sign&h&"┬░ "&m&"'" ┬¼
  392. into line 2 of fld Pos
  393. get -sind(lat)*sind(dec)/cosd(lat)/cosd(dec)
  394. put atan(sqrt(1-it*it)/it) into ang
  395. put dec>0 into d1
  396. put lat>0 into d2
  397. if d1 is d2 then
  398. add pi to ang
  399. end if
  400. put ang/fac/15 into delta
  401. put dra/15+line 2 of fld UT-line 2 of fld ST+24-DSTcheck() into arg
  402. get (arg-delta) mod 24
  403. put arg into line 3 of fld rise
  404. put it into line 4 of fld rise
  405. hm false,it
  406. ampm
  407. put short name of this cd && "Rises at "& h &":" & m && mode ┬¼
  408. into line 1 of fld rise
  409. get (arg+delta) mod 24
  410. put it into line 5 of fld rise
  411. hm false,it
  412. ampm
  413. put short name of this cd && "Sets  at "& h &":" & m && mode into ┬¼
  414. line 2 of fld rise
  415. set cursor to 1001
  416. end if
  417. -- calc alt and az of object
  418. put ((360+15*(line 2 of fld ST)-dra) mod 360) into LHA
  419. put cosd(LHA)*sind(lat)-tand(dec)*cosd(lat) into den
  420. put round(atanq(den,sind(LHA))/fac) into temp
  421. put sind(lat)*sind(dec)+cosd(lat)*cosd(dec)*cosd(LHA) into sina
  422. if abs(sina)<1 then
  423. put round(atan(sina/(sqrt(1-sina*sina)))/fac) into alt
  424. if alt>0 then
  425. put "Az. = "& temp into line 3 of fld Pos
  426. put "Alt. = " & alt into line 4 of fld Pos
  427. else
  428. if temp>180
  429. then put "W" into tem
  430. else put "E" into tem
  431. put "below " & tem & " horizon" into line 3 of fld Pos
  432. put empty into line 4 of fld Pos
  433. end if
  434. else
  435. beep
  436. end if
  437. set cursor to 1
  438. end calc
  439.  
  440. on ccalc
  441. global cdata
  442. put the seconds into t
  443. add DSTcheck()*3600 to t
  444. convert t to dateitems
  445. put item 2 of t into m
  446. if m<10 then put space before m
  447. put item 3 of t into d
  448. if d<10 then put space before d
  449. put m&"/"&d&".0/ "&item 1 of t into mask
  450. put line 2 of fld planet into