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 >
Wrap
Text File
|
1998-02-21
|
6KB
|
144 lines
Author....... : Gary Price
Copyrighted by: Freejack's Software 1997-98
USERS_IDX API for TriBBS v10.x/11.x written in PowerBasic v3.5
---------------------------------------------------------------------------
The USERS_IDX unit is used to manipulate data in the USERS.IDX data file
found in node 1's MWORK directory. The USERS_IDX unit is declared in
PBAPI10.INC as follows:
File Name: "USERS.IDX"
TYPE UERSIDX
UserName AS STRING * 61
RecordNumber AS LONG
END TYPE
DIM USERSIDX AS SHARED USERSIDX
DIM ui AS SHARED USERSIDX PTR
ui = VARPTR32(USERSIDX)
LSET USERSIDX = USERSIDX
---------------------------------------------------------------------------
FUNCTION's below are from the USERSIDX.PBU Unit and DECLAREd in PBAPI10.INC.
FUNCTION USERS_IDX_OPEN()
FUNCTION USERS_IDX_CLOSE()
FUNCTION USERS_IDX_READ(n AS WORD)
FUNCTION USERS_IDX_WRITE(n AS WORD)
FUNCTION USERS_IDX_Length() AS LONG
FUNCTION USERS_IDX_OpenRead(n AS WORD)
FUNCTION USERS_IDX_WriteClose(n AS WORD)
FUNCTION USERS_IDX_OpenReadClose(n AS WORD)
FUNCTION USERS_IDX_OpenWriteClose(n AS WORD)
FUNCTION USERS_IDX_Clearit(n AS WORD)
FUNCTION USERS_IDX_Search(s AS STRING) AS LONG
FUNCTION USERS_IDX_Insert(s AS STRING, n AS LONG) AS LONG
FUNCTION USERS_IDX_Replace(os AS STRING, ns AS STRING) AS INTEGER
FUNCTION USERS_IDX_GetUN() AS STRING
FUNCTION USERS_IDX_PutUN(s AS STRING)
FUNCTION USERS_IDX_GetRN() AS WORD
FUNCTION USERS_IDX_PutRN(n AS WORD)
---------------------------------------------------------------------------
** EXTERNAL FUNCTION USED BY USERS.IDX UNIT BELOW **
FUNCTION HashIt(s AS STRING) AS LONG
---------------------------------------------------------------------------
MPORTANT: TBNode1sMainDirectory must be set to node 1's main directory
before calling any with the "Open" word.
FUNCTION USERS_IDX_Open()
The USERS_IDX_Open opens the USERS.IDX file in node 1's MWORK directory.
FUNCTION USERS_IDX_Close()
The USERS_IDX_Close closes the USERS.IDX file in node 1's MWORK directory.
FUNCTION USERS_IDX_Read(n AS WORD)
The USERS_IDX_Read reads user index record specified by "n" into memory.
FUNCTION USERS_IDX_Write(n AS WORD)
The USERS_IDX_Write updates the user index record specified by "n" from
memory.
FUNCTION LONG USERS_IDX_Length()
The USERS_IDX_Length returns the number of records in the user index file.
FUNCTION USERS_IDX_OpenRead(n AS WORD)
The USERS_IDX_OpenRead provides the functionality of the USERS_IDX_Open and
USERS_IDX_Read functions in a single call.
FUNCTION USERS_IDX_WriteClose(n AS WORD)
The USERS_IDX_WriteClose provides the functionality of the USERS_IDX_Write
and USERS_IDX_Close functions in a single call.
FUNCTION USERS_IDX_OpenReadClose(n AS WORD)
The USERS_IDX_OpenReadClose provides the functionality of the USERS_IDX_Open,
USERS_IDX_Read, and USERS_IDX_Close functions in a single call.
FUNCTION USERS_IDX_OpenWriteClose(n AS WORD)
The USERS_IDX_OpenWriteClose provides the functionality of the USERS_IDX_Open,
USERS_IDX_Write, and USERS_IDX_Close functions in a single call.
FUNCTION USERS_IDX_ClearIt(n AS WORD)
The USERS_IDX_ClearIt sets the entire USERS_IDX data record for 'n' to all
zeros.
-----------------------------------------------------------------------------
POINTERS Uses a hidden variable I use called "@ui". Any reference to this
is only for your information for discussion in this doc file. You will not
need to concern yourself trying to use this.. All calls are handled in the
main USERSIDX.PBU Unit by my routines automatically. In other words, I am
trying to keep Pointers as easy as possible for your use. :)
Also, all calls to any Functions which gets data with the string routines
will auto-trim each string's extra spaces and the null terminator, CHR$(0),
off so printing will be easier for you to manipulate. When calling the string
routines to put data back into the string space, all string data will be
resized to fit the USERS.IDX type structure and will add the null terminator
back to the end of the string. Just remember, when working the data in memory
with the pointer calls, you still have to write the data back to the
USERS.IDX in order for the changes to become permanent.
-----------------------------------------------------------------------------
FUNCTION USERS_IDX_Search(s AS STRING) AS LONG
The USERS_IDX_Search searches the user index file for a name specified by
"s". If the name is found in the user index file, the user index file's
record number is return. Otherwise, the USERS_IDX_Search returns 0.
FUNCTION USERS_IDX_Insert(s AS STRING, n AS LONG) AS LONG
The USERS_IDX_Insert inserts a record in the user index files for the user
with the name specified by "s" and whose USERS.DAT record number is specified
by "n". The USERS_IDX_Insert returns the user index file's record number.
FUNCTION USERS_IDX_Replace(os AS STRING, ns AS STRING) AS INTEGER
The USERS_IDX_Replace replaces the record in the user index file for the user
with the name specified by "os" to a record with a new name specified by
"ns". The function will return either 0 or 1 depending if the current user
name exists.
0 = 'os' did exist, replaced 'os' with 'ns' string
1 = 'os' did not exist, function was aborted, 'os' was Not replaced.
FUNCTION USERS_IDX_GetUN() AS STRING
This form of the USERS_IDX_GetUN returns a pointer to the user index record's
name string.
FUNCTION USERS_IDX_PutUN(s AS STRING)
This form of the USERS_IDX_Name sets the user index record's name string to
the string pointed to by "s". Note that the string pointed to by "s" can be
no more than 60 characters in length.
FUNCTION USERS_IDX_GetRN() AS WORD
This form of the USERS_IDX_GetRN returns the user index record's USERS.DAT
record number.
FUNCTION USERS_IDX_PutRN(n AS WORD)
This form of the USERS_IDX_PutRN sets the user index record's USERS.DAT
record number to "n".