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

  1. Author....... : Gary Price
  2. Copyrighted by: Freejack's Software 1997-98
  3.  
  4. ALIAS_IDX API for TriBBS v10.x/11.x written in PowerBasic v3.5
  5. ---------------------------------------------------------------------------
  6.  
  7. The ALIAS_IDX unit is used to manipulate data in the ALIAS.IDX data file
  8. found in node 1's MWORK directory. The ALIAS_IDX unit is declared in
  9. PBAPI10.INC as follows:
  10.  
  11. File Name: "ALIAS.IDX"
  12.  TYPE USERSIDX
  13.     UserName     AS STRING * 61
  14.     RecordNumber AS LONG
  15.  END TYPE
  16.  
  17.  DIM ALIASIDX AS SHARED ALIASIDX     
  18.  DIM ai       AS SHARED ALIASIDX PTR 
  19.  
  20.  ai = VARPTR32(ALIASIDX)  
  21.  LSET ALIASIDX = ALIASIDX 
  22. ---------------------------------------------------------------------------
  23.  
  24. FUNCTION's below are from the ALIASIDX.PBU Unit and DECLAREd in PBAPI10.INC.
  25.  
  26. FUNCTION ALIAS_IDX_OPEN()
  27. FUNCTION ALIAS_IDX_CLOSE()
  28. FUNCTION ALIAS_IDX_READ(n AS WORD)
  29. FUNCTION ALIAS_IDX_WRITE(n AS WORD)
  30. FUNCTION ALIAS_IDX_Length() AS LONG
  31. FUNCTION ALIAS_IDX_OpenRead(n AS WORD)
  32. FUNCTION ALIAS_IDX_WriteClose(n AS WORD)
  33. FUNCTION ALIAS_IDX_OpenReadClose(n AS WORD)
  34. FUNCTION ALIAS_IDX_OpenWriteClose(n AS WORD)
  35. FUNCTION ALIAS_IDX_Clearit(n AS WORD)
  36.  
  37. FUNCTION ALIAS_IDX_Search(s AS STRING) AS LONG
  38. FUNCTION ALIAS_IDX_Insert(s AS STRING, n AS LONG) AS LONG
  39. FUNCTION ALIAS_IDX_Replace(os AS STRING, ns AS STRING) AS INTEGER
  40.  
  41. FUNCTION ALIAS_IDX_GetUN() AS STRING
  42. FUNCTION ALIAS_IDX_PutUN(s AS STRING)
  43. FUNCTION ALIAS_IDX_GetRN() AS WORD
  44. FUNCTION ALIAS_IDX_PutRN(n AS WORD)
  45.  
  46. ---------------------------------------------------------------------------
  47.  ** EXTERNAL FUNCTION USED BY ALIAS.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 ALIAS_IDX_Open()
  56.  The ALIAS_IDX_Open opens the ALIAS.IDX file in node 1's MWORK directory. 
  57.  
  58. FUNCTION ALIAS_IDX_Close()
  59.  The ALIAS_IDX_Close closes the ALIAS.IDX file in node 1's MWORK directory.
  60.  
  61. FUNCTION ALIAS_IDX_Read(n AS WORD)
  62.  The ALIAS_IDX_Read reads alais index record specified by "n" into memory.
  63.  
  64. FUNCTION ALIAS_IDX_Write(n AS WORD)
  65.  The ALIAS_IDX_Write updates the alias index record specified by "n" from
  66.  memory.
  67.  
  68. FUNCTION LONG ALIAS_IDX_Length()
  69.  The ALIAS_IDX_Length returns the number of records in the alias index file.
  70.  
  71. FUNCTION ALIAS_IDX_OpenRead(n AS WORD)
  72.  The ALIAS_IDX_OpenRead provides the functionality of the ALIAS_IDX_Open and
  73.  ALIAS_IDX_Read functions in a single call.
  74.  
  75. FUNCTION ALIAS_IDX_WriteClose(n AS WORD)
  76.  The ALIAS_IDX_WriteClose provides the functionality of the ALIAS_IDX_Write
  77.  and ALIAS_IDX_Close functions in a single call.
  78.  
  79. FUNCTION ALIAS_IDX_OpenReadClose(n AS WORD)
  80.  The ALIAS_IDX_OpenReadClose provides the functionality of the ALIAS_IDX_Open,
  81.  ALIAS_IDX_Read, and ALIAS_IDX_Close functions in a single call.
  82.  
  83. FUNCTION ALIAS_IDX_OpenWriteClose(n AS WORD)
  84.  The ALIAS_IDX_OpenWriteClose provides the functionality of the ALIAS_IDX_Open,
  85.  ALIAS_IDX_Write, and ALIAS_IDX_Close functions in a single call.
  86.  
  87. FUNCTION ALIAS_IDX_ClearIt(n AS WORD)
  88.  The ALIAS_IDX_ClearIt sets the entire ALIAS_IDX data record for 'n' to all
  89.  zeros.
  90.  
  91. -----------------------------------------------------------------------------
  92. POINTERS Uses a hidden variable I use called "@ai". 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 ALIASIDX.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 ALIAS.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. ALIAS.IDX in order for the changes to become permanent.
  106.  
  107. -----------------------------------------------------------------------------
  108. FUNCTION ALIAS_IDX_Search(s AS STRING) AS LONG
  109.  The ALIAS_IDX_Search searches the alias index file for a name specified by
  110.  "s". If the name is found in the alias index file, the alias index file's
  111.  record number is return. Otherwise, the ALIAS_IDX_Search returns 0.
  112.  
  113. FUNCTION ALIAS_IDX_Insert(s AS STRING, n AS LONG) AS LONG
  114.  The ALIAS_IDX_Insert inserts a record in the alias index files for the user
  115.  with the name specified by "s" and whose USERS.DAT record number is specified
  116.  by "n". The ALIAS_IDX_Insert returns the alias index file's record number.
  117.  
  118. FUNCTION ALIAS_IDX_Replace(os AS STRING, ns AS STRING) AS INTEGER
  119.  The ALIAS_IDX_Replace replaces the record in the alias index file for the
  120.  user with the name specified by "os" to a record with a new name specified
  121.  by "ns". The function will return either 0 or 1 depending if the current
  122.  alias name exists.
  123.  
  124.     0 = 'os' did exist, replaced 'os' with 'ns' string
  125.     1 = 'os' did not exist, function was aborted, 'os' was Not replaced.
  126.  
  127. FUNCTION ALIAS_IDX_GetUN() AS STRING
  128.  This form of the ALIAS_IDX_GetUN returns a pointer to the alais index
  129.  record's name string.
  130.  
  131. FUNCTION ALIAS_IDX_PutUN(s AS STRING)
  132.  This form of the ALIAS_IDX_Name sets the alias index record's name string to
  133.  the string pointed to by "s". Note that the string pointed to by "s" can be
  134.  no more than 60 characters in length.
  135.  
  136. FUNCTION ALIAS_IDX_GetRN() AS WORD
  137.  This form of the ALIAS_IDX_GetRN returns the alias index record's USERS.DAT
  138.  record number.
  139.  
  140. FUNCTION ALIAS_IDX_PutRN(n AS WORD)
  141.  This form of the ALIAS_IDX_PutRN sets the alias index record's USERS.DAT
  142.  record number to "n".
  143.  
  144.  
  145.