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

  1. ' ─────────────────────────────────────────────────────────────────────────
  2. ' Program Title: Sample Program for TriBBS's WHOSON.DAT 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 sample.bas file, you will see servals different examples on how
  13. ' to use the Pointer "wd" to make calls to the TriBBS API WHOSON.PBU Unit.
  14. ' Also there are some examples showing how to use the WHOSON.PBU Unit
  15. ' without using pointers.  To use any of the current examples, go to the
  16. ' section and you will see a "$IF 0" statment at the head of the example, all
  17. ' you need to do to make that section of code run is change the '0' to any
  18. ' non-zero number.
  19. '
  20. ' A pointer is a varible that holds 32-bit (4 byte) address of data located
  21. ' elsewhere in memory. It is called a pointer because it literally points
  22. ' to data. The data at which it points is known as the target.
  23. '
  24. ' Pointers are Powerful! The address is defined at run-time, so any target
  25. ' in memory can be referenced by your program just as if it were a standard
  26. ' PowerBASIC varible. This type of indirection is much faster and more
  27. ' efficient than PEEKing and POKEing at the target data.
  28. '
  29. ' All String Pointer calls will grab the data from memory, and strip any
  30. ' spaces and null terminator characters from the end of the string which
  31. ' will allow you to print with better screen output control.
  32. '
  33. ' When writting back to memory with a pointer string, this WHOSON API will
  34. ' set the length back to proper size and add the null terminator, CHR$(0)
  35. ' to the end of the string. This again, will save time in writting back
  36. ' to the original record WHOSON.DAT.
  37. ' ─────────────────────────────────────────────────────────────────────────
  38.  
  39. $CPU 80386                    ' Requires a 386 system or faster
  40.  
  41. $OPTIMIZE SPEED             ' make fastest possible executable
  42.  
  43. '$COMPILE EXE "WHOSON.EXE"   ' compile to an EXE
  44.  
  45. $DEBUG MAP OFF              ' turn off map file generation
  46. $DEBUG PBDEBUG OFF          ' don't include pbdebug support in our executable
  47.  
  48. $LIB COM        OFF         ' turn off PowerBASIC's communications library.
  49. $LIB CGA        OFF         ' turn off PowerBASIC's CGA graphics library.
  50. $LIB EGA        OFF         ' turn off PowerBASIC's EGA graphics library.
  51. $LIB VGA        OFF         ' turn off PowerBASIC's VGA graphics library.
  52. $LIB LPT        OFF         ' turn off PowerBASIC's printer support library.
  53. $LIB IPRINT     OFF         ' turn off PowerBASIC's interpreted print library.
  54. $LIB FULLFLOAT  OFF         ' turn off PowerBASIC's floating point support.
  55.  
  56. $ERROR BOUNDS   ON          ' turn on bounds checking for pointer debugging
  57. $ERROR NUMERIC  OFF         ' turn off numeric checking
  58. $ERROR OVERFLOW OFF         ' turn off overflow checking
  59. $ERROR STACK    OFF         ' turn off stack checking
  60.  
  61. $COM    0                   ' set communications buffer to nothing
  62. $STRING 16                  ' set largest string size at 16k
  63. $STACK  2048                ' let's use a 2k stack
  64. $SOUND  1                   ' smallest music buffer possible
  65.  
  66. $DIM ALL                    ' forces all Varibles and Arrays to be
  67.                             ' pre-dementioned before use.
  68.  
  69. $DYNAMIC                    ' all arrays will be dynamic by default
  70.  
  71. $OPTION CNTLBREAK OFF       ' don't allow Ctrl-Break to exit program
  72.  
  73. DEFINT A-Z                  ' default all variables to integers for maximum
  74.                             ' speed and minimum size
  75. '============================================================================
  76.  
  77.  
  78. '============================================================================
  79. '                          DECLARATIONS SECTION
  80. '============================================================================
  81. ' ** THIS SECTION IS FOR LINKS AND INCLUDES STATMENTS **
  82.  
  83. $LINK "G:\PB35\TBAPI10\PBAPI10.PBL"    ' ** SET THIS LINE TO YOUR PATH **
  84. $INCLUDE "G:\PB35\TBAPI10\PBAPI10.INC" ' ** SET THIS LINE TO YOUR PATH **
  85.  
  86. '---------------------------------------------------------------------------
  87. ' ** DECLARE SUB's BELOW THAT WILL BE USED IN THIS PROGRAM **
  88. '
  89. ' Use this section for any declarations needed to be made other than the
  90. ' WHOSON.DAT API which are located in the WHOSON.INC file.
  91. '----------------------------------------------------------------------------
  92. ' ** SET THIS LINE BELOW TO YOUR TRIBBS MAIN NODE's DIRECTORY **
  93.  
  94. TBNode1sMainDirectory = "E:\TRIBBS"
  95. '============================================================================
  96.  
  97. '============================================================================
  98. '                         ** MAIN PROGRAM BODY **
  99. '============================================================================
  100.  
  101. CLS     ' Clears screen prepares it for printing
  102.  
  103. '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  104. '                ** EXAMPLE for WHOSON.DAT Pointer Calls **
  105. '----------------------------------------------------------------------------
  106. $IF 0 ' Change the '0' to '1' to run this example
  107.  
  108. DIM T       AS STRING         ' Dimention a Local Varible to hold Time
  109.                               ' for this example
  110.   WHOSON_DAT_OpenRead(1)      ' Will Open and Read record #1 in WHOSON.DAT
  111.  
  112.   PRINT WHOSON_DAT_Length     ' Returns total records of the events.dat
  113.  
  114.   PRINT WHOSON_DAT_GetWN      ' Returns a 32-bit pointer to the new time
  115.                               ' string
  116.   PRINT "Chat Status        =";WHOSON_DAT_GetCS
  117.   PRINT "Node Chatting With =";WHOSON_DAT_GetNCW
  118.  
  119.   PRINT "Head               =";WHOSONDAT.Head
  120.   PRINT "Tail               =";WHOSONDAT.Tail
  121.   PRINT WHOSONDAT.ChatBuffer
  122.   PRINT LEN(RTRIM$(WHOSONDAT.ChatBuffer, ANY " " + CHR$(0)))
  123.   PRINT ""
  124.   PRINT "================================================================================"
  125.  
  126.   WHOSON_DAT_Close             ' Closes WHOSON.DAT file
  127.  
  128. $ENDIF
  129. '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  130.  
  131. END                            ' Ends the Program
  132.