/*************************************************/ /* */ /* File: M.cmd */ /* Purpose: Make the Messier catalog html files */ /* Author: Hartmut Frommert */ /* using ideas of Guy "Smiley" McArthur */ /* and contributions by Chris Kronberg */ /* */ /*************************************************/ /*************************************************/ /* First part parses for every Messier Project */ /*************************************************/ /* trace i */ DataFile = 'messier1.dat' Line.0 = 0 /* Read the DataFile .. */ src=Stream(DataFile, c, 'Open Read') do while Lines(DataFile) = 1 InL = Linein(DataFile) if \ abbrev(Inl,'#') then do Line.0 = Line.0+1 i=Line.0 Line.i = Inl end /* Do */ end /* do */ src=Stream(DataFile, c, 'Close') /* Parse the variables */ NObjects = Line.0 do i=1 to NObjects parse value Line.i with , number.i ngc.i .'"'const.i'"' con.i type.i subtype.i alpha.i a_min.i , delta.i d_min.i mag.i dim.i kly.i name.i if datatype(number.i, 'W') then FName.i = 'm' || number.i /* all but 102? */ else FName.i = 'ngc' || ngc.i /* M102? = NGC 5866 */ select when type.i=1 then do /* Open Cluster */ Desc.i = 'Open Cluster' TypeName.i = 'Cluster' type_link.i = 'cluster.html' TypeAbbr.i = 'OpCl' end /* Do */ when type.i=2 then do Desc.i = "Globular Cluster" TypeName.i = 'Cluster' type_link.i = 'cluster.html' TypeAbbr.i = 'GlCl' end /* Do */ when type.i=3 then do Desc.i = "Planetary Nebula" TypeName.i = 'Nebula' type_link.i = 'nebula.html' TypeAbbr.i = 'Pl N' end /* Do */ when type.i=4 then do Desc.i = "Diffuse Nebula" TypeName.i = 'Nebula' type_link.i = "nebula.html" TypeAbbr.i = 'DifN' end /* Do */ when type.i=5 then do Desc.i = "Spiral Galaxy" TypeName.i = 'Galaxy' type_link.i = "galaxy.html" TypeAbbr.i = 'Sp G' end /* Do */ when type.i=6 then do Desc.i = "Elliptical Galaxy" TypeName.i = 'Galaxy' type_link.i = "galaxy.html" TypeAbbr.i = 'El G' end /* Do */ when type.i=7 then do Desc.i = "Irregular Galaxy" TypeName.i = 'Galaxy' type_link.i = "galaxy.html" TypeAbbr.i = 'IrrG' end /* Do */ when type.i=8 then do Desc.i = "Lenticular (S0) Galaxy" TypeName.i = 'Galaxy' type_link.i = "galaxy.html" TypeAbbr.i = "S0 G" end /* Do */ when type.i=9 then do /* M1 */ Desc.i = "Supernova Remnant" TypeName.i = 'Nebula' type_link.i = "nebula.html" TypeAbbr.i = 'SNR' end /* Do */ when type.i=A then do /* M73 */ Desc.i = "Group or Asterism of 4 Stars" TypeName.i = 'Cluster, Asterism' type_link.i = "cluster.html" TypeAbbr.i = '4 St' end /* Do */ when type.i = B then do /* M24 */ Desc.i = "Milky Way Patch" TypeName.i = 'Milky Way, Star Cloud' type_link.i = "cluster.html" TypeAbbr.i = "MWP" end /* Do */ when type.i=C then do /* M40 */ Desc.i = "Double Star" TypeName.i = 'Binary Star' type_link.i = "cluster.html" TypeAbbr.i = '2 St' end /* Do */ otherwise say 'Undefined type number:' type.i; exit end /* select */ end /* do */ /******************************************************/ /* The following is to be modified in each project .. */ /******************************************************/ FilePrefix = 'm' /* name it 'm###.html' here */ DeDir = 'http://www.maa.mhn.de/Messier/D/' ItDir = 'http://astrolink.mclink.it/messier/m/' FrDir = 'http://www.obspm.fr/messier/f/' /* EnDir = 'http://messier.seds.org/m/' */ /* SEDS */ /* EnDir = 'http://www.maa.mhn.de/Messier/E/' */ /* MAA */ /* EnDir = 'http://www.obspm.fr/messier/m/' */ /* fr */ /* Write the HtmlFiles */ do i=1 to NObjects /* do i=101 to 105 */ HtmlFile = FName.i || '.html' /* Assign the Output File */ src=Stream(HtmlFile, c, 'Open Write') /* .. and open it */ /* say line.i */ /* and now write .. */ call WriteHtml '' if number.i = '102?' then do Num = 102 ImageName = 'ngc5866' dssmName = 'm102' call WriteHtml 'NGC 5866 (Messier 102 ?)' end /* then do */ else do Num = number.i+0 ImageName = 'm' || Num if Num < 10 then dssmName = 'm0' || Num else dssmName = 'm' || Num call WriteHtml 'Messier Object' Num'' end /* else do */ say 'M' Num call WriteHtml '' select when Num = 24 then do NgcStr = 'NGC 6603' end when Num = 25 then do NgcStr = 'IC 4725' end when Num = 40 then do NgcStr = 'WNC 4, Winnecke 4' end when Num = 45 then do NgcStr = '' end when number.i = 102 then do NgcStr = 'NGC 5866, M101, NGC 5457' end otherwise do NgcStr = 'NGC' ngc.i end end /* select */ if name.i \= "" then NgcStr = NgcStr || ',' strip(name.i) Keywords = 'Astronomy, Deep Sky, Messier, Messier' Num || ',' FName.i || , ', m' || Num || ',' Desc.i || ',' NgcStr || ',' TypeName.i || , ', Observing, SEDS' /* (c) Chris Kronberg ;-) */ call WriteHtml '' call WriteHtml '' call WriteHtml '' call WriteHtml '' call WriteHtml call WriteHtml '' call WriteHtml '' call WriteHtml '[de]' call WriteHtml '' call WriteHtml '[it]' call WriteHtml '' call WriteHtml '[fr]' call WriteHtml '

