hawk.ro / stories / Snoopy calendar

Adventures with Snoopy Calendar

2015-09-12

I found out about Snoopy Calendar from Virtually Fun. In fact, it seemed somewhat familiar, but only now I found out the story and the source. And that of course got me into the mood to make one for myself. On real fan-fold paper, of course. Sadly, I don't have a real Line Printer in my collection, a more usual Epson dot matrix will have to do. However, from idea to practice, there are some more steps. I somehow missed the modified source and, downloading the PDP-11 source from the link provided, I tried it on VMS. The first problems were quite easy to solve - some leftover junk (NULs) at the end of the file and the file open commands that included device (?) specifiers (U:SNPCAL.DAT instead of just SNPCAL.DAT). Eventually everything worked and I ended up with a brand new SNPCAL.OUT file.
That was the easy part.

However, all was not well, since (as it can be seen on most pages showing the output) pictures don't look quite right. The most obvious example is (assuming a one year calendar) just before April. This:

1OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
+                                                                                                                                    
 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
+                                                                                                                                    
 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
+                                                               $$$$$$$                                                              
 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
+                                                           $$$$$$$$$$$$$$$                                                          
 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
+                                                         $$$$$$$$$$$$$$$$$$                                                         
 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
+                                                         $$$$$$$$$$$$$$$$$$                                                         
 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
+                                   $$$$                    $$$$$$$$$$$$$$$                                                          
 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
+                                 $$$$ $$                            $$$$$                                                           
 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
+                              $$$$$$ $$$                          $$$$$$                                                            
 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
+                             $$$$$$ $$$                        $$$$$$$$                                                             
 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
+                           $$$$$$$ $$$              $$$$$$   $$$$$$       $$$$$$$$$$$$$                                             
 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO            OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
+                          $$$$$$$$$$$           $$$$$$$$$$$$$$$$        $$            $$$$                                          
 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO            OOOOOOOOOO                 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
+                         $$$$$$$$$$$           $$             $$$$$$$$$$                 $$                                         
 OOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOO        OO                                 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
+                       $$$ $$$$$$$$          $$        $$                                 $$                                        
 OOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOO        OO                                   OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
+                      $$$ $$$$$$$$          $$        $$                                   $$                                       
 OOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOO        OO                     OOOOOOOOO       OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
+                     $$$$ $$$$$$           $$        $$                     $$$$$$$$$       $$                                      
 OOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOO                               OOOOOOOOOOOO      OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
+                    $$$$ $$$$$$          $$$                               $$$$$$$$$$$$      $$                                     
 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO                OO            OOOOOOOOOOOO      OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
+                    $$$$$$$$$$$$$$$$$$$$$$$$$                $$            $$$$$$$$$$$$      $$                                     
 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO                OO                              OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
+                    $$$$$$$$$$$$$$$$$$$$$$$$$                $$                              $$                                     
 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO                 OO                     OO     OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
+                     $$$$$$$$$$$$$$$$$$$$$$$$                 $$                     $$     $$                                      
 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO                  OO                   OO     OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
+                       $$$$$$$$$$$$$$$    $$$                  $$                   $$     $$                                       
 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO                    OO              OOO    OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
+                                           $$                    $$              $$$    $$$                                         
 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO                    OO    OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
+                                            $$                    $$    $$$$$$$$$$$$$$$$                                            
 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO                 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
+                                              $$$$                 $$$$$$$                                                          
 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO              OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
+                                                 $$$$$              $$$              $$$$                                           
<SNIP>
just doesn't look right. It seems that each second line should overwrite the one above it. I happen to see this effect from time to time in HTML displayed fortunes, with underline:
"At least they're ___________EXPERIENCED incompetents"

The '+' sign at the beginning suggests that it might be a command for some printers. Indeed, after a short search I learn about ASA carriage control characters.
At first I think about modifying the snpcal.dat file in order to replace 1 with FORM-FEED (^L, 0x0c), but the problem is with overwriting lines. They could contain just CR instead of CRLF, however, it's only after the newline has been emitted that the program gets to the '+'. As SNPPIC is written, it outputs a full line before processing the next one, so this would mean non-trivial modifications to it. An easier approach would be to write a simple filter program that would reprocess the file and convert it to proper ASCII control codes (FORM-FEED and avoidance of LF on lines starting with '+').

I transferred (using FTP ASCII) the file from emulated VAX to a contemporary computer and ran the filter on it. Once this was done, the output did look much better:

(luckily my networked Laser printer still has Epson emulation)

