home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
y
/
yearcalc.zip
/
YEARCAL.DOC
< prev
next >
Wrap
Text File
|
1987-12-02
|
14KB
|
275 lines
/***************************************************************/
YEARCAL v0.04T 2 Nov 1987
Copyright 1987 by Paul M. Sittler
YEARCAL makes calendars (A) and schedules (M/W/D) for years after 1901.
At the user's option, Normal, Fiscal Year, AGGIE, or 3-Digit Julian
Date Calendars can be produced, in multiple copies, for a number of
consecutive years, or both. Fiscal Year calendars may be produced for
any arbitrary 12 or 13 month fiscal year. The user may select a
Programmer's calendar, numbered in Hexadecimal or Octal numbers rather
than decimal numbers, and may choose one of several languages.
The calendars may be displayed on the screen, printed, or written to
a file as desired. If written to disk, files are named like YYYY.ENG
(Normal ENGlish), YYYYFY.DUT (Fiscal-Year DUTch), YYYYAGG.TEX (Aggie-
type TEXan), or YYYYJUL.POL (3-Digit Julian Date POLish) calendars,
etc. Hex or Octal calendar files will have an "H" or "O" added to
their names, such as YYYYH.SPA, YYYYFYO.SER or YYYYAGGH.FRE.
YEARCAL may be freely distributed, and used for non-commercial
purposes, as long as the unmodified program source code and
documentation files are distributed with it.
/***************************************************************/
Brief History: Why (and much of How) YEARCAL came to be. . .
A fellow at the office asked if I could get him a calendar for
1989, as his desk calendar only went to 1988. I grabbed a
program that I had lying around, and did it. I also went onto
GENie and found a program there that did the same job. Both of
these programs were written in BASIC, and when interpreted ran
slowly. When compiled they took up 45-50 Kbytes or so. I
thought I might be able to make one a little smaller, faster,
and with a few more useful features.
Along the way, I discovered that 2000 will really be a leap
year, while 1900 was not, and that the year 4000 will be weird
too. I also remembered a way of making an AGGIE calendar that
has the information arranged a little differently, and added
that capability to it as well. I decided that one could
logically wish to view a calendar on a screen, print a calendar
on a printer, or write the calendar to a file. It seemed useful
to make runs of multiple years or copies, so it can do both.
Then, Chris Lang suggested that it would really be neat to have
a program that produced fiscal year calendars. YEARCAL will now
produce fiscal year calendars for an arbitrary 12 full-month
fiscal year. Rich Hedges suggested that it would really be neat
to produce a fiscal year calendar for a fiscal year that begins
on a weird date, like July 15th. . . Well, not yet, and maybe
never . . .
Turned out that adding code to accommodate 13 month arbitrary
starting dates was not all that difficult. . . So now it does
that as well.
Then, Dale Schafer pointed out that on his IBM token ring
network setup, a banner and a blank page were being printed
between each successive calendar. This was because I was
skillfully closing the file (PRN, CON, etc.) after every
calendar was written. Hmmmm. . . Also fairly easy to fix,
but required a little bit of rethinking.
I confess. There was an undocumented feature in version 0.01c
or 0.01d that allowed the "JANUARY" month of a fiscal year to be
printed as "SUNDAY", and then "FEBRUARY" as "TUESDAY". Further,
Not everyone has or uses DeSmet C. . . I converted YEARCAL to
Borland's Turbo-C, and that wee beastie has been put to bed.
Damn those entomological cybernoids!!
A super serious individual (who shall remain nameless) asked me
what the AGGIE calendar was good for. I have been using it for
some time time to keep up with meeting dates that occur more or
less by formula. You know, such things as "First Tuesday of
every month at 7:30 pm" and the like. No sense of humour. . .
Then, one night an old CP/M-hacking KayPro user (Don Buzzingham)
happened by, and after one too many cups of coffee, we were
inspired to do a "Programmer's" calendar. Where is it written
that a calendar must represent the dates with decimal numbers?
Why not Hexadecimal, or (for us real fossils) Octal? Why not
Binary? (Answer: binary representations won't fit easily and
neatly on the screen. . . ) Why not any arbitrary number
base? (Gag me with a spoon, Adolph!) (Answer: unless the number
base is larger than base 4, the dates won't fit nicely either.)
In keeping with the concept of following the path of least
resistance, I took the easy way out, and added the capability of
doing Hex and Octal calendars too.
Why not have it produce calendars in a number of different
languages? (Do you know how many languages exist?) So, language
support for sixteen different languages was added. This
created some problems with the limitations of the IBM(tm)
character set that came stock with my computer. Not all of the
requisite special characters are there. When I used the cute
special characters, and sent them to several different printers,
each printer decided to react to them in different ways, and
usually NOT by printing the special character I had intended.
Alas, proper use of the international characters is not to be,
at least not yet. . . I apologise in advance to all of those
who care, and ask your indulgence. I did try. . .
I dropped Greek and Russian because of the character set
problem, and have made no attempt at adding any oriental
languages for the same reason. (I have been tempted to add
Korean, using the McKune-Reischauer Romanisation scheme. Let me
know if anyone cares.) Added Afrikaans at the suggestion of a
friend. . . Finally did add Korean (Romanised). . .
I woke up late one night with a memory of another calendar
hassle that I had experienced while in the forced employ of the
Army. The DOD and GAO find it useful to think of dates as mere
numbers. The so-called Julian-Date scheme is used there. It
basically takes note of the fact that there are either 365 or
366 days in the Gregorian calendar year, and numbers a date by
its relative position in the year. Thus, January 1 would be
001, and December 31st might be either 365 or 366. This is
referred to as a 3-digit Julian Date, and is mighty useful if
you know what year it is. It makes it really simple to find out
how many days there are between dates, so you can find out how
long your most important requisition has been backordered (also
known as "Lost in the System"). For greater specificity, the
Four-Digit, Five-Digit, Six-Digit, and Seven-Digit Julian Dates
can be made by adding more or less of the year in front of the
date. February 29th, 1988 might be shown as 1988059 as a
Seven-Digit Julian Date, and as 8059 for a Four-Digit Julian
Date.
GAO even puts out a clever little form that supply types often
refer to when they can't find their desk calendars. Made of
heavy card-stock, it is called a "Perpetual Julian Date
Calendar". There are basically only two types of Julian Date
Calendars, one for Leap Years and one for Non-Leap Years. The
hassle I had was that in the field we usually didn't have our
desk calendars, and sometimes (usually) couldn't find our GAO
cheat sheets. Since no well-equipped armed force would dream of
trying to operate without its computer(s), I added the
capability to produce 3-Digit Julian Date calendars as well in
decimal, hexadecimal, and octal numbering systems. . . If you
don't ordinarily take your computer(s) to the field, you have
the option of printing them out on paper.
I guess it had to happen. If you solicit suggestions for
enhancement, bug reports, and sound as if you are sincere,
someone may take you up on it. I received a Fido Message from
Jim Gibbs of KIVY AM/FM in Crockett, TX. suggesting that maybe
I could modify it to do a "Broadcast" or "Advertising" calendar.
Seems like all of the months in those industries begin on a
Sunday. If I only had a sample. . .
Another Fido E-Mail message suggested that it would be nice if
it would make Annual, Monthly, and Weekly calendars. I got to
thinking about that and decided that the Weekly and Daily
Schedules would be helpful for time management, and that perhaps
a monthly calendar would be pretty easy to do too. I guess that
most businesses have stopped giving them out at Christmas
lately. So, the ability to do Monthly calendars and Weekly and
Daily schedules was added. I decided that the schedules should
be allowed to start on any given day, as some people like to
start their weeks on Tuesday, or Thursday. This will probably
help in the Broadcast or Advertising week thing, as you may
specify that the schedules will start on a Monday. (More later
for you, Jim. . . ) Chris Lang suggested that the ability to
add user-specified title lines would be helpful, so that he could
make his very own "Wildlife and Fisheries Science Department"
"Monthly Vehicle Use Projection" type calendars. I pointed out
that he could simply edit the files that it could produce, but
he said that I didn't have to put up with the whining of his
office staff. I quickly added that capability as well.
Someone wanted it to do a Hebrew calendar, someone (else) an
Islamic calendar (for equal time); a Lunar calendar, a Mayan
calendar, a Babylonian calendar, . . . I intend to contact
the local neighborhood rabbi, (I know, things I should have
learned in Schul). I am even interested in a rumoured scheme
for a thirteen-month calendar. . . I had never realised how
many ways there are for abstracting the same natural phenomenon
(turn, turn, turn. . .). (Let's hear it for them
Byrd-brains!).
Why not have the first screen ask which language to use in all
supported languages? Then you could have instructions and
prompts written in whatever language was selected. . . Alas,
I am not up to that linguistically. Would need a little help
from all of you out there in the world. . . And that would
make the program grow somewhat. . . (Jiminy!! It's already up
to 26 Kbytes, and runs slightly slower than it used to. . .).
Lately I have been dreaming about a "Random" calendar. As I
envision it, the months would be scrambled, and the days of the
week would be scrambled randomly, but have the right dates under
them. . . How many possible permutations. . .
Here is YEARCAL. Enjoy it, and remember, the AGGIE calendar
really does have a useful purpose. I use it to help schedule
meetings of the type of "First Tuesday Monthly" and that sort of
thing. The code is over commented by most 'c' programmer's
standards. I do that so that I can fix it easily three months
later. Plus, my mother was frightened by an assembler while
carrying me. By special request, for those purists out there, I
can supply a version of the source that is devoid of white space
that has all variable names shortened to two uppercase
characters.
There are some really cute functions there that may be useful
for learning tools. For example, I know of no way to more
efficiently determine whether or not a year is leap year than
the cute little sieve that I wrote. (Sin of pride).
By the way, the good news is that:
The CP/M version is due out "Real Soon Now". . . according to
Jerry P., who writes a lot of very good fiction.
/***************************************************************/
Limitations:
1) Date must be after 1901 and before 4000. I understand that
there will be an adjustment of some kind in 4000, but am not
sure what it is to be. Anyway, it will be after my shift. . .
2) Assumes 80 column screen, and uses the DOS calls to do screen
I/O, thus there is no colour, no graphics, and it is s l o w.
However, it will therefor work on almost all MSDOS machines.
3) Assumes MSDOS for date/time interrupt 21 call to get the DOS
date. Source code should port easily to any c compiler, for
CP/M machines, VAXen, and other dinosaurs...
4) It assumes a printer that can print at least 85 columns. The
scheduling options for Monthly, Weekly, and Daily schedules
will ask for the printer page length and page width values,
and adjust the output accordingly.
5) It assumes that the printer can respond to a form-feed character.
6) It does not do any neat double-wide, emphasized print, nor
does it make use of any graphics characters. It just puts out
vanilla ASCII text. To do so would be to try to figure out all
of the many printer codes and do an installation program or
another menu or something.
7) It does not work from a command line. It is interactive.
/***************************************************************/
** Copyright (c) 1987 by Paul M. Sittler.
** All rights reserved. The copyright owner hereby authorizes the no-charge,
** noncommercial making and/or distribution of copies of the entirety of
** this work unchanged and unincorporated in any other work (except "LiBRary"
** or "ARChive" disk files for the sole purpose of no-charge noncommercial
** distribution). No other reproduction or use is authorized without the
** express prior written consent of the copyright owner.
** Once upon a time, in a kingdom far away, people shared source code and
** many of us benefited from the sharing. This silly little program is here
** presented with source in hopes that it may stimulate the renewed sharing
** of our efforts.
** I am open to comment, suggestions for enhancements, and bug
** reports.
** Paul M. Sittler
** 1106 Berkeley Drive
** College Station, TX 77840
** Modem (409) 764-0056 300/1200/2400 baud 24 hours/day
** My Word #2 Fido 117/1
** GENie User mail address P.M.SITTLER
/***************************************************************/