home *** CD-ROM | disk | FTP | other *** search
/ Boot Disc 8 / boot-disc-1997-04.iso / PDA_Soft / Psion / utils / Jpcli161 / JPPRINT.OPL < prev   
Text File  |  1995-05-07  |  4KB  |  136 lines

  1. PROC jpprint:
  2.     global ax%,bx%,cx%,dx%,si%,di%,name$(16),val$(255),c$(128),p$(128),fsp$(3),dr$(1),pfile$(64),curid$(10),d$(128),env$(4),buff$(255),r%,p1%
  3.     print "JPprint Background Print Spooler"
  4.     print "(c) J.Portwin 1995"
  5.     ax%=$2100
  6.     name$="JP"+chr$(0)
  7.     di%=addr(name$)+1
  8.     dx%=len(name$)-1
  9.     si%=addr(val$)+1
  10.     ax%=$2100
  11.     bx%=0
  12.     if os($8b,addr(ax%)) and 1
  13.         if (ax% or $ff00)=-33
  14.             print "Please start JPprint from within JPcli v1.6" :get :stop
  15.             endif
  16.         raise (ax% or $ff00)
  17.         endif
  18.     pokeb addr(val$),ax%
  19. c$=mid$(val$,1,loc(val$,"«")-1)
  20.     val$=mid$(val$,loc(val$,"«")+1,len(val$))
  21. p$=mid$(val$,1,loc(val$,"«")-1)
  22.     val$=mid$(val$,loc(val$,"«")+1,len(val$))
  23. fsp$=mid$(val$,1,loc(val$,"«")-1)
  24.     val$=mid$(val$,loc(val$,"«")+1,len(val$))
  25. dr$=mid$(val$,1,loc(val$,"«")-1)
  26.     val$=mid$(val$,loc(val$,"«")+1,len(val$))
  27. curid$=mid$(val$,1,loc(val$,"«")-1)
  28.     val$=mid$(val$,loc(val$,"«")+1,len(val$))
  29.     if loc(c$," ")=0 :help: :endif
  30.     c$=mid$(c$,loc(c$," ")+1,len(c$))
  31.     if loc(c$," ")=0 :help: :endif
  32.     pfile$=mid$(c$,1,loc(c$," ")-1)
  33.     setpath fsp$+"::"+dr$+":"+p$
  34.     if loc(c$,"/P")>0 :print "Printing to Parallel"
  35.         lopen "PAR:A"
  36.     elseif loc(c$,"/S")>0 :print "Printing to Serial"
  37.         lopen "TTY:A"
  38.         rsset:(16,0,8,1,0)
  39.     elseif loc(c$,"/F")>0 :print "Printing to File ";
  40.     env$="P$F"
  41.     ax%=$2100
  42.     bx%=0
  43.     di%=addr(env$)+1
  44.     dx%=len(env$)
  45.     si%=addr(d$)+1
  46.     os($008b,addr(ax%))
  47.     pokeb addr(d$),ax%
  48.     print d$
  49.     lopen d$
  50.     else
  51.     print "Error - no device specified." :help: :stop
  52.     endif
  53.     if mid$(pfile$,1,1)<>"\" :pfile$=p$+pfile$ :endif
  54.     if loc(pfile$,":")=0 :pfile$=dr$+":"+pfile$ :endif
  55.     if loc(pfile$,"::")=0 :pfile$=fsp$+"::"+pfile$ :endif
  56.     print pfile$
  57.     ax%=$0300
  58.     bx%=val(curid$)
  59.     os($88,addr(ax%))
  60.     r%=ioopen(p1%,pfile$,$420)
  61.     if r%<0 :raise r% :endif
  62.     do
  63.     r%=ioread(p1%,addr(buff$)+1,255)
  64.     if r%=-36 :lprint chr$(12); :lclose :r%=ioclose(p1%) :r%=ioopen(p1%,pfile$,$420) :stop :endif
  65.     if r%<0 :raise r% :endif
  66.     pokeb addr(buff$),r%
  67.     lprint buff$
  68.     until 1=0
  69. ENDP
  70. PROC rsset:(baud%,parity%,data%,stop%,hand%,term&)
  71. local tstore%(5)
  72. if exist ("\jpcli\com.dat")
  73. r%=ioopen(p1%,"\jpcli\com.dat",$420)
  74. c:
  75. r%=ioread(p1%,addr(d$),127)
  76. if r%=-36 :goto ca2ll :endif
  77. c:
  78. pokeb addr(d$),r%
  79. tstore%(1)=val(d$)
  80. r%=ioread(p1%,addr(d$),127)
  81. if r%=-36 :goto ca2ll :endif
  82. c:
  83. pokeb addr(d$),r%
  84. tstore%(2)=val(d$)
  85. r%=ioread(p1%,addr(d$),127)
  86. if r%=-36 :goto ca2ll :endif
  87. c:
  88. pokeb addr(d$),r%
  89. tstore%(3)=val(d$)
  90. r%=ioread(p1%,addr(d$),127)
  91. if r%=-36 :goto ca2ll :endif
  92. c:
  93. pokeb addr(d$),r%
  94. tstore%(4)=val(d$)
  95. r%=ioread(p1%,addr(d$),127)
  96. if r%=-36 :goto ca2ll :endif
  97. c:
  98. pokeb addr(d$),r%
  99. tstore%(5)=val(d$)
  100. ca2ll::
  101. if tstore%(5)=0 :tstore%(5)=hand% :endif
  102. if tstore%(4)=0 :tstore%(4)=hand% :endif
  103. if tstore%(3)=0 :tstore%(3)=hand% :endif
  104. if tstore%(2)=0 :tstore%(2)=hand% :endif
  105. if tstore%(1)=0 :tstore%(1)=hand% :endif
  106. rssett:(tstore%(1),tstore%(2),tstore%(3),tstore%(4),tstore%(5),term&)
  107. else
  108. rssett:(baud%,parity%,data%,stop%,hand%,term&)
  109. endif
  110. ENDP
  111. PROC rssett:(baud%,parity%,data%,stop%,hand%,term&)
  112. local frame%,srchar%(6),dummy%,err%
  113. frame%=data%-5
  114. if stop%=2 :frame%=frame% or 16 :endif
  115. if parity% :frame%=frame% or 32 :endif
  116. srchar%(1)=baud% or (baud%*256)
  117. srchar%(2)=frame% or (parity%*256)
  118. srchar%(3)=(Hand% and 255) or $1100
  119. srchar%(4)=$13
  120. pokel addr(srchar%(5)),term&
  121. r%=iow(-1,7,srchar%(1),dummy%)
  122. c:
  123. ENDP
  124. PROC help:
  125. print "JPprint must be started specifying the file"
  126. print "to print followed by the device. Ie:"
  127. print
  128. print "JPPRINT JP.TXT /P - Prints JP.TXT to parallel"
  129. print "JPPRINT L.DOC /S - Prints L.DOC to serial"
  130. print "JPPRINT JPCLI.TXT /F - Prints JPCLI.TXT to file"
  131. print
  132. print "Press a key"
  133. get
  134. stop
  135. ENDP
  136.