home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / MISC / PBAPI10.ZIP / USERSSPF.BAS < prev    next >
BASIC Source File  |  1998-02-21  |  6KB  |  132 lines

  1. ' ─────────────────────────────────────────────────────────────────────────
  2. ' Program Title: Sample Program for TriBBS's USERS.SPF 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 userspf.bas file, you will see a couple different examples on how
  13. ' to use the Pointer "uspf" to make calls to the TriBBS API USERSSPF.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 "USERSPF.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.SPF API which are located in the USERSSPF.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 for USERS.SPF Pointer Calls **
  96. '----------------------------------------------------------------------------
  97. $IF 0 ' Change the '0' to '1' to run this example
  98.  
  99. DIM APAF AS INTEGER                 ' Dimention Local variable for this
  100.                                     ' example to hold a integer value
  101.  
  102.   USERS_SPF_OpenRead 1, 1           ' Will Open USERS.SPF and Read user
  103.                                     ' record #1, and conference record #1
  104.  
  105.       PRINT USERS_SPF_TotalRecords  ' Prints total records for this user
  106.       PRINT                         ' Print blank line
  107.       APAF = USERS_SPF_GetAPAF      ' Get current Access Private Area Flag
  108.                                       ' 0 = The user doesn't have access to a
  109.                                       '     private file area
  110.                                       ' 1 = The user does have access to a
  111.                                       '     private file area
  112.  
  113.       PRINT APAF                    ' Let's print the current value
  114.  
  115.       SELECT CASE APAF              ' Check variable and see if it is a 1 or
  116.          CASE 0                     ' 0, then change it to the other.
  117.            APAF = 1
  118.          CASE 1
  119.            APAF = 0
  120.       END SELECT
  121.  
  122.       USERS_SPF_PutAPAF APAF        ' Change value in memory with new value
  123.  
  124.       PRINT USERS_SPF_GetAPAF       ' Prints New bit value after change
  125.  
  126.   USERS_SPF_Close                   ' Closes USERS.SPF file
  127.  
  128. $ENDIF
  129.  
  130. '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  131. END                          ' Ends the Program
  132.