home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.wwiv.com
/
ftp.wwiv.com.zip
/
ftp.wwiv.com
/
pub
/
MISC
/
PBAPI10.ZIP
/
USERSSPM.BAS
< prev
next >
Wrap
BASIC Source File
|
1998-02-21
|
8KB
|
155 lines
' ─────────────────────────────────────────────────────────────────────────
' Program Title: Sample Program for TriBBS's USERS.SPM API UNIT
' Copyright: 1997-98 by Freejack's Software
' Author: Gary Price
' Last Modified: 02/21/98
' ─────────────────────────────────────────────────────────────────────────
' Notes:
' ─────────────────────────────────────────────────────────────────────────
' History:
' ─────────────────────────────────────────────────────────────────────────
'
' In this userspm.bas file, you will see a couple different examples on how
' to use the Pointer "uspm" to make calls to the TriBBS API USERSSPM.PBU Unit.
' To use any of the current examples, go to the section and you will see a
' "$IF 0" statment at the head of the example, all you need to do to make
' that section of code run is change the '0' to any non-zero number.
'
' A pointer is a varible that holds 32-bit (4 byte) address of data located
' elsewhere in memory. It is called a pointer because it literally points
' to data. The data at which it points is known as the target.
'
' Pointers are Powerfull! The address is defined at run-time, so any target
' in memory can be referenced by your program just as if it were a standard
' PowerBASIC varible. This type of indirection is much faster and more
' efficient than PEEKing and POKEing at the target data.
'
' ─────────────────────────────────────────────────────────────────────────
$CPU 80386 ' Requires a 386 system or faster
$OPTIMIZE SPEED ' make fastest possible executable
'$COMPILE EXE "USERSPM.EXE" ' compile to an EXE
$DEBUG MAP OFF ' turn off map file generation
$DEBUG PBDEBUG OFF ' don't include pbdebug support in our executable
$LIB COM OFF ' turn off PowerBASIC's communications library.
$LIB CGA OFF ' turn off PowerBASIC's CGA graphics library.
$LIB EGA OFF ' turn off PowerBASIC's EGA graphics library.
$LIB VGA OFF ' turn off PowerBASIC's VGA graphics library.
$LIB LPT OFF ' turn off PowerBASIC's printer support library.
$LIB IPRINT OFF ' turn off PowerBASIC's interpreted print library.
$LIB FULLFLOAT OFF ' turn off PowerBASIC's floating point support.
$ERROR BOUNDS ON ' turn on bounds checking for pointer debugging
$ERROR NUMERIC OFF ' turn off numeric checking
$ERROR OVERFLOW OFF ' turn off overflow checking
$ERROR STACK OFF ' turn off stack checking
$COM 0 ' set communications buffer to nothing
$STRING 16 ' set largest string size at 16k
$STACK 2048 ' let's use a 2k stack
$SOUND 1 ' smallest music buffer possible
$DIM ALL ' forces all Varibles and Arrays to be
' pre-dementioned before use.
$DYNAMIC ' all arrays will be dynamic by default
$OPTION CNTLBREAK OFF ' don't allow Ctrl-Break to exit program
DEFINT A-Z ' default all variables to integers for maximum
' speed and minimum size
'============================================================================
'============================================================================
' DECLARATIONS SECTION
'============================================================================
' ** THIS SECTION IS FOR LINKS AND INCLUDES STATMENTS **
$LINK "G:\PB35\TBAPI10\PBAPI10.PBL" ' ** SET THIS LINE TO YOUR PATH **
$INCLUDE "G:\PB35\TBAPI10\PBAPI10.INC" ' ** SET THIS LINE TO YOUR PATH **
'---------------------------------------------------------------------------
' ** DECLARE SUB's BELOW THAT WILL BE USED IN THIS PROGRAM **
'
' Use this section for any declarations needed to be made other than the
' USERS.SPM API which are located in the USERSSPM.INC file.
'----------------------------------------------------------------------------
' ** SET THIS LINE BELOW TO YOUR TRIBBS MAIN NODE's DIRECTORY **
TBNode1sMainDirectory = "E:\TRIBBS"
'============================================================================
'============================================================================
' ** MAIN PROGRAM BODY **
'============================================================================
CLS ' Clears screen prepares it for printing
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' ** EXAMPLE 1 for USERS.SPM Pointer Calls **
'----------------------------------------------------------------------------
$IF 0 ' Change the '0' to '1' to run this example
DIM LMR AS LONG ' Dimention local varible to use for this
' example
USERS_SPM_OpenRead 1, 1 ' Will Open USERS.SPM and Read user
' record #1, and conference record #1
LMR = USERS_SPM_GetLMR ' Get Last Message Read and assigns it
' to a local varible
PRINT LMR
LMR = LMR + 1 ' Let's add 1 to the Last Message Read
USERS_SPM_PutLMR LMR ' Put the new value into the record in
' memory. NOTE: You will need to write
' any changed information back to the
' users.spm before the change is permanent
PRINT USERS_SPM_GetLMR ' Let's get the New Last Message Read
' and print it to the screen
USERS_SPM_Close ' Closes USERS.SPM file
$ENDIF
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' ** EXAMPLE 2 for USERS.SPM Pointer Calls **
'----------------------------------------------------------------------------
$IF 0 ' Change the '0' to '1' to run this example
USERS_SPM_OpenRead 1, 1 ' Will Open USERS.SPM and Read user
' record #1, and conference record #1
PRINT USERS_SPM_TotalRecords ' Prints total records for this user
PRINT
PRINT USERS_SPM_GetLMR ' Prints Last Message Read
PRINT USERS_SPM_GetLWMR ' Prints Last Waiting Message Read
PRINT USERS_SPM_GetWMC ' Prints Waiting Message Counter
PRINT USERS_SPM_GetQC ' Prints Queued Conference
' 0 = Conference isn't queued
' 1 = Conference is queued
PRINT USERS_SPM_GetAPCF ' Prints Access Private Conference Flag
' 0 = The user doesn't have access to a
' private conference
' 1 = The user does have access to a
' private conference
PRINT USERS_SPM_GetCSSF ' Prints Co-Sysop Flag
' 0 = The user doesn't have co-sysop
' status in the conference
' 1 = The user has co-sysop status in
' the conference
USERS_SPM_Close ' Closes USERS.SPM file
$ENDIF
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
END ' Ends the Program