' call WriteHtml call WriteHtml '

' call WriteHtml '

' if number.i = '102?' then call WriteHtml 'NGC 5866 (M102 ?)' else call WriteHtml 'M' Num call WriteHtml '

' call WriteHtml select when Num = 24 then NgcStr = '(contains NGC' ngc.i || ')' when Num = 25 then NgcStr = '(IC 4725)' when Num = 40 then NgcStr = '(WNC 4)' when Num = 45 then NgcStr = '' otherwise NgcStr = '(NGC' ngc.i || ')' end /* select */ if subtype.i = "-" then TypeStr = "" else if type.i = 2 then TypeStr = ", class" subtype.i"," /* Globulars */ else if type.i = 4 then do /* Diffuse Nebulae */ select when subtype.i = "E" then TypeStr = ", an emission nebula," when subtype.i = "R" then TypeStr = ", a reflection nebula," otherwise /* subtype = "E+R" */ TypeStr = ", an emission and reflection nebula," end /* select */ end /* Do */ else TypeStr = ", type" subtype.i"," if number.i = '102?' then call WriteHtml , ''Desc.i' NGC 5866 (M102 ?)' , || TypeStr else if number.i = 102 then call WriteHtml , 'Galaxy M102' else call WriteHtml ''Desc.i' M' , || Num NgcStr'' || TypeStr if number.i \= 102 then do call WriteHtml 'in ' || const.i || '' if name.i \= '' then do call WriteHtml '

' call Writehtml '' || name.i || '' end /* Do */ end /* Do */ call WriteHtml '

' call WriteHtml call WriteHtml '

' if number.i = 102 then do /* M102: Image centered, no table .. */ call WriteHtml '

' call WriteHtml '' call WriteHtml '[m102.jpg]' call WriteHtml '
' end /* Do */ else do /* table left, image right aligned; all but "m102.html" */ call WriteHtml '' call WriteHtml '[' || ImageName || '.jpg]' /* write the data table */ call WriteHtml '' call WriteHtml ' ' call WriteHtml ' ' call WriteHtml ' ' call WriteHtml ' ' call WriteHtml ' ' call WriteHtml ' ' call WriteHtml ' ' call WriteHtml ' ' call WriteHtml ' ' call WriteHtml ' ' call WriteHtml ' ' call WriteHtml ' ' call WriteHtml ' ' call WriteHtml ' ' call WriteHtml ' ' call WriteHtml ' ' call WriteHtml '
Right Ascension'alpha.i ':' a_min.i' (h:m)
Declination'delta.i ':' d_min.i' (deg:m)
Distance'kly.i' (kly)
Visual Brightness'mag.i' (mag)
Apparent Dimension'dim.i' (arc min)
' end /* Do */ call WriteHtml call WriteHtml '

