home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / MISC / PBAPI10.ZIP / APIDOCS.ZIP / EVENTS.DOC < prev    next >
Text File  |  1998-02-21  |  7KB  |  186 lines

  1. Author....... : Gary Price
  2. Copyrighted by: Freejack's Software 1997-98
  3.  
  4. EVENTS_DAT API for TriBBS v10.x/11.x written in PowerBasic v3.5
  5. ---------------------------------------------------------------------------
  6.  
  7. The EVENTS_DAT unit is used to manipulate data in the EVENTS.DAT data file
  8. found in Node's \NWORK directory. The EVENTS_DAT unit is declared in
  9. PBAPI10.INC as follows:
  10.  
  11.  Events.dat EventsDatBitFields Breakdown
  12.  
  13.  EventsDatBitFields.bit1 BIT Assignment
  14.   0 = EventExecutedTodayFlag 
  15.   1 = SlidingEventFlag 
  16.   2 to 7 Reserved, set to all 0's
  17.  
  18. Sub Type Structure for 1 byte BitFields
  19.   TYPE EventsDatBit
  20.     bit1 AS BYTE
  21.   END TYPE
  22.  
  23. File Name: "EVENTS.DAT"
  24.   TYPE EVENTSDAT
  25.     Time               AS STRING * 6
  26.     File               AS STRING * 13
  27.     Day                AS INTEGER
  28.     EventsDatBitFields AS EventsDatBit
  29.     ReservedDataArea   AS STRING * 234
  30.   END TYPE
  31.  
  32.   DIM EventsDatBit AS EventsDatBit
  33.   DIM EVENTSDAT    AS SHARED EVENTSDAT
  34.   DIM ed           AS SHARED EVENTSDAT PTR
  35.  
  36.   ed = VARPTR32(EVENTSDAT)
  37.   LSET EVENTSDAT = EVENTSDAT
  38.  
  39. ---------------------------------------------------------------------------
  40.  
  41. FUNCTION's below are from the EVENTSDAT.PBU Unit and DECLAREd in PBAPI10.INC.
  42.  
  43. FUNCTION EVENTS_DAT_Open()
  44. FUNCTION EVENTS_DAT_Close()
  45. FUNCTION EVENTS_DAT_Read(n AS INTEGER)
  46. FUNCTION EVENTS_DAT_Write(n AS INTEGER)
  47. FUNCTION EVENTS_DAT_OpenRead(n AS INTEGER)
  48. FUNCTION EVENTS_DAT_WriteClose(n AS INTEGER)
  49. FUNCTION EVENTS_DAT_OpenReadClose(n AS INTEGER)
  50. FUNCTION EVENTS_DAT_OpenWriteClose(n AS INTEGER)
  51. FUNCTION EVENTS_DAT_Length() AS LONG
  52. FUNCTION EVENTS_DAT_ClearIt(n AS INTEGER)
  53.  
  54. FUNCTION EVENTS_DAT_GetTime() AS STRING
  55. FUNCTION EVENTS_DAT_PutTime(s AS STRING)
  56. FUNCTION EVENTS_DAT_GetFile() AS STRING
  57. FUNCTION EVENTS_DAT_PutFile(s AS STRING)
  58. FUNCTION EVENTS_DAT_GetDay() AS INTEGER
  59. FUNCTION EVENTS_DAT_PutDay(n AS INTEGER)
  60.  
  61. FUNCTION EVENTS_DAT_GetEETF() AS INTEGER
  62. FUNCTION EVENTS_DAT_PutEETF(n AS INTEGER)
  63. FUNCTION EVENTS_DAT_GetSEF() AS INTEGER
  64. FUNCTION EVENTS_DAT_GetSEF(n AS INTEGER)
  65.  
  66. ---------------------------------------------------------------------------
  67.  MPORTANT: TBNode1sMainDirectory must be set to node 1's main directory
  68.  before calling any function with the "Open" word.
  69.  
  70. EVENTS_DAT_Open()
  71.  The EVENTS_DAT_Open function opens the EVENTS.DAT file in the node's NWORK
  72.  directory.
  73.  
  74. EVENTS_DAT_Close()
  75.  The EVENTS_DAT_Close function closes the EVENTS.DAT file in the node's NWORK
  76.  directory.
  77.  
  78. EVENTS_DAT_Read(n AS INTEGER)
  79.  The EVENTS_DAT_Read function reads the record for event "n" into memory.
  80.  
  81. EVENTS_DAT_Write(n AS INTEGER)
  82.  The EVENTS_DAT_Write function updates the record for event "n" from memory.
  83.  
  84. EVENTS_DAT_OpenRead(n AS INTEGER)
  85.  The EVENTS_DAT_OpenRead function provides the functionality of the
  86.  EVENTS_DAT_Open and EVENTS_DAT_Read functions in a single function call.
  87.  
  88. EVENTS_DAT_WriteClose(n AS INTEGER)
  89.  The EVENTS_DAT_WriteClose function provides the functionality of the
  90.  EVENTS_DAT_Write and EVENTS_DAT_Close functions in a single function call.
  91.  
  92. EVENTS_DAT_OpenReadClose(n AS INTEGER)
  93.  The EVENTS_DAT_OpenReadClose function provides the functionality of the
  94.  EVENTS_DAT_Open, EVENTS_DAT_Read, and EVENTS_DAT_Close functions in a single
  95.  function call.
  96.  
  97. EVENTS_DAT_OpenWriteClose(n AS INTEGER)
  98.  The EVENTS_DAT_OpenWriteClose function provides the functionality of the
  99.  EVENTS_DAT_Open, EVENTS_DAT_Write, and EVENTS_DAT_Close functions in a single
  100.  function call.
  101.  
  102. EVENTS_DAT_Length() AS LONG
  103.  The EVENTS_DAT_Length function returns the number of records in the
  104.  EVENTS.DAT file.
  105.  
  106. EVENTS_DAT_ClearIt(n AS INTEGER)
  107.  The EVENTS_DAT_ClearIt function sets the entire EVENTS_DAT data record to all
  108.  zeros for 'n'.
  109.  
  110. -----------------------------------------------------------------------------
  111. POINTERS Uses a hidden variable I use called "@ed". Any reference to this is
  112. only for your information for discussion in this doc file. You will not need
  113. to concern yourself trying to use this.. All calls are handled in the main
  114. EVENTSDAT.PBU Unit by my routines automatically. In other words, I am trying
  115. to keep Pointers as easy as possible for your use. :)
  116.  
  117. Also, all calls to any Functions which gets data with the string routines
  118. will auto-trim each string's extra spaces and the null terminator, CHR$(0),
  119. off so printing will be easier for you to manipulate. When calling the string
  120. routines to put data back into the string space, all string data will be
  121. resized to fit the EVENTS.DAT type structure and will add the null terminator
  122. back to the end of the string. Just remember, when working the data in memory
  123. with the pointer calls, you still have to write the data back to the
  124. EVENTS.DAT in order for the changes to become permanent.
  125.  
  126. -----------------------------------------------------------------------------
  127. EVENTS_DAT_GetTime() AS STRING
  128.  This form of the EVENTS_DAT_Time function returns the time of the event
  129.  string.
  130.  
  131. EVENTS_DAT_PutTime(s AS STRING)
  132.  This form of the EVENTS_DAT_Time function sets the time of the event string
  133.  to the string pointed to by "s". Note that the string pointed to by "s" can
  134.  be no more than 5 characters in length and must have the form "HH:MM".
  135.  
  136. EVENTS_DAT_GetFile() AS STRING
  137.  This form of the EVENTS_DAT_File function returns the file name for the event
  138.  string.
  139.  
  140. EVENTS_DAT_PutFile(s AS STRING)
  141.  This form of the EVENTS_DAT_File function sets the file name for the event
  142.  string to the string pointed to by "s". Note that the string pointed to by
  143.  "s" can be no more than 12 characters in length.
  144.  
  145. EVENTS_DAT_GetDay() AS INTEGER
  146.  This form of the EVENTS_DAT_Day function returns the day of the event.
  147.  
  148. EVENTS_DAT_PutDay(n AS INTEGER)
  149.  This form of the EVENTS_DAT_Day function sets the day of the event to "n".
  150.  "n" must be in the range of 0 to 7 as follows:
  151.  
  152.     0 = Sunday
  153.     1 = Monday
  154.     2 = Tuesday
  155.     3 = Wednesday
  156.     4 = Thursday
  157.     5 = Friday
  158.     6 = Saturday
  159.     7 = Everyday of the week
  160.  
  161. -----------------------------------------------------------------------------
  162. All BIT Field Flags below have been converted to Integers to allow easier
  163. access and handling.
  164. -----------------------------------------------------------------------------
  165. EVENTS_DAT_GetEETF() AS INTEGER
  166.  This form of the EVENTS_DAT_GetEET function returns the event executed today
  167.  flag.
  168.  
  169. EVENTS_DAT_PutEETF(n AS INTEGER)
  170.  This form of the EVENTS_DAT_PutEETF function sets the event executed today
  171.  flag to "n". "n" must be in the range of 0 to 1 as follows:
  172.  
  173.     0 = FALSE
  174.     1 = TRUE
  175.  
  176. EVENTS_DAT_GetSEF() AS INTEGER
  177.  This form of the EVENTS_DAT_GetSEF function returns the sliding event flag.
  178.  
  179. EVENTS_DAT_PutSEF(n AS INTEGER)
  180.  This form of the EVENTS_DAT_PutSEF function sets the event executed today
  181.  flag to "n". "n" must be in the range of 0 to 1 as follows:
  182.  
  183.     0 = FALSE
  184.     1 = TRUE
  185.  
  186.