home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Best of the Best
/
_.img
/
01171
/
wpress.bas
< prev
next >
Wrap
BASIC Source File
|
1990-12-22
|
6KB
|
270 lines
Dim Menu$(5), L$(100)
Subroutine iMoveTo%
i% = Instr%(Line$,"X=")
if i% = 0 Then Return 1
m$ = mid$(Line$,i%+2,12)
x% = val%(m$)
i% = Instr%(Line$,"Y=")
if i% = 0 Then Return 1
m$ = mid$(Line$,i%+2,12)
y% = val%(m$)
MoveTo x%+x0%, y%+y0%, device%
Return 0
EndSub
Subroutine iLineTo%
i% = Instr%(Line$,"X=")
if i% = 0 Then Return 1
m$ = mid$(Line$,i%+2,12)
x% = val%(m$)
i% = Instr%(Line$,"Y=")
if i% = 0 Then Return 1
m$ = mid$(Line$,i%+2,12)
y% = val%(m$)
LineTo x%+x0%, y%+y0%, device%
Return 0
EndSub
Subroutine iText%
a$ = Right$(Line$,len%(Line$)-3)
If device% = 1 Then Print a$;
If device% = 2 Then LPrint a$;
Return 0
Endsub
Subroutine iFont%
i% = instr%(Line$,"FF=")
If i% = 0 Then Return 1
m$ = mid$(Line$,i%+3,12)
FF% = val%(m$)
i% = instr%(Line$,"H=")
If i% = 0 Then Return 1
m$ = mid$(Line$,i%+2,12)
h% = val%(m$)
i% = instr%(Line$,"W=")
If i% = 0 Then Return 1
m$ = mid$(Line$,i%+2,12)
w% = val%(m$)
i% = instr%(Line$,"WEI=")
m$ = mid$(Line$,i%+4,12)
wei% = val%(m$)
If i% = 0 Then wei% = 400
i% = instr%(Line$,"STY=")
m$ = mid$(Line$,i%+4,12)
style% = val%(m$)
If i% = 0 Then style% = 400
Font h%, w%, wei%, style%, FF%, device%
Return 0
EndSub
Subroutine iArc%(flag%)
i% = instr%(Line$,"R=")
if i% = 0 Then Return 1
m$ = mid$(Line$,i%+2,12)
r% = val%(m$)
i% = instr%(Line$,"BEG=")
m$ = mid$(Line$,i%+4,12)
begin% = val%(m$)
if i% = 0 Then begin% = 0
i% = instr%(Line$,"END=")
m$ = mid$(Line$,i%+4,12)
end% = val%(m$)
if i% = 0 Then end% = 360
If Flag% Then
Pie r%, begin%, end%, device%
Else
Arc r%, begin%, end%, device%
Endif
Return 0
Endsub
Subroutine iBar%()
i% = instr%(Line$,"DX=")
if i% = 0 Then Return 1
m$ = mid$(Line$,i%+3,12)
dx% = val%(m$)
i% = instr%(Line$,"DY=")
if i% = 0 Then Return 1
m$ = mid$(Line$,i%+3,12)
dy% = val%(m$)
Rect dx%, dy%, device%
Return 0
Endsub
Subroutine iRect%
i% = instr%(Line$,"DX=")
if i% = 0 Then Return 1
m$ = mid$(Line$,i%+3,12)
dx% = val%(m$)
i% = instr%(Line$,"DY=")
if i% = 0 Then Return 1
m$ = mid$(Line$,i%+3,12)
dy% = val%(m$)
LineTo x%+x0%+dx%, y%+y0%, device%
LineTo x%+x0%+dx%, y%+y0%+dy%, device%
LineTo x%+x0%, y%+y0%+dy%, device%
LineTo x%+x0%, y%+y0%, device%
Return 0
Endsub
Subroutine iStyle%
i% = instr%(Line$,"PEN=")
m$ = mid$(Line$,i%+4,12)
pen% = val%(m$)
if i% = 0 Then pen% = 0
i% = instr%(Line$,"BACK=")
m$ = mid$(Line$,i%+5,12)
back% = val%(m$)
if i% = 0 Then back% = 0
i% = instr%(Line$,"W=")
m$ = mid$(Line$,i%+2,12)
w% = val%(m$)
if i% = 0 Then w% = 1
Style pen%, back%, w%, device%
Return 0
Endsub
Subroutine iCounter%
Counter% = Counter% + 1
Print Counter%
Lprint Counter%
Return 0
EndSub
Subroutine iBitmap%
a$ = Right$(Line$,len%(Line$)-3)
Bitmap a$, device%
Return 0
Endsub
Subroutine iWieder%(onoff%)
If onoff% = 0 Then
If inx% < nx% Then
x0% = x0% + ddx%
inx% = inx% + 1
iline% = ilinew%
Elseif iny% < ny% Then
x0% = 0 : inx% = 1
y0% = y0% + ddy%
iny% = iny% + 1
iline% = ilinew%
Else
ddx%=0 : ddy%=0
nx%=0 : ny%=0
x0%=0 : y0%=0
Endif
Else
i% = instr%(Line$,"NX=")
m$ = mid$(Line$,i%+3,12)
nx% = val%(m$)
if i% = 0 Then nx% = 0
i% = instr%(Line$,"NY=")
m$ = mid$(Line$,i%+3,12)
ny% = val%(m$)
if i% = 0 Then ny% = 0
i% = instr%(Line$,"DX=")
m$ = mid$(Line$,i%+3,12)
ddx% = val%(m$)
if i% = 0 Then ddx% = 0
i% = instr%(Line$,"DY=")
m$ = mid$(Line$,i%+3,12)
ddy% = val%(m$)
if i% = 0 Then ddy% = 0
ilinew% = iline%
inx% = 1 : iny% = 1
Endif
Return 0
Endsub
Subroutine IntpretLine
a$ = Ucase$(Left$(Line$,2))
If a$ <> "TX" Then Line$ = Ucase$(Line$)
If a$ = "MO" Then
err% = iMoveTo%()
Elseif a$ = "LI" Then
err% = iLineTo%()
Elseif a$ = "TX" Then
err% = iText%()
Elseif a$ = "FO" Then
err% = iFont%()
Elseif a$ = "BM" Then
err% = iBitmap%()
Elseif a$ = "AC" Then
err% = iArc%(0)
Elseif a$ = "PI" Then
err% = iArc%(1)
Elseif a$ = "BR" Then
err% = iBar%()
Elseif a$ = "RE" Then
err% = iRect%()
Elseif a$ = "ST" Then
err% = iStyle%()
Elseif a$ = "CT" Then
err% = iCounter%()
Elseif a$ = "WH" Then
err% = iWieder%(1)
Elseif a$ = "WE" Then
err% = iWieder%(0)
Else
MessageBox a$, "Falsches Kommando", 0, antwort%
Endif
If err% Then MessageBox Line$, "Syntax-Error", 0, antwort%
Endsub
Subroutine Press()
Mapmode 2, device%
Trace on
iline% = 1
Open "I", #1, File$
While 1
Line Input #1, L$(iline%)
If Error%() Then Break
iline% = iline% + 1
Wend
Close #1
imax% = iline%
iline% = 1
While iline% < imax%
Line$ = L$(iline%)
iline% = iline% + 1
If Left$(Line$,1) <> "'" Then Gosub IntpretLine()
Wend
Endsub
Rem *** Hauptprogramm ***
Menu$(1) = "S&cript"
Menu$(2) = "&Show"
Menu$(3) = "&Print"
Menu$(4) = "&Exit"
Menu$(5) = ""
Menu menu$
Size 10,10, 560,300
File$ = "order.prs"
'Exec "notepad.exe", " "+File$, 7
_1000:
Files "\win","*.prs", File$
If File$ <> "" Then
Cursor 2
Stop "notepad.exe"
Exec "notepad.exe", " "+File$, 7
Cursor 0
Cls
Endif
_2000:
cls
x%=0 : y%=0 : x0%=0 : y0%=0
device% = 1 : Gosub Press()
_3000:
x%=0 : y%=0 : x0%=0 : y0%=0
device% = 2 : Gosub Press()
Lprint chr$(12)
Cls
_4000:
Stop "notepad.exe"
Stop