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

  1. Author....... : Gary Price
  2. Copyrighted by: Freejack's Software 1997-98
  3.  
  4. USERS_IDX API for TriBBS v10.x/11.x written in PowerBasic v3.5
  5. ---------------------------------------------------------------------------
  6.  
  7. The USERS_IDX unit is used to manipulate data in the USERS.IDX data file
  8. found in node 1's MWORK directory. The USERS_IDX unit is declared in
  9. PBAPI10.INC as follows:
  10.  
  11. File Name: "USERS.IDX"
  12.  TYPE UERSIDX
  13.     UserName     AS STRING * 61
  14.     RecordNumber AS LONG
  15.  END TYPE
  16.  
  17.  DIM USERSIDX AS SHARED USERSIDX
  18.  DIM ui       AS SHARED USERSIDX PTR 
  19.  
  20.  ui = VARPTR32(USERSIDX)
  21.  LSET USERSIDX = USERSIDX
  22. ---------------------------------------------------------------------------
  23.  
  24. FUNCTION's below are from the USERSIDX.PBU Unit and DECLAREd in PBAPI10.INC.
  25.  
  26. FUNCTION USERS_IDX_OPEN()
  27. FUNCTION USERS_IDX_CLOSE()
  28. FUNCTION USERS_IDX_READ(n AS WORD)
  29. FUNCTION USERS_IDX_WRITE(n AS WORD)
  30. FUNCTION USERS_IDX_Length() AS LONG
  31. FUNCTION USERS_IDX_OpenRead(n AS WORD)
  32. FUNCTION USERS_IDX_WriteClose(n AS WORD)
  33. FUNCTION USERS_IDX_OpenReadClose(n AS WORD)
  34. FUNCTION USERS_IDX_OpenWriteClose(n AS WORD)
  35. FUNCTION USERS_IDX_Clearit(n AS WORD)
  36.  
  37. FUNCTION USERS_IDX_Search(s AS STRING) AS LONG
  38. FUNCTION USERS_IDX_Insert(s AS STRING, n AS LONG) AS LONG
  39. FUNCTION USERS_IDX_Replace(os AS STRING, ns AS STRING) AS INTEGER
  40.  
  41. FUNCTION USERS_IDX_GetUN() AS STRING
  42. FUNCTION USERS_IDX_PutUN(s AS STRING)
  43. FUNCTION USERS_IDX_GetRN() AS WORD
  44. FUNCTION USERS_IDX_PutRN(n AS WORD)
  45.  
  46. ---------------------------------------------------------------------------
  47.  ** EXTERNAL FUNCTION USED BY USERS.IDX UNIT BELOW **
  48.  
  49. FUNCTION HashIt(s AS STRING) AS LONG
  50.  
  51. ---------------------------------------------------------------------------
  52.  MPORTANT: TBNode1sMainDirectory must be set to node 1's main directory
  53.  before calling any with the "Open" word.
  54.  
  55. FUNCTION USERS_IDX_Open()
  56.  The USERS_IDX_Open opens the USERS.IDX file in node 1's MWORK directory. 
  57.  
  58. FUNCTION USERS_IDX_Close()
  59.  The USERS_IDX_Close closes the USERS.IDX file in node 1's MWORK directory.
  60.  
  61. FUNCTION USERS_IDX_Read(n AS WORD)
  62.  The USERS_IDX_Read reads user index record specified by "n" into memory.
  63.  
  64. FUNCTION USERS_IDX_Write(n AS WORD)
  65.  The USERS_IDX_Write updates the user index record specified by "n" from
  66.  memory.
  67.  
  68. FUNCTION LONG USERS_IDX_Length()
  69.  The USERS_IDX_Length returns the number of records in the user index file.
  70.  
  71. FUNCTION USERS_IDX_OpenRead(n AS WORD)
  72.  The USERS_IDX_OpenRead provides the functionality of the USERS_IDX_Open and
  73.  USERS_IDX_Read functions in a single call.
  74.  
  75. FUNCTION USERS_IDX_WriteClose(n AS WORD)
  76.  The USERS_IDX_WriteClose provides the functionality of the USERS_IDX_Write
  77.  and USERS_IDX_Close functions in a single call.
  78.  
  79. FUNCTION USERS_IDX_OpenReadClose(n AS WORD)
  80.  The USERS_IDX_OpenReadClose provides the functionality of the USERS_IDX_Open,
  81.  USERS_IDX_Read, and USERS_IDX_Close functions in a single call.
  82.  
  83. FUNCTION USERS_IDX_OpenWriteClose(n AS WORD)
  84.  The USERS_IDX_OpenWriteClose provides the functionality of the USERS_IDX_Open,
  85.  USERS_IDX_Write, and USERS_IDX_Close functions in a single call.
  86.  
  87. FUNCTION USERS_IDX_ClearIt(n AS WORD)
  88.  The USERS_IDX_ClearIt sets the entire USERS_IDX data record for 'n' to all
  89.  zeros.
  90.  
  91. -----------------------------------------------------------------------------
  92. POINTERS Uses a hidden variable I use called "@ui". Any reference to this
  93. is only for your information for discussion in this doc file. You will not
  94. need to concern yourself trying to use this.. All calls are handled in the
  95. main USERSIDX.PBU Unit by my routines automatically. In other words, I am
  96. trying to keep Pointers as easy as possible for your use. :)
  97.  
  98. Also, all calls to any Functions which gets data with the string routines
  99. will auto-trim each string's extra spaces and the null terminator, CHR$(0),
  100. off so printing will be easier for you to manipulate. When calling the string
  101. routines to put data back into the string space, all string data will be
  102. resized to fit the USERS.IDX type structure and will add the null terminator
  103. back to the end of the string. Just remember, when working the data in memory
  104. with the pointer calls, you still have to write the data back to the
  105. USERS.IDX in order for the changes to become permanent.
  106.  
  107. -----------------------------------------------------------------------------
  108.  
  109. FUNCTION USERS_IDX_Search(s AS STRING) AS LONG
  110.  The USERS_IDX_Search searches the user index file for a name specified by
  111.  "s". If the name is found in the user index file, the user index file's
  112.  record number is return. Otherwise, the USERS_IDX_Search returns 0.
  113.  
  114. FUNCTION USERS_IDX_Insert(s AS STRING, n AS LONG) AS LONG
  115.  The USERS_IDX_Insert inserts a record in the user index files for the user
  116.  with the name specified by "s" and whose USERS.DAT record number is specified
  117.  by "n". The USERS_IDX_Insert returns the user index file's record number.
  118.  
  119. FUNCTION USERS_IDX_Replace(os AS STRING, ns AS STRING) AS INTEGER
  120.  The USERS_IDX_Replace replaces the record in the user index file for the user
  121.  with the name specified by "os" to a record with a new name specified by
  122.  "ns". The function will return either 0 or 1 depending if the current user
  123.  name exists.
  124.  
  125.     0 = 'os' did exist, replaced 'os' with 'ns' string
  126.     1 = 'os' did not exist, function was aborted, 'os' was Not replaced.
  127.  
  128. FUNCTION USERS_IDX_GetUN() AS STRING
  129.  This form of the USERS_IDX_GetUN returns a pointer to the user index record's
  130.  name string.
  131.  
  132. FUNCTION USERS_IDX_PutUN(s AS STRING)
  133.  This form of the USERS_IDX_Name sets the user index record's name string to
  134.  the string pointed to by "s". Note that the string pointed to by "s" can be
  135.  no more than 60 characters in length.
  136.  
  137. FUNCTION USERS_IDX_GetRN() AS WORD
  138.  This form of the USERS_IDX_GetRN returns the user index record's USERS.DAT
  139.  record number.
  140.  
  141. FUNCTION USERS_IDX_PutRN(n AS WORD)
  142.  This form of the USERS_IDX_PutRN sets the user index record's USERS.DAT
  143.  record number to "n".
  144.