home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
RISCWORLD 6
/
RISCWORLD_VOL6.iso
/
Software
/
ISSUE2
/
PD
/
taufull.spk
/
!Tau_!RunImage
(
.txt
)
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
undefined
UTF-8
Wrap
RISC OS BBC BASIC V Source
|
2005-07-05
|
122.0 KB
|
4,971 lines
This is Tau version 1.50
Copyright (C) 2001 Tim Birks
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Tim Birks
Email : pystab@hotmail.com
Current development by Peter Killworth
Email : p.killworth@soc.soton.ac.uk
Snail : National Oceanography Centre, Southampton
Empress Dock
Southampton
SO14 3ZH
United Kingdom.
$+" at line ";
IFLEFT$(REPORT$,16)<>"ARM BBC BASIC V " THENERROR0,"Tau can only run on Basic V"
--- constants and array dimensions ---
%maxC1%=64:room%=16*4096:minP1%=16
C%=15:P%=4095
!$C1%=C%+1:P1%=P%+1:maxC%=maxC1%-1
"*fileversion$="150":workspacesize%=7804
#@white%=&FFFFFF00:black%=&0:lgrey%=&DDDDDD00:mgrey%=&BBBBBB00
block% 3500, block1% 255, block2% 255, block3% 255, workspace0% workspacesize%
colourpick% 50, colourtitle% 50:colourhandle%=0
s%(60),g%(60)
ColumnPlot%(maxC%),ColumnMeaning$(maxC%),ColumnLine%(maxC%),ColumnThick(maxC%),ColumnDash(maxC%),ColumnGap(maxC%),ColumnFill%(maxC%),ColumnKeyText$(maxC%),workhorse%(maxC%)
ColumnPoints%(maxC%),ColumnChar%(maxC%),ColumnWidth(maxC%),ColumnHeight(maxC%),ColumnError%(maxC%),ColumnErrorThick(maxC%),ColumnErrorCap(maxC%),ColumnColour%(maxC%),drawn%(maxC%)
ColumnLinecol%(maxC%),ColumnCharcol%(maxC%)
ColumnLinestyle%(maxC%),ColumnDash2(maxC%)
ColumnX%(maxC%)
Data% 5*C1%*P1%,DataStatus% C1%*P1%
i%=0
C1%*P1%-4
4:DataStatus%!i%=0:
Save$(5),FileType$(5),OldSave$(5)
groupheader%(3)
style$(2):style$(0)="
":style$(1)="
":style$(2)="
defaultsavevars
sel%=1<<21:grey%=1<<22
37leftwidth%=96:topheight%=80:ox%=0:x%=ox%+leftwidth%
--- initial values for variables ---
52quit%=
:fileopen%=0:juststarted%=
:mainopen%=
65caretcolumn%=0:caretrow%=0:maxcolumn%=0:maxrow%=0
77caret$=" ":caretoffset%=11:gotcaret%=
8/caretx1%=0:caretx2%=0:carety1%=0:carety2%=0
9(changed%=
:TauFileName$="<Untitled>"
importdrawfile%=
defaultvars
--- initial actions ---
=%*FontCat { > <Tau$Dir>.FontList }
loadDFMPicker:ViewOn%=
:ViewLength%=0:ViewScale0=1:ViewScaleFactor=0.9:ViewUpdate%=
setupsprites
stdum% 4
!stdum%=0
"Wimp_Initialise",310,&4B534154,"Tau",stdum%
,taskhandle%
error1
23,255,255,255,255,255,255,255,255,255:fill$=
templates
definemenus
iconbaricon
opendatawindow:
caretstring(-1)
juststarted% juststarted%=
Tautoload
error
K!MinSlotSize%=
-&8000:Himem%=
"Wimp_Poll",%110001,block%
reason%
reason%
user redraw of window
!block%=viewhandle%
"Hourglass_On"
T9 !block%=viewhandle%:
"Wimp_GetWindowState",,block%
U9 ViewMatrixScale%=ViewScale0*ViewScaleFactor*(1<<16)
V+ !block1%=ViewMatrixScale%:block1%!4=0
W- block1%!8=0:block1%!12=ViewMatrixScale%
XQ block1%!16=256*((block%!4+block%!12)
2 -ViewX%*ViewScale0*ViewScaleFactor)
YQ block1%!20=256*((block%!8+block%!16)
2 -ViewY%*ViewScale0*ViewScaleFactor)
!block% <> colourhandle%
"Wimp_RedrawWindow",,block%
flag%
flag%
!block%
columnhandle%:
redrawcolumn
viewhandle%:
redrawview
colourhandle%:
do nothing
userdraw
"Wimp_GetRectangle",,block%
flag%
!block%=viewhandle%
"Hourglass_Smash"
open window
!block%
mainhandle%:
datawindowmoved
colourhandle%:
ignore
"Wimp_OpenWindow",,block%
close window
!block%=mainhandle%
ViewOn%
closewindow(viewhandle%):ViewOn%=
"Wimp_SlotSize",MinSlotSize%,-1
changed%
Tjeopardy mainopen%=
mainopen%=
mainopen%=
cleardata
recordcaret(
}"
closewindow(cornerhandle%)
closewindow(tophandle%)
closewindow(lefthandle%)
closewindow(mainhandle%)
closewindow(columnhandle%)
closewindow(framehandle%)
closewindow(sizehandle%)
closewindow(!block%)
!block%=viewhandle% ViewOn%=
"Wimp_SlotSize",MinSlotSize%,-1
mouse click
N x%=!block%:y%=block%!4:button%=block%!8:window%=block%!12:icon%=block%!16
window%=mainhandle%
recordcaret(
button%
menu clicked
window%
mainhandle%,tophandle%,lefthandle%,cornerhandle%
@ ?WarningItem%=(?WarningItem%
&FE)
(JeopardyWarning%
"Wimp_CreateMenu",,mainmenu%,x%-64,y%
closewindow(columnhandle%):
closewindow(framehandle%):
closewindow(sizehandle%)
menutree$="main"
viewhandle%:
9 ?UpdateItem%=(?UpdateItem%
&FE)
(ViewUpdate%
"Wimp_CreateMenu",,viewmenu%,x%-64,y%
menutree$="view"
sizehandle%:
icon%=30
ty$="keyfill"
9
opencolour("Key background colour",s%(30),30,1)
icon%=32
ty$="keyborder"
5
opencolour("Key border colour",s%(32),32,1)
framehandle%:
icon%=13
ty$="framefill"
5
opencolour("Background colour",s%(13),13,1)
icon%=14
ty$="framecol"
A
opencolour("Frame, labels and text colour",s%(14),14,1)
columnhandle%:
icon%=41
icon%=43
(icon%=15
g%(15))
icon%=41
ty$="colline"
0
opencolour("Line colour",s%(41),41,1)
icon%=43
ty$="colchar"
5
opencolour("Character colour",s%(43),43,1)
icon%=15
ty$="colfill"
0
opencolour("Fill colour",s%(15),15,1)
icon%=47
"Wimp_CreateMenu",,stylemenu%,x%-64,y%
menutree$="styles"
"Wimp_CreateMenu",,iconbarmenu%,x%-64,96+2*44
menutree$="iconbar"
adjust,select clicked (or double-clicked instead for mainhandle)
window%
opendatawindow:
caretstring(-1)
mainhandle%:
button%=4
n
Tshift
highlight(0,maxcolumn%,caretrow%,caretrow%)
highlight(caretcolumn%,caretcolumn%,0,maxrow%)
closewindow(columnhandle%):
closewindow(framehandle%)
closewindow(sizehandle%)
cornerhandle%:
closewindow(columnhandle%):
closewindow(framehandle%)
closewindow(sizehandle%)
view(0)
viewhandle%:
Tshift
viewmouse(2)
viewmouse(button%)
columnhandle%:
icon%=41
icon%=43
icon%=15
g%(15)
icon%=41
ty$="colline"
0
opencolour("Line colour",s%(41),41,1)
icon%=43
ty$="colchar"
5
opencolour("Character colour",s%(43),43,1)
icon%=15
ty$="colfill"
0
opencolour("Fill colour",s%(15),15,1)
'
selectvariables(window%,icon%)
icon%=1
icon%=2
closewindow(columnhandle%):
cancelOK
corrnhandle%:
icon%=1
icon%=2
closewindow(corrnhandle%)
edithandle%:
icon%=1
pkiedit
icon%=2
closewindow(edithandle%):
"Wimp_CreateMenu",,-1
sizehandle%:
(icon%=30
icon%=32)
icon%=30
ty$="keyfill"
:
opencolour("Key background colour",s%(30),30,1)
icon%=32
ty$="keyborder"
6
opencolour("Key border colour",s%(32),32,1)
'
selectvariables(window%,icon%)
=
icon%=1
icon%=2
closewindow(sizehandle%):
cancelOK
framehandle%:
(icon%=13
s%(11))
icon%=14
icon%=13
s%(11)
ty$="framefill"
<
opencolour("Background frame colour",s%(13),13,1)
icon%=14
ty$="framecol"
A
opencolour("Frame, labels and text colour",s%(14),14,1)
'
selectvariables(window%,icon%)
>
icon%=1
icon%=2
closewindow(framehandle%):
cancelOK
colourhandle%:
ignore
icon%=1
icon%=2
cancelOK
'
selectvariables(window%,icon%)
16,64:
drag
window%=savehandle%
icon%=0
: !block%=savehandle%:
"Wimp_GetWindowState",,block%
3 x%=block%!4-block%!20:y%=block%!16-block%!24
3 block%!4=icon%:
"Wimp_GetIconState",,block%
Q xmin%=x%+block%!8:ymin%=y%+block%!12:xmax%=x%+block%!16:ymax%=y%+block%!20
P block%!4=5:block%!8=xmin%:block%!12=ymin%:block%!16=xmax%:block%!20=ymax%
F block%!24=0:block%!28=0:block%!32=&7FFFFFFF:block%!36=&7FFFFFFF
"Wimp_DragBox",,block%
256,1024:
click when double-click is active
window%=mainhandle%
!block%=mainhandle%
"Wimp_GetWindowState",,block%
5 ox%=block%!4-block%!20:oy%=block%!16-block%!24
H column%=(x%-ox%-leftwidth%)
(14*16):row%=(oy%-y%-topheight%)
column%>C% column%=C%
column%<0 column%=0
row%>P% row%=P%
row%<0 crow%=0
redrawmain(caretx1%,caretx2%,carety1%,carety2%)
button%=256
O caretx1%=caretcolumn%:caretx2%=column%:carety1%=caretrow%:carety2%=row%
!A
caretx1%>caretx2% caretx2%=caretcolumn%:caretx1%=column%
";
carety1%>carety2% carety2%=caretrow%:carety1%=row%
caretstring(-1)
%J caretx1%=column%:carety1%=row%:caretx2%=caretx1%:carety2%=carety1%
&+ caretcolumn%=column%:caretrow%=row%
'5
caretstring(((x%-ox%-leftwidth%-8)
)7
redrawmain(caretx1%,caretx2%,carety1%,carety2%)
drag box
"Wimp_GetPointerInfo",,block%:window%=block%!12
window%
colourhandle%:
ignore this
putsave
3, Save$=Save$(SaveType%):i%=
Save$,".")
Save$=
Save$,i%+1)
i%=
Save$,".")
8O destx%=!block%:desty%=block%!4:desthandle%=block%!12:desticon%=block%!16
9! !block%=4*((49+
Save$)
:H block%!12=0:block%!16=1:block%!20=desthandle%:block%!24=desticon%
;9 block%!28=destx%:block%!32=desty%:block%!36=&10000
<0 block%!40=
("&"+
FileType$(SaveType%),3))
$(block%+44)=Save$+
>;
"Wimp_SendMessage",18,block%,desthandle%,desticon%
key pressed
B# key%=block%!24:window%=!block%
!block%=mainhandle%
flush
key%
&183:
G'
"Wimp_GetPointerInfo",,block%
H;
"Wimp_CreateMenu",,savehandle%,!block%-64,block%!4
SaveType%=0
getsave
KA
"Wimp_SetCaretPosition",savehandle%,3,0,0,-1,
(Save$(0))
&18E:
down arrow
Mo
caretrow%<P%
recordcaret(
):caretrow%+=1:
oneselect(-1):
getmaininfo:
caretrow%>brow%-2
scrollarea(1)
&18F:
up arrow
On
caretrow%>0
recordcaret(
):caretrow%-=1:
oneselect(-1):
getmaininfo:
caretrow%<trow%+2
scrollarea(2)
&1AE:
CTRL-down
QA
recordcaret(
):caretrow%=P%:
scrollarea(5):
oneselect(-1)
&1AF:
CTRL-up
S@
recordcaret(
):caretrow%=0:
scrollarea(6):
oneselect(-1)
&19C:
SHIFT-left
getmaininfo:i%=-1
VZ
caretx2%>caretcolumn% i%=caretx2%:caretx2%-=1
caretx1%>0 caretx1%-=1:i%=caretx1%
WP
i%>-1
redrawmain(i%,i%,carety1%,carety2%):
i%<lcolumn%+1
scrollarea(4)
&19D:
SHIFT-right
getmaininfo:i%=-1
Z[
caretx1%<caretcolumn% i%=caretx1%:caretx1%+=1
caretx2%<C% caretx2%+=1:i%=caretx2%
[P
i%>-1
redrawmain(i%,i%,carety1%,carety2%):
i%>rcolumn%-1
scrollarea(3)
&19E:
SHIFT-down
getmaininfo:i%=-1
^X
carety1%<caretrow% i%=carety1%:carety1%+=1
carety2%<P% carety2%+=1:i%=carety2%
_M
i%>-1
redrawmain(caretx1%,caretx2%,i%,i%):
i%>brow%-2
scrollarea(1)
&19F:
SHIFT-up
getmaininfo:i%=-1
bW
carety2%>caretrow% i%=carety2%:carety2%-=1
carety1%>0 carety1%-=1:i%=carety1%
cM
i%>-1
redrawmain(caretx1%,caretx2%,i%,i%):
i%<trow%+2
scrollarea(2)
&18A:
e)
recordcaret(
caretcolumn%<C%
f[ caretcolumn%+=1:
oneselect(11):
getmaininfo:
caretcolumn%>rcolumn%-1
scrollarea(3)
hO
caretrow%<P% caretcolumn%=0:caretrow%+=1:
oneselect(11):
scrollarea(9)
&19A:
SHIFT-TAB
k(
recordcaret(
caretcolumn%>0
l[ caretcolumn%-=1:
oneselect(11):
getmaininfo:
caretcolumn%<lcolumn%+1
scrollarea(4)
nP
caretrow%>0 caretcolumn%=C%:caretrow%-=1:
oneselect(11):
scrollarea(10)
home
qO
recordcaret(
):caretcolumn%=0:caretrow%=0:
oneselect(11):
scrollarea(7)
&19B:
SHIFT-copy/end
s^
recordcaret(
):caretcolumn%=maxcolumn%:caretrow%=maxrow%:
oneselect(11):
scrollarea(8)
&18D:
right arrow
caretoffset%<11
v" caretoffset%+=1:
movecaret
x{
caretcolumn%<C%
recordcaret(
):caretcolumn%+=1:
oneselect(0):
getmaininfo:
caretcolumn%>rcolumn%-1
scrollarea(3)
&18C:
left arrow
{&
caretoffset%>11-
caretshort$
|" caretoffset%-=1:
movecaret
~{
caretcolumn%>0
recordcaret(
):caretcolumn%-=1:
oneselect(11):
getmaininfo:
caretcolumn%<lcolumn%+1
scrollarea(4)
backspace
( pos%=
caretshort$-11+caretoffset%
pos%>0 caretshort$=
caretshort$,pos%-1)+
caretshort$,pos%+1)
3 caret$=
" "+caretshort$+" ",14)
redrawmain(caretcolumn%,caretcolumn%,caretrow%,caretrow%)
return
recordcaret(
oneselect(11)
Tshift
caretcolumn%<C%
\ caretcolumn%+=1:
oneselect(11):
getmaininfo:
caretcolumn%>rcolumn%-1
scrollarea(3)
P
caretrow%<P% caretcolumn%=0:caretrow%+=1:
oneselect(11):
scrollarea(9)
Tctrl
P
caretrow%<P% caretcolumn%=0:caretrow%+=1:
oneselect(11):
scrollarea(9)
caretrow%<P% caretrow%+=1:
oneselect(11):
getmaininfo:
caretrow%>brow%-2
scrollarea(1)
delete
Tshift
caretrow%<=maxrow%
changed(
8
j%=caretx1%
caretx2%:
i%=caretrow%
maxrow%-1
%
data(j%,i%,
Tdata(j%,i%+1))
< DataStatus%?(j%+C1%*i%)=DataStatus%?(j%+C1%*(i%+1))
+
:DataStatus%?(j%+C1%*maxrow%)=0:
9 maxrow%-=1:
caretstring(11):
update(mainhandle%)
) pos%=
caretshort$-11+caretoffset%
E
pos%>0 caretshort$=
caretshort$,pos%-1)+
caretshort$,pos%+1)
4 caret$=
" "+caretshort$+" ",14)
B
redrawmain(caretcolumn%,caretcolumn%,caretrow%,caretrow%)
&1CD:
insert
caretrow%<P%
caretrow%<=maxrow%
changed(
):maxrow%+=1
;
j%=caretx1%
caretx2%:
i%=maxrow%
caretrow%+1
$
data(j%,i%,
Tdata(j%,i%-1))
; DataStatus%?(j%+C1%*i%)=DataStatus%?(j%+C1%*(i%-1))
,
:DataStatus%?(j%+C1%*caretrow%)=0:
E caretrow%+=1:carety1%=caretrow%:carety2%=caretrow%:
movecaret
6
getmaininfo:
caretrow%>brow%-2
scrollarea(1)
update(mainhandle%)
CTRL-U
i%=caretx1%
caretx2%:
j%=carety1%
carety2%
# DataStatus%?(i%+C1%*j%)=0:
caretstring(11):
redrawmain(caretx1%,caretx2%,carety1%,carety2%)
changed(
maxcolumnrow
including valid characters
"Mm0123456789.E- ",
key%)=0
"Wimp_ProcessKey",key%
) pos%=
caretshort$-11+caretoffset%
A caretshort$=
caretshort$,pos%)+
key%+
caretshort$,pos%+1)
4
caretshort$>10 caretshort$=
caretshort$,2)
4 caret$=
" "+caretshort$+" ",14)
B
redrawmain(caretcolumn%,caretcolumn%,caretrow%,caretrow%)
window%
colourhandle%:
do nothing
key%
return
# button%=4:icon%=1:
cancelOK
"Wimp_ProcessKey",key%
menu selection
"Wimp_GetPointerInfo",,block1%
S x%=!block1%:y%=block1%!4:button%=block1%!8:window%=block1%!12:icon%=block1%!16
adjust%=(button%=1)
menutree$
"iconbar":
!block%
quit selected
changed%
quit%=
Tjeopardy
quit%=
adjust%
"Wimp_CreateMenu",,iconbarmenu%
"view":
!block%
redraw to default size
8 ViewScaleFactor=0.9:ViewX%=ViewX0%:ViewY%=ViewY0%
"Wimp_ForceRedraw",viewhandle%,0,-2000,2000,0
replot graph
view(0)
toggle auto-update flag
ViewUpdate%=
ViewUpdate%
ViewUpdate%
view(0)
adjust% ?UpdateItem%=(?UpdateItem%
&FE)
(ViewUpdate%
"Wimp_CreateMenu",,viewmenu%
"styles":
setthestyle(block%!0)
"main":
!block%
paper, new for 1.50
block%!4=0
getvariables(sizehandle%):
openwindow(sizehandle%)
graph, new for 1.50
block%!4=1
getvariables(framehandle%):
openwindow(framehandle%)
Column
block%!4=0
getvariables(columnhandle%):
openwindow(columnhandle%)
block%!4=3
calculate
block%!4=5
normalise
block%!4=6
Save
SaveType%=block%!4
Cells
block%!4
whole row
5
highlight(0,maxcolumn%,caretrow%,caretrow%)
whole column
8
highlight(caretcolumn%,caretcolumn%,0,maxrow%)
to top
:
highlight(caretcolumn%,caretcolumn%,0,caretrow%)
to bottom
@
highlight(caretcolumn%,caretcolumn%,caretrow%,maxrow%)
all data
+
highlight(0,maxcolumn%,0,maxrow%)
Reduce
block%!4
Compact
compact
Clear
changed%
Tjeopardy
cleardata
cleardata
Warnings
* JeopardyWarning%=
JeopardyWarning%
View
view(0)
Multiple Xs
& !iMultipleX% = !iMultipleX%
MultipleX% =
MultipleX%
k,M, G labels
suffix%=
suffix%
!isuffix%=!isuffix%
adjust% ?WarningItem%=(?WarningItem%
&FE)
(JeopardyWarning%
"Wimp_CreateMenu",,mainmenu%
report("No such menu tree!")
lose caret
window%=block%!0
window%<>colourhandle%
recordcaret(
gotcaret%=
gain caret
window%=block%!0
window%<>colourhandle% gotcaret%=
17,18:
message system
block%!16
quit
quit%=
pre-quit
changed%
Tjeopardy
block%!12=block%!8
0(
"Wimp_SendMessage",19,block%,0
&400C9:
colour picker
block%!12=block%!8
5(
"Wimp_SendMessage",19,block%,0
&47700:
colour picked
ty$
"colline":
s%(41)=block%!28
:8
setcolour(columnhandle%,41,block%!28,"line")
"colchar":
s%(43)=block%!28
=8
setcolour(columnhandle%,43,block%!28,"char")
"colfill":
s%(15)=block%!28
@8
setcolour(columnhandle%,15,block%!28,"fill")
"framefill":
s%(13)=block%!28
C7
setcolour(framehandle%,13,block%!28,"fill")
"framecol":
s%(14)=block%!28
F7
setcolour(framehandle%,14,block%!28,"line")
"keyfill":
s%(30)=block%!28
I6
setcolour(sizehandle%,30,block%!28,"fill")
"keyborder":
s%(32)=block%!28
L6
setcolour(sizehandle%,32,block%!28,"line")
M
&47702:
close colour picker
"ColourPicker_CloseDialogue",0,dialogue%
&400C1:
mode change
&400C0:
menu warning
R1 handle%=block%!20:x%=block%!24:y%=block%!28
handle%=savehandle% SaveType%=block%!36
getvariables(handle%)
"Wimp_CreateSubMenu",,handle%,x%,y%
DataLoad
W- file$=
Tzeroterminatedstring(block%+44)
filetype%=block%!40
DataSaveAck
[8 Save$(SaveType%)=
Tzeroterminatedstring(block%+44)
now send a DataLoad message
]$ block%!12=block%!8:block%!16=3
"Wimp_SendMessage",18,block%,block%!4
getsave
update(savehandle%)
"Wimp_CreateMenu",,-1
quit%
"Wimp_CloseDown"
data(col%,row%,val)
k"|(Data%+5*col%+5*C1%*row%)=val
Tdata(col%,row%)
=|(Data%+5*col%+5*C1%*row%)
loadDFMPicker
try to find the DrawFile and ColourPicker modules
TpresentDFM
"XOS_Module",1,"<Tau$Dir>.DrawFile"
TpresentPicker
"XOS_Module",1,"<Tau$Dir>.Picker"
TpresentDFM
length%,flag%
*Set TauDraw$Exists Yes
z1*RMEnsure DrawFile 1.01 Set TauDraw$Exists No
"XOS_ReadVarVal","TauDraw$Exists",block3%,255,0,0
,,length%
length%>255 =
block3%?length%=13
=($block3%="Yes")
TpresentPicker
length%,flag%
*Set TauPicker$Exists Yes
7*RMEnsure ColourPicker 0.39 Set TauPicker$Exists No
"XOS_ReadVarVal","TauPicker$Exists",block3%,255,0,0
,,length%
length%>255 =
block3%?length%=13
=($block3%="Yes")
error1:@%=&90A
report("fatal error: "+
$+" (line "+
+")")
"Wimp_CloseDown"
error:@%=&90A
report(
$+" (line "+
+")")
fileopen%
#fileopen%:fileopen%=0
"OS_Byte",121,112
,escpressed%
escpressed%
"Wimp_CloseDown":
"Wimp_CreateMenu",,-1
ViewOn%
closewindow(viewhandle%):ViewOn%=
"Wimp_SlotSize",MinSlotSize%,-1
report(i$)
#!block3%=255:$(block3%+4)=i$+
"Wimp_ReportError",block3%,1,"Tau"
Tjeopardy
JeopardyWarning%
!block3%=255
/$(block3%+4)="Data in jeopardy - proceed ?"
"Wimp_ReportError",block3%,&13,"Tau"
,response%
=(response%=1)
templates
workspace%=workspace0%
'endwork%=workspace0%+workspacesize%
"Wimp_OpenTemplate",,"<Tau$Dir>.Templates"
)mainhandle%=
Tgettemplate("DataMain")
'tophandle%=
Tgettemplate("DataTop")
)lefthandle%=
Tgettemplate("DataLeft")
;X1%=block%!40:Y1%=block%!44:X2%=block%!48:Y2%=block%!52
'framehandle%=
Tgettemplate("Frame")
'tickshandle%=
Tgettemplate("Ticks")
'gridshandle%=
Tgettemplate("Grids")
)labelshandle%=
Tgettemplate("Labels")
%sizehandle%=
Tgettemplate("Size")
+scalinghandle%=
Tgettemplate("Scaling")
)columnhandle%=
Tgettemplate("Column")
%savehandle%=
Tgettemplate("Save")
%infohandle%=
Tgettemplate("Info")
/calculatehandle%=
Tgettemplate("Calculate")
+optionshandle%=
Tgettemplate("Options")
+bestfithandle%=
Tgettemplate("BestFit")
'fontshandle%=
Tgettemplate("Fonts")
-cornerhandle%=
Tgettemplate("DataCorner")
-axistexthandle%=
Tgettemplate("AxisText")
+magnifyhandle%=
Tgettemplate("Magnify")
+meaninghandle%=
Tgettemplate("Meaning")
%weedhandle%=
Tgettemplate("Weed")
)importhandle%=
Tgettemplate("Import")
)downtohandle%=
Tgettemplate("Downto")
%manyhandle%=
Tgettemplate("Many")
/worksheethandle%=
Tgettemplate("Worksheet")
%viewhandle%=
Tgettemplate("View")
'corrnhandle%=
Tgettemplate("Corrn")
%edithandle%=
Tgettemplate("Edit")
"Wimp_CloseTemplate"
!block%=mainhandle%
"Wimp_GetWindowInfo",,block%
titlebuffer%=block%!76
!block%=viewhandle%
"Wimp_GetWindowInfo",,block%
viewtitlebuffer%=block%!76
changed(
L!block1%=tophandle%:
"Wimp_GetWindowState",,block1%:topflag%=block1%!32
N!block2%=lefthandle%:
"Wimp_GetWindowState",,block2%:leftflag%=block2%!32
R!block3%=cornerhandle%:
"Wimp_GetWindowState",,block3%:cornerflag%=block3%!32
setextent
Tgettemplate(temp$)
$block2%=temp$
"Wimp_LoadTemplate",,block%,workspace%,endwork%,-1,block2%,0
,,workspace%
temp$="Save" block%!112=1:
special pleading !!!
temp$
"Column":
,block%!64=spritearea%:
point to sprites
$block%!(88+15*32+24)=spritearea%
$block%!(88+41*32+24)=spritearea%
$block%!(88+43*32+24)=spritearea%
"Frame":
,block%!64=spritearea%:
point to sprites
$block%!(88+13*32+24)=spritearea%
$block%!(88+14*32+24)=spritearea%
"Size":
,block%!64=spritearea%:
point to sprites
$block%!(88+30*32+24)=spritearea%
$block%!(88+32*32+24)=spritearea%
"Wimp_CreateWindow",,block%
handle%
=handle%
setextent
assumes C% and P% (and C1% and P1%) are set to valid new values
and that any data is cleared (with the user's agreement).
)!block%=0:block%!4=-topheight%-32*P1%
-block%!8=leftwidth%+14*16*C1%:block%!12=0
"Wimp_SetExtent",mainhandle%,block%
(block%!4=-32*P1%:block%!8=leftwidth%
"Wimp_SetExtent",lefthandle%,block%
+block%!4=-topheight%:block%!8=14*16*C1%
"Wimp_SetExtent",tophandle%,block%
!block%=mainhandle%
"Wimp_GetWindowState",,block%
datawindowmoved
changed(i%)
x1%,x2%,y2%
changed%=i%
changed% $titlebuffer%=TauFileName$+" *"
$titlebuffer%=TauFileName$
!block%=mainhandle%
"Wimp_GetWindowState",,block%
,x1%=block%!4:x2%=block%!12:y2%=block%!16
"Wimp_ForceRedraw",-1,x1%,y2%,x2%,y2%+44
ViewOn%
changed%
ViewUpdate%
view(0)
viewchanged(
viewchanged(i%)
x1%,x2%,y2%
i% $viewtitlebuffer%=TauFileName$+" (has been modified)"
$viewtitlebuffer%=TauFileName$
!block%=viewhandle%
"Wimp_GetWindowState",,block%
,x1%=block%!4:x2%=block%!12:y2%=block%!16
"Wimp_ForceRedraw",-1,x1%,y2%,x2%,y2%+44
opendatawindow
mainopen%=
openwindow(tophandle%)
openwindow(lefthandle%)
openwindow(cornerhandle%)
openwindow(mainhandle%)
7!block%=mainhandle%:
"Wimp_GetWindowState",,block%
block%!28=-1
datawindowmoved
openwindow(handle%)
!block%=handle%
"Wimp_GetWindowState",,block%
"Wimp_OpenWindow",,block%
datawindowmoved
reopenmain%
reopenmain%=
#8!block1%=tophandle%:
"Wimp_GetWindowState",,block1%
$"new%=block%!28:old%=block1%!28
new%<>old% reopenmain%=
block%!28=cornerhandle%
"Wimp_OpenWindow",,block%
'/!block2%=lefthandle%:!block3%=cornerhandle%
(Gblock1%!4=block%!4+leftwidth%:block2%!4=block%!4:block3%!4=block%!4
)Tblock1%!8=block%!16-topheight%:block2%!8=block%!8:block3%!8=block%!16-topheight%
*Vblock1%!12=block%!12:block2%!12=block%!4+leftwidth%:block3%!12=block%!4+leftwidth%
+Mblock1%!16=block%!16:block2%!16=block%!16-topheight%:block3%!16=block%!16
,2block1%!20=block%!20:block2%!20=0:block3%!20=0
-2block1%!24=0:block2%!24=block%!24:block3%!24=0
.Cblock1%!32=topflag%:block2%!32=leftflag%:block3%!32=cornerflag%
/@block1%!28=new%:block2%!28=tophandle%:block3%!28=lefthandle%
"Wimp_OpenWindow",,block1%
"Wimp_OpenWindow",,block2%
"Wimp_OpenWindow",,block3%
reopenmain% block%!28=cornerhandle%:
"Wimp_OpenWindow",,block%
closewindow(handle%)
!block%=handle%
"Wimp_CloseWindow",,block%
Tshift
"OS_Byte",202,0,255
,status%
=(status%
Tctrl
"OS_Byte",202,0,255
,status%
=(status%
maxcolumnrow
j%,k%
EEk%=
j%=0
maxrow%:k%=k%
(DataStatus%?(maxcolumn%+C1%*j%)<>0):
(maxcolumn%>0)
maxcolumn%-=1
HF k%=
j%=0
maxrow%:k%=k%
(DataStatus%?(maxcolumn%+C1%*j%)<>0):
JEk%=
j%=0
maxcolumn%:k%=k%
(DataStatus%?(j%+C1%*maxrow%)<>0):
(maxrow%>0)
maxrow%-=1
MF k%=
j%=0
maxcolumn%:k%=k%
(DataStatus%?(j%+C1%*maxrow%)<>0):
getmaininfo
!block%=mainhandle%
"Wimp_GetWindowState",,block%
T2ox%=block%!4-block%!20:oy%=block%!16-block%!24
U9x1%=block%!4:x2%=block%!12:y1%=block%!8:y2%=block%!16
lcolumn%=(x1%-ox%)
(16*14)
W*rcolumn%=(x2%-ox%-leftwidth%)
(16*14)
trow%=(oy%-y2%)
Y"brow%=(oy%-y1%-topheight%)
scrollarea(type%)
change the main window's visible area in some way
!block%=mainhandle%
"Wimp_GetWindowState",,block%
type%
1:block%!24=block%!24-32:
scroll down
2:block%!24=block%!24+32:
scroll up
3:block%!20=block%!20+16*14:
scroll right
4:block%!20=block%!20-16*14:
scroll left
5:block%!24=-32*P1%-topheight%:
bottom
6:block%!24=0:
7:block%!24=0:block%!20=0:
home
8:block%!24=-32*(maxrow%+2)+(block%!16-block%!8)-topheight%:block%!20=16*14*(maxcolumn%+1)-(block%!12-block%!4)+leftwidth%:
9:block%!24=block%!24-32:block%!20=0:
beginning of next line
10:block%!24=block%!24+32:block%!20=14*16*C1%+leftwidth%:
end of last line
block%!20<0 block%!20=0
block%!20>14*16*C1%+leftwidth%-(block%!12-block%!4) block%!20=14*16*C1%+leftwidth%-(block%!12-block%!4)
block%!24>0 block%!24=0
block%!24<-32*P1%-topheight%+(block%!16-block%!8) block%!24=-32*P1%-topheight%+(block%!16-block%!8)
datawindowmoved
oneselect(co%)
collapse the selected area to the caret cell only
redrawmain(caretx1%,caretx2%,carety1%,carety2%)
v+caretx1%=caretcolumn%:caretx2%=caretx1%
w(carety1%=caretrow%:carety2%=carety1%
redrawmain(caretx1%,caretx2%,carety1%,carety2%)
caretstring(co%)
caretstring(co%)
define the caret variables for the caret cell, and put the caret there
DataStatus%?(caretcolumn%+C1%*caretrow%)
move flag
caretshort$="M"
caretoffset%=11
numerical value
@%=&100060D
2 caretshort$=
Tdata(caretcolumn%,caretrow%))
co%>=0 caretoffset%=co%
empty cell
caretshort$=""
caretoffset%=11
255,"Bad DataStatus in PROCcaretstring"
0caret$=
" "+caretshort$+" ",14)
movecaret
recordcaret(bigarea%)
an edit of a cell has finished - record the result
altered%,ds%,d,cs$
flag, new DataStatus%, new Data, old caretshort$
altered%=
:ds%=1
caretshort$,"M")
caretshort$,"m") ds%=2
caretshort$=
caretshort$," ") ds%=0
caretshort$
bigarea%
8 x1%=caretx1%:x2%=caretx2%:y1%=carety1%:y2%=carety2%
3 x1%=caretcolumn%:x2%=x1%:y1%=caretrow%:y2%=y1%
i%=x1%
j%=y1%
$@%=&100060D:cs$=
Tdata(i%,j%))
DataStatus%?(i%+C1%*j%)<>ds%
(ds%=1
cs$<>caretshort$) altered%=
data(i%,j%,d):DataStatus%?(i%+C1%*j%)=ds%
altered%
caretx2%>maxcolumn% maxcolumn%=caretx2%
carety2%>maxrow% maxrow%=carety2%
changed(
movecaret
caretoffset%<11-
caretshort$ caretoffset%=11-
caretshort$
caretoffset%>11 caretoffset%=11
mainopen%
"Wimp_SetCaretPosition",mainhandle%,-1,caretcolumn%*16*14+16*(caretoffset%+1)+leftwidth%,-caretrow%*32-36-topheight%,&40B0028,-1
userdraw
screen co-ords of lop left of visible area
*topleftx%=block%!4:toplefty%=block%!16
offset of top left of visible area from work area origin
)scrollx%=block%!20:scrolly%=block%!24
screen co-ords of redraw rectangle
;x1%=block%!28:y1%=block%!32:x2%=block%!36:y2%=block%!40
screen co-ords of work area origin
7workx%=topleftx%-scrollx%:worky%=toplefty%-scrolly%
distance, of top left corner of redraw rectangle, from work area origin
/rectworkx%=x1%-workx%:rectworky%=worky%-y2%
!block%
mainhandle%:
character positions from work area origin, start and max width
L startx%=(rectworkx%-leftwidth%)
16:starty%=(rectworky%-topheight%)
4 widthx%=1+(x2%-x1%)
16:widthy%=1+(y2%-y1%)
startx%<0 startx%=0
starty%<0 starty%=0
widthy%>P%-starty% widthy%=P%-starty%
endy%=starty%+widthy%
@%=&100060D
startcolumn%=startx%
G endcolumn%=startcolumn%+1+widthx%
endcolumn%>C% endcolumn%=C%
i%=starty%
endy%
j%=startcolumn%
endcolumn%
K select%=(j%>=caretx1%)
(j%<=caretx2%)
(i%>=carety1%)
(i%<=carety2%)
select%
workx%+16*14*j%+leftwidth%,worky%-32*i%-4-topheight%
fill$;
"Wimp_SetColour",8
i%=caretrow%
j%=caretcolumn%
workx%+16*14*j%+leftwidth%,worky%-32*i%-4-topheight%
caret$;
DataStatus%?(j%+C1%*i%)=1
workx%+16*14*j%+leftwidth%,worky%-32*i%-4-topheight%
" "+
Tdata(j%,i%))+" ",14);
DataStatus%?(j%+C1%*i%)=2
workx%+16*14*j%+leftwidth%,worky%-32*i%-4-topheight%
" M ",14);
select%
"Wimp_SetColour",0
lefthandle%:
character positions from work area origin, start and max width
starty%=rectworky%
widthy%=1+(y2%-y1%)
widthy%>P%-starty% widthy%=P%-starty%
endy%=starty%+widthy%
i%=starty%
endy%
topleftx%+16,worky%-32*i%-4
" "+
(i%),4)
tophandle%:
character positions from work area origin, start and max width
i%=0
workx%+14*16*i%+9*16+8,toplefty%-8
i%,2)
workx%+14*16*i%+8*16+8,toplefty%-44
" "+ColumnMeaning$(i%),3)
255,"Bad redraw request"
redrawmain(x1%,x2%,y1%,y2%)
Cxmin%=x1%*14*16-4+leftwidth%:xmax%=x2%*14*16+14*16+4+leftwidth%
:ymax%=-y1%*32+8-topheight%:ymin%=-y2%*32-40-topheight%
"Wimp_ForceRedraw",mainhandle%,xmin%,ymin%,xmax%,ymax%
update(handle%)
!block1%=handle%
"Wimp_GetWindowState",,block1%
%xmin%=block1%!20:ymax%=block1%!24
Exmax%=xmin%+block1%!12-block1%!4:ymin%=ymax%+block1%!8-block1%!16
"Wimp_ForceRedraw",handle%,xmin%,ymin%,xmax%,ymax%
highlight(x1%,x2%,y1%,y2%)
redrawmain(caretx1%,caretx2%,carety1%,carety2%)
7caretx1%=x1%:caretx2%=x2%:carety1%=y1%:carety2%=y2%
caretstring(((x%-ox%-leftwidth%-8)
redrawmain(caretx1%,caretx2%,carety1%,carety2%)
flush
"OS_Byte",21,0
compact
row%,status%,j%,count%,start%
"Hourglass_On"
maxcolumnrow
count%=0:start%=-1
row%=0
maxrow%
status%=
j%=0
maxcolumn%
DataStatus%?(j%+C1%*row%) status%=
block%?row%=status%
status%=
count%+=1:
start%=-1 start%=row%
docompact(count%,start%)
"Hourglass_Smash"
caretstring(11):
update(mainhandle%)
doweed
i%,count%,start%,end%
retain start% and then every WeedGap% until end% (keep end%)
maxcolumnrow
start%=0:end%=maxrow%
WeedSelection% start%=carety1%:end%=carety2%
end%>maxrow% end%=maxrow%
WeedGap%<2
end%-start%<2
"Hourglass_On"
i%=0
start%:block%?i%=
i%=end%
maxrow%:block%?i%=
count%=0
i%=start%+1
end%-1
(i%-start%)
WeedGap%=0 block%?i%=
block%?i%=
:count%+=1
docompact(count%,start%+1)
"Hourglass_Smash"
caretstring(11):
update(mainhandle%)
changed(
docompact(count%,start%)
old%,row%,j%
assumes block% is a table of which rows contain data
with count% gaps, the first being row number start%
count%=0
old%=start%
row%=start%
maxrow%-count%
block%?old%=
old%+=1:
row%<>old%
j%=0
maxcolumn%
data(j%,row%,
Tdata(j%,old%))
>9 DataStatus%?(j%+C1%*row%)=DataStatus%?(j%+C1%*old%)
old%+=1
row%=maxrow%-count%+1
maxrow%
j%=0
maxcolumn%
DataStatus%?(j%+C1%*row%)=0
maxrow%-=count%
maxcolumnrow
definemenus
papermenu%=
Tdefinemenu
stylemenu%=
Tdefinemenu
plotsmenu%=
Tdefinemenu
savemenu%=
Tdefinemenu
reducemenu%=
Tdefinemenu
cellsmenu%=
Tdefinemenu
mainmenu%=
Tdefinemenu
viewmenu%=
Tdefinemenu
iconbarmenu%=
Tdefinemenu
colourmenu%=FNTdefinemenu
stylemenu%=
Tdefinemenu
2,"Paper"
0,-1,"Size..."
&88,magnifyhandle%,"Magnify"
8,"Graph"
8,scalinghandle%,"Scaling"
0,-1,"Frame..."
8,tickshandle%,"Ticks"
8,gridshandle%,"Grids"
8,labelshandle%,"Labels"
8,axistexthandle%,"Texts"
8,fontshandle%,"Fonts"
&88,worksheethandle%,"Worksheet"
7,"Column"
0,-1,"Plot..."
8,meaninghandle%,"Meaning"
8,manyhandle%,"Plot (many)"
8,calculatehandle%,"Calculate"
8,bestfithandle%,"Best fit"
0,-1,"Normalise"
&80,-1,"Sort"
7,"Save"
8,savehandle%,"Draw file F3"
8,savehandle%,"Tau file"
8,savehandle%,"Tau style"
8,savehandle%,"CSV data"
8,savehandle%,"Text data"
8,savehandle%,"Binary data"
&88,optionshandle%,"Options"
4,"Reduce"
8,weedhandle%,"Weed"
0,-1,"Compact"
0,-1,"Clear"
&80,-1,"Warnings"
6,"Cells"
0,-1,"Whole row"
0,-1,"Whole column"
0,-1,"To top"
0,-1,"To bottom"
8,downtohandle%,"Down to"
&80,-1,"All data"
11,"Main"
0,papermenu%,"Paper"
0,stylemenu%,"Graph"
0,plotsmenu%,"Column"
0,savemenu%,"Save"
8,importhandle%,"Import"
0,cellsmenu%,"Cells"
0,reducemenu%,"Reduce"
0,-1,"View"
0,-1,"Many Xs"
0,-1,"k,M,G labels"
&80,edithandle%,"Global Edit"
3,"View"
0,-1,"Zoom to fit"
0,-1,"Re-plot"
&80,-1,"Auto-update"
2,"Tau"
8,infohandle%,"Info"
128,-1,"Quit"
flags,submenu,entry
3,"Line styles"
0,-1,"
0,-1,"
&80,-1,"
Tdefinemenu
m%,p%,fg%
m% 28+24*n%
*m%!12=&70207:m%!20=44:m%!24=0:width%=0
i%=m%+28:p%=-1
f%,i%!4,i$
i$="Warnings" WarningItem%=i%
i$="Auto-update" UpdateItem%=i%
PDK Multiple X addition
i$="Many Xs"
iMultipleX%=i%
MultipleX% f%=(f%
PDK suffix addition
i$="k,M,G labels"
isuffix%=i%
suffix% f%=(f%
$!i%=f%:i%!8=&7000021:$(i%+12)=i$
i$>width% width%=
i%+=24
m%!16=(1+width%)*16
iconbaricon
>!block%=-1:block%!4=0:block%!8=0:block%!12=68:block%!16=68
'block%!20=&3002:$(block%+24)="!tau"
"Wimp_CreateIcon",,block%
iconbariconhandle%
Tzeroterminatedstring(m%)
i$="":i%=?m%
i%<>0
m%+=1:i%=?m%
Tcheckfont(font$)
find%,i$
$find%=
:font$=
Tlowercase(font$)
"<Tau$Dir>.FontList":fileopen%=c%
#c%:i$=
Tlowercase(i$)
font$=i$ find%=
find%
#c%:fileopen%=0
=find%
Tlowercase(i$)
i$=0 =i$
i%=1
i$,i%,1)
i$,i%,1)=
view(length%)
TpresentDFM
importdrawfile%=
ViewOn%
closewindow(viewhandle%):ViewOn%=
"Wimp_SlotSize",MinSlotSize%,-1
report("Cannot view the graph: the DrawFile module is absent"):
**** to avoid possible sillies before any scaling
ScalingAuto%
autoscale
"Hourglass_On"
length% ViewLength%=length%
ViewLength%=
Tgenerate(
ViewLength%
"DrawFile_BBox",0,Himem%,ViewLength%,0,block2%
) ViewWidth%=(block2%!8-!block2%)
, ViewHeight%=(block2%!12-block2%!4)
I ViewScale0=ViewWidth%:
ViewHeight%>ViewWidth% ViewScale0=ViewHeight%
ViewScale0=1280/ViewScale0
J ViewX0%=(block2%!8+!block2%)
512:ViewY0%=(block2%!12+block2%!4)
(ViewScaleFactor>0.8
ViewScaleFactor<1)
ViewOn% ViewScaleFactor=0.9:ViewX%=ViewX0%:ViewY%=ViewY0%
!block%=viewhandle%
"Wimp_GetWindowState",,block%
- block%!12=block%!4+ViewScale0*ViewWidth%
. block%!8=block%!16-ViewScale0*ViewHeight%
block%!28=-1
"Wimp_OpenWindow",,block%
"Wimp_ForceRedraw",viewhandle%,0,-2000,2000,0
ViewOn%=
viewchanged(
ViewOn%
closewindow(viewhandle%):ViewOn%=
"Wimp_SlotSize",MinSlotSize%,-1
report("There is not enough free memory to view the graph")
"Hourglass_Smash"
redrawview
TpresentDFM
"DrawFile_Render",0,Himem%,ViewLength%,block1%,block%+28,0
viewmouse(button%)
!block%=viewhandle%
"Wimp_GetWindowState",,block%
EViewX%+=(x%-(block%!4+block%!12)
2)/(ViewScale0*ViewScaleFactor)
EViewY%+=(y%-(block%!8+block%!16)
2)/(ViewScale0*ViewScaleFactor)
button%=4 ViewScaleFactor=ViewScaleFactor*2
button%=1 ViewScaleFactor=ViewScaleFactor/2
"Wimp_ForceRedraw",viewhandle%,0,-2000,2000,0
##### file operations, loading, saving, etc #####
cleardata
i%=0
C1%*P1%-4
4:DataStatus%!i%=0:
maxcolumn%=0:maxrow%=0
caretcolumn%=0:caretrow%=0
oneselect(11)
update(mainhandle%)
changed(
changed(
Tautoload
r$,i%,object%,load%
"OS_GetEnv"
"%i%=
r$,"!RunImage"):r$=
r$,i%+10)
r$,"0")
i%<>0
filetype%=
("&"+
r$,i%,3))
file$=
r$,i%+3)
file$="<Tau$Dir>.Default"
"OS_File",17,file$
object%,,load%
filetype%=(load%>>8)
(filetype%=&82
filetype%=&83)
object%=1 =
filetype%=&FFB
file$:
BASIC file
filetype%=&AFF importdrawfile%=
view(0):
drawfile
changed%
filetype%<>&83
filetype%=&82
(caretrow%<=maxrow%
caretcolumn%<=maxcolumn%)
Tjeopardy
"Hourglass_On"
ViewOn%
closewindow(viewhandle%):ViewOn%=
"Wimp_SlotSize",MinSlotSize%,-1
9$rw0%=caretrow%:cl0%=caretcolumn%
(file$):fileopen%=c%
filetype%
&1000,&2000:
directory or application
TauFile
Tloadvars
loadtaudata:
changed(
checkscaling:
file$<>"<Tau$Dir>.Default" Save$(1)=file$:TauFileName$=
Tleafname(file$)
TauStyle
Tloadvars
checkscaling:
file$<>"<Tau$Dir>.Default" Save$(2)=file$
&DFE:
loaddata:Save$(3)=file$:
changed(
&FFF:
Text
loaddata:Save$(4)=file$:
changed(
any other file type (including &FE4 "DOS" and &FFD "Data")
#c%=0
i%=&40
i%=&80
i%=&88
assume this is a BASIC data file
loaddatadata:Save$(5)=file$
loaddata
changed(
#c%:fileopen%=0
filetype%=&82
filetype%=&83
Tcheckfont(FontsPoints$)
report("Warning: the font for data points is absent!")
Tcheckfont(FontsLabels$)
report("Warning: the font for graph labels is absent!")
ScalingAuto%
autoscale
mainopen%
update(tophandle%)
update(mainhandle%):
caretstring(-1)
opendatawindow:
caretstring(-1)
"Hourglass_Smash"
loadtaudata
#c%,maxcolumn%,maxrow%
maxrow%>P% maxrow%=P%:
report("Big file: some rows of data will not be imported!")
i%=0
C1%*P1%-4
4:DataStatus%!i%=0:
rw%=0
maxrow%
cl%=0
maxcolumn%
#c%,d
data(cl%,rw%,d)
g"DataStatus%?(cl%+C1%*rw%)=
loadweedwarn
l=loadweed%=(ImportGap%<>1)
(ImportRow%>0)
(ImportCol%>0)
JeopardyWarning%
loadweed%
report("Imported data will be weeded!")
loaddata
a place filled with just "." has status "empty" but reserves a space
a place filled with "M" marks a move rather than a draw plot action
loadweedwarn
t/rw%=caretrow%-1:cl%=caretcolumn%-ImportCol%
skiprows%=ImportRow%
rows
skip rows, with next byte ready in b%
i%=skiprows%
b%<>13
b%<>10
#c%:b%=
(b%=13
b%=10)
#c%:b%=
i%-=1
skiprows%=ImportGap%-1
#c% rw%+=1:cl%=caretcolumn%-ImportCol%
columns
get the next datum
anything not numerical, space, CR or LF is treated like a comma
b%=32
#c%:b%=
0 i$="":b$=
b%:n%=
"0123456789.EeDd+-Mm",b$)
i$+=b$
4 b%=
#c%:b$=
b%:n%=
"0123456789.EeDd+-Mm",b$)
n%=0
accept the datum if it hasn't been weeded
cl%>=caretcolumn%
(i$<>""
#c%)
cl%<=C%
rw%<=P%
" i%=
i$,"e"):
i$,i%)="E"
" i%=
i$,"D"):
i$,i%)="E"
" i%=
i$,"d"):
i$,i%)="E"
3 i%=
i$,"E"):
i% i$=
i$,i%-1)+"E"+
i$,i%+1)
data(cl%,rw%,
,
".","":DataStatus%?(cl%+C1%*rw%)=0
-
"M","m":DataStatus%?(cl%+C1%*rw%)=2
%
:DataStatus%?(cl%+C1%*rw%)=1
cl%>maxcolumn% maxcolumn%=cl%
rw%>maxrow% maxrow%=rw%
cl%+=1
get the next bit of filling
b%<>13
b%<>10
#c% b%=
next column
no more columns, next row
(b%=13
b%=10)
#c%:b%=
rw%>P%
loaddatadata
ImportGet%
#c%,cls%
cls%=ImportNumber%
cls%<=ImportCol%
report("all columns are weeded!")
loadweedwarn
$rw%=caretrow%-1:cl%=caretcolumn%
skiprows%=ImportRow%
skiprows%
i%=1
cls%*skiprows%
#c%,I
skiprows%=ImportGap%-1
#c% rw%+=1
ImportCol%
i%=1
ImportCol%
#c%,I
cl%=caretcolumn%
caretcolumn%+cls%-1-ImportCol%
#c%,I
cl%<=C%
rw%<=P%
data(cl%,rw%,I):DataStatus%?(cl%+C1%*rw%)=1
rw%>maxrow% maxrow%=rw%
rw%>P%
caretcolumn%+cls%-1-ImportCol% maxcolumn%=caretcolumn%+cls%-1-ImportCol%
Tloadvars
filever%
!i$="":
i%=1
17:i$+=
#c%):
i$,14)<>"Tau variables "
report("That's not a Tau-compatible file!"):=
filever%=
i$,3))
filever%
100:newC1%=16:newP1%=1024
120,130,140,filever%:
#c%,newC1%,newP1%
report("This version of Tau is too old for that file!"):=
newP1%<minP1% newP1%=minP1%
newC1%>maxC1%
report("File has too many columns of data!"):=
newC1%<2
report("File has less than 2 columns of data!"):=
newC1%*newP1%>room% newP1%=room%
newC1%
changed%
filetype%=&83
newC1%<>C1%
newP1%<>P1%
Tjeopardy
+C1%=newC1%:P1%=newP1%:C%=C1%-1:P%=P1%-1
setextent
#c%,DrawFrame%,DrawXAxis%,DrawYAxis%
#c%,FrameThick,AxisThick
filever%=150
#c%,FrameFill%,FrameFillColour%,FrameColour%
#c%,KeyBack%,KeyOutline%
#c%,TicksMajorXFrame%,TicksMajorYFrame%,TicksMajorXAxis%,TicksMajorYAxis%
#c%,TicksMinorXFrame%,TicksMinorYFrame%,TicksMinorXAxis%,TicksMinorYAxis%
#c%,TicksMajorIn,TicksMajorOut,TicksMajorDown,TicksMajorUp,TicksMajorLeft,TicksMajorRight
#c%,TicksMinorIn,TicksMinorOut,TicksMinorDown,TicksMinorUp,TicksMinorLeft,TicksMinorRight
#c%,TicksMajorThick,TicksMinorThick
#c%,GridsMajorX%,GridsMajorY%,GridsMinorX%,GridsMinorY%
#c%,GridsDash,GridsGap,GridsThick
#c%,LabelsXFrame%,LabelsXAxis%,LabelsBelow%,LabelsXMinor%
#c%,LabelsYFrame%,LabelsYAxis%,LabelsLeft%,LabelsYMinor%,LabelsYRotate%
#c%,LabelsXOffset,LabelsYOffset
#c%,FontsLabels$
#c%,LabelsFontWidth,LabelsFontHeight
#c%,AxistextXPlot%,AxistextYPlot%,AxistextXFrame%,AxistextYFrame%
#c%,AxistextBelow%,AxistextLeft%,AxistextRotate%
#c%,AxistextXOffset,AxistextYOffset,AxistextXSpacing,AxistextYSpacing
#c%,AxistextXText$,AxistextYText$
#c%,AxistextFontWidth,AxistextFontHeight
#c%,GraphWidth,GraphHeight,GraphLeft,GraphBottom,GraphBorder%
#c%,GraphBorderWidth,GraphBorderHeight,GraphBorderLeft,GraphBorderBottom
#c%,GraphKey%,GraphKeyLeft,GraphKeyTop
#c%,ScalingAuto%,ScalingBound%,ScalingXLog%,ScalingYLog%
#c%,ScalingXMin,ScalingXMax,ScalingXAtYAxis
#c%,ScalingYMin,ScalingYMax,ScalingYAtXAxis
#c%,ScalingXDigits%,ScalingYDigits%,ScalingXFormat%,ScalingYFormat%
#c%,ScalingXMajor,ScalingXMinor,ScalingXAnchor
#c%,ScalingYMajor,ScalingYMinor,ScalingYAnchor
#c%,ScalingXLogType%,ScalingYLogType%
i%=0
#c%,ColumnPlot%(i%)
#c%,ColumnMeaning$(i%),ColumnKeyText$(i%)
#c%,ColumnLine%(i%),ColumnThick(i%),ColumnDash(i%),ColumnGap(i%)
#c%,ColumnFill%(i%),ColumnColour%(i%)
convert to 24-bit
filever%< 150
ColumnColour%(i%)=
Treadpalette(ColumnColour%(i%))
#c%,ColumnPoints%(i%),ColumnChar%(i%),ColumnWidth(i%),ColumnHeight(i%)
#c%,ColumnError%(i%),ColumnErrorThick(i%),ColumnErrorCap(i%)
filever%>= 130
#c%,ColumnLinecol%(i%),ColumnCharcol%(i%)
#c%,ColumnLinestyle%(i%),ColumnDash2(i%)
filever%>= 130
filever%< 150
convert colours to 24-bit
8ColumnLinecol%(i%)=
Treadpalette(ColumnLinecol%(i%))
8ColumnCharcol%(i%)=
Treadpalette(ColumnCharcol%(i%))
filever%>= 140
#c%,ColumnX%(i%)
#c%,BestFitYColumn%,BestFitForce%,BestFitX,BestFitY
#c%,FontsPoints$,Calculate$
#c%,Magnify,JeopardyWarning%
#c%,SaveIncludePoint%,SaveIncludeMove%,SaveOrder%,SaveLocal%
filever%>=140
#c%,MultipleX%
MultipleX% !iMultipleX%=1
!iMultipleX%=0
MultipleX%=0
SaveType%=-1 SaveType%=1
SaveType%<0
SaveType%>5
SaveType%=0
checkscaling:
scalingerror$
report("Can't create a Draw file: bad scaling!"):
Tcheckfont(FontsPoints$)
Tcheckfont(FontsLabels$))
report("Can't create a Draw file: font missing!"):
8Save$=Save$(SaveType%):Scrap%=(Save$="<Wimp$Scrap>")
Save$,".")=0)
Scrap%
report("Incomplete path name"):
"Hourglass_On"
maxcolumnrow
SaveType%
DrawFile
savedrawfile
TauFile
(Save$):fileopen%=c%
savevars:
savetaudata:TauFileName$=
Tleafname(Save$)
Scrap%
changed(
checkscaling
#c%:fileopen%=0
TauStyle
(Save$):fileopen%=c%
savevars:
checkscaling
#c%:fileopen%=0
CSVFile
(Save$):fileopen%=c%
savedatacommas
#c%:fileopen%=0
TextFile
(Save$):fileopen%=c%
savedataspaces
#c%:fileopen%=0
BASIC data file, with no. columns (integer) as the first row
(Save$):fileopen%=c%
savedatadata
#c%:fileopen%=0
255,"Bad save operation"
"SetType "+Save$+" "+
FileType$(SaveType%),3)
Scrap% Save$(SaveType%)=OldSave$(SaveType%)
"Hourglass_Smash"
savetaudata
#c%,maxcolumn%,maxrow%
rw%=0
maxrow%
cl%=0
maxcolumn%
Tdata(cl%,rw%)
#c%,DataStatus%?(cl%+C1%*rw%)
savedataspaces
@%=&100060D
saverange
rw%=rw1%
#c%:status%=
cl%=cl1%
Q,i$=
Tdata(workhorse%(cl%),rw%)):l%=
l%<12
i$,"E"):
e%=0 e%=l%+1
i$,".") j$=
12-l%,"0")
j$="."+
11-l%,"0")
U! i$=
i$,e%-1)+j$+
i$,l%-e%+1)
" "+i$,14)
DataStatus%?(workhorse%(cl%)+C1%*rw%)
0:i$=" ":
SaveIncludePoint% i$=" . "
1:status%=
2:i$=" ":
SaveIncludeMove% i$=" M "
255,"Bad data status value"
i%=1
i$,i%,1):
#c%,&0D:
#c%,&0A
status%
#c%=p%
savedatacommas
@%=&100060D
saverange
rw%=rw1%
#c%:status%=
cl%=cl1%
i$=","
DataStatus%?(workhorse%(cl%)+C1%*rw%)=1 status%=
Tdata(workhorse%(cl%),rw%))+","
(DataStatus%?(workhorse%(cl%)+C1%*rw%)=2)
SaveIncludeMove% i$="M,"
#c%,i$;
#c%-1
#c%,&0D:
#c%,&0A
status%
#c%=p%
savedatadata
saverange
SaveBinaryColumns%
#c%,cl2%-cl1%+1
rw%=rw1%
#c%:status%=
cl%=cl1%
DataStatus%?(workhorse%(cl%)+C1%*rw%)=1 status%=
Tdata(workhorse%(cl%),rw%)
status%
#c%=p%
saverange
i%,j%
.rw1%=0:rw2%=maxrow%:cl1%=0:cl2%=maxcolumn%
SaveLocal% rw1%=carety1%:rw2%=carety2%:cl1%=caretx1%:cl2%=caretx2%
i%=cl1%
cl2%:workhorse%(i%)=i%:
SaveOrder%
workhorse(cl1%) will equal the column% for the first saved column
i%=cl1%
ColumnMeaning$(i%))<>"X"
i%<cl2%
i%+=1
ColumnMeaning$(i%))="X"
i%>cl1%
workhorse%(cl1%)=i%
j%=cl1%+1
i%:workhorse%(j%)=j%-1:
savevars
@i$="Tau variables "+fileversion$:
i%=1
i$,i%,1):
#c%,C1%,P1%
#c%,DrawFrame%,DrawXAxis%,DrawYAxis%
#c%,FrameThick,AxisThick
1.50 next 2 lines
#c%,FrameFill%,FrameFillColour%,FrameColour%
#c%,KeyBack%,KeyOutline%
#c%,TicksMajorXFrame%,TicksMajorYFrame%,TicksMajorXAxis%,TicksMajorYAxis%
#c%,TicksMinorXFrame%,TicksMinorYFrame%,TicksMinorXAxis%,TicksMinorYAxis%
#c%,TicksMajorIn,TicksMajorOut,TicksMajorDown,TicksMajorUp,TicksMajorLeft,TicksMajorRight
#c%,TicksMinorIn,TicksMinorOut,TicksMinorDown,TicksMinorUp,TicksMinorLeft,TicksMinorRight
#c%,TicksMajorThick,TicksMinorThick
#c%,GridsMajorX%,GridsMajorY%,GridsMinorX%,GridsMinorY%
#c%,GridsDash,GridsGap,GridsThick
#c%,LabelsXFrame%,LabelsXAxis%,LabelsBelow%,LabelsXMinor%
#c%,LabelsYFrame%,LabelsYAxis%,LabelsLeft%,LabelsYMinor%,LabelsYRotate%
#c%,LabelsXOffset,LabelsYOffset
#c%,FontsLabels$
#c%,LabelsFontWidth,LabelsFontHeight
#c%,AxistextXPlot%,AxistextYPlot%,AxistextXFrame%,AxistextYFrame%
#c%,AxistextBelow%,AxistextLeft%,AxistextRotate%
#c%,AxistextXOffset,AxistextYOffset,AxistextXSpacing,AxistextYSpacing
#c%,AxistextXText$,AxistextYText$
#c%,AxistextFontWidth,AxistextFontHeight
#c%,GraphWidth,GraphHeight,GraphLeft,GraphBottom,GraphBorder%
#c%,GraphBorderWidth,GraphBorderHeight,GraphBorderLeft,GraphBorderBottom
#c%,GraphKey%,GraphKeyLeft,GraphKeyTop
#c%,ScalingAuto%,ScalingBound%,ScalingXLog%,ScalingYLog%
#c%,ScalingXMin,ScalingXMax,ScalingXAtYAxis
#c%,ScalingYMin,ScalingYMax,ScalingYAtXAxis
#c%,ScalingXDigits%,ScalingYDigits%,ScalingXFormat%,ScalingYFormat%
#c%,ScalingXMajor,ScalingXMinor,ScalingXAnchor
#c%,ScalingYMajor,ScalingYMinor,ScalingYAnchor
#c%,ScalingXLogType%,ScalingYLogType%
i%=0
#c%,ColumnPlot%(i%)
#c%,ColumnMeaning$(i%),ColumnKeyText$(i%)
#c%,ColumnLine%(i%),ColumnThick(i%),ColumnDash(i%),ColumnGap(i%)
#c%,ColumnFill%(i%),ColumnColour%(i%)
#c%,ColumnPoints%(i%),ColumnChar%(i%),ColumnWidth(i%),ColumnHeight(i%)
#c%,ColumnError%(i%),ColumnErrorThick(i%),ColumnErrorCap(i%)
#c%,ColumnLinecol%(i%),ColumnCharcol%(i%)
#c%,ColumnLinestyle%(i%),ColumnDash2(i%)
#c%,ColumnX%(i%)
#c%,BestFitYColumn%,BestFitForce%,BestFitX,BestFitY
#c%,FontsPoints$,Calculate$
#c%,Magnify,JeopardyWarning%
#c%,SaveIncludePoint%,SaveIncludeMove%,SaveOrder%,SaveLocal%
#c%,MultipleX%
Tleafname(file$)
file$,".")
file$=
file$,i%+1)
file$,".")
=file$
savedrawfile
length%
length%=
Tgenerate(
length%
"Save "+Save$+" "+
~Himem%+" +"+
~length%
ViewOn%
view(length%)
"Wimp_SlotSize",MinSlotSize%,-1
"Wimp_SlotSize",MinSlotSize%,-1
(Save$):fileopen%=c%
length%=
Tgenerate(
#c%:fileopen%=0
##### transfer between window icons and program variables #####
cancelOK
icon%=1
putvariables(window%)
window%=scalinghandle%
checkscaling
button%=4
"Wimp_CreateMenu",,-1
getvariables(window%)
"Wimp_CreateMenu",,mainmenu%
window%=savehandle%
icon%=1
window%=edithandle%
icon%=1
pkiedit
getvariables(handle%)
@%=&1000405
ScalingAuto%
autoscale
handle%
framehandle%:
getframe
tickshandle%:
getticks
gridshandle%:
getgrids
labelshandle%:
getlabels
axistexthandle%:
getaxistext
sizehandle%:
getsize
scalinghandle%:
getscaling
columnhandle%:
getcolumn
savehandle%:
getsave
calculatehandle%:
getcalculate
optionshandle%:
getoptions
bestfithandle%:
getbestfit
fontshandle%:
getfonts
magnifyhandle%:
getmagnify
meaninghandle%:
getmeaning
weedhandle%:
getweed
importhandle%:
getimport
downtohandle%:
getdownto
manyhandle%:
getmany
worksheethandle%:@%=&1000005:
getworksheet
selectvariables(handle%,icon%)
handle%
framehandle%:
selectframe
tickshandle%:
selectticks
gridshandle%:
selectgrids
labelshandle%:
selectlabels
axistexthandle%:
selectaxistext
sizehandle%:
selectsize
scalinghandle%:
selectscaling
columnhandle%:
selectcolumn
optionshandle%:
selectoptions
bestfithandle%:
selectbestfit
meaninghandle%:
selectmeaning
weedhandle%:
selectweed
importhandle%:
selectimport
downtohandle%:
selectdownto
putvariables(handle%)
chng%
chng%=
handle%
framehandle%:
putframe
tickshandle%:
putticks
gridshandle%:
putgrids
labelshandle%:
putlabels
axistexthandle%:
putaxistext
sizehandle%:
putsize
scalinghandle%:
putscaling
columnhandle%:
putcolumn
savehandle%:
putsave:chng%=
calculatehandle%:
putcalculate
optionshandle%:
putoptions:chng%=
bestfithandle%:
putbestfit
fontshandle%:
putfonts
magnifyhandle%:
putmagnify
meaninghandle%:
putmeaning
weedhandle%:
putweed
importhandle%:
putimport:chng%=
downtohandle%:
putdownto:chng%=
manyhandle%:
putmany
worksheethandle%:
putworksheet:chng%=
chng%
changed(
setwritable(ih%,v)
setwritablestring(ih%,
setwritablestring(ih%,v$)
?A!block1%=handle%:block1%!4=ih%:
"Wimp_GetIconState",,block1%
@ indir%=block1%!28:$indir%=v$
Tgetwritable(ih%)
Tgetwritablestring(ih%))
Tgetwritablestring(ih%)
GA!block1%=handle%:block1%!4=ih%:
"Wimp_GetIconState",,block1%
indir%=block1%!28
=$indir%
setselectgrey(i1%,i2%)
s%() indicates selected icons, g%() indicates UN-greyed icons
N+!block1%=handle%:block1%!12=sel%
grey%
i%=i1%
P;block1%!4=i%:block1%!8=(s%(i%)
sel%)
g%(i%)
grey%)
"Wimp_SetIconState",,block1%
getframe
setwritable(7,FrameThick):
setwritable(8,AxisThick)
W=s%()=
:s%(4)=DrawFrame%:s%(5)=DrawXAxis%:s%(6)=DrawYAxis%
s%(11)=FrameFill%
s%(13)=FrameFillColour%
s%(14)=FrameColour%
setcolour(framehandle%,14,s%(14),"line")
greyframe
greyframe
`)g%()=
:g%(7)=s%(4):g%(8)=s%(5)
s%(6)
setselectgrey(4,11)
s%(11)
setcolour(framehandle%,13,s%(13),"fill")
setgreycolour(framehandle%,13,"fill")
selectframe
s%(icon%)=
s%(icon%)
greyframe
putframe
o:FrameThick=
Tgetwritable(7):AxisThick=
Tgetwritable(8)
p6DrawFrame%=s%(4):DrawXAxis%=s%(5):DrawYAxis%=s%(6)
q-FrameFill%=s%(11):FrameFillColour%=s%(13)
FrameColour%=s%(14)
getticks
setwritable(4,TicksMajorThick):
setwritable(9,TicksMajorDown):
setwritable(10,TicksMajorUp)
setwritable(11,TicksMajorLeft):
setwritable(12,TicksMajorRight):
setwritable(13,TicksMajorIn)
setwritable(14,TicksMajorOut):
setwritable(15,TicksMinorThick):
setwritable(20,TicksMinorDown)
setwritable(21,TicksMinorUp):
setwritable(22,TicksMinorLeft):
setwritable(23,TicksMinorRight)
setwritable(24,TicksMinorIn):
setwritable(25,TicksMinorOut)
{hs%()=
:s%(5)=TicksMajorXAxis%:s%(6)=TicksMajorYAxis%:s%(7)=TicksMajorXFrame%:s%(8)=TicksMajorYFrame%
|es%(16)=TicksMinorXAxis%:s%(17)=TicksMinorYAxis%:s%(18)=TicksMinorXFrame%:s%(19)=TicksMinorYFrame%
greyticks
greyticks
g%()=
dg%(5)=DrawXAxis%:g%(9)=g%(5)
s%(5):g%(10)=g%(9):g%(16)=g%(9):g%(20)=g%(9)
s%(16):g%(21)=g%(20)
hg%(6)=DrawYAxis%:g%(11)=g%(6)
s%(6):g%(12)=g%(11):g%(17)=g%(11):g%(22)=g%(11)
s%(17):g%(23)=g%(22)
Kg%(7)=DrawFrame%:g%(8)=g%(7):g%(13)=g%(7)
(s%(7)
s%(8)):g%(14)=g%(13)
cg%(18)=g%(7)
s%(7):g%(19)=g%(8)
s%(8):g%(24)=(g%(18)
s%(18))
(g%(19)
s%(19)):g%(25)=g%(24)
=g%(4)=g%(9)
g%(11)
g%(13):g%(15)=g%(20)
g%(22)
g%(24)
setselectgrey(4,25)
selectticks
s%(icon%)=
s%(icon%)
greyticks
putticks
cTicksMajorThick=
Tgetwritable(4):TicksMajorDown=
Tgetwritable(9):TicksMajorUp=
Tgetwritable(10)
eTicksMajorLeft=
Tgetwritable(11):TicksMajorRight=
Tgetwritable(12):TicksMajorIn=
Tgetwritable(13)
fTicksMajorOut=
Tgetwritable(14):TicksMinorThick=
Tgetwritable(15):TicksMinorDown=
Tgetwritable(20)
eTicksMinorUp=
Tgetwritable(21):TicksMinorLeft=
Tgetwritable(22):TicksMinorRight=
Tgetwritable(23)
BTicksMinorIn=
Tgetwritable(24):TicksMinorOut=
Tgetwritable(25)
aTicksMajorXFrame%=s%(7):TicksMajorYFrame%=s%(8):TicksMajorXAxis%=s%(5):TicksMajorYAxis%=s%(6)
eTicksMinorXFrame%=s%(18):TicksMinorYFrame%=s%(19):TicksMinorXAxis%=s%(16):TicksMinorYAxis%=s%(17)
getgrids
setwritable(7,GridsDash):
setwritable(8,GridsGap):
setwritable(9,GridsThick)
Vs%()=
:s%(3)=GridsMajorX%:s%(4)=GridsMajorY%:s%(5)=GridsMinorX%:s%(6)=GridsMinorY%
greygrids
greygrids
Mg%()=
:g%(5)=s%(3):g%(6)=s%(4):g%(7)=s%(3)
s%(4):g%(8)=g%(7):g%(9)=g%(7)
setselectgrey(3,9)
selectgrids
s%(icon%)=
s%(icon%)
greygrids
putgrids
TGridsDash=
Tgetwritable(7):GridsGap=
Tgetwritable(8):GridsThick=
Tgetwritable(9)
OGridsMajorX%=s%(3):GridsMajorY%=s%(4):GridsMinorX%=s%(5):GridsMinorY%=s%(6)
getlabels
setwritable(14,LabelsXOffset):
setwritable(15,LabelsYOffset)
setwritable(16,LabelsFontWidth):
setwritable(17,LabelsFontHeight)
Xs%()=
:s%(5)=LabelsXFrame%:s%(6)=LabelsXAxis%:s%(7)=LabelsBelow%:s%(8)=LabelsXMinor%
is%(9)=LabelsYFrame%:s%(10)=LabelsYAxis%:s%(11)=LabelsLeft%:s%(12)=LabelsYMinor%:s%(13)=LabelsYRotate%
greylabels
greylabels
]g%()=
:g%(5)=DrawFrame%:g%(6)=DrawXAxis%:g%(7)=(g%(5)
s%(5))
(g%(6)
s%(6)):g%(8)=g%(7)
jg%(9)=DrawFrame%:g%(10)=DrawYAxis%:g%(11)=(g%(9)
s%(9))
(g%(10)
s%(10)):g%(12)=g%(11):g%(13)=g%(11)
Ag%(14)=g%(7):g%(15)=g%(11):g%(16)=g%(7)
g%(11):g%(17)=g%(16)
setselectgrey(5,17)
selectlabels
s%(icon%)=
s%(icon%)
icon%
5,6,9,10:
greylabels
putlabels
CLabelsXOffset=
Tgetwritable(14):LabelsYOffset=
Tgetwritable(15)
HLabelsFontWidth=
Tgetwritable(16):LabelsFontHeight=
Tgetwritable(17)
QLabelsXFrame%=s%(5):LabelsXAxis%=s%(6):LabelsBelow%=s%(7):LabelsXMinor%=s%(8)
iLabelsYFrame%=s%(9):LabelsYAxis%=s%(10):LabelsLeft%=s%(11):LabelsYMinor%=s%(12):LabelsYRotate%=s%(13)
getaxistext
setwritable(8,AxistextXOffset):
setwritable(9,AxistextXSpacing)
setwritable(15,AxistextYOffset):
setwritable(16,AxistextYSpacing)
setwritablestring(10,AxistextXText$):
setwritablestring(17,AxistextYText$)
setwritable(18,AxistextFontWidth):
setwritable(19,AxistextFontHeight)
Js%()=
:s%(5)=AxistextXPlot%:s%(6)=AxistextXFrame%:s%(7)=AxistextBelow%
\s%(11)=AxistextYPlot%:s%(12)=AxistextYFrame%:s%(13)=AxistextLeft%:s%(14)=AxistextRotate%
greyaxistext
greyaxistext
:g%()=
:g%(5)=DrawFrame%
DrawXAxis%:g%(6)=g%(5)
s%(5)
<g%(7)=((DrawFrame%
s%(6))
(DrawXAxis%
s%(6)))
s%(5)
7g%(11)=DrawFrame%
DrawYAxis%:g%(12)=g%(11)
s%(11)
Ng%(13)=((DrawFrame%
s%(12))
(DrawYAxis%
s%(12)))
s%(11):g%(14)=g%(13)
Rg%(8)=g%(7):g%(9)=g%(7):g%(10)=g%(7):g%(15)=g%(13):g%(16)=g%(13):g%(17)=g%(13)
&g%(18)=g%(7)
g%(13):g%(19)=g%(18)
setselectgrey(5,19)
selectaxistext
s%(icon%)=
s%(icon%)
icon%
5,6,11,12:
greyaxistext
putaxistext
FAxistextXOffset=
Tgetwritable(8):AxistextYOffset=
Tgetwritable(15)
HAxistextXSpacing=
Tgetwritable(9):AxistextYSpacing=
Tgetwritable(16)
QAxistextXText$=
Tgetwritablestring(10):AxistextYText$=
Tgetwritablestring(17)
LAxistextFontWidth=
Tgetwritable(18):AxistextFontHeight=
Tgetwritable(19)
CAxistextXPlot%=s%(5):AxistextXFrame%=s%(6):AxistextBelow%=s%(7)
\AxistextYPlot%=s%(11):AxistextYFrame%=s%(12):AxistextLeft%=s%(13):AxistextRotate%=s%(14)
getsize
setwritable(5,GraphWidth):
setwritable(6,GraphHeight)
setwritable(7,GraphLeft):
setwritable(8,GraphBottom)
setwritable(10,GraphBorderWidth):
setwritable(11,GraphBorderHeight)
setwritable(12,GraphBorderLeft):
setwritable(13,GraphBorderBottom)
setwritable(15,GraphKeyLeft):
setwritable(16,GraphKeyTop)
.s%()=
:s%(9)=GraphBorder%:s%(14)=GraphKey%
s%(30)=KeyBack%
s%(32)=KeyOutline%
greysize
greysize
g%()=
:g%(10)=s%(9):g%(11)=g%(10):g%(12)=g%(10):g%(13)=g%(10)
g%(15)=s%(14):g%(16)=g%(15)
setselectgrey(5,16)
s%(14)
setgreycolour(handle%,30,"fill"):
setgreycolour(handle%,32,"line")
setcolour(handle%,30,s%(30),"fill"):
setcolour(handle%,32,s%(32),"line")
selectsize
s%(icon%)=
s%(icon%)
greysize
putsize
<GraphWidth=
Tgetwritable(5):GraphHeight=
Tgetwritable(6)
;GraphLeft=
Tgetwritable(7):GraphBottom=
Tgetwritable(8)
JGraphBorderWidth=
Tgetwritable(10):GraphBorderHeight=
Tgetwritable(11)
IGraphBorderLeft=
Tgetwritable(12):GraphBorderBottom=
Tgetwritable(13)
@GraphKeyLeft=
Tgetwritable(15):GraphKeyTop=
Tgetwritable(16)
&KeyBack%=s%(30):KeyOutline%=s%(32)
'GraphBorder%=s%(9):GraphKey%=s%(14)
getscaling
setwritable(10,ScalingXMin):
setwritable(11,ScalingXMax):
setwritable(12,ScalingXAtYAxis)
setwritable(13,ScalingXDigits%):
setwritable(14,ScalingYMin):
setwritable(15,ScalingYMax)
setwritable(16,ScalingYAtXAxis):
setwritable(17,ScalingYDigits%)
setwritable(18,ScalingXMajor):
setwritable(19,ScalingXMinor):
setwritable(20,ScalingXAnchor)
setwritable(21,ScalingYMajor):
setwritable(22,ScalingYMinor):
setwritable(23,ScalingYAnchor)
Xs%()=
:s%(7)=ScalingAuto%:s%(34)=ScalingBound%:s%(8)=ScalingXLog%:s%(9)=ScalingYLog%
7s%(27-ScalingXLogType%)=
:s%(32-ScalingYLogType%)=
5s%(37+ScalingXFormat%)=
:s%(42+ScalingYFormat%)=
1tempx%=ScalingXDigits%:tempy%=ScalingYDigits%
D!block%=scalinghandle%:block%!4=13:
"Wimp_GetIconState",,block%
!>ix1%=block%!8:iy1%=block%!12:ix2%=block%!16:iy2%=block%!20
"D!block%=scalinghandle%:block%!4=17:
"Wimp_GetIconState",,block%
#>jx1%=block%!8:jy1%=block%!12:jx2%=block%!16:jy2%=block%!20
greyscaling
greyscaling
ScalingAuto%
) g%()=
:g%(7)=
g%(34)=TRUE
g%(8)=
:g%(9)=
,P g%()=
:g%(24)=s%(8):g%(25)=g%(24):g%(26)=g%(24):g%(27)=g%(24):g%(28)=g%(24)
-7 g%(18)=s%(28)
g%(24):g%(19)=g%(18):g%(20)=g%(18)
.I g%(29)=s%(9):g%(30)=g%(29):g%(31)=g%(29):g%(32)=g%(29):g%(33)=g%(29)
/7 g%(21)=s%(33)
g%(29):g%(22)=g%(21):g%(23)=g%(21)
setselectgrey(7,44)
selectscaling
icon%
autoscale clicked, must change AutoScale% and scale immediately
8$ s%(7)=
s%(7):ScalingAuto%=s%(7)
24,25,26,27,28:
X log radio icons
i%=24
28:s%(i%)=(i%=icon%):
29,30,31,32,33:
Y log radio icons
i%=29
33:s%(i%)=(i%=icon%):
35,36:
X arrow icons
>" tempx%+=(icon%=36)-(icon%=35)
tempx%<1 tempx%=10
tempx%>10 tempx%=1
setwritable(13,tempx%):
"Wimp_ForceRedraw",scalinghandle%,ix1%,iy1%,ix2%,iy2%
40,41:
Y arrow icons
B" tempy%+=(icon%=41)-(icon%=40)
tempy%<1 tempy%=10
tempy%>10 tempy%=1
setwritable(17,tempy%):
"Wimp_ForceRedraw",scalinghandle%,jx1%,jy1%,jx2%,jy2%
37,38,39:
X format radio icons
i%=37
39:s%(i%)=(i%=icon%):
42,43,44:
X format radio icons
i%=42
44:s%(i%)=(i%=icon%):
normal icons
s%(icon%)=
s%(icon%)
ScalingAuto%
M? ScalingBound%=s%(34):ScalingXLog%=s%(8):ScalingYLog%=s%(9)
autoscale
OS icon%=2:button%=1:
cancelOK:
imitates click on Cancel icon with Adjust button
icon%<34
greyscaling
putscaling
VaScalingXMin=
Tgetwritable(10):ScalingXMax=
Tgetwritable(11):ScalingXAtYAxis=
Tgetwritable(12)
W%ScalingXDigits%=
Tgetwritable(13)
XaScalingYMin=
Tgetwritable(14):ScalingYMax=
Tgetwritable(15):ScalingYAtXAxis=
Tgetwritable(16)
Y%ScalingYDigits%=
Tgetwritable(17)
ZdScalingXMajor=
Tgetwritable(18):ScalingXMinor=
Tgetwritable(19):ScalingXAnchor=
Tgetwritable(20)
[dScalingYMajor=
Tgetwritable(21):ScalingYMinor=
Tgetwritable(22):ScalingYAnchor=
Tgetwritable(23)
\/i%=4:
:i%-=1:
s%(27-i%):ScalingXLogType%=i%
]/i%=4:
:i%-=1:
s%(32-i%):ScalingYLogType%=i%
^.i%=3:
:i%-=1:
s%(37+i%):ScalingXFormat%=i%
_.i%=3:
:i%-=1:
s%(42+i%):ScalingYFormat%=i%
`>ScalingBound%=s%(34):ScalingXLog%=s%(8):ScalingYLog%=s%(9)
checkscaling
scalingerror$=""
ScalingXLog%
ScalingXMin<=0
adderror("min x value bad for log scale")
ScalingXMajor<ScalingXMinor
adderror("minor>major in x spacing")
ScalingXMajor<=0
ScalingXMinor<=0
adderror("x spacing <= 0")
ScalingYLog%
ScalingYMin<=0
adderror("min y value bad for log scale")
ScalingYMajor<ScalingYMinor
adderror("minor>major in y spacing")
ScalingYMajor<=0
ScalingYMinor<=0
adderror("y spacing <= 0")
ScalingXMin>=ScalingXMax
adderror("min>=max in x values")
ScalingYMin>=ScalingYMax
adderror("min>=max in y values")
ScalingXDigits%<1
ScalingXDigits%>10
adderror("bad number of x digits")
ScalingYDigits%<1
ScalingYDigits%>10
adderror("bad number of y digits")
scalingerror$
report(scalingerror$):button%=1
adderror(i$)
scalingerror$ scalingerror$+=", "+i$
scalingerror$=i$
getcolumn
handle%=columnhandle%
setwritable(3,caretcolumn%):
setwritablestring(4,ColumnMeaning$(caretcolumn%))
setwritable(7,ColumnThick(caretcolumn%))
setwritable(8,ColumnDash(caretcolumn%)):
setwritable(9,ColumnGap(caretcolumn%))
setwritable(11,ColumnErrorThick(caretcolumn%)):
setwritable(12,ColumnErrorCap(caretcolumn%))
setwritable(17,ColumnWidth(caretcolumn%)):
setwritable(18,ColumnHeight(caretcolumn%))
setwritable(19,ColumnChar%(caretcolumn%)):
setwritablestring(13,ColumnKeyText$(caretcolumn%))
setwritable(45,ColumnDash2(caretcolumn%))
setwritablestring(47,style$(ColumnLinestyle%(caretcolumn%)))
MultipleX%
ColumnMeaning$(caretcolumn%),1)<>"X"
setwritable(49,ColumnX%(caretcolumn%))
setwritable(49,0)
'tempchar%=ColumnChar%(caretcolumn%)
=!block%=handle%:block%!4=19:
"Wimp_GetIconState",,block%
>ix1%=block%!8:iy1%=block%!12:ix2%=block%!16:iy2%=block%!20
=!block%=handle%:block%!4=22:
"Wimp_GetIconState",,block%
>jx1%=block%!8:jy1%=block%!12:jx2%=block%!16:jy2%=block%!20
Js%()=
:s%(5)=ColumnPlot%(caretcolumn%):s%(6)=ColumnLine%(caretcolumn%)
is%(10)=ColumnError%(caretcolumn%):s%(16)=ColumnPoints%(caretcolumn%):s%(14)=ColumnFill%(caretcolumn%)
&s%(15)=ColumnColour%(caretcolumn%)
's%(41)=ColumnLinecol%(caretcolumn%)
's%(43)=ColumnCharcol%(caretcolumn%)
greycolumn
greycolumn
i%,i$
ColumnMeaning$(caretcolumn%),1)<>"Y"
g%()=
:g%(5)=
:g%(4)=
setgrey(47,
setgrey(8,
setgrey(9,
setgrey(45,
setgreycolour(columnhandle%,41,"line")
setgreycolour(columnhandle%,43,"char")
/ g%()=
:g%(7)=s%(6):g%(8)=g%(7):g%(9)=g%(7)
g%(11)=s%(10):g%(12)=g%(11)
X g%(17)=s%(16):g%(18)=g%(17):g%(19)=g%(17):g%(20)=g%(17):g%(21)=g%(17):g%(22)=g%(17)
) g%(14)=
ScalingYLog%
ScalingBound%
# g%(13)=GraphKey%:g%(15)=s%(14)
s%(6)
$ i$=
Tgetwritablestring(47),3)
i%=-1
i%+=1
style$(i%),3)=i$
setgrey(47,
setthestyle(i%)
setgrey(47,
setgrey(8,
setgrey(9,
setgrey(45,
setselectgrey(4,22)
g%(15)
grey%)
setgreycolour(handle%,15,"fill")
setcolour(handle%,15,s%(15),"fill")
s%(16)
setgreycolour(handle%,43,"char")
setcolour(handle%,43,s%(43),"char")
s%(6)
setgreycolour(handle%,41,"line")
setcolour(handle%,41,s%(41),"line")
setgrey(49,MultipleX%
ColumnMeaning$(caretcolumn%),1)<>"X")
"Wimp_ForceRedraw",handle%,jx1%,jy1%,jx2%,jy2%
selectcolumn
tempchar%=
Tgetwritable(19)
icon%
20,21:
arrow icons
:tempchar%+=(icon%=21)-(icon%=20):
tempchar%<>127
tempchar%<32 tempchar%=255
tempchar%>255 tempchar%=32
setwritable(19,tempchar%):
"Wimp_ForceRedraw",handle%,ix1%,iy1%,ix2%,iy2%
"Wimp_ForceRedraw",handle%,jx1%,jy1%,jx2%,jy2%
normal icons
s%(icon%)=
s%(icon%)
greycolumn
redrawcolumn
x%,y%,i$,dofont%,fonthandle%,bx1%,by1%,bx2%,by2%,cl%
!block%=columnhandle%:SYS"Wimp_GetWindowState",,block%
Tx%=block%!4-block%!20:y%=block%!16-block%!24:
screen co-ords of top-left corner
tempchar%:dofont%=
dofont%=
dofont%
"Font_FindFont",,FontsPoints$,16*32,16*32
fonthandle%
"Font_CharBBox",fonthandle%,tempchar%,16
,bx1%,by1%,bx2%,by2%
g%(19) cl%=7
cl%=2
"Wimp_SetFontColours",,0,cl%
"Font_Paint",,i$,16,x%+(jx1%+jx2%)/2-(bx1%+bx2%)/2,y%+(jy1%+jy2%)/2-(by1%+by2%)/2
"Font_LoseFont",fonthandle%
"Wimp_SetColour",11
x%+jx1%+56,y%+jy2%-32:
"Bad"
x%+jx1%+48,y%+jy2%-72:
"Font"
putcolumn
i%,i$
handle%=columnhandle%
.ColumnThick(caretcolumn%)=
Tgetwritable(7)
VColumnDash(caretcolumn%)=
Tgetwritable(8):ColumnGap(caretcolumn%)=
Tgetwritable(9)
cColumnErrorThick(caretcolumn%)=
Tgetwritable(11):ColumnErrorCap(caretcolumn%)=
Tgetwritable(12)
\ColumnWidth(caretcolumn%)=
Tgetwritable(17):ColumnHeight(caretcolumn%)=
Tgetwritable(18)
dColumnChar%(caretcolumn%)=
Tgetwritable(19):ColumnKeyText$(caretcolumn%)=
Tgetwritablestring(13)
MultipleX%
ColumnMeaning$(caretcolumn%),1)<>"X" ColumnX%(caretcolumn%)=
Tgetwritable(49)
Tgetwritablestring(47),3)
i%=-1
i%+=1
style$(i%),3)=i$
%ColumnLinestyle%(caretcolumn%)=i%
/ColumnDash2(caretcolumn%)=
Tgetwritable(45)
CColumnPlot%(caretcolumn%)=s%(5):ColumnLine%(caretcolumn%)=s%(6)
iColumnError%(caretcolumn%)=s%(10):ColumnPoints%(caretcolumn%)=s%(16):ColumnFill%(caretcolumn%)=s%(14)
&ColumnColour%(caretcolumn%)=s%(15)
'ColumnLinecol%(caretcolumn%)=s%(41)
'ColumnCharcol%(caretcolumn%)=s%(43)
ScalingAuto%
autoscale
update(tophandle%)
getmeaning
i$,l$,n$,i%
7i$=ColumnMeaning$(caretcolumn%):l$=
i$,1):n$=
i$,2)
setwritablestring(11,n$)
.s%()=
:s%(0)=
"XYLRHDUV",l$):s%(2+s%(0))=
greymeaning
greymeaning
+g%()=
s%(0)=1
MultipleX% g%(11)=
setselectgrey(3,11)
selectmeaning
$s%()=
:s%(0)=icon%-2:s%(icon%)=
greymeaning
putmeaning
i$,j$
"XYLRHDUV",s%(0),1)
i$<>"X"
i$+=
Tgetwritablestring(11)
MultipleX%
j$=
Tgetwritablestring(11)
j$="" i$="X0"
i$+=j$
"#ColumnMeaning$(caretcolumn%)=i$
update(tophandle%)
getsave
handle%=savehandle%
setwritablestring(3,Save$(SaveType%))
setwritablestring(0,FileType$(SaveType%))
putsave
handle%=savehandle%
.+Save$(SaveType%)=
Tgetwritablestring(3)
getcalculate
setwritablestring(0,Calculate$)
putcalculate
6%Calculate$=
Tgetwritablestring(0)
calculate
calculate
j%,noerror%,calc$,pos%,n$,a$,b$,row%,i%,ds%,col%
"Hourglass_On"
col%=caretx1%
caretx2%
>5 calc$=Calculate$:workhorse%()=
:pos%=
calc$,"#")
pos%
@= n$=
calc$,pos%+1,1):a$=
calc$,pos%-1):b$=
calc$,pos%+2)
A0
"9" n$+=
b$,1):b$=
b$,2)
n$="@" n$=
CD
n$="#" calc$=a$+"row%"+b$
calc$=a$+"FNTdata("+n$+",row%)"+b$
D
n$<>"#" workhorse%(
pos%=
calc$,"#")
workhorse is TRUE for columns which DON'T feature in the calculation
noerror%=
row%=carety1%
carety2%
j%=2:noerror%=
noerror%
data(col%,row%,
calc$)
j%=
i%=0
PD ds%=DataStatus%?(i%+C1%*row%):
ds%=2
workhorse%(i%)
255,"M"
Q& j%=j%
((ds%=1)
workhorse%(i%))
j% j%=1
U. noerror%=
:DataStatus%?(col%+C1%*row%)=j%
carety2%>maxrow% maxrow%=carety2%
caretx2%>maxcolumn% maxcolumn%=caretx2%
redrawmain(caretx1%,caretx2%,carety1%,carety2%)
caretstring(11):
changed(
"Hourglass_Smash"
getoptions
`ms%(3)=SaveIncludePoint%:s%(4)=SaveIncludeMove%:s%(5)=SaveOrder%:s%(6)=SaveLocal%:s%(7)=SaveBinaryColumns%
g%()=
setselectgrey(3,7)
selectoptions
s%(icon%)=
s%(icon%)
putoptions
imSaveIncludePoint%=s%(3):SaveIncludeMove%=s%(4):SaveOrder%=s%(5):SaveLocal%=s%(6):SaveBinaryColumns%=s%(7)
getmagnify
setwritable(3,Magnify)
n's%(3)=
:g%(3)=
setselectgrey(3,3)
putmagnify
Tgetwritable(3)
i>0 Magnify=i
getbestfit
setwritable(3,BestFitYColumn%):
setwritable(5,BestFitX):
setwritable(6,BestFitY)
y's%(4)=BestFitForce%:s%(5)=
:s%(6)=
greybestfit
greybestfit
~#g%(4)=
:g%(5)=s%(4):g%(6)=g%(5)
setselectgrey(4,6)
selectbestfit
s%(icon%)=
s%(icon%)
greybestfit
putbestfit
A$,B$,pk1,pk2
XBestFitYColumn%=
Tgetwritable(3):BestFitX=
Tgetwritable(5):BestFitY=
Tgetwritable(6)
BestFitForce%=s%(4)
caretx2%<>caretx1%
report("Best fit: too many destination columns"):
'x%=-1:y%=-1:A$="Y"+
BestFitYColumn%
MultipleX%
i%=-1
i%+=1
i$=ColumnMeaning$(i%)
i%=C%
i$=A$
i$=A$ y%=i%
y%>-1
, i%=-1:ii%=ColumnX%(y%):A$="X"+
(ii%)
i%+=1
i$=ColumnMeaning$(i%)
i%=C%
i$=A$
9
i$=A$ x%=i%:ColumnX%(caretcolumn%)=ColumnX%(y%)
i%=0
i$=ColumnMeaning$(i%)
x%=-1
i$="X" x%=i%
y%=-1
i$="Y"+
BestFitYColumn% y%=i%
x%=-1
report("Best fit: no X column"):
y%=-1
report("Best fit: no Y column"):
$s%=0:sx=0:sy=0:sxx=0:sxy=0:syy=0
i%=carety1%
carety2%
DataStatus%?(x%+C1%*i%)=1
DataStatus%?(y%+C1%*i%)=1
* s%+=1:x=
Tdata(x%,i%):y=
Tdata(y%,i%)
ScalingXLog%
x>0 x=
report("Best fit: bad log"):
ScalingYLog%
y>0 y=
report("Best fit: bad log"):
+ sx+=x:sy+=y:sxx+=x*x:sxy+=x*y:syy+=y*y
s%<2
report("Best fit: not enough points"):
BestFitForce%
" h=BestFitX:
ScalingXLog% h=
" k=BestFitY:
ScalingYLog% k=
1 m=(sxy-k*sx-h*sy+s%*h*k)/(sxx-2*h*sx+s%*h*h)
c=k-m*h
$ m=(sxy*s%-sx*sy)/(s%*sxx-sx*sx)
c=(sy-m*sx)/s%
i%=carety1%
carety2%
'DataStatus%?(caretcolumn%+C1%*i%)=0
DataStatus%?(x%+C1%*i%)=1
Tdata(x%,i%):
ScalingXLog% x=
y=m*x+c:
ScalingYLog% y=
data(caretcolumn%,i%,y)
( DataStatus%?(caretcolumn%+C1%*i%)=1
caretcolumn%>maxcolumn% maxcolumn%=caretcolumn%
redrawmain(caretcolumn%,caretcolumn%,carety1%,carety2%)
caretstring(11):
changed(
ScalingXLog%
ScalingYLog%
pk1=
- A$ = "y = "+
(pk1)+" * (x ** "+
(m)+")"
) A$ = "y = "+
(m)+" * LN(x) + "+
ScalingYLog%
pk1=
/ A$ = "y = "+
(pk1)+" * EXP("+
(m)+" * x)"
% A$ = "y = "+
(m)+" * x + "+
handle%=corrnhandle%
setwritablestring(3,A$)
BestFitForce%
B$="Not applicable"
< pk2 = (sxy*s%-sx*sy)/
( (sxx*s%-sx*sx)*(syy*s%-sy*sy) )
(pk2)
setwritablestring(4,B$)
update(corrnhandle%)
openwindow(corrnhandle%)
getfonts
setwritablestring(0,FontsPoints$)
setwritablestring(3,FontsLabels$)
putfonts
'FontsPoints$=
Tgetwritablestring(0)
'FontsLabels$=
Tgetwritablestring(3)
Tcheckfont(FontsPoints$)
report("Warning: the font for data points is absent!")
Tcheckfont(FontsLabels$)
report("Warning: the font for graph labels is absent!")
getweed
setwritable(3,WeedGap%)
s%()=
:s%(6)=WeedSelection%
greyweed
greyweed
g%()=
setselectgrey(3,6)
selectweed
gap%
icon%
select
s%(6)=
s%(6)
arrow icons
. gap%=
Tgetwritable(3)-(icon%=4)+(icon%=5)
gap%<1 gap%=1
gap%>99 gap%=99
setwritable(3,gap%)
"Wimp_ForceRedraw",handle%,220,-60,280,0
putweed
WeedGap%=
Tgetwritable(3)
WeedSelection%=s%(6)
WeedGap%<1 WeedGap%=1
doweed
getimport
setwritable(5,ImportNumber%):
setwritable(6,ImportGap%)
setwritable(7,ImportRow%):
setwritable(8,ImportCol%)
s%()=
:s%(4)=ImportGet%
greyimport
greyimport
g%()=
:g%(5)=
s%(4)
setselectgrey(4,8)
selectimport
icon%=4
s%(4)=
s%(4)
greyimport
putimport
$>ImportNumber%=
Tgetwritable(5):ImportGap%=
Tgetwritable(6)
%;ImportRow%=
Tgetwritable(7):ImportCol%=
Tgetwritable(8)
ImportGet%=s%(4)
ImportNumber%<1 ImportNumber%=1
ImportGap%<1 ImportGap%=1
getdownto
setwritable(3,maxrow%)
s%()=
greydownto
greydownto
g%()=
setselectgrey(3,5)
selectdownto
gap%
icon%
arrow icons
:. gap%=
Tgetwritable(3)-(icon%=4)+(icon%=5)
gap%<0 gap%=0
gap%>P% gap%=P%
setwritable(3,gap%)
"Wimp_ForceRedraw",handle%,220,-60,280,0
putdownto
end%
end%=
Tgetwritable(3)
highlight(caretcolumn%,caretcolumn%,0,end%)
getmany
setwritablestring(3,ManyChoice$):
setwritablestring(4,ManyTag$)
s%()=
greymany
greymany
g%()=
setselectgrey(3,4)
putmany
i%,col%,i$,j$,i1%,i2%,t$
UFManyChoice$=
Tgetwritablestring(3):ManyTag$=
Tgetwritablestring(4)
t$=ManyTag$:i%=
t$,"#")
X" t$=
i$,i%-1)+"col%"+
t$,i%+1)
t$,"#")
t$="" t$="-1"
i$=ManyChoice$
i$,1)=" ":i$=
i$,2):
i$)=" ":i$=
i$="" i$="FALSE"
i$,"#")
(i$="TRUE"
i$="FALSE")
c# i$=
i$,i%-1)+"col%"+
i$,i%+1)
i%=
i$,"#")
col%=0
manycopy(col%,caretcolumn%,t$)
i%=
i$,",")
i% j$=
i$,i%-1):i$=
i$,i%+1)
j$=i$:i$=""
i%=
j$,"-")
i% i1%=
j$,i%-1):i2%=
j$,i%+1)
j$:i2%=i1%
col%=i1%
p&
manycopy(col%,caretcolumn%,t$)
i$=""
update(tophandle%)
manycopy(col%,s%,t$)
i%,i$
ColumnMeaning$(s%),1)
z*i%=
i%>=0
i%<100
i$<>"X" i$+=
ColumnMeaning$(col%)=i$
|%ColumnThick(col%)=ColumnThick(s%)
}#ColumnDash(col%)=ColumnDash(s%)
~!ColumnGap(col%)=ColumnGap(s%)
/ColumnErrorThick(col%)=ColumnErrorThick(s%)
+ColumnErrorCap(col%)=ColumnErrorCap(s%)
%ColumnWidth(col%)=ColumnWidth(s%)
'ColumnHeight(col%)=ColumnHeight(s%)
%ColumnChar%(col%)=ColumnChar%(s%)
+ColumnKeyText$(col%)=ColumnKeyText$(s%)
)ColumnColour%(col%)=ColumnColour%(s%)
%ColumnPlot%(col%)=ColumnPlot%(s%)
%ColumnLine%(col%)=ColumnLine%(s%)
'ColumnError%(col%)=ColumnError%(s%)
)ColumnPoints%(col%)=ColumnPoints%(s%)
%ColumnFill%(col%)=ColumnFill%(s%)
+ColumnLinecol%(col%)=ColumnLinecol%(s%)
+ColumnCharcol%(col%)=ColumnCharcol%(s%)
/ColumnLinestyle%(col%)=ColumnLinestyle%(s%)
%ColumnDash2(col%)=ColumnDash2(s%)
ColumnX%(col%)=ColumnX%(s%)
getworksheet
setwritable(3,C1%):
setwritable(4,P1%)
setwritablestring(5,""):
setwritablestring(6,"")
s%()=
greyworksheet
greyworksheet
g%()=
setselectgrey(3,6)
putworksheet
i$,j$
AnewC1%=
Tgetwritablestring(5):newP1%=
Tgetwritablestring(6)
newC1%=0
newP1%=0
newC1%=0
newP1%<minP1% newP1%=minP1%
6 newC1%=room%
newP1%:
newC1%>maxC1% newC1%=maxC1%
newP1%=0 newP1%=room%
newC1%
newP1%<minP1% newP1%=minP1%
newC1%<2
report("That gives less than 2 columns!"):
newC1%>maxC1%
report("The maximum number of columns is "+
maxC1%+"!"):
newC1%<>C1%
newP1%<=maxrow%
changed%
Tjeopardy
cleardata
+C1%=newC1%:P1%=newP1%:C%=C1%-1:P%=P1%-1
setextent
update(tophandle%)
caretx2%<>caretx1%
report("Sort: too many destination columns"):
carety2%=carety1%
report("Sort: not enough points"):
"Hourglass_On"
(s%=caretcolumn%:n%=carety2%-carety1%
i%=carety1%
carety2%-1
n%>100
10=0
"Hourglass_Percentage",
(100.0*
(i%/n%))
any%=
:I=0:k%=-1
j%=i%
carety2%
DataStatus%?(s%+C1%*j%)=1
Tdata(s%,j%)<I
any%=
Tdata(s%,j%):k%=j%:any%=
any%
(k%<>i%)
l%=0
@ I=
Tdata(l%,i%):
data(l%,i%,
Tdata(l%,k%)):
data(l%,k%,I)
l I%=DataStatus%?(l%+C1%*i%):DataStatus%?(l%+C1%*i%)=DataStatus%?(l%+C1%*k%):DataStatus%?(l%+C1%*k%)=I%
"Hourglass_Smash"
getmaininfo:
redrawmain(lcolumn%,rcolumn%,trow%,brow%)
caretstring(11):
changed(
normalise
i%,j%,m
"Hourglass_On":m=0
i%=caretx1%
caretx2%:
j%=carety1%
carety2%
DataStatus%?(i%+C1%*j%)=1
Tdata(i%,j%)>m m=
Tdata(i%,j%)
"Hourglass_Smash":
report("Can't normalise by zero!"):
i%=caretx1%
caretx2%:
j%=carety1%
carety2%
data(i%,j%,
Tdata(i%,j%)/m)
redrawmain(caretx1%,caretx2%,carety1%,carety2%)
caretstring(11):
changed(
"Hourglass_Smash"
defaultsavevars
DrawFile,file_aff,TauFile,file_082,TauStyle,file_083,CSVFile,file_dfe,TextFile,file_fff,DataFile,file_ffd
i%=0
Save$(i%),FileType$(i%):
OldSave$()=Save$()
*SaveIncludePoint%=
:SaveIncludeMove%=
2SaveOrder%=
:SaveLocal%=
:SaveBinaryColumns%=
defaultvars
*DrawFrame%=
:DrawXAxis%=
:DrawYAxis%=
FrameThick=0.6:AxisThick=0.6
v1.50
<FrameFill%=
:FrameFillColour%=lgrey%:FrameColour%=black%
&KeyBack%=white%:KeyOutline%=black%
QTicksMajorXFrame%=
:TicksMajorYFrame%=
:TicksMajorXAxis%=
:TicksMajorYAxis%=
QTicksMinorXFrame%=
:TicksMinorYFrame%=
:TicksMinorXAxis%=
:TicksMinorYAxis%=
jTicksMajorIn=10:TicksMajorOut=0:TicksMajorDown=10:TicksMajorUp=10:TicksMajorLeft=10:TicksMajorRight=10
eTicksMinorIn=5:TicksMinorOut=0:TicksMinorDown=5:TicksMinorUp=5:TicksMinorLeft=5:TicksMinorRight=5
+TicksMajorThick=0.2:TicksMinorThick=0.2
?GridsMajorX%=
:GridsMajorY%=
:GridsMinorX%=
:GridsMinorY%=
*GridsDash=1:GridsGap=3:GridsThick=0.05
ALabelsXFrame%=
:LabelsXAxis%=
:LabelsBelow%=
:LabelsXMinor%=
QLabelsYFrame%=
:LabelsYAxis%=
:LabelsLeft%=
:LabelsYMinor%=
:LabelsYRotate%=
(LabelsXOffset=0.25:LabelsYOffset=0.5
QFontsLabels$="Homerton.Medium.Oblique":LabelsFontWidth=18:LabelsFontHeight=18
IAxistextXPlot%=
:AxistextYPlot%=
:AxistextXFrame%=
:AxistextYFrame%=
6AxistextBelow%=
:AxistextLeft%=
:AxistextRotate%=
UAxistextXOffset=0.5:AxistextYOffset=0.5:AxistextXSpacing=1.2:AxistextYSpacing=1.2
]AxistextXText$="Horizontal text\(x variable)":AxistextYText$="Vertical text\(y variable)"
.AxistextFontWidth=18:AxistextFontHeight=18
GGraphWidth=5:GraphHeight=4:GraphLeft=2:GraphBottom=2:GraphBorder%=
PGraphBorderWidth=7:GraphBorderHeight=6:GraphBorderLeft=1:GraphBorderBottom=1
,GraphKey%=
:GraphKeyLeft=8:GraphKeyTop=6
"ScalingAuto%=
:ScalingBound%=
!ScalingXLog%=
:ScalingYLog%=
1ScalingXMin=1:ScalingXMax=2:ScalingXAtYAxis=1
1ScalingYMin=1:ScalingYMax=2:ScalingYAtXAxis=1
KScalingXDigits%=3:ScalingYDigits%=3:ScalingXFormat%=0:ScalingYFormat%=0
8ScalingXMajor=0.5:ScalingXMinor=0.1:ScalingXAnchor=0
8ScalingYMajor=0.5:ScalingYMinor=0.1:ScalingYAnchor=0
)ScalingXLogType%=1:ScalingYLogType%=1
<ColumnPlot%()=
:ColumnMeaning$(0)="X":ColumnChar%(0)=108
i%=1
maxC1%-1:ColumnMeaning$(i%)="Y"+
i%:ColumnChar%(i%)=108+i%
%ColumnKeyText$()=ColumnMeaning$()
bColumnLine%()=
:ColumnThick()=0.6:ColumnDash()=6:ColumnGap()=0:ColumnDash2()=6:ColumnFill%()=
6ColumnPoints%()=
:ColumnWidth()=8:ColumnHeight()=8
?ColumnError%()=
:ColumnErrorThick()=0.6:ColumnErrorCap()=10
SColumnLinecol%()=black%:ColumnCharcol%()=black%:linecol%=black%:charcol%=black%
(ColumnLinestyle%()=0:ColumnDash2()=0
ColumnX%()=0
;BestFitYColumn%=1:BestFitForce%=
:BestFitX=0:BestFitY=0
)FontsPoints$="Selwyn":Calculate$="##"
7Magnify=1:JeopardyWarning%=
:ColumnColour%()=lgrey%
WeedGap%=2:WeedSelection%=
ImportGet%=
:ImportNumber%=2
*ImportGap%=1:ImportRow%=0:ImportCol%=0
ManyChoice$="":ManyTag$="#"
MultipleX%=
suffix%=
autoscale
x%,min,max,minb,maxb,i%,y%,ii%,ok%
ScalingAuto%
255,"shouldn't be autoscaling"
x%=-1:min=0:max=0
:ii%=0
:x%+=1
!4i%=ColumnPlot%(x%)
ColumnMeaning$(x%),1)="X")
(x%=maxcolumn%)
Tmaxmin(x%,min,max)
MultipleX%
ii%=0
'$ ii%=1:minb=min:maxb=max:ok%=
min>minb min=minb
max<maxb max=maxb
MultipleX%)
(x%=maxcolumn%)
MultipleX% i%=ok%
1; ScalingXMin=min:ScalingXMax=max:
min<=0 ScalingXLog%=
ScalingXLog%
autolog(ScalingXMin,ScalingXMax,ScalingXLogType%)
ScalingXLogType%=-1
autolin(ScalingXMin,ScalingXMax,ScalingXMajor,ScalingXMinor,ScalingXAnchor,
autolin(ScalingXMin,ScalingXMax,ScalingXMajor,ScalingXMinor,ScalingXAnchor,
8D ScalingXAtYAxis=ScalingXMin:ScalingXDigits%=3:ScalingXFormat%=0
y%=-1:i%=
:min=0:max=0
y%<maxcolumn%
:y%+=1
=5ii%=ColumnPlot%(y%)
ColumnMeaning$(y%),1)="Y")
(y%=maxcolumn%)
ii% ii%=
Tmaxmin(y%,min,max)
min<ScalingYMin ScalingYMin=min
max>ScalingYMax ScalingYMax=max
E% ScalingYMin=min:ScalingYMax=max
i%=i%
ScalingYMin<=0 ScalingYLog%=
ScalingYLog%
autolog(ScalingYMin,ScalingYMax,ScalingYLogType%)
ScalingYLogType%=-1
autolin(ScalingYMin,ScalingYMax,ScalingYMajor,ScalingYMinor,ScalingYAnchor,
autolin(ScalingYMin,ScalingYMax,ScalingYMajor,ScalingYMinor,ScalingYAnchor,
RD ScalingYAtXAxis=ScalingYMin:ScalingYDigits%=3:ScalingYFormat%=0
Tmaxmin(column%,
min,
max)
valid%=
:min=0:max=0
j%=0
maxrow%
Tdata(column%,j%)
DataStatus%?(column%+C1%*j%)=1
valid%
D>max max=D
D<min min=D
valid%=
min=D:max=D
min=max
0:max=1
-1:min=2*min
1:max=2*max
=valid%
autolog(
min,
max,
type%)
n!min=10^
min:max=10^
max+1)
type%=3
max/min<1E6 type%=2
max/min<100 type%=1
max/min<20 type%=0
max/min<10 type%=-1
autolin(
min,
max,
major,
minor,
anchor,allowminmaxtochange%)
w1xr=(max-min)/2:xl=10^(
xr):j%=
(xr/xl+0.001)
j%>4 major=5*xl:minor=xl
j%>1 major=2*xl:minor=xl
major=xl:minor=xl/2
allowminmaxtochange% min=
(min/major+0.001)*major:max=
(max/major-0.001+1)*major
anchor=min
##### generation of graph as a Draw file #####
Tgenerate(memory%)
buffer%,newsize%,overflow%,ptr%
output file already opened with handle c% if memory% is FALSE
if memory% is TRUE, then write file to memory above HIMEM
overflow%=
memory%
buffer%=64*1024
"Wimp_SlotSize",MinSlotSize%+buffer%,-1
newsize%
newsize%<>MinSlotSize%+buffer% =0
ptr%=0
?point%=640:pointsininch%=72:point=point%*Magnify:drawn%()=
importdrawfile%
importdrawfile%=
"OS_File",5,file$
,,,,ptr%
"Load "+file$+" "+
~Himem%
startdrawfile
fonttable
startgroup(1)
GraphBorder%
GraphKey%
startgroup(2)
FrameFill%
fillback
plots
overflow%
DrawFrame%
frame
DrawXAxis%
xaxis
DrawYAxis%
yaxis
xmarks
ymarks
AxistextXPlot%
xtext
AxistextYPlot%
ytext
GraphBorder%
GraphKey%
endgroup(2)
GraphKey%
startgroup(3):
graphkey:
endgroup(3)
GraphBorder%
border
endgroup(1)
boundgroups
enddrawfile
overflow%
=ptr%
plots
x%,i%
MultipleX%
x%=
Txcolumn:
x%<0
i%=0
ColumnMeaning$(i%),1)="Y")
ColumnPlot%(i%)
ycolumn(i%)
i%=0
ColumnMeaning$(i%),1)="Y")
ColumnPlot%(i%)
x%=ColumnX%(i%)
Tokx(x%)
ycolumn(i%)
Tokx(
xx%,i%
xx%=-1
xx%+=1
Zi%= (
ColumnMeaning$(xx%),1)="X")
ColumnPlot%(xx%)
ColumnMeaning$(xx%),2))=x%)
xx%=C%
i% x%=xx%
Txcolumn
x%,i%
x%=-1:i%=-1
i%+=1
only use column i% if its ColumnPlot% is TRUE
ColumnMeaning$(i%),1)="X")
ColumnPlot%(i%) x%=i%
i%=C%
x%<>-1
ycolumn(y%)
column$,validpoints%,j%,L%,R%,U%,D%,k%,type%
global x%
linecol%=ColumnLinecol%(y%)
charcol%=ColumnCharcol%(y%)
column$=
ColumnMeaning$(y%))
validpoints%=0
j%=0
maxrow%
DataStatus%?(x%+C1%*j%)=1
DataStatus%?(y%+C1%*j%)=1 validpoints%+=1
ColumnFill%(y%)
(validpoints%>1)
ScalingYLog%
ScalingBound%
line(ColumnColour%(y%)):drawn%(y%)=
ColumnLine%(y%)
(validpoints%>1)
(ColumnDash(y%)>0)
line(-1):drawn%(y%)=
ColumnError%(y%)
validpoints%
error bars
L%=-1:R%=-1:U%=-1:D%=-1
k%=0
(column$=
ColumnMeaning$(k%)))
ColumnPlot%(k%)
only use column k% if its ColumnPlot% is TRUE
- type%=
"HLRVDU",
ColumnMeaning$(k%),1))
type%
L%=-1 L%=k%
R%=-1 R%=k%
L%=-1 L%=k%
R%=-1 R%=k%
D%=-1 D%=k%
U%=-1 U%=k%
D%=-1 D%=k%
U%=-1 U%=k%
L%+R%+D%+U%<>-4
errorbars:drawn%(y%)=
ColumnPoints%(y%)
validpoints%
points:drawn%(y%)=
line(fill%)
start%,possiblestart%,oldin%,ox,oy,j%,x,y,in%,option%,x1,y1,x2,y2,xx,yy,localbound%
linecol%=ColumnLinecol%(y%)
there is a line to be plotted for data column x%,y%
Pstart%=
:possiblestart%=
:localbound%=ScalingBound%:
fill%<>-1 localbound%=
localbound%
oldin%=
:ox=0:oy=0
j%=0
maxrow%
(DataStatus%?(x%+C1%*j%)=2
DataStatus%?(y%+C1%*j%)=2)
6 in%=
:oldin%=
:possiblestart%=
start%
endpath
start%=
DataStatus%?(x%+C1%*j%)=1
DataStatus%?(y%+C1%*j%)=1
% x=
Tdata(x%,j%):y=
Tdata(y%,j%)
P in%=(x>=ScalingXMin)
(x<=ScalingXMax)
(y>=ScalingYMin)
(y<=ScalingYMax)
$ option%=-4*in%-2*oldin%-start%
option%
both points are in, path in progress, join them
draw(
Tx(x),
Ty(y))
this point is in, previous point in, path not in progress but must have been declared possible: start, move to old, draw to current
linestartpath(j%):
move(
Tx(ox),
Ty(oy)):
draw(
Tx(x),
Ty(y))
this point is in, the last one was out, path in progress, join them
crossing(ox,oy,x,y):
move(
Tx(xx),
Ty(yy)):
draw(
Tx(x),
Ty(y))
this point is in, last was out, path not started
possiblestart%
.
start up, do crossing, move and draw
\
linestartpath(j%):
crossing(ox,oy,x,y):
move(
Tx(xx),
Ty(yy)):
draw(
Tx(x),
Ty(y))
3
point is in, so possible start of a line
possiblestart%=
this point is out, the last one was in, path in progress, join them
crossing(x,y,ox,oy):
draw(
Tx(xx),
Ty(yy))
this point is out, last was in, must be a possible start
linestartpath(j%):
crossing(x,y,ox,oy):
move(
Tx(ox),
Ty(oy)):
draw(
Tx(xx),
Ty(yy))
this point is out, the last one was out, path in progress, join them?
Tinandout
move(
Tx(x1),
Ty(y1)):
draw(
Tx(x2),
Ty(y2))
this point is out, last point out
possiblestart%
D
if there is a line, start up and draw it, else do nothing
V
Tinandout
linestartpath(j%):
move(
Tx(x1),
Ty(y1)):
draw(
Tx(x2),
Ty(y2))
possiblestart%=
#
255,"banjaxed"
ox=x:oy=y:oldin%=in%
start%
endpath
j%=0
maxrow%
(DataStatus%?(x%+C1%*j%)=2
DataStatus%?(y%+C1%*j%)=2)
start%
fill%<>-1
draw(
Tx(x),
Ty(0))
start%=
endpath
DataStatus%?(x%+C1%*j%)=1
DataStatus%?(y%+C1%*j%)=1
4% x=
Tdata(x%,j%):y=
Tdata(y%,j%)
start%
draw(
Tx(x),
Ty(y))
linestartpath(j%)
start%
:R
fill%<>-1
move(
Tx(x),
Ty(0)):
draw(
Tx(x),
Ty(y))
move(
Tx(x),
Ty(y))
start%
fill%<>-1
draw(
Tx(x),
Ty(0))
endpath
linestartpath(pt%)
start%
255,"Don't call PROClinestartpath if already started!"
localbound%
do test as per usual if no bounds checking
pt%>=maxrow%
pt%+=1
DataStatus%?(x%+C1%*pt%)=1
DataStatus%?(y%+C1%*pt%)=1 start%=
DataStatus%?(x%+C1%*pt%)=2
DataStatus%?(y%+C1%*pt%)=2 pt%=maxrow%
start%
(pt%=maxrow%)
start%
already checked if localbound%=TRUE
start%=
fill%<>-1
ScalingYLog%
report("Can't do a log fill graph (no zero!)")
startpathfill(-1,0,fill%)
ColumnGap(y%)=0
startpath(ColumnThick(y%),0,0,0,0)
startpath(ColumnThick(y%),128,ColumnDash(y%),ColumnGap(y%),ColumnDash2(y%))
crossing(xout,yout,xin,yin)
yh,xv,yv
the line between <in> and <out> leaves the frame at xx,yy
yout>yin yh=ScalingYMax
yh=ScalingYMin
xout<xin xv=ScalingXMin
xv=ScalingXMax
xin=xout xx=xin:yy=yh:
yin=yout yy=yin:xx=xv:
g+yv=yout+(xv-xout)*(yin-yout)/(xin-xout)
yv<=ScalingYMax
yv>=ScalingYMin xx=xv:yy=yv:
i1yy=yh:xx=xout+(yh-yout)*(xin-xout)/(yin-yout)
Tinandout
yleft,yright,xbottom,xtop,gotone%,xx,yy
if TRUE, the line between x,y and ox,oy enters and leaves the frame at x1,y1 and x2,y2
(x<=ScalingXMin
ox<=ScalingXMin)
(x>=ScalingXMax
ox>=ScalingXMax)
(y<=ScalingYMin
oy<=ScalingYMin)
(y>=ScalingYMax
oy>=ScalingYMax) =
x=ox
x<ScalingXMin
x>ScalingXMax =
(y-ScalingYMax)*(oy-ScalingYMax)>0 =
s, x1=x:x2=x:y1=ScalingYMin:y2=ScalingYMax
y=oy
y<ScalingYMin
y>ScalingYMax =
(x-ScalingXMax)*(ox-ScalingXMax)>0 =
y, y1=y:y2=y:x1=ScalingXMin:x2=ScalingXMax
|+yleft=oy+(ScalingXMin-ox)*(y-oy)/(x-ox)
},yright=oy+(ScalingXMax-ox)*(y-oy)/(x-ox)
~-xbottom=ox+(ScalingYMin-oy)*(x-ox)/(y-oy)
*xtop=ox+(ScalingYMax-oy)*(x-ox)/(y-oy)
gotone%=
yleft>=ScalingYMin
yleft<=ScalingYMax
(y-yleft)*(yleft-oy)>=0 gotone%=
:x1=ScalingXMin:y1=yleft
yright>=ScalingYMin
yright<=ScalingYMax
(y-yright)*(yright-oy)>=0
xx=ScalingXMax:yy=yright
gotone% x2=xx:y2=yy:=
gotone%=
:x1=xx:y1=yy
xbottom>=ScalingXMin
xbottom<=ScalingXMax
(x-xbottom)*(xbottom-ox)>=0
xx=xbottom:yy=ScalingYMin
gotone% x2=xx:y2=yy:=
gotone%=
:x1=xx:y1=yy
xtop>=ScalingXMin
xtop<=ScalingXMax
(x-xtop)*(xtop-ox)>=0
gotone% x2=xtop:y2=ScalingYMax:=
points
i$,fonthandle%,bx1%,by1%,bx2%,by2%,d%,x,y
there are points to be plotted for data column x%,y%
ColumnChar%(y%)
pointlength(y%)
charcol%=ColumnCharcol%(y%)
d%=0
maxrow%
Tdata(x%,d%):y=
Tdata(y%,d%)
DataStatus%?(x%+C1%*d%)=1
DataStatus%?(y%+C1%*d%)=1
((x>=ScalingXMin
x<=ScalingXMax
y>=ScalingYMin
y<=ScalingYMax)
ScalingBound%)
text(
Tx(x)-(x1+x2)/2,
Ty(y)-(y1+y2)/2,2,ColumnWidth(y%),ColumnHeight(y%),i$,0)
charcol%=black%
errorbars
w,d%,x,y,start%,e
there are probably error bars to be plotted for column x%,y%
using column L%,R%,D%,U% (any =-1 means no error bars there)
w=ColumnErrorCap(y%)
d%=0
maxrow%
Tdata(x%,d%):y=
Tdata(y%,d%)
DataStatus%?(x%+C1%*d%)=1
DataStatus%?(y%+C1%*d%)=1
((x>=ScalingXMin
x<=ScalingXMax
y>=ScalingYMin
y<=ScalingYMax)
ScalingBound%)
start%=
L%>=0
DataStatus%?(L%+C1%*d%)=1
start% start%=
startpath(ColumnErrorThick(y%),0,0,0,0)
e=
Tdata(L%,d%)
move(
Tx(x),
Ty(y)):
draw(
Tx(x-e),
Ty(y))
move(
Tx(x-e),
Ty(y)-w):
draw(
Tx(x-e),
Ty(y)+w)
R%>=0
DataStatus%?(R%+C1%*d%)=1
start% start%=
startpath(ColumnErrorThick(y%),0,0,0,0)
e=
Tdata(R%,d%)
move(
Tx(x),
Ty(y)):
draw(
Tx(x+e),
Ty(y))
move(
Tx(x+e),
Ty(y)-w):
draw(
Tx(x+e),
Ty(y)+w)
D%>=0
DataStatus%?(D%+C1%*d%)=1
start% start%=
startpath(ColumnErrorThick(y%),0,0,0,0)
e=
Tdata(D%,d%)
move(
Tx(x),
Ty(y)):
draw(
Tx(x),
Ty(y-e))
move(
Tx(x)-w,
Ty(y-e)):
draw(
Tx(x)+w,
Ty(y-e))
U%>=0
DataStatus%?(U%+C1%*d%)=1
start% start%=
startpath(ColumnErrorThick(y%),0,0,0,0)
e=
Tdata(U%,d%)
move(
Tx(x),
Ty(y)):
draw(
Tx(x),
Ty(y+e))
move(
Tx(x)-w,
Ty(y+e)):
draw(
Tx(x)+w,
Ty(y+e))
start%
endpath
xmarks
minors%,exponent%,m,mantissa%,x,y,i%,a%,i$,x1,y1,x2,y2,i,ex,ex$
variables for label offset control
-frameup=0:framedown=0:axisup=0:axisdown=0
DrawFrame%
TicksMajorXFrame%
2 frameup=TicksMajorOut:framedown=TicksMajorOut
TicksMinorXFrame%
(TicksMinorOut>TicksMajorOut) frameup=TicksMinorOut:framedown=TicksMinorOut
DrawXAxis%
TicksMajorXAxis%
0 axisup=TicksMajorUp:axisdown=TicksMajorDown
TicksMinorXAxis%
(TicksMinorUp>TicksMajorUp) axisup=TicksMinorUp
TicksMinorXAxis%
(TicksMinorDown>TicksMajorDown) axisdown=TicksMinorDown
now prepare for loop
ScalingXLog%
minors%=2
? exponent%=
(ScalingXMin*0.999):m=ScalingXMin/10^exponent%
ScalingXLogType%
0,-1:
m>5 mantissa%=1:exponent%+=1
m>2 mantissa%=5
mantissa%=2
m>3 mantissa%=1:exponent%+=1
mantissa%=3
2:mantissa%=1:
m>1 exponent%+=1
3:mantissa%=1:
m>1 exponent%+=1
exponent%
3 exponent%+=1:
exponent%
3 exponent%+=1
x=mantissa%*10^exponent%
i%=1:
mantissa%=1 i%=0
ScalingXLogType%=-1
mantissa%=1
mantissa%=2
mantissa%=5 i%=0
i%=1
1 minors%=
(ScalingXMajor/ScalingXMinor+0.001)
d a%=0:
ScalingXAnchor>ScalingXMin a%=minors%*
((ScalingXAnchor-ScalingXMin)/ScalingXMajor+1.001)
i%=-1
:i%+=1:x=ScalingXAnchor+(i%-a%)*ScalingXMajor/minors%:
x>=ScalingXMin
linecol%=FrameColour%
charcol%=FrameColour%
x<=ScalingXMax
grids
((i%
minors%=0)
GridsMinorX%)
GridsMajorX%
(GridsDash>0)
GridsGap>0
startpath(GridsThick,128,GridsDash,GridsGap,0)
startpath(GridsThick,0,0,0,0)
move(
Tx(x),
Ty(ScalingYMin)):
draw(
Tx(x),
Ty(ScalingYMax))
endpath
ticks
minors%
minor tick
DrawFrame%
TicksMajorXFrame%
TicksMinorXFrame%
(TicksMinorIn+TicksMinorOut>0)
do a frame tick
startpath(TicksMinorThick,0,0,0,0)
move(
Tx(x),
Ty(ScalingYMin)-TicksMinorOut):
draw(
Tx(x),
Ty(ScalingYMin)+TicksMinorIn)
endpath
startpath(TicksMinorThick,0,0,0,0)
move(
Tx(x),
Ty(ScalingYMax)+TicksMinorOut):
draw(
Tx(x),
Ty(ScalingYMax)-TicksMinorIn)
endpath
DrawXAxis%
TicksMajorXAxis%
TicksMinorXAxis%
(TicksMinorUp+TicksMinorDown>0)
do an x axis tick
startpath(TicksMinorThick,0,0,0,0)
move(
Tx(x),
Ty(ScalingYAtXAxis)-TicksMinorDown):
draw(
Tx(x),
Ty(ScalingYAtXAxis)+TicksMinorUp)
endpath
major tick
DrawFrame%
TicksMajorXFrame%
(TicksMajorIn+TicksMajorOut>0)
do a frame tick
startpath(TicksMajorThick,0,0,0,0)
move(
Tx(x),
Ty(ScalingYMin)-TicksMajorOut):
draw(
Tx(x),
Ty(ScalingYMin)+TicksMajorIn)
endpath
startpath(TicksMajorThick,0,0,0,0)
move(
Tx(x),
Ty(ScalingYMax)+TicksMajorOut):
draw(
Tx(x),
Ty(ScalingYMax)-TicksMajorIn)
endpath
DrawXAxis%
TicksMajorXAxis%
(TicksMajorUp+TicksMajorDown>0)
do an x axis tick
startpath(TicksMajorThick,0,0,0,0)
move(
Tx(x),
Ty(ScalingYAtXAxis)-TicksMajorDown):
draw(
Tx(x),
Ty(ScalingYAtXAxis)+TicksMajorUp)
endpath
((i%
minors%=0)
LabelsXMinor%)
((DrawFrame%
LabelsXFrame%)
(DrawXAxis%
LabelsXAxis%))
do a label
ex$="":ex = x
suffix%
(ex)>= 1.E12
ex$="T":ex=ex*1.E-12
(ex)>= 1.E9
ex$="G":ex=ex*1.E-9
(ex)>= 1.E6
ex$="M":ex=ex*1.E-6
(ex)>=1.E3
ex$="k":ex=ex*1.E-3
)H @%=&A+(ScalingXDigits%<<8)+(ScalingXFormat%<<16)+(1<<24):i$=
ex+ex$
labellength(i$)
(DrawFrame%
LabelsXFrame%)
LabelsBelow% y=
Ty(ScalingYMin)-framedown-LabelsFontHeight*(1+LabelsXOffset)
Ty(ScalingYMax)+frameup+LabelsFontHeight*LabelsXOffset
text(
Tx(x)-(x1+x2)/2,y,1,LabelsFontWidth,LabelsFontHeight,i$,0)
(DrawXAxis%
LabelsXAxis%)
LabelsBelow% y=
Ty(ScalingYAtXAxis)-axisdown-LabelsFontHeight*(1+LabelsXOffset)
Ty(ScalingYAtXAxis)+axisup+LabelsFontHeight*LabelsXOffset
text(
Tx(x)-(x1+x2)/2,y,1,LabelsFontWidth,LabelsFontHeight,i$,0)
ScalingXLog%
ScalingXLogType%
mantissa%=5 mantissa%=1:exponent%+=1
mantissa%=2 mantissa%=5
mantissa%=2
mantissa%=3 mantissa%=1:exponent%+=1
mantissa%=3
2:exponent%+=1
3:exponent%+=3
-1:mantissa%+=1:
mantissa%=10 mantissa%=1:exponent%+=1
x=mantissa%*10^exponent%
i%=1:
mantissa%=1 i%=0
ScalingXLogType%=-1
mantissa%=1
mantissa%=2
mantissa%=5 i%=0
i%=1
B9 i%+=1:x=ScalingXAnchor+(i%-a%)*ScalingXMajor/minors%
now update ready for axis text offset
F(i=LabelsFontHeight*(1+LabelsXOffset)
DrawFrame%
LabelsXFrame%
LabelsBelow% framedown+=i
frameup+=i
DrawXAxis%
LabelsXAxis%
LabelsBelow% axisdown+=i
axisup+=i
xtext
x,y,x1,y1,x2,y2,n%,i$,j$,i%,j%
charcol%=FrameColour%
R-i$=AxistextXText$:n%=
Tcountbackslash(i$)
i%=0
T3j%=
i$,"\"):j$=i$:
j% j$=
i$,j%-1):i$=
i$,j%+1)
textlength(j$):x=(
Tx(ScalingXMin)+
Tx(ScalingXMax)-x1-x2)/2
(DrawFrame%
AxistextXFrame%)
AxistextBelow% y=
Ty(ScalingYMin)-framedown-AxistextFontHeight*(1+AxistextXOffset+i%*AxistextXSpacing)
Ty(ScalingYMax)+frameup+AxistextFontHeight*(AxistextXOffset+(n%-i%)*AxistextXSpacing)
text(x,y,1,AxistextFontWidth,AxistextFontHeight,j$,0)
(DrawXAxis%
AxistextXFrame%)
AxistextBelow% y=
Ty(ScalingYAtXAxis)-axisdown-AxistextFontHeight*(1+AxistextXOffset+i%*AxistextXSpacing)
Ty(ScalingYAtXAxis)+axisup+AxistextFontHeight*(AxistextXOffset+(n%-i%)*AxistextXSpacing)
text(x,y,1,AxistextFontWidth,AxistextFontHeight,j$,0)
ymarks
minors%,exponent%,m,mantissa%,x,y,i%,a%,i$,x1,y1,x2,y2,i,longest,rot%,ex,ex$
variables for label offset control
d=frameright=0:frameleft=0:axisright=0:axisleft=0:longest=0
DrawFrame%
TicksMajorYFrame%
f5 frameright=TicksMajorOut:frameleft=TicksMajorOut
TicksMinorYFrame%
(TicksMinorOut>TicksMajorOut) frameright=TicksMinorOut:frameleft=TicksMinorOut
DrawYAxis%
TicksMajorYAxis%
j6 axisright=TicksMajorRight:axisleft=TicksMajorLeft
TicksMinorYAxis%
(TicksMinorRight>TicksMajorRight) axisright=TicksMinorRight
TicksMinorYAxis%
(TicksMinorLeft>TicksMajorLeft) axisleft=TicksMinorLeft
n6rot%=0:
LabelsYRotate% rot%=-1:
LabelsLeft% rot%=1
now prepare for loop
ScalingYLog%
minors%=2
r? exponent%=
(ScalingYMin*0.999):m=ScalingYMin/10^exponent%
ScalingYLogType%
0,-1:
m>5 mantissa%=1:exponent%+=1
m>2 mantissa%=5
mantissa%=2
m>3 mantissa%=1:exponent%+=1
mantissa%=3
2:mantissa%=1:
m>1 exponent%+=1
3:mantissa%=1:
m>1 exponent%+=1
exponent%
3 exponent%+=1:
exponent%
3 exponent%+=1
y=mantissa%*10^exponent%
i%=1:
mantissa%=1 i%=0
ScalingYLogType%=-1
mantissa%=1
mantissa%=2
mantissa%=5 i%=0
i%=1
1 minors%=
(ScalingYMajor/ScalingYMinor+0.001)
d a%=0:
ScalingYAnchor>ScalingYMin a%=minors%*
((ScalingYAnchor-ScalingYMin)/ScalingYMajor+1.001)
i%=-1
:i%+=1:y=ScalingYAnchor+(i%-a%)*ScalingYMajor/minors%:
y>=ScalingYMin
linecol%=FrameColour%
charcol%=FrameColour%
y<=ScalingYMax
grids
((i%
minors%=0)
GridsMinorY%)
GridsMajorY%
(GridsDash>0)
GridsGap>0
startpath(GridsThick,128,GridsDash,GridsGap,0)
startpath(GridsThick,0,0,0,0)
move(
Tx(ScalingXMin),
Ty(y)):
draw(
Tx(ScalingXMax),
Ty(y))
endpath
ticks
minors%
minor tick
DrawFrame%
TicksMajorYFrame%
TicksMinorYFrame%
(TicksMinorIn+TicksMinorOut>0)
do a frame tick
startpath(TicksMinorThick,0,0,0,0)
move(
Tx(ScalingXMin)-TicksMinorOut,
Ty(y)):
draw(
Tx(ScalingXMin)+TicksMinorIn,
Ty(y))
endpath
startpath(TicksMinorThick,0,0,0,0)
move(
Tx(ScalingXMax)+TicksMinorOut,
Ty(y)):
draw(
Tx(ScalingXMax)-TicksMinorIn,
Ty(y))
endpath
DrawYAxis%
TicksMajorYAxis%
TicksMinorYAxis%
(TicksMinorLeft+TicksMinorRight>0)
do a y axis tick
startpath(TicksMinorThick,0,0,0,0)
move(
Tx(ScalingXAtYAxis)-TicksMinorLeft,
Ty(y)):
draw(
Tx(ScalingXAtYAxis)+TicksMinorRight,
Ty(y))
endpath
major tick
DrawFrame%
TicksMajorYFrame%
(TicksMajorIn+TicksMajorOut>0)
do a frame tick
startpath(TicksMajorThick,0,0,0,0)
move(
Tx(ScalingXMin)-TicksMajorOut,
Ty(y)):
draw(
Tx(ScalingXMin)+TicksMajorIn,
Ty(y))
endpath
startpath(TicksMajorThick,0,0,0,0)
move(
Tx(ScalingXMax)+TicksMajorOut,
Ty(y)):
draw(
Tx(ScalingXMax)-TicksMajorIn,
Ty(y))
endpath
DrawYAxis%
TicksMajorYAxis%
(TicksMajorLeft+TicksMajorRight>0)
do a y axis tick
startpath(TicksMajorThick,0,0,0,0)
move(
Tx(ScalingXAtYAxis)-TicksMajorLeft,
Ty(y)):
draw(
Tx(ScalingXAtYAxis)+TicksMajorRight,
Ty(y))
endpath
((i%
minors%=0)
LabelsYMinor%)
((DrawFrame%
LabelsYFrame%)
(DrawYAxis%
LabelsYAxis%))
do a label
ex$="":ex = y
suffix%
(ex)>= 1.E9
ex$="G":ex=ex*1.E-9
(ex)>= 1.E6
ex$="M":ex=ex*1.E-6
(ex)>=1.E3
ex$="k":ex=ex*1.E-3
H @%=&A+(ScalingYDigits%<<8)+(ScalingYFormat%<<16)+(1<<24):i$=
ex+ex$
labellength(i$):
rotateboundingbox(rot%):
x2-x1>longest longest=x2-x1
(DrawFrame%
LabelsYFrame%)
LabelsLeft% x=
Tx(ScalingXMin)-frameleft-LabelsFontWidth*LabelsYOffset-x2
Tx(ScalingXMax)+frameright+LabelsFontWidth*LabelsYOffset-x1
text(x,
Ty(y)-(y1+y2)/2,1,LabelsFontWidth,LabelsFontHeight,i$,rot%)
(DrawYAxis%
LabelsYAxis%)
LabelsLeft% x=
Tx(ScalingXAtYAxis)-axisleft-LabelsFontWidth*LabelsYOffset-x2
Tx(ScalingXAtYAxis)+axisright+LabelsFontWidth*LabelsYOffset-x1
text(x,
Ty(y)-(y1+y2)/2,1,LabelsFontWidth,LabelsFontHeight,i$,rot%)
ScalingYLog%
ScalingYLogType%
mantissa%=5 mantissa%=1:exponent%+=1
mantissa%=2 mantissa%=5
mantissa%=2
mantissa%=3 mantissa%=1:exponent%+=1
mantissa%=3
2:exponent%+=1
3:exponent%+=3
-1:mantissa%+=1:
mantissa%=10 mantissa%=1:exponent%+=1
y=mantissa%*10^exponent%
i%=1:
mantissa%=1 i%=0
ScalingYLogType%=-1
mantissa%=1
mantissa%=2
mantissa%=5 i%=0
i%=1
9 i%+=1:y=ScalingYAnchor+(i%-a%)*ScalingYMajor/minors%
now update ready for axis text offset
+i=LabelsFontWidth*LabelsYOffset+longest
rot% i=LabelsFontHeight*(1+LabelsYOffset)
DrawFrame%
LabelsYFrame%
LabelsLeft% frameleft+=i
frameright+=i
DrawYAxis%
LabelsYAxis%
LabelsLeft% axisleft+=i
axisright+=i
ytext
x,y,x1,y1,x2,y2,n%,i$,j$,i%,j%,longest,rot%,meany,x0
charcol%=FrameColour%
9rot%=0:
AxistextRotate% rot%=-1:
AxistextLeft% rot%=1
-i$=AxistextYText$:n%=
Tcountbackslash(i$)
find the longest font-substring
longest=0:i%=
i$,"\"):j$=i$
textlength(
j$,i%-1)):
x2-x1>longest longest=x2-x1
j$,i%+1):i%=
j$,"\")
textlength(
j$,i%-1)):
x2-x1>longest longest=x2-x1
now get on with it
/meany=(
Ty(ScalingYMin)+
Ty(ScalingYMax))/2
i%=0
i$,"\"):j$=i$:
j% j$=
i$,j%-1):i$=
i$,j%+1)
textlength(j$):
rotateboundingbox(rot%)
rot%
3 x0=longest/2+AxistextYOffset*AxistextFontWidth
AxistextLeft% x0=-x0-(x1+x2)/2
x0=x0-(x1+x2)/2
O y=meany-AxistextFontHeight/2+AxistextFontHeight*AxistextYSpacing*(n%/2-i%)
F x0=-AxistextFontHeight*(AxistextYOffset+AxistextYSpacing*(n%-i%))
y=meany-(y1+y2)/2
E x0=AxistextFontHeight*(AxistextYOffset+AxistextYSpacing*(n%-i%))
y=meany-(y1+y2)/2
(DrawFrame%
AxistextYFrame%)
AxistextLeft% x=
Tx(ScalingXMin)-frameleft+x0
Tx(ScalingXMax)+frameright+x0
text(x,y,1,AxistextFontWidth,AxistextFontHeight,j$,rot%)
(DrawYAxis%
AxistextYFrame%)
AxistextLeft% x=
Tx(ScalingXAtYAxis)-axisleft+x0
Tx(ScalingXAtYAxis)+axisright+x0
text(x,y,1,AxistextFontWidth,AxistextFontHeight,j$,rot%)
labellength(i$)
returns bounding box in points in x1,y1,x2,y2
fonthandle%
"Font_FindFont",,FontsLabels$,16*LabelsFontWidth,16*LabelsFontHeight
fonthandle%
"Font_StringBBox",,i$
,x1,y1,x2,y2
"Font_LoseFont",fonthandle%
/x1=x1/1000:y1=y1/1000:x2=x2/1000:y2=y2/1000
textlength(i$)
returns bounding box in points in x1,y1,x2,y2
fonthandle%
"Font_FindFont",,FontsLabels$,16*AxistextFontWidth,16*AxistextFontHeight
fonthandle%
"Font_StringBBox",,i$
,x1,y1,x2,y2
"Font_LoseFont",fonthandle%
/x1=x1/1000:y1=y1/1000:x2=x2/1000:y2=y2/1000
pointlength(y%)
returns bounding box in points in x1,y1,x2,y2
fonthandle%
"Font_FindFont",,FontsPoints$,16*ColumnWidth(y%),16*ColumnHeight(y%)
fonthandle%
"Font_CharBBox",fonthandle%,ColumnChar%(y%),0
,x1,y1,x2,y2
"Font_LoseFont",fonthandle%
&/x1=x1/1000:y1=y1/1000:x2=x2/1000:y2=y2/1000
rotateboundingbox(rot%)
rot%
rotate anticlockwise
-" i=x1:x1=-y2:y2=x2:x2=-y1:y1=i
rotate clockwise
/" i=x1:x1=y1:y1=-x2:x2=y2:y2=-i
Tcountbackslash(i$)
i%,n%
n%=0:i%=
i$,"\")
(i%>0)
(i$<>"")
7"n%+=1:i$=
i$,i%+1):i%=
i$,"\")
graphkey
x,y,i%,width,style%,on,off,s,h,w,i$,fonthandle%,x1%,y1%,x2%,y2%,yo,wo
=Mx=GraphKeyLeft*pointsininch%:y=GraphKeyTop*pointsininch%-LabelsFontHeight
s=LabelsFontHeight
i%=0
ColumnMeaning$(i%),1)="Y")
ColumnPlot%(i%)
ColumnHeight(i%)>s s=ColumnHeight(i%)
:s=1.2*s
work out rectangle sizing first
i%=0
ColumnMeaning$(i%),1)="Y")
ColumnPlot%(i%)
drawn%(i%)
G+ i$=ColumnKeyText$(i%):
labellength(i$)
wo < x2-x1 wo = x2-x1
L-charcol%=KeyOutline%:linecol%=KeyOutline%
wo > 0
add in rectangle
wo+=72+LabelsFontWidth
startpathfill(linecol%,FrameThick,KeyBack%)
move(x-18,yo+s):
draw(x-18+wo,yo+s):
draw(x-18+wo,y+s/2):
draw(x-18,y+s/2)
closesubpath
endpath
i%=0
ColumnMeaning$(i%),1)="Y")
ColumnPlot%(i%)
drawn%(i%)
ColumnPoints%(i%)
Y> h=ColumnHeight(i%):w=ColumnWidth(i%):i$=
ColumnChar%(i%)
pointlength(i%)
[! charcol%=ColumnCharcol%(i%)
text(x+18-(x1+x2)/2,y+s/3-(y1+y2)/2,2,w,h,i$,0)
charcol%=black%
ColumnLine%(i%)
`! linecol%=ColumnLinecol%(i%)
an width=ColumnThick(i%):style%=0:on=ColumnDash(i%):off=ColumnGap(i%):on2=ColumnDash2(i%):
off>0 style%=128
on>0 linecol%=ColumnLinecol%(i%):
startpath(width,style%,on,off,on2):
move(x,y+s/3):
draw(x+36,y+s/3):
endpath:linecol%=black%
d+ i$=ColumnKeyText$(i%):
labellength(i$)
text(x+36+LabelsFontWidth,y+s/2-LabelsFontHeight/2,1,LabelsFontWidth,LabelsFontHeight,i$,0)
startpathfill(colour%,width,fill%)
word(2)
memory% pathheader%=ptr%
pathheader%=
word(0):
coord(0,0):
coord(1,1)
word(fill%):
fill colour given by fill%
word(colour%)
word(width*point%):
word(0)
local%=
text(x,y,font%,w,h,i$,rot%)
assumes bounding box given by x1,y1,x2,y2;text colour is charcol%
j%,w%,k%
rot%
word(12)
word(13*4+4+4*(
4)+28)
bound(x+x1,y+y1,x+x2,y+y2)
word(0):
word(rot%*&10000)
word(-rot%*&10000):
word(0)
word(0):
word(0)
word(0)
word(1)
word(13*4+4+4*(
bound(x+x1,y+y1,x+x2,y+y2)
word(charcol%):
coloured text
word(white%):
white background
word(font%)
coord(w*point,h*point):
coord(x*point,y*point)
j%=0
k%=0
j%+k%<
i$ w%+=((
i$,1+j%+k%,1))<<(8*k%))
word(w%)
xaxis
linecol%=FrameColour%
startpath(AxisThick,0,0,0,0)
move(
Tx(ScalingXMin),
Ty(ScalingYAtXAxis))
draw(
Tx(ScalingXMax),
Ty(ScalingYAtXAxis))
endpath
yaxis
linecol%=FrameColour%
startpath(AxisThick,0,0,0,0)
move(
Tx(ScalingXAtYAxis),
Ty(ScalingYMin))
draw(
Tx(ScalingXAtYAxis),
Ty(ScalingYMax))
endpath
frame
linecol%=FrameColour%
startpath(FrameThick,0,0,0,0)
move(
Tx(ScalingXMin),
Ty(ScalingYMin))
draw(
Tx(ScalingXMax),
Ty(ScalingYMin))
draw(
Tx(ScalingXMax),
Ty(ScalingYMax))
draw(
Tx(ScalingXMin),
Ty(ScalingYMax))
closesubpath
endpath
fillback
startpathfill(-1,0,FrameFillColour%)
move(
Tx(ScalingXMin),
Ty(ScalingYMin))
draw(
Tx(ScalingXMax),
Ty(ScalingYMin))
draw(
Tx(ScalingXMax),
Ty(ScalingYMax))
draw(
Tx(ScalingXMin),
Ty(ScalingYMax))
closesubpath
endpath
border
linecol%=black%
startpath(0,0,0,0,0)
move(GraphBorderLeft*pointsininch%,GraphBorderBottom*pointsininch%)
draw((GraphBorderLeft+GraphBorderWidth)*pointsininch%,GraphBorderBottom*pointsininch%)
draw((GraphBorderLeft+GraphBorderWidth)*pointsininch%,(GraphBorderBottom+GraphBorderHeight)*pointsininch%)
draw(GraphBorderLeft*pointsininch%,(GraphBorderBottom+GraphBorderHeight)*pointsininch%)
closesubpath
endpath
Tx(x):
in points
offset
ScalingXLog%
9 offset=(
ScalingXMin)/(
ScalingXMax-
ScalingXMin)
5 offset=(x-ScalingXMin)/(ScalingXMax-ScalingXMin)
offset is between 0 and 1 if within the frame
<=GraphLeft*pointsininch%+GraphWidth*pointsininch%*offset
Ty(y):
in points
offset
ScalingYLog%
9 offset=(
ScalingYMin)/(
ScalingYMax-
ScalingYMin)
5 offset=(y-ScalingYMin)/(ScalingYMax-ScalingYMin)
offset is between 0 and 1 if within the frame
?=GraphBottom*pointsininch%+GraphHeight*pointsininch%*offset
startpath(width,style%,on,off,on2)
word(2)
memory% pathheader%=ptr%
pathheader%=
word(0):
coord(0,0):
coord(1,1)
word(-1):
fill colour = no fill
word(linecol%):
line colour = linecol%
word(width*point):
word(style%)
(style%
128)
on2>0
word(0):
word(4)
word(on*point):
word(off*point)
word(on2*point):
word(off*point)
word(0):
word(2)
word(on*point):
word(off*point)
local%=
Treadpalette(fill%)
"Wimp_ReadPalette",,block%
$r%=(block%!(4*fill%))
&F0F0F000
(r%>>>4)
move(x,y)
word(2)
coord(x*point,y*point)
updatelocal(x,y)
draw(x,y)
word(8)
coord(x*point,y*point)
updatelocal(x,y)
closesubpath
word(5)
endpath
word(0)
memory% end%=ptr%:ptr%=pathheader%
end%=
#c%=pathheader%
word(end%-pathheader%+4)
local%
coord((localxmin-1)*point,(localymin-1)*point)
coord((localxmax+1)*point,(localymax+1)*point)
updateglobal(localxmin,localymin,localxmax,localymax)
memory%
ptr%=end%
#c%=end%
updatelocal(x,y)
in points
local%
x<localxmin localxmin=x
y<localymin localymin=y
x>localxmax localxmax=x
y>localymax localymax=y
localxmin=x:localxmax=x
localymin=y:localymax=y
local%=
updateglobal(xmin,ymin,xmax,ymax)
in points
global%
xmin<globalxmin globalxmin=xmin
ymin<globalymin globalymin=ymin
xmax>globalxmax globalxmax=xmax
ymax>globalymax globalymax=ymax
"$ globalxmin=xmin:globalxmax=xmax
#$ globalymin=ymin:globalymax=ymax
global%=
startdrawfile
word(&77617244):
word(201):
word(0)
twelve("Tau")
memory% fileheader%=ptr%
fileheader%=
coord(0,0)
coord(1,1)
global%=
fonttable
fontdata$,length%,i%,b%,j%
33fontdata$=
1+FontsLabels$+
2+FontsPoints$+
4*fontdata$+=
fontdata$
length%=
fontdata$
word(0):
word(8+length%)
i%=0
length%-4
86b%=0:
j%=0
3:b%+=
fontdata$,1+i%+j%,1)<<(8*j%):
word(b%)
enddrawfile
global%
memory% end%=ptr%:ptr%=fileheader%
end%=
#c%=fileheader%
coord((globalxmin-1)*point,(globalymin-1)*point)
coord((globalxmax+1)*point,(globalymax+1)*point)
memory% ptr%=end%
#c%=end%
startgroup(grouplevel%)
word(6)
memory% groupheader%(grouplevel%)=ptr%
groupheader%(grouplevel%)=
word(0):
coord(0,0):
coord(1,1)
twelve("")
endgroup(grouplevel%)
memory% end%=ptr%:ptr%=groupheader%(grouplevel%)
end%=
#c%=groupheader%(grouplevel%)
word(end%-groupheader%(grouplevel%)+4)
memory% ptr%=end%
#c%=end%
boundgroups
memory% end%=ptr%
end%=
boundgroup(1)
GraphBorder%
GraphKey%
boundgroup(2)
GraphKey%
boundgroup(3)
memory% ptr%=end%
#c%=end%
boundgroup(grouplevel%)
memory% ptr%=groupheader%(grouplevel%)+4
#c%=groupheader%(grouplevel%)+4
coord((globalxmin-1)*point,(globalymin-1)*point)
coord((globalxmax+1)*point,(globalymax+1)*point)
word(i%)
memory%
overflow%
Himem%!ptr%=i%
d5 ptr%+=4:
ptr%>buffer%-16 overflow%=
Tcheckmemory
#c%,i%
#c%,(i%>>>8)
#c%,(i%>>>16)
#c%,(i%>>>24)
twelve(i$)
i$+" ",12)
memory%
overflow%
$(Himem%+ptr%)=i$
s6 ptr%+=12:
ptr%>buffer%-16 overflow%=
Tcheckmemory
i%=1
i$,i%,1)
Tcheckmemory
buffer%+=32*1024
"Wimp_SlotSize",MinSlotSize%+buffer%,-1
newsize%
newsize%<>MinSlotSize%+buffer% =
coord(x%,y%)
word(x%):
word(y%)
bound(x1,y1,x2,y2)
never use this PROC with dummy values !!!
coord(x1*point,y1*point)
coord(x2*point,y2*point)
updateglobal(x1,y1,x2,y2)
setthestyle(i%)
handle%=columnhandle%
setwritablestring(47,style$(i%))
Qg%(8)=
:g%(9)=
:g%(45)=
setwritablestring(45,"0"):
setwritablestring(9,"0")
7g%(8)=
:g%(9)=
:g%(45)=
setwritablestring(45,"0")
Tgetwritable(9):
x%=0
setwritablestring(9,"6")
g%(8)=
:g%(9)=
:g%(45)=
Tgetwritable(9):
x%=0
setwritablestring(9,"6")
Tgetwritable(45):
x%=0
setwritablestring(45,"2")
setgrey(8,g%(8))
setgrey(9,g%(9))
setgrey(45,g%(45))
setgrey(icon%,state%)
if state% TRUE, ungreyed, else greyed; always unselected
+!block1%=handle%:block1%!12=sel%
grey%
block1%!4=icon%
state% block1%!8=0
block1%!8=grey%
"Wimp_SetIconState",,block1%
pkiedit
r%,c%,a$,b$,a,b,s%,ch%
handle%=edithandle%
ch%=
Tgetwritablestring(3)
Tgetwritablestring(5)
closewindow(edithandle%)
a$=""
report("No value to change!"):
"Wimp_CreateMenu",,-1:
b$)=" " b$=
(b$)-1):
".","":
b=0:s%=0
"m","M":
b=0:s%=2
(b$):s%=1
r%=0
maxrow%
c%=0
maxcolumn%
Tdata(c%,r%)=a
ch%=
data(c%,r%,b)
DataStatus%?(c%+C1%*r%)=s%
ch%
ScalingAuto%
autoscale
update(mainhandle%)
"Wimp_CreateMenu",,-1
opencolour(t$,colour%,icon%,type%)
!colourpick%=0
colourpick%!4=colourtitle%
$colourtitle%=t$
colourpick%!8=x%
5colourpick%!12=&80000000:colourpick%!16=&7FFFFFFF
colourpick%!20=y%
%colourpick%!24=0:colourpick%!28=0
colourpick%!32=colour%
colourpick%!36=0
"ColourPicker_OpenDialogue",type%,colourpick%
dialogue%,colourhandle%
setupsprites
spritearea% 700
!spritearea%=700
spritearea%!4=0
spritearea%!8=16
spritearea%!12=0
&2E,256+9,spritearea%
&2E,256+10,spritearea%,"<Tau$Dir>.Sprites"
&2E,256+37,spritearea%,"fill",-1
,,,,filladdress%
&2E,256+37,spritearea%,"line",-1
,,,,lineaddress%
&2E,256+37,spritearea%,"char",-1
,,,,charaddress%
setcolour(handle%,ih%,col%,sprname$)
address%
sprname$
"fill":address%=filladdress%
"line":address%=lineaddress%
"char":address%=charaddress%
!address%=col%
<block1%!0=handle%:block1%!4=ih%:block1%!8=0:block1%!12=0
"Wimp_SetIconState",,block1%
setgrey(ih%,
setgreycolour(handle%,ih%,sprname$)
setcolour(handle%,ih%,mgrey%,sprname$)
setgrey(ih%,