home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / C / YEARCAL.ZIP / YEARCAL.DOC < prev    next >
Encoding:
Text File  |  1988-02-05  |  17.7 KB  |  346 lines

  1. /***************************************************************/
  2.                 YEARCAL v0.06T 4 Feb 1988
  3.  
  4.         Copyright 1987, 1988 by Paul M. Sittler
  5.  
  6. YEARCAL makes calendars (A) and schedules (M/W/D) for years after 1901.
  7.  
  8. At the user's option, Normal, Fiscal Year, AGGIE, or 3-Digit Julian
  9. Date Calendars can be produced, in multiple copies, for a number of
  10. consecutive years, or both.  Fiscal Year calendars may be produced for
  11. any arbitrary 12 or 13 month fiscal year.  The user may select a
  12. Programmer's calendar, numbered in Hexadecimal or Octal numbers rather
  13. than decimal numbers, and may choose one of several languages.
  14.  
  15. The calendars may be displayed on the screen, printed, or written to
  16. a file as desired.  If written to disk, files are named like YYYY.ENG
  17. (Normal ENGlish), YYYYFY.DUT (Fiscal-Year DUTch), YYYYAGG.TEX (Aggie-
  18. type TEXan), or YYYYJUL.POL (3-Digit Julian Date POLish) calendars,
  19. etc.  Hex or Octal calendar files will have an "H" or "O" added to
  20. their names, such as YYYYH.SPA, YYYYFYO.SER or YYYYAGGH.FRE.
  21.  
  22. YEARCAL may be freely distributed, and used for non-commercial
  23. purposes, as long as the unmodified program source code and
  24. documentation files are distributed with it.
  25.  
  26. /***************************************************************/
  27.  
  28. Brief History:  Why (and much of How) YEARCAL came to be. . .
  29.  
  30. In 1987, a fellow at the office asked if I could get him a calendar
  31. for 1989, as his desk calendar only went to 1988.  I grabbed a
  32. program that I had lying around, and did it.  I also went onto
  33. GENie and found a program there that did the same job.  Both of
  34. these programs were written in BASIC, and when interpreted ran
  35. slowly.  When compiled they took up 45-50 Kbytes or so.  I
  36. thought I might be able to make one a little smaller, faster,
  37. and with a few more useful features.
  38.  
  39. Along the way, I discovered that 2000 will really be a leap
  40. year, while 1900 was not, and that the year 4000 will be weird
  41. too.  I also remembered a way of making an AGGIE calendar that
  42. has the information arranged a little differently, and added
  43. that capability to it as well.  I decided that one could
  44. logically wish to view a calendar on a screen, print a calendar
  45. on a printer, or write the calendar to a file.  It seemed useful
  46. to make runs of multiple years or copies, so it can do both.
  47.  
  48. Then, Chris Lang suggested that it would really be neat to have
  49. a program that produced fiscal year calendars.  YEARCAL will now
  50. produce fiscal year calendars for an arbitrary 12 full-month
  51. fiscal year.  Rich Hedges suggested that it would really be neat
  52. to produce a fiscal year calendar for a fiscal year that begins
  53. on a weird date, like July 15th. . .  Well, not yet, and maybe
  54. never. . .
  55.  
  56. Turned out that adding code to accommodate 13 month arbitrary
  57. starting dates was not all that difficult. . .  So now it does
  58. that as well.
  59.  
  60. Then, Dale Schafer pointed out that on his IBM token ring
  61. network setup, a banner and a blank page were being printed
  62. between each successive calendar.  This was because I was
  63. skillfully closing the file (PRN, CON, etc.) after every
  64. calendar was written.  Hmmmm. . .  Also fairly easy to fix,
  65. but required a little bit of rethinking.
  66.  
  67. I confess.  There was an undocumented feature in version 0.01c
  68. or 0.01d that allowed the "JANUARY" month of a fiscal year to be
  69. printed as "SUNDAY", and then "FEBRUARY" as "TUESDAY".  Further,
  70. Not everyone has or uses DeSmet C. . .  I converted YEARCAL to
  71. Borland's Turbo-C, and that wee beastie has been put to bed.
  72. Damn those entomological cybernoids!!
  73.  
  74. A super serious individual (who shall remain nameless) asked me
  75. what the AGGIE calendar was good for.  I have been using it for
  76. some time time to keep up with meeting dates that occur more or
  77. less by formula.  You know, such things as "First Tuesday of
  78. every month at 7:30 pm" and the like.  No sense of humour. . .
  79.  
  80. Then, one night an old CP/M-hacking KayPro user (Don Buzzingham)
  81. happened by, and after one too many cups of coffee, we were
  82. inspired to do a "Programmer's" calendar.  Where is it written
  83. that a calendar must represent the dates with decimal numbers?
  84. Why not Hexadecimal, or (for us real fossils) Octal? Why not
  85. Binary?  (Answer: binary representations won't fit easily and
  86. neatly on the screen. . .  )  Why not any arbitrary number
  87. base?  (Gag me with a spoon, Adolph!)  (Answer: unless the number
  88. base is larger than base 4, the dates won't fit nicely either.)
  89. In keeping with the concept of following the path of least
  90. resistance, I took the easy way out, and added the capability of
  91. doing Hex and Octal calendars too.
  92.  
  93. Why not have it produce calendars in a number of different
  94. languages?  (Do you know how many languages exist?)  So, language
  95. support for sixteen different languages was added.  This
  96. created some problems with the limitations of the IBM(tm)
  97. character set that came stock with my computer.  Not all of the
  98. requisite special characters are there.  When I used the cute
  99. special characters, and sent them to several different printers,
  100. each printer decided to react to them in different ways, and
  101. usually NOT by printing the special character I had intended.
  102. Alas, proper use of the international characters is not to be,
  103. at least not yet. . .  I apologise in advance to all of those
  104. who care, and ask your indulgence.  I did try. . .  At the
  105. behest of several, I have added an optional pause at the end
  106. of each printed page, for those who wish to print out multiple
  107. calendars on single sheets using a daisy wheel printer that
  108. has neither forms tractor nor sheet feeder.  If you need it,
  109. it's there now.  If you don't need it, I don't think that it
  110. will get in the way too much. . .
  111.  
  112. I dropped Greek and Russian because of the character set
  113. problem, and have made no attempt at adding any oriental
  114. languages for the same reason.  (I have been tempted to add
  115. Korean, using the McKune-Reischauer Romanisation scheme.  Let me
  116. know if anyone cares.)  Added Afrikaans at the suggestion of a
  117. friend. . .  Finally did add Korean (Romanised). . .
  118. Thanx to the mostly Reverend Daniel Marek, Pastor of the Caldwell
  119. Brethren Church, Caldwell, Texas, through the instrument of one
  120. Briggs Myrick (hacker friend and part time philosopher), we have
  121. now added Czech to our repertoire of voices!!
  122.  
  123. I will gladly add any language that can be represented in a standard
  124. fashion by the Roman character set.  One fellow is supposedly trying
  125. to get Roumanian, and we may be able to produce the first automated
  126. calendars ever in a language used by an American Indian Tribe, if
  127. they decide to use the roman alphabet rather than rolling their own.
  128. The information that I need is simple:  the names of the days of the
  129. week and the names of the months.  I suspect that there is a standard
  130. technique for romanising Japanese, Thai, and Vietnamese, at least.
  131.  
  132. I woke up late one night with a memory of another calendar
  133. hassle that I had experienced while in the forced employ of the
  134. Army.  The DOD and GAO find it useful to think of dates as mere
  135. numbers.  The so-called Julian-Date scheme is used there.  It
  136. basically takes note of the fact that there are either 365 or
  137. 366 days in the Gregorian calendar year, and numbers a date by
  138. its relative position in the year.  Thus, January 1 would be
  139. 001, and December 31st might be either 365 or 366.  This is
  140. referred to as a 3-digit Julian Date, and is mighty useful if
  141. you know what year it is.  It makes it really simple to find out
  142. how many days there are between dates, so you can find out how
  143. long your most important requisition has been backordered (also
  144. known as "Lost in the System").  For greater specificity, the
  145. Four-Digit, Five-Digit, Six-Digit, and Seven-Digit Julian Dates
  146. can be made by adding more or less of the year in front of the
  147. date.  February 29th, 1988 might be shown as 1988059 as a
  148. Seven-Digit Julian Date, and as 8059 for a Four-Digit Julian
  149. Date.
  150.  
  151. GAO even puts out a clever little form that supply types often
  152. refer to when they can't find their desk calendars.  Made of
  153. heavy card-stock, it is called a "Perpetual Julian Date
  154. Calendar".  There are basically only two types of Julian Date
  155. Calendars, one for Leap Years and one for Non-Leap Years.  The
  156. hassle I had was that in the field we usually didn't have our
  157. desk calendars, and sometimes (usually) couldn't find our GAO
  158. cheat sheets.  Since no well-equipped armed force would dream of
  159. trying to operate without its computer(s), I added the
  160. capability to produce 3-Digit Julian Date calendars as well in
  161. decimal, hexadecimal, and octal numbering systems. . .  If you
  162. don't ordinarily take your computer(s) to the field, you have
  163. the option of printing them out on paper.
  164.  
  165. I guess it had to happen.  If you solicit suggestions for
  166. enhancement, bug reports, and sound as if you are sincere,
  167. someone may take you up on it.  I received a Fido Message from
  168. Jim Gibbs of KIVY AM/FM in Crockett, TX.  suggesting that maybe
  169. I could modify it to do a "Broadcast" or "Advertising" calendar.
  170. Seems like all of the months in those industries begin on a
  171. Sunday.  If I only had a sample. . .   (Now I do!)  If I only had
  172. a little more time. . .
  173.  
  174. Another Fido E-Mail message suggested that it would be nice if
  175. it would make Annual, Monthly, and Weekly calendars.  I got to
  176. thinking about that and decided that the Weekly and Daily
  177. Schedules would be helpful for time management, and that perhaps
  178. a monthly calendar would be pretty easy to do too.  I guess that
  179. most businesses have stopped giving them out at Christmas
  180. lately.  So, the ability to do Monthly calendars and Weekly and
  181. Daily schedules was added.  I decided that the schedules should
  182. be allowed to start on any given day, as some people like to
  183. start their weeks on Tuesday, or Thursday.  This will probably
  184. help in the Broadcast or Advertising week thing, as you may
  185. specify that the schedules will start on a Monday.  (More later
  186. for you, Jim. . . )  Chris Lang suggested that the ability to
  187. add user-specified title lines would be helpful, so that he could
  188. make his very own "Wildlife and Fisheries Science Department"
  189. "Monthly Vehicle Use Projection" type calendars.  I pointed out
  190. that he could simply edit the files that it could produce, but
  191. he said that I didn't have to put up with the whining of his
  192. office staff.  I quickly added that capability as well.  In fact,
  193. this capability has been implemented to almost the ridiculous, as
  194. there are now five (5) each user-definable title lines that may be
  195. set at will by the user.  (8 January 1988)
  196.  
  197. Someone wanted it to do a Hebrew calendar, someone (else) an
  198. Islamic calendar (for equal time); a Lunar calendar, a Mayan
  199. calendar, a Babylonian calendar, . . .  I intend to contact
  200. the local neighborhood rabbi, (I know, things I should have
  201. learned in Schul).  I am even interested in a rumoured scheme
  202. for a thirteen-month calendar. . .  I had never realised how
  203. many ways there are for abstracting the same natural phenomenon
  204. (turn, turn, turn. . .).  (Let's hear it for them
  205. Byrd-brains!).
  206.  
  207. Why not have the first screen ask which language to use in all
  208. supported languages? Then you could have instructions and
  209. prompts written in whatever language was selected. . .  Alas,
  210. I am not up to that linguistically.  Would need a little help
  211. from all of you out there in the world. . .  And that would
  212. make the program grow somewhat. . .  (Jiminy!! It's already up
  213. to 26 Kbytes, and runs slightly slower than it used to. . .).
  214. Would you believe 30 Kbytes now, with an automatic 717 byte
  215. weight gain when a virgin copy is run?  Some of that bulkiness
  216. is due to changing to Borland's v1.5, and some is due to putting
  217. back in certain functions that I had gotten rid of.  Some of it may
  218. actually be due to more code and (of course) greater functionality?
  219. (4 Feb 1988)
  220.  
  221. Alan Holub writes a delightful column called "c chest" in Dr. Dobbs'
  222. Journal of Software Tools (formerly known as "Doctor Dobbs' Journal
  223. of Computer Calisthenics and Orthodontia, or Running Light without
  224. Overbyte") (No, it REALLY was!!  This is a Walt Disney True-life
  225. Adventure. . .)   In the February 1988 edition (#136), Alan suggests
  226. a method of keeping changeable or user configurable parameters
  227. right at the end of the MSDOS .EXE file.  This means a method of
  228. keeping user configurations without a need for a separate configuration
  229. file as I had done in the past.  Those Darn things always seem to
  230. get lost in the great bit bucket in the sky, or something that goes
  231. bump in the night munches them into teeny riney bits, or they get lost
  232. on a path of their own. . .  I had worked on a similar thingy, but
  233. gotten trapped by DOS's need for some sort of check-sum.  Alan was
  234. kind enough to show the way, so I have included his routines here.
  235. The bad news is that this technique may not really be portable, as it
  236. is (probably) MSDOS-specific.
  237.  
  238. The net effect is that you may now set the parameters as you like
  239. them, and then save them as you exit.  They will be waiting for you
  240. the next time!!  This includes the five lines of user installable
  241. titles as well.  There is one little tiny bizarreness about it all,
  242. though.  If you compile the program or run a virgin copy, it will grow
  243. by around 700 bytes when you save your parameters as defaults.  The
  244. Date and Time will also change to the date and time that YOU saved it.
  245. You will need to get the date and version from the sign-on screen.
  246. However, you can set up your very own personally customized version,
  247. now.  (4 February 1988)
  248.  
  249. In the realm of a more subtle change, the left margin offset may
  250. now be user customized in the various schedules so that you may
  251. really have a binder edge at 20 CPI.  The older versions had been
  252. stuck at an arbitrary seven (7) spaces, which becomes smaller than
  253. desirable when used on an Epson in the 20CPI condensed elite mode.
  254. (4 February 1988)
  255.  
  256. Lately I have been dreaming about a "Random" calendar.  As I
  257. envision it, the months would be scrambled, and the days of the
  258. week would be scrambled randomly, but have the right dates under
  259. them. . .  How many possible permutations. . .
  260.  
  261. Here is YEARCAL.  Enjoy it, and remember, the AGGIE calendar
  262. really does have a useful purpose.  I use it to help schedule
  263. meetings of the type of "First Tuesday Monthly" and that sort of
  264. thing.  The code is over commented by most 'c' programmer's
  265. standards.  I do that so that I can fix it easily three months
  266. later.  Plus, my mother was frightened by an assembler while
  267. carrying me.  By special request, for those purists out there, I
  268. can supply a version of the source that is devoid of white space
  269. that has all variable names shortened to two upper/lower case
  270. characters.
  271.  
  272. There are some really cute functions there that may be useful
  273. for learning tools.  For example, I know of no way to more
  274. efficiently determine whether or not a year is leap year than
  275. the cute little sieve that I wrote.  (Sin of pride).
  276.  
  277. By the way, the good news is that:
  278.  
  279. The Unix System V version is due out "Real Soon Now". . . according to
  280. Ed Braaten, who writes a bit of very good code.  BTW, UPS charges
  281. $22.00 US to send a two-day packet to W.Germany, while the US Snail
  282. only charged $3.23 for Air-Snail service of same package.
  283.  
  284. The CP/M version is due out "Real Soon Now". . . according to
  285. Jerry P., who writes a lot of very good fiction.
  286.  
  287. /***************************************************************/
  288.  
  289. Limitations:
  290.  
  291. 1) Date must be after 1901 and before 4000.  I understand that
  292.    there will be an adjustment of some kind in 4000, but am not
  293.    sure what it is to be.  Anyway, it will be after my shift. . .
  294.  
  295. 2) Assumes 80 column screen, and uses the DOS calls to do screen
  296.    I/O, thus there is no colour, no graphics, and it is s l o w.
  297.    However, it will therefor work on almost all MSDOS machines.
  298.  
  299. 3) Assumes MSDOS for date/time interrupt 21 call to get the DOS
  300.    date.  Source code should port easily to any c compiler, for
  301.    CP/M machines, VAXen, and other dinosaurs...
  302.  
  303. 4) It assumes a printer that can print at least 80 columns.  The
  304.    scheduling options for Monthly, Weekly, and Daily schedules
  305.    will ask for the printer page length and width values, and the
  306.    number of spaces for left margin offset, and adjust the output
  307.    accordingly.
  308.  
  309. 5) It assumes that the printer can respond to a form-feed character.
  310.  
  311. 6) It does not do any neat double-wide, emphasized print, nor
  312.    does it make use of any graphics characters.  It just puts out
  313.    vanilla ASCII text.  To do so would be to try to figure out all
  314.    of the many printer codes and do an installation program or
  315.    another menu or something.
  316.  
  317. 7) It does not work from a command line.  It is interactive.
  318.  
  319. /***************************************************************/
  320. **  Copyright (c) 1987, 1988 by Paul M. Sittler.
  321. **  All rights reserved.  The copyright owner hereby authorizes the no-charge,
  322. **  noncommercial making and/or distribution of copies of the entirety of
  323. **  this work unchanged and unincorporated in any other work (except "LiBRary"
  324. **  or "ARChive" disk files for the sole purpose of no-charge noncommercial
  325. **  distribution).  No other reproduction or use is authorized without the
  326. **  express prior written consent of the copyright owner.
  327.  
  328. **  Once upon a time, in a kingdom far away, people shared source code and
  329. **  many of us benefited from the sharing.  This silly little program is here
  330. **  presented with source in hopes that it may stimulate the renewed sharing
  331. **  of our efforts.
  332.  
  333. **  I am open to comment, suggestions for enhancements, and bug
  334. **  reports.
  335.  
  336. **  Paul M. Sittler
  337. **  1106 Berkeley Drive
  338. **  College Station, TX 77840
  339.  
  340. **  Modem (409) 764-0056 300/1200/2400 baud 24 hours/day
  341. **  My Word #2 Fido 117/1
  342. **  GENie User mail address P.M.SITTLER
  343.  
  344. /***************************************************************/
  345.  
  346.