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

  1. ' ─────────────────────────────────────────────────────────────────────────
  2. ' Program Title: Sample Program for TriBBS's SYSDAT1.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 SYSDAT1.PBU Unit.
  14. ' Also there are some examples showing how to use the SYSDAT1.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 SYSDAT1 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 SYSDAT1.DAT.
  37. ' ─────────────────────────────────────────────────────────────────────────
  38.  
  39. $CPU 80386                    ' Requires a 386 system or faster
  40.  
  41. $OPTIMIZE SPEED             ' make fastest possible executable
  42.  
  43. '$COMPILE EXE "SYSDAT1.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. ' SYSDAT1.DAT API which are located in the SYSDAT1.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 SYSDAT1.DAT Pointer Calls **
  106. '----------------------------------------------------------------------------
  107. $IF 0 ' Change the '0' to '1' to run this example
  108.  
  109. DIM SN AS STRING            ' Dimention a Local Varible to hold Sysop's Name
  110.                             ' for this example
  111.  
  112.   SYSDAT1_DAT_OpenRead      ' Will Open and Read in SYSDAT1.DAT
  113.  
  114.     SN = SYSDAT1_DAT_GetSN  ' Returns a 32-bit pointer to the Sysop's Name
  115.                             ' string
  116.  
  117.     PRINT SN                ' Prints the Sysop's Name
  118.  
  119.     SYSDAT1_DAT_PutSN "SysGod"  ' Let's put a new Sysop Name
  120.  
  121.     PRINT SYSDAT1_DAT_GetSN ' Returns a 32-bit pointer to the Sysop's Name
  122.                             ' string with the new Sysop Name.
  123.  
  124.   SYSDAT1_DAT_Close         ' Closes SYSDAT1.DAT file
  125.  
  126.  ' In the example below, we can open, read, close the SYSDAT1.DAT file, also
  127.  ' get and print the BBS Board's Name all in a single line of code. :)
  128.  
  129.    PRINT    ' Print a blank line
  130.    SYSDAT1_DAT_OpenReadClose : PRINT SYSDAT1_DAT_GetBN
  131.  
  132. $ENDIF
  133. '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  134.  
  135. '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  136. '                ** EXAMPLE 2 for SYSDAT1.DAT Pointer Calls **
  137. '----------------------------------------------------------------------------
  138. $IF 0 ' Change the '0' to '1' to run this example
  139.  
  140.  SYSDAT1_DAT_OpenReadClose      ' Will Open, Read & Close SYSDAT1.DAT
  141.  
  142.   ' Grab File Area's data from memory using the a 32-bit pointer
  143.  
  144.     PRINT SYSDAT1_DAT_GetRC          ' Registration Code
  145.     PRINT SYSDAT1_DAT_GetBN          ' Board Name
  146.     PRINT SYSDAT1_DAT_GetSN          ' Sysop Name
  147.     PRINT SYSDAT1_DAT_GetVCCL        ' Virus Checker Command Line
  148.     PRINT SYSDAT1_DAT_GetZIPCCL      ' ZIP Compress Command Line
  149.     PRINT SYSDAT1_DAT_GetZIPUCCL     ' ZIP UnCompress Command Line
  150.     PRINT SYSDAT1_DAT_GetARJCCL      ' ARJ Compress Command Line
  151.     PRINT SYSDAT1_DAT_GetARJUCCL     ' ARJ UnCompress Command Line
  152.     PRINT SYSDAT1_DAT_GetLZHCCL      ' LZH Compress Command Line
  153.     PRINT SYSDAT1_DAT_GetLZHUCCL     ' LZH UnCompress Command Line
  154.     PRINT SYSDAT1_DAT_GetARCCCL      ' ARC Compress Command Line
  155.     PRINT SYSDAT1_DAT_GetARCUCCL     ' ARC UnCompress Command Line
  156.     PRINT SYSDAT1_DAT_GetPAKCCL      ' PAK Compress Command Line
  157.     PRINT SYSDAT1_DAT_GetPAKUCCL     ' PAK UnCompress Command Line
  158.     PRINT SYSDAT1_DAT_GetSDNCCL      ' SDN Compress Command Line
  159.     PRINT SYSDAT1_DAT_GetSDNUCCL     ' SDN UnCompress Command Line
  160.     PRINT SYSDAT1_DAT_GetRARCCL      ' RAR Compress Command Line
  161.     PRINT SYSDAT1_DAT_GetRARUCCL     ' RAR UnCompress Command Line
  162.     PRINT SYSDAT1_DAT_GetBSD         ' Board Start Date
  163.     PRINT SYSDAT1_DAT_GetTN          ' Total Nodes
  164.     PRINT SYSDAT1_DAT_GetCT          ' Calls Today
  165.     PRINT SYSDAT1_DAT_GetMT          ' Messages Today
  166.  
  167.        PRINT
  168.        PRINT "Hit Any Key To Continue"
  169.        DO: LOOP WHILE INKEY$ = ""
  170.        CLS
  171.  
  172.     PRINT SYSDAT1_DAT_GetUT          ' Uploads Today
  173.     PRINT SYSDAT1_DAT_GetDT          ' Downloads Today
  174.     PRINT SYSDAT1_DAT_GetDDTL        ' Default Daily Time Limit
  175.     PRINT SYSDAT1_DAT_GetDDL         ' Default Daily Logons
  176.     PRINT SYSDAT1_DAT_GetDTPL        ' Defautl Time Per Logon
  177.     PRINT SYSDAT1_DAT_GetMSSL        ' Minimum Sysop Security Level
  178.     PRINT SYSDAT1_DAT_GetNUSL        ' New User Security Level
  179.     PRINT SYSDAT1_DAT_GetNUTL        ' New User Time Limit
  180.     PRINT SYSDAT1_DAT_GetUTCR        ' Upload Time Compensation Ratio
  181.     PRINT SYSDAT1_DAT_GetMFASL       ' Minimum File Attachment Security Level
  182.     PRINT SYSDAT1_DAT_GetMAVSL       ' Minimum At Varible Security Level
  183.     PRINT SYSDAT1_DAT_GetFLSL        ' Fast Logon Security Level
  184.     PRINT SYSDAT1_DAT_GetTC          ' Total Calls
  185.     PRINT
  186.  
  187.  ' ** These are Bit Fields converted to integers below **
  188.  
  189.     PRINT SYSDAT1_DAT_GetPNSF    ' Phone Number Flag
  190.                                   '  0 = Do not format phone number
  191.                                   '  1 = North American-sytle phone numbers
  192.     PRINT SYSDAT1_DAT_GetTUF     ' Test Upload Flag
  193.                                   ' 0 = Do not test uploads
  194.                                   ' 1 = Test uploads
  195.     PRINT SYSDAT1_DAT_GetAADF    ' Auto ANSI detect flag
  196.                                   ' 0 = Do not auto dectect ANSI
  197.                                   ' 1 = Auto detect ANSI
  198.     PRINT SYSDAT1_DAT_GetCFWMF   ' Check for waiting messages flag
  199.                                   ' 0 = Do not check for waiting messages at
  200.                                   '     logon
  201.                                   ' 1 = Check for waiting messages at logon
  202.     PRINT SYSDAT1_DAT_GetUDRTF   ' Upload/Download Ratio type flag
  203.                                   ' 0 = Use sliding security levels
  204.                                   ' 1 = Ratios only effect download ability
  205.     PRINT SYSDAT1_DAT_GetPOHDMF  ' Phone on hook during maintainance flag
  206.                                   ' 0 = Take phone off hook during maintainance
  207.                                   ' 1 = Do not take the phone off hook during
  208.                                   '     maintainance
  209.     PRINT SYSDAT1_DAT_GetNOWNF   ' No one word names flag
  210.                                   ' 0 = Allow on word names
  211.                                   ' 1 = Do not allow one word names
  212.  
  213.        PRINT
  214.        PRINT "Hit Any Key To Continue"
  215.        DO: LOOP WHILE INKEY$ = ""
  216.        CLS
  217.  
  218.     PRINT SYSDAT1_DAT_GetNBMALF  ' No bulletin menu at logon flag
  219.                                   ' 0 = Display bulletin menu at logon
  220.                                   ' 1 = Do not display bulletin menu at logon
  221.     PRINT SYSDAT1_DAT_GetAAF     ' Allow aliases flag
  222.                                   ' 0 = Do not allow aliases
  223.                                   ' 1 = Allow aliases
  224.     PRINT SYSDAT1_DAT_GetCSBMF   ' Clear screen before menus flag
  225.                                   ' 0 = Do not clear the screen before menus
  226.                                   ' 1 = Clear the screen before menus
  227.     PRINT SYSDAT1_DAT_GetEFNMFDF ' Exact file name matching for dupes flag
  228.                                   ' 0 = Ignore the extension during duplicate
  229.                                   '     file checking
  230.                                   ' 1 = Do not Ignore the extension during
  231.                                   '     duplicate file checking
  232.     PRINT SYSDAT1_DAT_GetDNUBPF  ' Disable new user birthday prompt flag
  233.                                   ' 0 = Display the birthday prompt to a new
  234.                                   '     user at logon
  235.                                   ' 1 = Do not display the birthday prompt to
  236.                                   '     a new user at logon
  237.     PRINT SYSDAT1_DAT_GetDDCLF   ' Disable detailed callers log flag
  238.                                   ' 0 = Use a detailed callers log
  239.                                   ' 1 = Do not use a detailed callers log
  240.     PRINT SYSDAT1_DAT_GetEREF    ' Enable RIPscip emulation flag
  241.                                   ' 0 = Do not enable RIPscipt
  242.                                   ' 1 = Enable RIPscipt
  243.     PRINT SYSDAT1_DAT_GetUAORNF  ' Use alias or real names flag
  244.                                   ' 0 = Uses the caller's alias for between
  245.                                   '     node information purposes
  246.                                   ' 1 = Uses the caller's real name for
  247.                                   '     between node information purposes
  248.     PRINT SYSDAT1_DAT_GetCUADF   ' Clear uploads and downloads flag
  249.                                   ' 0 = Do not clear the user's upload/download
  250.                                   '     counters when a user's subscription
  251.                                   '     expires
  252.                                   ' 1 = Clear th user's upload/download
  253.                                   '     counters when a user's subsciption
  254.                                   '     expires
  255.     PRINT SYSDAT1_DAT_GetCPMAF   ' Clear private message area flag
  256.                                   ' 0 = Do not clear the user's private
  257.                                   '     message area flags when the user's
  258.                                   '     subsciption expires
  259.                                   ' 1 = Clear the user's private message
  260.                                   '     area flages when the user's
  261.                                   '     spbsciption expires
  262.     PRINT SYSDAT1_DAT_GetCPFAF   ' Clear private file area flag
  263.                                   ' 0 = Do not clear the user's private file
  264.                                   '     area flags when the user's subsciption
  265.                                   '     expires
  266.                                   ' 1 = Clear the the user's private file
  267.                                   '     area flags when the user's subscription
  268.                                   '     expires
  269.     PRINT SYSDAT1_DAT_GetDUBF    ' Disable uploaded by flag
  270.                                   ' 0 = Put "Uploaded By:" lines in the file
  271.                                   '     list when a file is uploaded
  272.                                   ' 1 = Do not put "Uploaded By:" lines in
  273.                                   '     the file list when a file is uploaded
  274.  
  275. $ENDIF
  276.  
  277. '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  278.  
  279. END                          ' Ends the Program
  280.