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 >
Wrap
Text File
|
1998-02-21
|
6KB
|
145 lines
Author....... : Gary Price
Copyrighted by: Freejack's Software 1997-98
ALIAS_IDX API for TriBBS v10.x/11.x written in PowerBasic v3.5
---------------------------------------------------------------------------
The ALIAS_IDX unit is used to manipulate data in the ALIAS.IDX data file
found in node 1's MWORK directory. The ALIAS_IDX unit is declared in
PBAPI10.INC as follows:
File Name: "ALIAS.IDX"
TYPE USERSIDX
UserName AS STRING * 61
RecordNumber AS LONG
END TYPE
DIM ALIASIDX AS SHARED ALIASIDX
DIM ai AS SHARED ALIASIDX PTR
ai = VARPTR32(ALIASIDX)
LSET ALIASIDX = ALIASIDX
---------------------------------------------------------------------------
FUNCTION's below are from the ALIASIDX.PBU Unit and DECLAREd in PBAPI10.INC.
FUNCTION ALIAS_IDX_OPEN()
FUNCTION ALIAS_IDX_CLOSE()
FUNCTION ALIAS_IDX_READ(n AS WORD)
FUNCTION ALIAS_IDX_WRITE(n AS WORD)
FUNCTION ALIAS_IDX_Length() AS LONG
FUNCTION ALIAS_IDX_OpenRead(n AS WORD)
FUNCTION ALIAS_IDX_WriteClose(n AS WORD)
FUNCTION ALIAS_IDX_OpenReadClose(n AS WORD)
FUNCTION ALIAS_IDX_OpenWriteClose(n AS WORD)
FUNCTION ALIAS_IDX_Clearit(n AS WORD)
FUNCTION ALIAS_IDX_Search(s AS STRING) AS LONG
FUNCTION ALIAS_IDX_Insert(s AS STRING, n AS LONG) AS LONG
FUNCTION ALIAS_IDX_Replace(os AS STRING, ns AS STRING) AS INTEGER
FUNCTION ALIAS_IDX_GetUN() AS STRING
FUNCTION ALIAS_IDX_PutUN(s AS STRING)
FUNCTION ALIAS_IDX_GetRN() AS WORD
FUNCTION ALIAS_IDX_PutRN(n AS WORD)
---------------------------------------------------------------------------
** EXTERNAL FUNCTION USED BY ALIAS.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 ALIAS_IDX_Open()
The ALIAS_IDX_Open opens the ALIAS.IDX file in node 1's MWORK directory.
FUNCTION ALIAS_IDX_Close()
The ALIAS_IDX_Close closes the ALIAS.IDX file in node 1's MWORK directory.
FUNCTION ALIAS_IDX_Read(n AS WORD)
The ALIAS_IDX_Read reads alais index record specified by "n" into memory.
FUNCTION ALIAS_IDX_Write(n AS WORD)
The ALIAS_IDX_Write updates the alias index record specified by "n" from
memory.
FUNCTION LONG ALIAS_IDX_Length()
The ALIAS_IDX_Length returns the number of records in the alias index file.
FUNCTION ALIAS_IDX_OpenRead(n AS WORD)
The ALIAS_IDX_OpenRead provides the functionality of the ALIAS_IDX_Open and
ALIAS_IDX_Read functions in a single call.
FUNCTION ALIAS_IDX_WriteClose(n AS WORD)
The ALIAS_IDX_WriteClose provides the functionality of the ALIAS_IDX_Write
and ALIAS_IDX_Close functions in a single call.
FUNCTION ALIAS_IDX_OpenReadClose(n AS WORD)
The ALIAS_IDX_OpenReadClose provides the functionality of the ALIAS_IDX_Open,
ALIAS_IDX_Read, and ALIAS_IDX_Close functions in a single call.
FUNCTION ALIAS_IDX_OpenWriteClose(n AS WORD)
The ALIAS_IDX_OpenWriteClose provides the functionality of the ALIAS_IDX_Open,
ALIAS_IDX_Write, and ALIAS_IDX_Close functions in a single call.
FUNCTION ALIAS_IDX_ClearIt(n AS WORD)
The ALIAS_IDX_ClearIt sets the entire ALIAS_IDX data record for 'n' to all
zeros.
-----------------------------------------------------------------------------
POINTERS Uses a hidden variable I use called "@ai". 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 ALIASIDX.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 ALIAS.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
ALIAS.IDX in order for the changes to become permanent.
-----------------------------------------------------------------------------
FUNCTION ALIAS_IDX_Search(s AS STRING) AS LONG
The ALIAS_IDX_Search searches the alias index file for a name specified by
"s". If the name is found in the alias index file, the alias index file's
record number is return. Otherwise, the ALIAS_IDX_Search returns 0.
FUNCTION ALIAS_IDX_Insert(s AS STRING, n AS LONG) AS LONG
The ALIAS_IDX_Insert inserts a record in the alias index files for the user
with the name specified by "s" and whose USERS.DAT record number is specified
by "n". The ALIAS_IDX_Insert returns the alias index file's record number.
FUNCTION ALIAS_IDX_Replace(os AS STRING, ns AS STRING) AS INTEGER
The ALIAS_IDX_Replace replaces the record in the alias 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
alias name exists.
0 = 'os' did exist, replaced 'os' with 'ns' string
1 = 'os' did not exist, function was aborted, 'os' was Not replaced.
FUNCTION ALIAS_IDX_GetUN() AS STRING
This form of the ALIAS_IDX_GetUN returns a pointer to the alais index
record's name string.
FUNCTION ALIAS_IDX_PutUN(s AS STRING)
This form of the ALIAS_IDX_Name sets the alias 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 ALIAS_IDX_GetRN() AS WORD
This form of the ALIAS_IDX_GetRN returns the alias index record's USERS.DAT
record number.
FUNCTION ALIAS_IDX_PutRN(n AS WORD)
This form of the ALIAS_IDX_PutRN sets the alias index record's USERS.DAT
record number to "n".