Only later did I find that such a filter program already exists.
Eventually, what I want to do is print this from a real VAX on a true A3 fanfold printer (the Epson mentioned above) in order to have a calendar to tape on my office wall. (I don't want to pretend I'm a real programmer, that's why mine will be 2015). I wanted to transfer my "filter" program to VMS when I noticed something odd: when using vi (on VMS) to look at the SNPCAL.OUT file, it would begin with ^L instead of 1. When using TYPE SNPCAL.OUT the result would also miss the strange 1 and the picture above would look like this:

                                                               $$$$$$$                                                              
                                                           $$$$$$$$$$$$$$$                                                          
                                                         $$$$$$$$$$$$$$$$$$                                                         
                                                         $$$$$$$$$$$$$$$$$$                                                         
                                   $$$$                    $$$$$$$$$$$$$$$                                                          
                                 $$$$ $$                            $$$$$                                                           
                              $$$$$$ $$$                          $$$$$$                                                            
                             $$$$$$ $$$                        $$$$$$$$                                                             
                           $$$$$$$ $$$              $$$$$$   $$$$$$       $$$$$$$$$$$$$                                             
                          $$$$$$$$$$$           $$$$$$$$$$$$$$$$        $$            $$$$                                          
                         $$$$$$$$$$$           $$             $$$$$$$$$$                 $$                                         
                       $$$ $$$$$$$$          $$        $$                                 $$                                        
                      $$$ $$$$$$$$          $$        $$                                   $$                                       
                     $$$$ $$$$$$           $$        $$                     $$$$$$$$$       $$                                      
                    $$$$ $$$$$$          $$$                               $$$$$$$$$$$$      $$                                     
                    $$$$$$$$$$$$$$$$$$$$$$$$$                $$            $$$$$$$$$$$$      $$                                     
                    $$$$$$$$$$$$$$$$$$$$$$$$$                $$                              $$                                     
                     $$$$$$$$$$$$$$$$$$$$$$$$                 $$                     $$     $$                                      
                       $$$$$$$$$$$$$$$    $$$                  $$                   $$     $$                                       
                                           $$                    $$              $$$    $$$                                         
                                            $$                    $$    $$$$$$$$$$$$$$$$                                            
                                              $$$$                 $$$$$$$                                                          
                                                 $$$$$              $$$              $$$$                                           
                                                     $$$$$          $$              $$  $   $$$                                     
                                                          $$        $$              $$  $$$$$$$$$                                   
                                                           $$       $$              $$  $       $$$                                 
                                                             $$$$$$$$$$           $$           $$$$                                 
<SNIP>

This might be familiar to people more experienced on VMS but it was new to me. Eventually I learned that VMS has a special attribute called "Fortran carriage control" (as revealed by DIR/FULL command) that would convert the ASA Carriage Control Characters on certain operations. Of course, as with all automatic conversions this happens only in some circumstances: vi would see the ASCII (converted) version while EDIT/TPU would see the original ASA CCC version. ASCII transfer with FTP will get the unconverted version, but zip file encapsulation (FTP BINARY transfer is mostly useless between VMS and Unix/Windows) will get the modified version. In the end this means that my little filter program was twice useless.
But that doesn't matter, I learned a lot of 'old new things' that I never knew existed.1

Another matter is the starting day. Here in Romania we are used to calendars starting on Monday, not Sunday (my .profile includes alias cal='cal -m'). This means that I would have to (blasphemy!) modify the program. Well, I don't mind being a little blashpemous. Two modifications were needed: one in the snpcal.dat (I simply shifted the days2) and the other in snpcal.for, where IDOW is computed. Luckily the name of the variable was quite clear, and the formula that multiplies by 4, 100 and 400 was a giveaway, a -1 at the end shifted the computed day of week in the new position.

(This will be continued with pictures of the VAX and printer setup, as well as the picture of the calendar taped to the wall)

The second part is done.


1 beside Fortran carriage control, this was the first time I attempted printing from within VMS, and also from withing simh. Not very difficult but first the queue system had to be initialized with START/QUEUE/MANAGER/NEW_VERSION, then a queue had to be created INITIALIZE/QUEUE/NODEFAULT/START/ON=LPA0: SYS$PRINT

2 however, I had to pay attention to the way the file is structured, the records read are 66 chars long, but the lines are 80 chars long; as a related note, it is quite interesting to see how the original programmer worked around the lack of string operations.


Published 2015-09-12 by Mihai Gaitos - contacthawk.ro