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 >
BASIC Source File  |  1998-02-21  |  8KB  |  155 lines

  1. ' ─────────────────────────────────────────────────────────────────────────
  2. ' Program Title: Sample Program for TriBBS's USERS.SPM API UNIT
  3. '     Copyright: 1997-98 by Freejack's Software
  4. '        Author: Gary Price
  5. ' Last Modified: 02/21/98
  6. ' ─────────────────────────────────────────────────────────────────────────
  7. '         Notes:
  8. ' ─────────────────────────────────────────────────────────────────────────
  9. '       History:
  10. ' ─────────────────────────────────────────────────────────────────────────
  11. '
  12. ' In this userspm.bas file, you will see a couple different examples on how
  13. ' to use the Pointer "uspm" to make calls to the TriBBS API USERSSPM.PBU Unit.
  14. ' To use any of the current examples, go to the section and you will see a
  15. ' "$IF 0" statment at the head of the example, all you need to do to make
  16. ' that section of code run is change the '0' to any non-zero number.
  17. '
  18. ' A pointer is a varible that holds 32-bit (4 byte) address of data located
  19. ' elsewhere in memory. It is called a pointer because it literally points
  20. ' to data. The data at which it points is known as the target.
  21. '
  22. ' Pointers are Powerfull! The address is defined at run-time, so any target
  23. ' in memory can be referenced by your program just as if it were a standard
  24. ' PowerBASIC varible. This type of indirection is much faster and more
  25. ' efficient than PEEKing and POKEing at the target data.
  26. '
  27. ' ─────────────────────────────────────────────────────────────────────────
  28.  
  29. $CPU 80386                    ' Requires a 386 system or faster
  30.  
  31. $OPTIMIZE SPEED             ' make fastest possible executable
  32.  
  33. '$COMPILE EXE "USERSPM.EXE" ' compile to an EXE
  34.  
  35. $DEBUG MAP OFF              ' turn off map file generation
  36. $DEBUG PBDEBUG OFF          ' don't include pbdebug support in our executable
  37.  
  38. $LIB COM        OFF         ' turn off PowerBASIC's communications library.
  39. $LIB CGA        OFF         ' turn off PowerBASIC's CGA graphics library.
  40. $LIB EGA        OFF         ' turn off PowerBASIC's EGA graphics library.
  41. $LIB VGA        OFF         ' turn off PowerBASIC's VGA graphics library.
  42. $LIB LPT        OFF         ' turn off PowerBASIC's printer support library.
  43. $LIB IPRINT     OFF         ' turn off PowerBASIC's interpreted print library.
  44. $LIB FULLFLOAT  OFF         ' turn off PowerBASIC's floating point support.
  45.  
  46. $ERROR BOUNDS   ON          ' turn on bounds checking for pointer debugging
  47. $ERROR NUMERIC  OFF         ' turn off numeric checking
  48. $ERROR OVERFLOW OFF         ' turn off overflow checking
  49. $ERROR STACK    OFF         ' turn off stack checking
  50.  
  51. $COM    0                   ' set communications buffer to nothing
  52. $STRING 16                  ' set largest string size at 16k
  53. $STACK  2048                ' let's use a 2k stack
  54. $SOUND  1                   ' smallest music buffer possible
  55.  
  56. $DIM ALL                    ' forces all Varibles and Arrays to be
  57.                             ' pre-dementioned before use.
  58.  
  59. $DYNAMIC                    ' all arrays will be dynamic by default
  60.  
  61. $OPTION CNTLBREAK OFF       ' don't allow Ctrl-Break to exit program
  62.  
  63. DEFINT A-Z                  ' default all variables to integers for maximum
  64.                             ' speed and minimum size
  65. '============================================================================
  66.  
  67.  
  68. '============================================================================
  69. '                          DECLARATIONS SECTION
  70. '============================================================================
  71. ' ** THIS SECTION IS FOR LINKS AND INCLUDES STATMENTS **
  72.  
  73. $LINK "G:\PB35\TBAPI10\PBAPI10.PBL"    ' ** SET THIS LINE TO YOUR PATH **
  74. $INCLUDE "G:\PB35\TBAPI10\PBAPI10.INC" ' ** SET THIS LINE TO YOUR PATH **
  75.  
  76. '---------------------------------------------------------------------------
  77. ' ** DECLARE SUB's BELOW THAT WILL BE USED IN THIS PROGRAM **
  78. '
  79. ' Use this section for any declarations needed to be made other than the
  80. ' USERS.SPM API which are located in the USERSSPM.INC file.
  81.  
  82. '----------------------------------------------------------------------------
  83. ' ** SET THIS LINE BELOW TO YOUR TRIBBS MAIN NODE's DIRECTORY **
  84.  
  85. TBNode1sMainDirectory = "E:\TRIBBS"
  86. '============================================================================
  87.  
  88. '============================================================================
  89. '                         ** MAIN PROGRAM BODY **
  90. '============================================================================
  91.  
  92. CLS     ' Clears screen prepares it for printing
  93.  
  94. '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  95. '                ** EXAMPLE 1 for USERS.SPM Pointer Calls **
  96. '----------------------------------------------------------------------------
  97. $IF 0 ' Change the '0' to '1' to run this example
  98.  
  99. DIM LMR AS LONG                 ' Dimention local varible to use for this
  100.                                 ' example
  101.  
  102.   USERS_SPM_OpenRead 1, 1       ' Will Open USERS.SPM and Read user
  103.                                 ' record #1, and conference record #1
  104.  
  105.       LMR = USERS_SPM_GetLMR    ' Get Last Message Read and assigns it
  106.                                 ' to a local varible
  107.       PRINT LMR
  108.       LMR = LMR + 1             ' Let's add 1 to the Last Message Read
  109.       USERS_SPM_PutLMR LMR      ' Put the new value into the record in
  110.                                 ' memory. NOTE: You will need to write
  111.                                 ' any changed information back to the
  112.                                 ' users.spm before the change is permanent
  113.  
  114.       PRINT USERS_SPM_GetLMR    ' Let's get the New Last Message Read
  115.                                 ' and print it to the screen
  116.  
  117.   USERS_SPM_Close               ' Closes USERS.SPM file
  118.  
  119. $ENDIF
  120. '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  121.  
  122. '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  123. '                ** EXAMPLE 2 for USERS.SPM Pointer Calls **
  124. '----------------------------------------------------------------------------
  125. $IF 0 ' Change the '0' to '1' to run this example
  126.  
  127.   USERS_SPM_OpenRead 1, 1           ' Will Open USERS.SPM and Read user
  128.                                     ' record #1, and conference record #1
  129.  
  130.       PRINT USERS_SPM_TotalRecords  ' Prints total records for this user
  131.       PRINT
  132.       PRINT USERS_SPM_GetLMR        ' Prints Last Message Read
  133.       PRINT USERS_SPM_GetLWMR       ' Prints Last Waiting Message Read
  134.       PRINT USERS_SPM_GetWMC        ' Prints Waiting Message Counter
  135.       PRINT USERS_SPM_GetQC         ' Prints Queued Conference
  136.                                       ' 0 = Conference isn't queued
  137.                                       ' 1 = Conference is queued
  138.       PRINT USERS_SPM_GetAPCF       ' Prints Access Private Conference Flag
  139.                                       ' 0 = The user doesn't have access to a
  140.                                       '     private conference
  141.                                       ' 1 = The user does have access to a
  142.                                       '     private conference
  143.       PRINT USERS_SPM_GetCSSF       ' Prints Co-Sysop Flag
  144.                                         ' 0 = The user doesn't have co-sysop
  145.                                       '     status in the conference
  146.                                       ' 1 = The user has co-sysop status in
  147.                                       '     the conference
  148.  
  149.   USERS_SPM_Close                   ' Closes USERS.SPM file
  150.  
  151. $ENDIF
  152.  
  153. '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  154. END                          ' Ends the Program
  155.