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

  1. ' ─────────────────────────────────────────────────────────────────────────
  2. ' Program Title: Sample Program for TriBBS's NODE.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 "sys1" to make calls to the TriBBS API NODEDAT.PBU Unit.
  14. ' Also there are some examples showing how to use the NODEDAT.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 NODEDAT 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 NODE.DAT.
  37. ' ─────────────────────────────────────────────────────────────────────────
  38.  
  39. $CPU 80386                    ' Requires a 386 system or faster
  40.  
  41. $OPTIMIZE SPEED             ' make fastest possible executable
  42.  
  43. '$COMPILE EXE "NODEDAT.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. ' NODEDAT.DAT API which are located in the NODEDAT.INC file.
  91.  
  92. '----------------------------------------------------------------------------
  93. ' ** SET THIS LINE BELOW TO YOUR TRIBBS MAIN NODE's DIRECTORY **
  94.  
  95. TBNode1sMainDirectory = "E:\TRIBBS"
  96. '============================================================================
  97.  
  98. '============================================================================
  99. '                         ** MAIN PROGRAM BODY **
  100. '============================================================================
  101.  
  102. CLS     ' Clears screen prepares it for printing
  103.  
  104. '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  105. '                ** EXAMPLE 1 for NODE.DAT Pointer Calls **
  106. '----------------------------------------------------------------------------
  107. $IF 0 ' Change the '0' to '1' to run this example
  108.  
  109. DIM IS AS STRING         ' Dimention a Local Varible to hold Initialization
  110.                          ' String for this example
  111.  
  112.   NODE_DAT_OpenRead      ' Will Open and Read in NODE.DAT
  113.  
  114.     IS = NODE_DAT_GetIS  ' Returns a 32-bit pointer to the Initialization
  115.                          ' String
  116.  
  117.     PRINT IS             ' Prints the Initialization String
  118.  
  119.     NODE_DAT_PutIS "AT&FS0=0^M"  ' Let's change the Initialization String
  120.                                  ' data in memory
  121.  
  122.     PRINT NODE_DAT_GetIS ' Returns a 32-bit pointer to the Initialization
  123.                          ' String back from memory.
  124.  
  125.   NODE_DAT_Close         ' Closes NODE.DAT file
  126.  
  127.  ' In the example below, we can open, read, close the NODE.DAT file, also
  128.  ' get and print the Date Of Last Call all in a single line of code. :)
  129.  
  130.    PRINT    ' Print a blank line
  131.    NODE_DAT_OpenReadClose : PRINT NODE_DAT_GetDOLC
  132.  
  133. $ENDIF
  134. '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  135.  
  136. '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  137. '                ** EXAMPLE 2 for NODE.DAT Pointer Calls **
  138. '----------------------------------------------------------------------------
  139. $IF 0 ' Change the '0' to '1' to run this example
  140.  
  141.  NODE_DAT_OpenReadClose      ' Will Open, Read & Close NODE.DAT
  142.  
  143.   ' Grab File Area's data from memory using the a 32-bit pointer
  144.  
  145.     PRINT NODE_DAT_GetIS          ' Initialization String
  146.     PRINT NODE_DAT_GetECCM        ' Error Correcting Connect Message
  147.     PRINT NODE_DAT_GetATZS        ' ATZ String
  148.     PRINT NODE_DAT_GetATAS        ' ATA String
  149.     PRINT NODE_DAT_GetATH0S       ' ATH0 String
  150.     PRINT NODE_DAT_GetATH1S       ' ATH1 String
  151.     PRINT NODE_DAT_GetDOLC        ' Date Of Last Call
  152.     PRINT NODE_DAT_GetNN          ' Node Number
  153.     PRINT NODE_DAT_GetSP          ' Serial Port
  154.     PRINT NODE_DAT_GetDBATA       ' Delay Before ATA
  155.     PRINT NODE_DAT_GetNOR         ' Number of Rings
  156.     PRINT NODE_DAT_GetNSL         ' Node Security Level
  157.     PRINT NODE_DAT_GetMKIT        ' Maximum Keyboard Idle Time
  158.     PRINT NODE_DAT_GetNSIRQN      ' Non-Standard IRQ Number
  159.     PRINT NODE_DAT_GetDAC         ' Delay After CONNECT
  160.     PRINT NODE_DAT_GetMBR         ' Maximum Baud Rate
  161.  
  162.  
  163.  ' ** These are Bit Fields converted to integers below **
  164.  
  165.     PRINT NODE_DAT_GetN300BCF   ' No 300 Baud Callers Flag
  166.                                   ' 0 = Allow 300 baud callers
  167.                                   ' 1 = Do not allow 300 baud callers
  168.     PRINT NODE_DAT_GetN1200BCF  ' No 1200 Baud Callers Flag
  169.                                   ' 0 = Allow 1200 baud callers
  170.                                   ' 1 = Do not allow 1200 baud callers
  171.     PRINT NODE_DAT_GetN2400BCF  ' No 2400 Baud Callers Flag
  172.                                   ' 0 = Allow 2400 baud callers
  173.                                   ' 1 = Do not allow 2400 baud callers
  174.     PRINT NODE_DAT_GetRTSCTSHF  ' RTS/CTS Handshaking Flag
  175.                                   ' 0 = Do not use RTS/CTS handshaking
  176.                                   ' 1 = Use RTS/CTS handshaking
  177.     PRINT NODE_DAT_GetLSPF      ' Lock Serial Port Flag
  178.                                   ' 0 = Do not lock the serial port
  179.                                   ' 1 = Lock the serial port
  180.     PRINT NODE_DAT_GetDSWF      ' Direct Screen Write Flag
  181.                                   ' 0 = Disable the video controller when
  182.                                   '     writing to the screen memory
  183.                                   ' 1 = Do not disable the videod controller
  184.                                   '     when writting to the screen memory
  185.  
  186.        PRINT
  187.        PRINT "Hit Any Key To Continue"
  188.        DO: LOOP WHILE INKEY$ = ""
  189.        CLS
  190.  
  191.     PRINT NODE_DAT_GetPBOF      ' Page Bell On Flag
  192.                                   ' 0 = Page bell is off
  193.                                   ' 1 = Page bell is on
  194.     PRINT NODE_DAT_GetUNDDF     ' Use Node 1's DISPLAY Directory Flag
  195.                                   ' 0 = Use node 1's DISPLAY directory
  196.                                   ' 1 = Do not use node 1's DISPLAY directory
  197.     PRINT NODE_DAT_GetPOHDEF    ' Phone Off Hook During Events Flag
  198.                                   ' 0 = Do not take the phone off hook during
  199.                                   '     events flag
  200.                                   ' 1 = Take the phone off hook during events
  201.     PRINT NODE_DAT_GetELRIPEF   ' Enable Local RIPscrip Emulation Flag
  202.                                   ' 0 = Disable local RIPscrip emulation
  203.                                   ' 1 = Enable local RIPscrip emulation
  204.     PRINT NODE_DAT_GetUFDF      ' Use Fossil Driver Flag
  205.                                   ' 0 = Do not use a fossil driver
  206.                                   ' 1 = Use a fossil driver
  207.     PRINT NODE_DAT_GetECIDF     ' Enable Caller ID Flag
  208.                                   ' 0 = Do not Enable Caller ID
  209.                                   ' 1 = Enable Caller ID
  210.     PRINT NODE_DAT_GetBNICF     ' Bump No Info Calls Flag
  211.                                   ' 0 = Do not bump no info calls
  212.                                   ' 1 = Bump no info calls
  213.     PRINT NODE_DAT_GetBBCF      ' Bump Blocked Calls Flag
  214.                                   ' 0 = Do not bump blocked calls
  215.                                   ' 1 = Bump blocked calls
  216.     PRINT NODE_DAT_GetBOOACF    ' Bump Out Of Area Calls Flag
  217.                                   ' 0 = Do not bump  out of area calls
  218.                                   ' 1 = Bump out of area calls
  219.  
  220. $ENDIF
  221.  
  222. '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  223.  
  224. END                          ' Ends the Program
  225.