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

  1. ' ─────────────────────────────────────────────────────────────────────────
  2. ' Program Title: Sample Program for TriBBS's DOORS.TMP 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 file, you will see servals different examples on how
  13. ' to use the Pointer "dt" to make calls to the TriBBS API DOORTMP.PBU Unit.
  14. ' However, will not need to concern yourself with actually using of "dt" as
  15. ' this is all handled in the DOORTMP.PBU Unit.
  16. '
  17. ' To use any of the current examples, go to the section and you will see a
  18. ' "$IF 0" statment at the head of the example, all you need to do to make
  19. ' that section of code run is change the '0' to any non-zero number.
  20. '
  21. ' A pointer is a varible that holds 32-bit (4 byte) address of data located
  22. ' elsewhere in memory. It is called a pointer because it literally points
  23. ' to data. The data at which it points is known as the target.
  24. '
  25. ' Pointers are Powerfull! The address is defined at run-time, so any target
  26. ' in memory can be referenced by your program just as if it were a standard
  27. ' PowerBASIC varible. This type of indirection is much faster and more
  28. ' efficient than PEEKing and POKEing at the target data.
  29. '
  30. ' ─────────────────────────────────────────────────────────────────────────
  31.  
  32. $CPU 80386                    ' Requires a 386 system or faster
  33.  
  34. $OPTIMIZE SPEED             ' make fastest possible executable
  35.  
  36. '$COMPILE EXE "DOORTMP.EXE"  ' compile to an EXE
  37.  
  38. $DEBUG MAP OFF              ' turn off map file generation
  39. $DEBUG PBDEBUG OFF          ' don't include pbdebug support in our executable
  40.  
  41. $LIB COM        OFF         ' turn off PowerBASIC's communications library.
  42. $LIB CGA        OFF         ' turn off PowerBASIC's CGA graphics library.
  43. $LIB EGA        OFF         ' turn off PowerBASIC's EGA graphics library.
  44. $LIB VGA        OFF         ' turn off PowerBASIC's VGA graphics library.
  45. $LIB LPT        OFF         ' turn off PowerBASIC's printer support library.
  46. $LIB IPRINT     OFF         ' turn off PowerBASIC's interpreted print library.
  47. $LIB FULLFLOAT  OFF         ' turn off PowerBASIC's floating point support.
  48.  
  49. $ERROR BOUNDS   ON          ' turn on bounds checking for pointer debugging
  50. $ERROR NUMERIC  OFF         ' turn off numeric checking
  51. $ERROR OVERFLOW OFF         ' turn off overflow checking
  52. $ERROR STACK    OFF         ' turn off stack checking
  53.  
  54. $COM    0                   ' set communications buffer to nothing
  55. $STRING 16                  ' set largest string size at 16k
  56. $STACK  2048                ' let's use a 2k stack
  57. $SOUND  1                   ' smallest music buffer possible
  58.  
  59. $DIM ALL                    ' forces all Varibles and Arrays to be
  60.                             ' pre-dementioned before use.
  61.  
  62. $DYNAMIC                    ' all arrays will be dynamic by default
  63.  
  64. $OPTION CNTLBREAK OFF       ' don't allow Ctrl-Break to exit program
  65.  
  66. DEFINT A-Z                  ' default all variables to integers for maximum
  67.                             ' speed and minimum size
  68. '============================================================================
  69. 'NOTE!: You will have to create a DOORS.TMP file by logging into TriBBS and
  70. '       going into a door, then shell out and copy the DOORS.TMP file to a
  71. '       Dummy TriBBS directory like "C:\TRI\NWORK and then set your TriBBS
  72. '       Main Node below to show "C:\TRI" directory.
  73. '
  74. ============================================================================
  75. '                          DECLARATIONS SECTION
  76. '============================================================================
  77. ' ** THIS SECTION IS FOR LINKS AND INCLUDES STATMENTS **
  78.  
  79. $LINK "G:\PB35\TBAPI10\PBAPI10.PBL"     ' ** SET THIS LINE TO YOUR PATH **
  80. $INCLUDE "G:\PB35\TBAPI10\PBAPI10.INC"  ' ** SET THIS LINE TO YOUR PATH **
  81. '---------------------------------------------------------------------------
  82. ' ** DECLARE SUB's BELOW THAT WILL BE USED IN THIS PROGRAM **
  83. '
  84. ' Use this section for any declarations needed to be made other than the
  85. ' DOORS.TMP API which are located in the DOORTMP.INC file.
  86.  
  87. '---------------------------------------------------------------------------
  88. ' ** DIMENTION ALL VARIBLES, ARRAYS, TYPE STRUCTURES, & POINTERS **
  89.  
  90. DIM n AS INTEGER     ' Local Variable
  91.  
  92. '---------------------------------------------------------------------------
  93. ' ** SET THIS LINE BELOW TO YOUR TRIBBS MAIN NODE's DIRECTORY **
  94. ' * Special Note: If you setup a program to work with multinodes, then you
  95. ' * will have to create a config file to read in for your program and have
  96. ' * the sysop enter the node from which they are calling and running the
  97. ' * program from.
  98. ' *
  99. ' * Example: TBNode1sMainDirectory = "C:\TRIBBS2" for Node 2.
  100.  
  101. TBNode1sMainDirectory = "E:\TRIBBS"
  102. '============================================================================
  103.  
  104. '============================================================================
  105. '                         ** MAIN PROGRAM BODY **
  106. '============================================================================
  107.  
  108. CLS     ' Clears screen prepares it for printing
  109.  
  110. '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  111. '                ** EXAMPLE 1 for DOORS.TMP Pointer Calls **
  112. '----------------------------------------------------------------------------
  113. $IF 0  ' Change the '0' to '1' to run this example
  114.  
  115.  IF DOORS_TMP_OpenRead <> 0 THEN ' Will Open and Read in DOORS.TMP record if
  116.                                  ' it returns a file exist value of 1.
  117.                                  '  0 = Doors.tmp does not exist did not open
  118.                                  '  1 = Doors.tmp does exist and was opened
  119.  
  120.    n = DOORS_TMP_GetTLAL        ' Gets Time Left At Logon
  121.    PRINT n                      ' Prints the Time Left At Logon
  122.  
  123.    DOORS_TMP_PutTLAL 10         ' Put the value of '10' in the Time Left At
  124.                                 ' Logon
  125.  
  126.    PRINT DOORS_TMP_GetTLAL      ' Gets and Prints Time Left At Logon in one
  127.                                 ' line of code
  128.  
  129.    DOORS_TMP_Close              ' Closes Doors.tmp file
  130.  
  131.  END IF                         ' Ends IF/END IF Statement
  132.  
  133.  ' In the example below, we can open, read, close the doors.tmp file, also
  134.  ' get and print the Time Left At Logon all in a single line of code. :)
  135.  
  136.    PRINT    ' Print a blank line
  137.    IF DOORS_TMP_OpenReadClose <> 0 THEN PRINT DOORS_TMP_GetTLAL
  138.  
  139. $ENDIF
  140. '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  141.  
  142. '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  143. '                ** EXAMPLE 2 for DOORS.TMP Pointer Calls **
  144. '----------------------------------------------------------------------------
  145. $IF 0  ' Change the '0' to '1' to run this example
  146.  
  147.  
  148.  IF DOORS_TMP_OpenReadClose <> 0 THEN ' Will Open and Read in DOORS.TMP
  149.                                       ' record if it returns a file exist
  150.                                       ' value of 1 and then Closes the file.
  151.                                         '  0 = Doors.tmp does not exist did not open
  152.                                         '  1 = Doors.tmp does exist and was opened
  153.  
  154.  
  155.  'Grab Doors.tmp data from memory using the a 32-bit pointer
  156.  
  157.  
  158.     PRINT DOORS_TMP_GetTLAL   ' Time Left After Logon
  159.     PRINT DOORS_TMP_GetCFA    ' Current File Area
  160.     PRINT DOORS_TMP_GetCMC    ' Current Message Conference
  161.     PRINT DOORS_TMP_GetFET    ' Front End Time
  162.     PRINT DOORS_TMP_GetWTDWCF ' Where The Door Was Called From
  163.                                  ' 0 = Called from Doors Menu
  164.                                 ' 1 = Newusers.bat
  165.                                 ' 2 = SECnnnn.bat
  166.                                 ' 3 = Logon.bat
  167.                                 ' 4 = Called from Main Menu
  168.                                 ' 5 = Called from Files Menu
  169.                                 ' 6 = Called from Message Menu
  170.                                 ' 7 = Called from Sysop Menu
  171.     PRINT DOORS_TMP_GetLN     ' Language Number
  172.     PRINT DOORS_TMP_GetNOFF   ' Number of Files Flagged
  173.     PRINT DOORS_TMP_GetTIDSys ' Time In Door.Sys
  174.     PRINT DOORS_TMP_GetURN    ' User Record Number
  175.     PRINT DOORS_TMP_GetBR     ' Baud Rate
  176.     PRINT DOORS_TMP_GetFEBR   ' Front End Baud Rate
  177.     PRINT DOORS_TMP_GetTWULO  ' Time When User Logged On
  178.  
  179.   ' ** These are Bit Fields converted to integers below **
  180.  
  181.     PRINT DOORS_TMP_GetAF     ' ANSI Flag (0=No,1=Yes)
  182.     PRINT DOORS_TMP_GetFEF    ' Front End Flag
  183.                                 ' 0 = TriBBS was not called from Front End
  184.                                 ' 1 = TriBBS was called from Front End
  185.     PRINT DOORS_TMP_GetFEHU   ' Front End Hang Up Flag
  186.                                 ' 0 = TriBBS will not hang up on
  187.                                 '     the caller before returning to
  188.                                 '     front end
  189.                                 ' 1 = TriBBS will hang up on the
  190.                                 '     caller before returning to front end
  191.     PRINT DOORS_TMP_GetUWF    ' User Window Flag
  192.                                 ' 0 = The User status window is
  193.                                 '     not being displayed
  194.                                 ' 1 = The User status window is
  195.                                 '     being displayed
  196.     PRINT DOORS_TMP_GetCRF    ' Caller Requested Flag
  197.                                 ' 0 = The Caller hasn't requested a chat
  198.                                 ' 1 = The Caller has requested a chat
  199.     PRINT DOORS_TMP_GetEPF    ' Event Pending Flag
  200.                                 ' 0 = An Event is not pending
  201.                                 ' 1 = An Even is pending
  202.     PRINT DOORS_TMP_GetGFD    ' Goodbye From Door Flag
  203.                                 ' 0 = The caller hasn't selected
  204.                                 '     "goodbye" from a door
  205.                                 ' 1 = The caller has selected
  206.                                 '     "goodbye" from a door
  207.     PRINT DOORS_TMP_GetFBDAC  ' Force Board Down After Call Flag
  208.                                 ' 0 = Do not exit TriBBS when
  209.                                 '     caller is done
  210.                                 ' 1 = Exit TriBBS when caller is
  211.                                 '     done
  212.     PRINT DOORS_TMP_GetRIP    ' RIPscrip Flag
  213.                                 ' 0 = The caller isn't using
  214.                                 '     RIPscrip emualtion
  215.                                 ' 1 = The caller is using
  216.                                 '     RIPscrip emulation
  217.     PRINT DOORS_TMP_GetDSF    ' DOOR.SYS Flag
  218.                                 ' 0 = Do not read DOOR.SYS back
  219.                                 '     in after returning from Door
  220.                                 ' 1 = Read DOOR.SYS back in after
  221.                                 '     returning from Door
  222.     PRINT DOORS_TMP_GetECC    ' Error Correction Connection Flag
  223.                                 ' 0 = There is a non-error
  224.                                 '     correction connection
  225.                                 ' 1 = There is a error correction
  226.                                 '     connection
  227.  
  228.  END IF                         ' Ends IF/END IF Statement
  229.  
  230. $ENDIF
  231.  
  232. '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  233.  
  234. END                             ' Ends the Program