home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / lan / basnet / ibasic.bas < prev    next >
BASIC Source File  |  1987-02-11  |  9KB  |  239 lines

  1. 100     'set up Netware Function calls
  2. 120     gosub 10000
  3.  
  4. 1000    ' This first call will open a file called test.txt as shareable RW
  5. 1010    ' 66 in HEX is 42, which, as described in DOS Tech Ref is SRW.
  6.  
  7. 1020    Mode% = 66  
  8. 1030    Filename$ = "test.txt"+chr$(0)
  9. 1040    def seg = libseg
  10. 1050    call xtndopn(Mode%, Filename$ , Handle%, Errcode%)
  11. 1060    def seg
  12. 1065    print "In extended open:"
  13. 1070    print "Handle =";Handle%
  14. 1080    print "Errcode =";Errcode%
  15. 1085    print
  16. 1090    input "Press ENTER to continue.";a$
  17.  
  18. 1095    '======================================================================
  19.  
  20. 1096    'This call will log the first byte in the file test.txt.  It uses the
  21. 1097    'handle given in the previous call.
  22.  
  23. 1200    HiB% = 00
  24. 1210    LoB% = 00
  25. 1220    HiL% = 00
  26. 1230    LoL% = 01
  27. 1240    Flags% = 00
  28. 1250    TimeOut% = 00
  29. 1260    def seg = libseg
  30. 1270    call PRLH.LOG(Handle%,HiB%,LoB%,HiL%,LoL%,Flags%,TimeOut%,ErrCode%)                                      
  31. 1280    def seg
  32. 1285    print "In Physical Record Lock; Log record:"
  33. 1290    print "  ErrCode =";ErrCode%
  34. 1291    print
  35. 1292    input "Press ENTER to continue.";a$
  36.  
  37. 1300    '======================================================================
  38.  
  39. 1310    'This call will open a semaphore called SEMA.  It will give an initial
  40. 1320    'value of 5.
  41.  
  42. 1850    Sema4$ = "SEMA"
  43. 1860    SemaValue% = 5
  44. 1870    def seg = libseg
  45. 1880    call OpenSem(Sema4$,SemaValue%,HiHandle%,LoHandle%,OpenCnt%,RetCode%)
  46. 1890    def seg
  47. 1900    print "Open Semaphore"
  48. 1910    print "  RetCode =";RetCode%
  49. 1920    print "  Low Handle =";LoHandle%
  50. 1930    print "  High Handle =";HiHandle%
  51. 1940    print "  Open Count =";OpenCnt%
  52. 1941    print
  53. 1942    input "Press ENTER to continue.";a$
  54.  
  55. 1945    '======================================================================
  56.  
  57. 2000    'This call is an example of Get Volume Stats.
  58.  
  59. 2700    Vol% = 4
  60. 2710    Reply$ = chr$(99)+chr$(0)+space$(99)
  61. 2720    def seg = libseg
  62. 2730    call volstat(RetCode%,Reply$)
  63. 2740    def seg
  64. 2750    print "In Volume Stats"
  65. 2760    print "  RetCode";RetCode%
  66. 2771    Print "  # of sectors/block =";asc(mid$(Reply$,1,2))
  67. 2772    print "  # of total blocks =";asc(mid$(Reply$,3,2))
  68. 2773    print "  # of unused blocks =";asc(mid$(Reply$,5,2))
  69. 2774    print "  # of dir entries =";asc(mid$(Reply$,7,2))
  70. 2775    print "  # of unused dir entries =";asc(mid$(Reply$,9,2))
  71. 2776    print "  Volume name is ";mid$(Reply$,11,16)
  72. 2777    print "  Removable Flag =";asc(mid$(Reply$,27,2))
  73. 2779    print
  74. 2780    input "Press ENTER to continue.";a$
  75.  
  76. 2790    '======================================================================
  77.  
  78. 2800    'This is an example of a spool function call.
  79.  
  80. 3050    LoPacLen$ = chr$(6)
  81. 3060    HiPacLen$ = chr$(0)
  82. 3070    Func$ = chr$(2)
  83. 3080    PrintFlags$ = chr$(224)
  84. 3090    TabSize$ = chr$(5)
  85. 3100    TargetPrinter$ = chr$(0)
  86. 3110    NumberCopies$ = chr$(1)
  87. 3120    FormType$ = chr$(0)
  88. 3130    ErrCode% = 0
  89. 3140    Request$=LoPacLen$+HiPacLen$+Func$+PrintFlags$+TabSize$+TargetPrinter$+NumberCopies$+FormType$
  90. 3150    Reply$=chr$(2)+chr$(0)
  91. 3160    def seg = libseg
  92. 3170    call splreq(ErrCode%,Request$,Reply$)
  93. 3180    def seg
  94. 3190    print "In Spool Request"
  95. 3200    print "  Error Code =";ErrCode%
  96. 3205    print
  97. 3210    input "Press ENTER to continue.";a$
  98.  
  99. 3220    '======================================================================
  100.  
  101. 3230    'This function is an example of Directory Request Functions.
  102. 3235    'In particular this call will map a number to a Volume Name
  103.  
  104. 3400    LoPacLen$ = chr$(2)
  105. 3410    HiPacLen$ = chr$(0)
  106. 3420    Func$ = chr$(6)
  107. 3430    VolumeNumber$ = chr$(3)
  108. 3440    ErrCode% = 0
  109. 3450    Request$=LoPacLen$+HiPacLen$+Func$+VolumeNumber$
  110. 3460    Reply$=chr$(255)+chr$(0)+space$(99)
  111. 3470    def seg = libseg
  112. 3480    call dpath(ErrCode%,Request$,Reply$)
  113. 3490    def seg
  114. 3500    print "In Directory Path"
  115. 3510    print "  Error Code: ";ErrCode%
  116. 3514    print "Volume name is:";mid$(Reply$,4,asc(mid$(Reply$,3,1)))
  117. 3515    print
  118. 3520    input "Press ENTER to continue.";a$
  119. 3525    print
  120.  
  121. 3530    '======================================================================
  122.  
  123. 3540    'This call will Get FileServer Information
  124.  
  125. 3550    LoPacLen$ = chr$(1)
  126. 3560    HiPacLen$ = chr$(0)
  127. 3570    Func$ = chr$(17)               '11 Hex
  128. 3640    ErrCode% = 0
  129. 3650    Request$=LoPacLen$+HiPacLen$+Func$
  130. 3660    Reply$=chr$(138)+chr$(0)+space$(138)
  131. 3670    def seg = libseg
  132. 3680    call syslog(ErrCode%,Request$,Reply$)
  133. 3690    def seg
  134. 3700    print "In Get File Server Information"
  135. 3710    print "  Error Code: ";ErrCode%
  136. 3715    print "  Server Name: ";mid$(Reply$,3,48)
  137. 3730     print
  138. 3735    input "Press ENTER to continue.";A$
  139.  
  140.  
  141. 3740    '======================================================================
  142.  
  143. 4200    'This call will get the Physical Station Number
  144.  
  145. 4205    def seg = libseg
  146. 4210    call GetPSN(PSN%)
  147. 4220    def seg
  148. 4230    print "In Physical Station Number"
  149. 4240    print "  PSN is : ";PSN%
  150.  
  151. 5000    system
  152.  
  153. 10000 '
  154. 10010 ' routines for network use
  155. 10020 '
  156.  
  157. 10100 '  This section contains the routine names and
  158. 10101 '  offsets for the BASNET library
  159. 10102 ' the return is after everything is set up for NetWare calls
  160.  
  161. 10110 XTNDOPN  =   0   'xtndopn(Mode%, Filename$, Handle%, ErrCode%)
  162. 10111 SETATTR  =   3   'setattr(Func%, Filename$, Attribute%, ErrCode%)
  163. 10112 EOJSTAT  =   6   'eojstat(Flag%)
  164. 10113 PRLH.LOG =   9   'PRLH.Log(FileHandle%,HiByteOffset%,LoByteOffset%,HiLockLen%,LoLockLen%,Flags%,TimeOut%,ErrCode%)
  165. 10114 PRLH.REL =  12   'PRLH.Rel(FileHandle%,HiByteOffset%,LoByteOffset%,ErrCode%)
  166. 10115 PRLH.CLR =  15   'PRLH.Clr(FileHandle%,HiByteOffset%,LoByteOffset%,Errcode%)
  167. 10116 PRLF.LOG =  18   'PRLF.Log(fcb%,HiByteOffset%,LoByteOffset%,HiLockLen%,LoLockLen%,Flags%,TimeOut%,ErrCode%)
  168. 10117 PRLF.REL =  21   'PRLF.Rel(fcb%,HiByteOffset%,LoByteOffset%,ErrCode%)
  169. 10118 PRLF.CLR =  24   'PRLF.Clr(fcb%,HiByteOffset%,LoByteOffset%,ErrCode%)
  170. 10119 PRLS.LCK =  27   'PRLS.Lck(Flags%,TimeOut%,ErrCode%)
  171. 10120 PRLS.REL =  30   'PRLS.Rel(ErrCode%)
  172. 10121 PRLS.CLR =  33   'PRLS.Clr(ErrCode%)
  173. 10122 OPENSEM  =  36   'OpenSem(Sema4$,SemaValu%,HiHandle%,LoHandle%,OpenCnt%,RetCode%)
  174. 10123 EXAMSEM  =  39   'ExamSem(HiHandle%,LoHandle%,SemaValu%,OpenCnt%,RetCode%)
  175. 10124 WAITSEM  =  42   'WaitSem(HiHandle%,LoHandle%,TimeOut%,RetCode%)
  176. 10125 SIGSEM   =  45   'SigSem(HiHandle%,LoHandle%,RetCode%)
  177. 10126 CLOSSEM  =  48   'ClosSem(HiHandle%,LoHandle%,RetCode%)
  178. 10127 SETLCK   =  51   'setlck(Func%,Mode%)
  179. 10128 TTS      =  54   'TTS(Func%,RetCode%)
  180. 10129 BLFTRAN  =  57   'BLFtran(RetCode%)
  181. 10130 ELFTRAN  =  60   'ELFtran(ReturnCode%)
  182. 10131 EXCLOG   =  63   'exclog(ReturnCode%, FcbAddr)
  183. 10132 EXCLCKS  =  66   'exclcks(ReturnCode%, Mode%)
  184. 10133 EXCULKF  =  69   'exculkf(ReturnCode%, FcbAddr)
  185. 10134 EXCULKS  =  72   'exculks(ReturnCode%)
  186. 10135 EXCCLRF  =  75   'excclrf(ReturnCode%, FcbAddr)
  187. 10136 EXCCLRS  =  78   'excclrs(ReturnCode%)
  188. 10137 RECLOG   =  81   'reclog(ReturnCode%, String$)
  189. 10138 RECLCK   =  84   'reclck(ReturnCode%, Mode%)
  190. 10139 RECULK   =  87   'reculk(ReturnCode%, Semaphore$)
  191. 10140 RECULKS  =  90   'reculks(ReturnCode%)
  192. 10141 RECCLR   =  93   'recclr(ReturnCode%, Semaphore$)
  193. 10142 RECCLRS  =  96   'recclrs(ReturnCode%)
  194. 10143 EOJ      =  99   'eoj(ReturnCode%)
  195. 10144 SYSOUT   = 102   'sysout(ReturnCode%)
  196. 10147 VOLSTAT  = 105   'volstat(volume%, reply$)
  197. 10148 LOCDRV   = 108   'locdrv(NumDisks%)
  198. 10149 WSID     = 111   'wsid(ThisStationNum%)
  199. 10150 ERRMODE  = 114   'errmode(mode%)
  200. 10151 BCSMODE  = 117   'bcsmode(mode%)
  201. 10152 CTLSPL   = 120   'ctlspl(mode%)
  202. 10153 SPLREQ   = 123   'splreq(ErrCode%, RequestBlock$, Reply$)
  203. 10154 PIPREQ   = 126   'pipreq(ErrCode%, RequestBlock$, Reply$)
  204. 10155 DPATH    = 129   'dpath(ReturnCode%, RequestBlock$, Reply$)
  205. 10156 SYSLOG   = 132   'syslog(ReturnCode%, RequestBlock$, Reply$)
  206. 10157 FATTR    = 135   'fattr(ReturnCode%, FcbAddr, Attribute%)
  207. 10158 UPDFCB   = 138   'updfcb(RetCode%,FcbAddr)
  208. 10159 CPYFILE  = 141   'cpyfile(ReturnCode%, FcbSource, FcbDest, CountLow, CountHigh)
  209. 10160 NETTOD   = 144   'nettod(time$)
  210. 10161 CLSMODE  = 147   'clsmode(mode%)
  211. 10162 DRVMAP   = 150   'drvmap(ReturnFlags%, drive%)
  212. 10163 RETSHL   = 153   'retshl(RetCode%, Mode%)
  213. 10164 ASCLOG   = 156   'asclog(RetCode%, Asciiz$)
  214. 10165 ASCULKF  = 159   'asculkf(RetCode%, Asciiz$)
  215. 10166 ASCCLRF  = 162   'ascclrf(RetCode%, Asciiz$)
  216. 10167 GETPSN   = 165   'Get_PSN(StationNo%)
  217. 10168 GETSTA   = 168   'Get_STA(Mode%,Segment%,Offset%)
  218. 10169 SETSERV  = 171   'SetServ(Mode%,NewServ%,CurrServ%)
  219. 10170 MODSERV  = 174   'ModServ(Mode%,NewServ%,RetCode%)
  220. 10171 GETDRV   = 177   'GetDrv(Drive%)
  221. 10200     '
  222. 10210     ' Assign the segment address for the library to the variable LibSeg
  223. 10220     '
  224. 10230     def seg = 0
  225. 10240     suboff = peek(&h4f0)+(256*peek(&h4f1))
  226. 10250     subseg = peek(&h4f2)+(256*peek(&h4f3))
  227. 10260     LibSeg = subseg
  228. 10270     def seg
  229. 10280     ' be sure the resident module is in place so we don't blow up
  230. 10290     if LibSeg = 0 or suboff <> 0 then print "The resident library must be loaded before running this program.":end
  231. 10300     '
  232. 10310     ' set the error mode so its more informative
  233. 10320     def seg = LibSeg
  234. 10330     NewMode% = 1
  235. 10340     call errmode(NewMode%)
  236. 10350     def seg
  237. 10400     '
  238. 10999     return
  239.