' call WriteHtml call WriteHtml '' /* Now input Text, if exists */ TextName = TextExists(FName.i) if TextName \= '' then call TextInput TextName else call WriteHtml '->Type Text Description and Information HERE<-' call WriteHtml '' call WriteHtml '
' call WriteHtml call WriteHtml '

' call WriteHtml '


' call WriteHtml 'Hartmut Frommert' call WriteHtml '(spider@seds.org)' call WriteHtml '
' call WriteHtml 'Christine Kronberg' call WriteHtml '(smil@agleia.de)' call WriteHtml '

' call WriteHtml call WriteHtml '

' call WriteHtml '' || , '[SEDS]' call WriteHtml '' || , '[MAA]' call WriteHtml '' || , '[Home]' call WriteHtml select /* previous object */ when number.i = 1 then j = NObjects when number.i = 103 then j = 102 otherwise j = i-1 end /* select */ call WriteHtml '' || , '[M' Number.j + 0 || ']' select /* next object */ when number.i = 102 then j = 104 /* M103 */ when number.i = 110 then j = 1 otherwise j = i+1 end /* select */ call WriteHtml '' || , '[M' Number.j + 0 || ']' /* Next Cluster */ do j=i+1 to NObjects while ((type.j \= 1) & (type.j \= 2) & , (type.j \= 'A') & (type.j \= 'B') & (type.j \= 'C')) end /* do */ if j > NObjects then j=2 call WriteHtml '' || , '[Next Cluster]' /* Next Nebula */ do j=i+1 to NObjects while ((type.j \= 3) & (type.j \= 4) & (type.j \= 9)) end /* do */ if j > NObjects then j=1 call WriteHtml '' || , '[Next Nebula]' /* Next Galaxy */ do j=i+1 to NObjects while ((type.j \= 5) & (type.j \= 6) & , (type.j \= 7) & (type.j \= 8)) end /* do */ if number.j='102?' then j=105 /* M104 */ if j > NObjects then j=31 call WriteHtml '' || , '[Next Galaxy]' if number.i = '102?' then do call WriteHtml '' || , '[Image Browser]' call WriteHtml '' || , '[DSSM]' end /* Do */ else do call WriteHtml '' || , '[Image Browser]' call WriteHtml '' || , '[DSSM]' end /* Do */ call WriteHtml '' || , '[Indexes]' /* JPegName = JPegExists(ImageName) */ /* if JPegName \= '' then , */ call WriteHtml '' || , '[PNG Image]' call WriteHtml '
' call WriteHtml '

' call WriteHtml call WriteHtml 'Last Modification:' date()',' substr(time(),1,5) 'MET' call WriteHtml call WriteHtml '' src=Stream(HtmlFile, c, 'Close') /* Close Output File. */ end /* do i=1 to NObjects */ exit /* !! EXIT PROGRAM !! */ TextExists: procedure TextDir = '.text\' TextEnd = 'text.htm' /* Text files have name: "m###text.htm" */ parse arg TextName PathName = TextDir || TextName || TextEnd PathName = Stream(PathName, c, 'Query Exist') return PathName TextInput: procedure expose HtmlFile parse arg TextName src = Stream(TextName, c, 'Open Read') do while Lines(TextName) = 1 line = LineIn(TextName) if \ abbrev(line,'#') , /* allow for comments starting with "#" */ then call WriteHtml line end /* do */ src = Stream(TextName, c, 'Close') return WriteHtml: procedure expose HtmlFile CrLf = d2c(13) || d2c(10) parse arg line line = line || CrLf fs = CharOut(HtmlFile,line,) return JPegExists: procedure /* jpg's are "../jpg/m##.jpg", if they exist */ JPegDir = '..\jpg\' parse arg ImageName PathName = JPegDir || ImageName || '.jpg' PathName = Stream(PathName, c, 'Query Exist') return PathName