home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / dos / prg / bas / hanlin3 / basupd20 / basupd.doc < prev    next >
Text File  |  1994-11-05  |  8KB  |  252 lines

  1.      BASUPD  Copyright (c) 1992-1994  Thomas G. Hanlin III
  2.  
  3.                      BasUpd Library, v2.0
  4.  
  5.                    for QuickBASIC 4.0 - 4.5
  6.  
  7.  
  8.  
  9. This library provides a set of routines which mimic new
  10. commands in other Microsoft BASIC compilers, such as PDS 7.x
  11. and Visual Basic.  In effect, it updates your QuickBASIC
  12. compiler to take advantage of these new features.  This adds a
  13. little more life to good ol' QuickBASIC and keeps you in touch
  14. with the ever-evolving BASIC language.
  15.  
  16. The included libraries are made for QuickBASIC 4.5.  If you are
  17. using one of the QuickBASIC 4.0, 4.0a, 4.0b releases, you must
  18. recompile the .BAS files and recreate the libraries.
  19.  
  20. The BasUpd library is protected by copyright.  However, it may
  21. be distributed freely, provided that all files are included
  22. together in original condition-- that is, you may not add
  23. files, remove files, or alter files in the BasUpd library.
  24.  
  25. BasUpd routines may be used in your program without royalties
  26. or licensing fees of any kind.
  27.  
  28. If you find BasUpd useful, you may want to check out my other
  29. free and shareware products for BASIC languages.  These include
  30. a wide assortment of libraries, utilities, and other goodies.
  31. See the CATALOG.TXT and ORDER.FRM files for more information.
  32.  
  33.                          Using BasUpd
  34.  
  35.  
  36.  
  37. BasUpd is a library of BASIC and assembly language routines.
  38. To use BasUpd, you must start QB with the /L switch, telling it
  39. to load the BasUpd library.  For example:
  40.  
  41.    QB program.bas /L BASUPD
  42.  
  43. or
  44.  
  45.    QB /L BASUPD
  46.  
  47. If you compile from the command line, using BC, you must tell
  48. LINK to bring in the necessary routines from the BASUPD
  49. library.  For example:
  50.  
  51.    BC program.bas/O;
  52.    LINK program.obj/EX,,NUL,BASUPD
  53.  
  54. You also need to include a "metacommand" in your program which
  55. loads the DECLARE information for the functions.  The first
  56. line in your program should read something like this:
  57.  
  58.    REM $INCLUDE: 'BASUPD.BI'
  59.  
  60. That's really all there is to it.  Once loaded, these routines
  61. act just like part of the BASIC language.
  62.  
  63. The BasUpd library provides you with almost all of the new
  64. BASIC functions from PDS 7.x and Visual Basic.  They are made
  65. to work as closely as possible to "the real thing".  This
  66. applies quite specifically to the time/date routines, which
  67. return the same "serial number" value as the equivalent PDS/VB
  68. routines.  So, if you move to one of these compilers, you will
  69. be able to use its functions instead of those in BasUpd with a
  70. minimum of fuss.
  71.  
  72. Name: ChDrive
  73.  
  74. This routine allows you to change the default drive.  The drive
  75. letter may be either uppercase or lowercase.  Only the first
  76. character of the string is examined, so it doesn't matter if
  77. you use a colon for the drive spec.
  78.  
  79.    ChDrive Drive$
  80.  
  81.  
  82.  
  83. Name: CurDir$
  84.  
  85. This function returns the default subdirectory on the specified
  86. drive.  The drive letter may be either uppercase or lowercase.
  87. Only the first character of the string is examined, so it
  88. doesn't matter if you use a colon for the drive spec.  If you
  89. just want to specify the current drive, you can use a null
  90. string for the drive spec.
  91.  
  92.    Subdir$ = CurDir$("C:")
  93.  
  94. The result is a fully-specified path.  For instance, the above
  95. example might have returned something like "C:\BASUPD".
  96.  
  97.  
  98.  
  99. Name: DateSerial#
  100.  
  101. This function returns a "serial number" for a specified date.
  102. See the appendix for a discussion of time/date serial numbers.
  103.  
  104. You may specify the year as 1753-2078, or as 0-178 (where 0 is
  105. assumed to mean 1900, and so forth).  It might be wise to
  106. restrict that to 0-99 instead of 0-178; while Microsoft's docs
  107. say that 0-178 works, their version actually generates an error
  108. if 100-178 is used.  The BasUpd version accepts the full 0-178
  109. range.
  110.  
  111.    Serial# = DateSerial#(YearNr%, MonthNr%, DayNr%)
  112.  
  113. Please note the unusual order of the parameters.  Also, be
  114. careful not to use "Year", "Month", or "Day" as variable names,
  115. since these are reserved words providing other time/date
  116. functions.
  117.  
  118.  
  119.  
  120. Name: Day%
  121.  
  122. This function returns the day corresponding to a specified
  123. time/date serial number.
  124.  
  125.    DayNr% = Day%(Serial#)
  126.  
  127. Name: Error$
  128.  
  129. This function returns the error message associated with a
  130. specific error number.  This would most often be used as part
  131. of an error-trapping routine.  Note that the built-in BASIC
  132. function ERR tells you the current error number.
  133.  
  134.    ErrorMsg$ = Error$(ErrorNumber%)
  135.  
  136.  
  137.  
  138. Name: Hour%
  139.  
  140. This function returns the hour corresponding to a specific
  141. time/date serial number.
  142.  
  143.    HourNr% = Hour%(Serial#)
  144.  
  145.  
  146.  
  147. Name: Minute%
  148.  
  149. This function returns the minute corresponding to a specific
  150. time/date serial number.
  151.  
  152.    MinuteNr% = Minute%(Serial#)
  153.  
  154.  
  155.  
  156. Name: Month%
  157.  
  158. This function returns the month corresponding to a specific
  159. time/date serial number.
  160.  
  161.    MonthNr% = Month%(Serial#)
  162.  
  163.  
  164.  
  165. Name: Now%
  166.  
  167. This function returns a time/date serial number for the current
  168. time and date.
  169.  
  170.    Serial# = Now%
  171.  
  172. Name: Second%
  173.  
  174. This function returns the second corresponding to a specific
  175. time/date serial number.
  176.  
  177.    SecondNr% = Second%(Serial#)
  178.  
  179.  
  180.  
  181. Name: TimeSerial#
  182.  
  183. This function returns a "serial number" for a specified time.
  184. See the appendix for a discussion of time/date serial numbers.
  185.  
  186. The hour is specified using 24-hour (military) time, with a
  187. range of 0-23 (midnight-11pm).
  188.  
  189.    Serial# = TimeSerial#(HourNr%, MinuteNr%, SecondNr%)
  190.  
  191. Be careful not to use "Hour", "Minute", or "Second" as variable
  192. names, since these are reserved words providing other time/date
  193. functions.
  194.  
  195.  
  196.  
  197. Name: WeekDay%
  198.  
  199. This function returns the day of the week corresponding to a
  200. specific time/date serial number.  This is returned as a number
  201. 1-7, where 1 = Sunday, 2 = Monday, ..., 7 = Saturday.
  202.  
  203.    WeekDayNr% = WeekDay%(Serial#)
  204.  
  205.  
  206.  
  207. Name: Year%
  208.  
  209. This function returns the year corresponding to a specific
  210. time/date serial number.
  211.  
  212.    YearNr% = Year%(Serial#)
  213.  
  214.                           Appendix A
  215.  
  216.                    Time/Date Serial Numbers
  217.  
  218.  
  219.  
  220. The new time and date routines are based on an encoded value
  221. called a "serial number" (Microsoft's choice, not mine).  This
  222. is a double-precision floating point value which may include
  223. either time or date information, or both.
  224.  
  225. To decode a serial number, divide it into left and right parts
  226. at the decimal point.  The part to the left of the decimal
  227. represents the date.  The part to the right of the decimal
  228. gives the time.
  229.  
  230. The date is specified in days, based on December 30, 1899.
  231. Dates before then will be negative.  Dates after then will be
  232. positive.  Years from 1753-2078 are supported.
  233.  
  234. The time is specified as a number indicating how much of the
  235. day has been used.  The easiest way to calculate it is to
  236. convert the time to the number of seconds past midnight:
  237.  
  238.    TimeNow# = (HourNr * 60 + MinuteNr) * 60 + SecondNr
  239.  
  240. Divide this by the number of seconds in a day (86,400), and
  241. you've got the same number as used in a time/date serial
  242. number.
  243.  
  244. The approach used to creating a time/date serial number means
  245. that you can use these numbers for comparison or sorting: a
  246. larger serial number will always indicate a later time/date
  247. than a smaller serial number.  Date manipulation is also
  248. possible by adding/subtracting days from the serial number,
  249. etc.  Date validation can be accomplished by converting a date
  250. to a serial number and back, then comparing the resulting
  251. year/month/day to the original.
  252.