Retribution V101 : Syndicate — File Browser

RetributionSyndicatev1.01 / RetributionSyndicatev1.01 / System / cal / cal.mrc

cal.mrc — 20.22 KB — Download this file

;[----------------------------------------------------------------------]
;[	Name	: Syndicate : Retribution V101				]
;[	Support	: DefCon Industries					]
;[	Author	: Risc							]
;[									]
;[	This Code, Content, is CopyRight 1999 : DefCon Industries	]
;[	No Copying, Ripping, or calling this Code your own		]
;[									]
;[----------------------------------------------------------------------]


alias qcalc3 { dialog -m qcalc qcalc }
dialog qcalc {
  title "Quick Calc 3.0 by Risc"
  size -1 -1 290 270
  list 1,5 5 280 105
  edit "",2,5 102 280 22,autohs
  radio "Home",3,5 127 45 18,push group
  radio "Y=",4,52 127 45 18,push
  radio "Window",5,99 127 45 18,push
  button "Graph",6,146 127 45 18
  radio "TblSet",7,193 127 45 18,push
  button "Table",8,240 127 45 18
  check "2nd",9,5 147 45 18,push
  button "X Var",10,52 147 45 18,disable
  button "Catalog",11,99 147 45 18
  button "Mode",12,146 147 45 18
  button "Back",13,193 147 45 18
  button "Clear",14,240 147 45 18
  button "(",15,5 167 45 18
  button ")",16,52 167 45 18
  button "Sin",17,99 167 45 18
  button "Cos",18,146 167 45 18
  button "Tan",19,193 167 45 18
  button "Stor",20,240 167 45 18
  button "7",21,5 187 45 18
  button "8",22,52 187 45 18
  button "9",23,99 187 45 18
  button "Log",24,146 187 45 18
  button "Ln",25,193 187 45 18
  button "Abs",26,240 187 45 18
  button "4",27,5 207 45 18
  button "5",28,52 207 45 18
  button "6",29,99 207 45 18
  button "n!",30,146 207 45 18
  button "e^x",31,193 207 45 18
  button "^",32,240 207 45 18
  button "1",33,5 227 45 18
  button "2",34,52 227 45 18
  button "3",35,99 227 45 18
  button "x",36,146 227 45 18
  button "/",37,193 227 45 18
  button "Sqrt",38,240 227 45 18
  button "0",39,5 247 45 18
  button ".",40,52 247 45 18
  button "pi",41,99 247 45 18
  button "+",42,146 247 45 18
  button "-",43,193 247 45 18
  button "Enter",44,240 247 45 18,default
  button "Ok",45,240 247 45 18,ok hide
  list 50,5 5 280 105,hide
  list 51,5 5 280 105,hide
  list 53,5 5 280 105,hide
}
dialog qcalc-recall {
  title "Recall Variable"
  size -1 -1 200 67
  text "Recall:",1,5 9 35 22
  edit "",2,40 5 155 22,result
  button "&Ok",3,15 42 80 20,ok default
  button "&Cancel"4,105 42 80 20,cancel 
}
dialog qcalc-c {
  title "Catalog"
  size -1 -1 130 180
  list 1,2 2 126 186,autovs sort
  edit "",2,2 2 100 22,hide result
  button "Ok",3,20 155 65 20,ok default hide
}
dialog qcalc-v {
  title "Var-Link"
  size -1 -1 220 160
  list 1,5 5 140 150
  button "&Insert",2,150 5 65 20,default
  button "&Delete",3,150 35 65 20
  button "Clea&r",4,150 65 65 20
  button "&Close",5,150 95 65 20,cancel
}
dialog qcalc-m {
  title "Mode Settings"
  size -1 -1 240 291
  box "General Settings",1,5 1 230 120
  text "Plot Type",2,15 20 100 20
  combo 3,115 15 115 80,drop
  text "Angle",4,15 45 100 20
  combo 5,115 40 115 80,drop  
  text "Decimal Numbers",6,15 70 100 20
  combo 7,115 65 115 200,drop
  text "History Pairs",8,15 95 100 20
  combo 9,115 90 115 160,drop
  box "Graph Display",10,5 121 230 95
  text "Axes",11,15 140 100 20
  combo 12,115 135 115 80,drop  
  text "Grid",13,15 165 100 20
  combo 14,115 160 115 80,drop
  text "Cordinates",15,15 190 100 20
  combo 16,115 185 115 80,drop
  box "Graphing Colors",17,5 216 230 45
  combo 18,15 231 90 200,drop
  text "=",19,118 234 35 20
  combo 20,140 231 90 200,drop
  button "&Ok",21,110 266 60 20,ok
  button "&Cancel",22,175 266 60 20,cancel
}
on  *:dialog:qcalc:*:*: {
  if ($did(1).lines > $qcr(mode,hist)) { did -d qcalc 1 1 }
  if ($devent == sclick) {
    if ($findtok(15.16.21.22.23.27.28.29.32.33.34.35.37.39.40.42.43,$did,1,46)) { did -a qcalc 2 $did($did) }
    elseif ($findtok(3.4.5.7,$did,1,46)) { did -h qcalc 1 | did -h qcalc 50 | did -h qcalc 51 | did -h qcalc 53 | did $iif($did == 4,-e,$iif($did(10) == Var-Link,-e,-b)) qcalc 10 | did -v qcalc $iif($did == 3,1,$calc(46+$did)) | gdata $calc(46+$did) }
    elseif ($did == 6) { graph }
    elseif ($did == 8) { table }
    elseif ($did == 9) { 
      if ($did(9).state == 1) { did -e qcalc 10 | did -a qcalc 15 [ | did -a qcalc 16 ] | did -a qcalc 17 ArcSin | did -a qcalc 18 ArcCos | did -a qcalc 19 ArcTan | did -a qcalc 14 ClrHst | did -a qcalc 10 Var-Link | did -a qcalc 20 Recall | did -f qcalc 2 }
      else { did $iif($did(6).state,-e,-b) qcalc 10 | did -a qcalc 15 ( | did -a qcalc 16 ) | did -a qcalc 17 Sin | did -a qcalc 18 Cos | did -a qcalc 19 Tan | did -a qcalc 14 Clear | did -a qcalc 10 X Var | did -a qcalc 20 Stor | did -f qcalc 2 }
    }
    elseif ($did == 10) { 
      if ($did(10) == Var-Link) { .timer 1 0 dialog -m qcalc-v qcalc-v }
      else { did -a qcalc 2 x }
    }
    elseif ($did == 11) { .timer 1 0 catalog } 
    elseif ($did == 12) { .timer 1 0 dialog -m qcalc-m qcalc-m }
    elseif ($did == 13) { did -o qcalc 2 1 $left($did(2),$calc($len($did(2))-1)) }
    elseif ($did == 14) { did -r qcalc $iif($did(14) == Clear,2,1) }
    elseif ($did == 20) {
      if ($did(20) == Stor) { .timer 1 0 writeini $scriptdirqcalc3.ini Variables $!$?="Enter a variable letter to store as..." $calc( [ $parse($did(2)) ] ) }
      else { .timer 1 0 dialog -m qcalc-recall qcalc-recall }
    }
    elseif ($did == 44) {
      if ($did(3).state == 1) {
        if ($qc($calc( [ $parse($did(2)) ] )) != $null) { did -ac qcalc 1 $ifmatch $iif($mouse.key == 2,or is it [ [ $r(1,9999) ] $+ ? ] ) }
        else { did -ac qcalc 1 Undefined }
      }
      elseif ($did(4).state == 1) { did -co qcalc 50 $did(50).sel y $+ $did(50).sel $+ (x)= $+ $did(2) | $iif($did(2) == $null,remini,writeini) $scriptdirqcalc3.ini y $did(50).sel $did(2) }
      elseif ($did(5).state == 1) { did -co qcalc 51 $did(51).sel $gettok($did(51,$did(51).sel),1,61) $+ = $+ $did(2) | writeini $scriptdirqcalc3.ini win $replace($did(51,$did(51).sel),=,$chr(32)) }
      elseif ($did(7).state == 1) { did -co qcalc 53 $did(53).sel $gettok($did(53,$did(53).sel),1,61) $+ = $+ $did(2) | writeini $scriptdirqcalc3.ini tblset $replace($did(53,$did(53).sel),=,$chr(32)) }
    }
    else { did -a qcalc 2 $replace($did($did),e^x,e^<,x,*,sqrt,sqrt<,pi,3.14159,n!,!<,arc,a,sin,sin<,cos,cos<,tan,tan<,ln,ln<,log,log<,abs,abs<,<,$chr(40)) }
  }
  elseif ($devent == dclick) {
    if ($did == 1) { did -a qcalc 2 $did(qcalc,1,$did(qcalc,1).sel) }
    elseif ($findtok(50.51.53,$did,1,46)) { did -o qcalc 2 1 $gettok($did(qcalc,$did,$did(qcalc,$did).sel),2,61) }
  }
  elseif ($devent == init) { 
    did -c qcalc 3
    set -u %qcalc.init 1
    :i
    if (%qcalc.init <= 10) { did -a qcalc 50 y $+ %qcalc.init $+ (x)= $+ $qcr(y,%qcalc.init) | inc %qcalc.init | goto i }
    did -c qcalc 50 1
  }
  did -f qcalc 2 
}
on *:dialog:qcalc-recall:sclick:3: {
  if ($qcr(variables,$did(2))) { did -a qcalc 2 $ifmatch }
  else { did -ac qcalc 1 $iif($mouse.key == 4,Don't touch that button damnit!,Undefined variable) }
}
on *:dialog:qcalc-c:*:*: {
  if ($devent == init) { ma qcalc-c 1 + - * / % ^ ^-1 ^2 ^3 !( 10^ 1/ abs( acos( asin( atan( cos( e^( int( log( ln( rand( root( round( sin( sqrt( sum( tan( }
  elseif ($devent == dclick) { did -o qcalc-c 2 1 $did(1,$did(qcalc-c,1).sel) | dialog -k qcalc-c }
}
on *:dialog:qcalc-m:*:*: {
  if ($devent == init) {
    ma qcalc-m 3 Connected Points
    ma qcalc-m 5 Degrees Radians
    ma qcalc-m 7 Fix&0 Fix&1 Fix&2 Fix&3 Fix&4 Fix&5 Fix&6 Fix&7 Fix&8 Fix&9 Float Float&1 Float&2 Float&3 Float&4 Float&5
    ma qcalc-m 9 10 20 30 40 50 60 70 80 90 100
    ma qcalc-m 12 On Off
    ma qcalc-m 14 On Off
    ma qcalc-m 16 On Off
    ma qcalc-m 18 y1(x) y2(x) y3(x) y4(x) y5(x) y6(x) y7(x) y8(x) y9(x) y10(x)
    ma qcalc-m 20 White Black Navy Green Red Maroon Violet Orange Yellow Lime Teal Cyan Blue Hot&Pink Grey Silver 
    did -c qcalc-m 3 $qcr(mode,plot) 
    did -c qcalc-m 5 $qcr(mode,angle) 
    did -c qcalc-m 7 $qcr(mode,digits)
    did -c qcalc-m 9 $calc($qcr(mode,hist)/10)
    did -c qcalc-m 12 $qcr(mode,axes)
    did -c qcalc-m 14 $qcr(mode,grid)
    did -c qcalc-m 16 $qcr(mode,cord)
    did -c qcalc-m 18 1
    did -c qcalc-m 20 $gettok($qcr(colors,1),1,32)
  }
  if ($devent == sclick) {
    if ($did == 18) { did -c qcalc-m 20 $gettok($qcr(colors,$did(18).sel),1,32) }
    elseif ($did == 20) { writeini $scriptdirqcalc3.ini colors $did(18).sel $did(20).sel $c-rgb($did(20).sel) }
    elseif ($did == 21) {
      writeini $scriptdirqcalc3.ini mode plot $did(3).sel
      writeini $scriptdirqcalc3.ini mode angle $did(5).sel
      writeini $scriptdirqcalc3.ini mode digits $did(7).sel
      writeini $scriptdirqcalc3.ini mode hist $calc($did(9).sel *10)
      writeini $scriptdirqcalc3.ini mode axes $did(12).sel
      writeini $scriptdirqcalc3.ini mode grid $did(14).sel
      writeini $scriptdirqcalc3.ini mode cord $did(16).sel
    }
  }
}
on *:dialog:qcalc-v:*:*: {
  if ($devent == sclick) { 
    if ($did == 2) { did -a qcalc 2 $qcr(variables,$gettok($did(1,$did(1).sel),1,61)) }
    elseif ($did == 3) { remini $scriptdirqcalc3.ini variables $gettok($did(1,$did(1).sel),1,61) | did -d qcalc-v 1 $did(1).sel }
    elseif ($did == 4) { remini $scriptdirqcalc3.ini variables | did -r qcalc-v 1 }
  }
  if ($devent == init) {
    set -u %qcalc.v $read -s"[Variables]" $scriptdirqcalc3.ini 
    set -u %qcalc.v 1
    :i
    if ( [ $read -l $+ [ $calc($readn + %qcalc.v) ] $scriptdirqcalc3.ini ] ) { did -a qcalc-v 1 $ifmatch | inc %qcalc.v | goto i }
    did -c qcalc-v 1
  }
}
on *:close:@: {
  if ($target == @graphing) { writeini $scriptdirqcalc3.ini win pos $window(@graphing).x $window(@graphing).y | .timerqc404 off }
  elseif ($target == @table) { writeini $scriptdirqcalc3.ini tblset pos $window(@table).x $window(@table).y $window(@table).w $window(@table).h }
}

menu @graphing {
  mouse {
    if (($qcr(mode,cord) == 1) && ($mouse.y <= $qcr(win,win-h))) { drawtext -rb @Graphing $rgb(text) $rgb(face) Verdana 12 5 $calc($qcr(win,win-h)+3) x= $qm(x,$mouse.x) , y= $qm(y,$mouse.y) $str($chr(160),100) }
  } 
  &Y=
  .$iif($gettok($did(qcalc,50,1),2-,61),$did(qcalc,50,1)):/
  .$iif($gettok($did(qcalc,50,2),2-,61),$did(qcalc,50,2)):/
  .$iif($gettok($did(qcalc,50,3),2-,61),$did(qcalc,50,3)):/
  .$iif($gettok($did(qcalc,50,4),2-,61),$did(qcalc,50,4)):/
  .$iif($gettok($did(qcalc,50,5),2-,61),$did(qcalc,50,5)):/
  .$iif($gettok($did(qcalc,50,6),2-,61),$did(qcalc,50,6)):/
  .$iif($gettok($did(qcalc,50,7),2-,61),$did(qcalc,50,7)):/
  .$iif($gettok($did(qcalc,50,8),2-,61),$did(qcalc,50,8)):/
  .$iif($gettok($did(qcalc,50,9),2-,61),$did(qcalc,50,9)):/
  .$iif($gettok($did(qcalc,50,10),2-,61),$did(qcalc,50,10)):/
  -
  &Zoom
  .Zoom&In:zoom $calc($qcr(win,x-min)/2 - $qcr(mouse,x)) $calc($qcr(win,x-max)/2 - $qcr(mouse,x)) $calc($qcr(win,y-min)/2 - $qcr(mouse,y)) $calc($qcr(win,y-max)/2 - $qcr(mouse,y))
  .Zoom&Out:zoom $calc(2* $qcr(win,x-min) - $qcr(mouse,x)) $calc(2* $qcr(win,x-max) - $qcr(mouse,x)) $calc(2* $qcr(win,y-min) - $qcr(mouse,y)) $calc(2* $qcr(win,y-max) - $qcr(mouse,y)) 
  .-
  .Zoom&Std:zoom -10 10 -10 10
  .Zoom&Dec:zoom -11.9 11.9 -5.1 5.1
  .Zoom&Trig:zoom -892.5 892.5 -4 4
  .ZoomI&nt:zoom -119 119 -51 51
  .-
  .Zoom&Prev:zoom $qcr(win,prev)
  .ZoomS&tor:writeini $scriptdirqcalc3.ini win stor $qcr(win,x-min) $qcr(win,x-max) $qcr(win,y-min) $qcr(win,x-max)
  .Zoom&Rcl:zoom $qcr(win,stor)
  &Window Size
  .&Custom:win $$?="Window Width" $$?="Window Height"
  .-
  .200x200:win 200 200
  .300x300:win 300 300
  .400x400:win 400 400
  .500x500:win 500 500
  .-
  .200x150:win 200 150
  .300x225:win 300 225
  .400x300:win 400 300
  .500x375:win 500 375
  -
  &Format
  .&Axes ( $+ $iif($qcr(mode,cord) == 1,Off,On) $+ ):writeini $scriptdirqcalc3.ini mode cord $iif($qcr(mode,cord) == 1,2,1) | graph
  .&Cordinates ( $+ $iif($qcr(mode,grid) == 1,Off,On) $+ ):writeini $scriptdirqcalc3.ini mode grid $iif($qcr(mode,grid) == 1,2,1) | graph
  .&Grid ( $+ $iif($qcr(mode,grid) == 1,Off,On) $+ ):writeini $scriptdirqcalc3.ini mode grid $iif($qcr(mode,grid) == 1,2,1) | graph
}
alias -l graph {
  if ($window(@Graphing)) { writeini $scriptdirqcalc3.ini win pos $window(@graphing).x $window(@graphing).y | .timerqc404 off | window -c @Graphing }
  window -odfkp +elt @Graphing $qcr(win,pos) $qcr(win,win-w) $calc($qcr(win,win-h)+15) @Graphing
  drawrect -rf @Graphing $rgb(255,255,255) 1 0 0 $qcr(win,win-w) $qcr(win,win-h)
  if ($qcr(mode,grid) == 1) { grid }
  if ($qcr(mode,axes) == 1) {  
    drawline -r @Graphing $rgb(0) 1 $calc(-1* ($sclfact(x)*$qcr(win,x-min))) 0 $calc(-1* ($sclfact(x)*$qcr(win,x-min))) $calc($qcr(win,win-h)+20)
    drawline -r @Graphing $rgb(0) 1 0 $calc($sclfact(y)*$abs($qcr(win,y-max))) $qcr(win,win-w) $calc($sclfact(y)*$abs($qcr(win,y-max)))
  }
  set -u %qcalc.i 1
  :i
  titlebar @Graphing $did(qcalc,50,%qcalc.i)
  if ((%qcalc.i <= 10 ) && ($gettok($did(qcalc,50,%qcalc.i),2-,61))) { 
    set -u %qcalc.i2 $qcr(win,x-min)
    :i2
    if (%qcalc.i2 <= $qcr(win,x-max)) { 
      set -u %qcalc.v1 $scale(%qcalc.i2,$calc( [ $parse($replace($gettok($did(qcalc,50,%qcalc.i),2-,61),x,[x],x,%qcalc.i2)) ] )) 
      if (($qcr(mode,plot) == 1) && (%qcalc.v2)) { drawline -r @graphing $rgb( [ $gettok($qcr(colors,%qcalc.i),2,32) ] ) 1 %qcalc.v2 %qcalc.v1 }
      else { drawdot -r @graphing $rgb( [ $gettok($qcr(colors,%qcalc.i),2,32) ] ) 1 %qcalc.v1 }
      set %qcalc.v2 %qcalc.v1
      inc %qcalc.i2 $calc(($abs($qcr(win,x-min))+$abs($qcr(win,x-max)))/$qcr(win,win-w)*$qcr(win,x-res)/$qcr(mode,plot))
      goto i2 
    }
    inc %qcalc.i
    unset %qcalc.v2
    goto i 
  }
  elseif (%qcalc.i < 10) { inc %qcalc.i | goto i }
  drawrect -rf @Graphing $rgb(face) 1 0 $qcr(win,win-h) $qcr(win,win-w) 15
  drawline -r @Graphing $rgb(frame) 1 0 $qcr(win,win-h) $qcr(win,win-w) $qcr(win,win-h)
  if ($qcr(mode,cord) == 2) { drawtext -r @Graphing $rgb(text) Verdana 12 5 $calc($qcr(win,win-h)+3) $qcr(win,win-w) x $qcr(win,win-h) res. }
  if ($qcr(mode,boo)) { .timerqc404 0 2 drawdot -ri @Graphing $rgb(text) $!r(5,30) $!r(1,$qcr(win,win-w)) $!r(1,$qcr(win,win-h)) }
  titlebar @Graphing completed
}
alias -l table {
  window -odkl -t8,16,24,32,40,48,56,64,72,80 @Table $qcr(tblset,pos) @Table
  aline @Table X	Y1	Y2	Y3	Y4	Y5	Y6	Y7	Y8	Y9	Y10
  set -u %qcalc.t1 $qcr(tblset,t-min)
  :i
  if (%qcalc.t1 <= $qcr(tblset,t-max)) { aline @Table $tbldat(%qcalc.t1) | titlebar @Table $chr(40) $+ $round($calc((%qcalc.t1 +$abs($qcr(tblset,t-min)))/($abs($qcr(tblset,t-min))+$abs($qcr(tblset,t-max)))*100),2) $+ $chr(37) $+ $chr(41) | inc %qcalc.t1 $qcr(tblset,t-scale) | goto i }
  window -b @Table
  sline @Table $fline(@Table, [ $qcr(tblset,t-start) ] *,1)
}
alias -l tbldat { 
  set -u %qcalc.td 1
  set %qcalc.tl $1
  :i
  if (%qcalc.td < 11) { set -u %qcalc.tl %qcalc.tl 	 $calc( [ $parse($replace($gettok($did(qcalc,50,%qcalc.td),2-,61),x,[x],x,$1)) ] ) | inc %qcalc.td | goto i }
  return %qcalc.tl
}
alias -l scale { return $calc(($1 - $qcr(win,x-min)) * $sclfact(x))  $calc(($2 - $qcr(win,y-max)) * $sclfact(y) *-1) }
alias -l sclfact { if ($1 == x) { return $calc($qcr(win,win-w)/ ($qcr(win,x-max)-$qcr(win,x-min))) } | else { return $calc($qcr(win,win-h)/ ($qcr(win,y-max)-$qcr(win,y-min))) } }
alias -l qm { writeini $scriptdirqcalc3.ini mouse $1 $iif($qm2($1,$2) == $null,0,$qm2($1,$2)) | return $qm2($1,$2) }
alias -l qm2 { if ($1 == x) { return $calc($2 / $sclfact(x) + $qcr(win,x-min)) } | else { return $calc(-1*($mouse.y / $sclfact(y) - $qcr(win,y-max))) } }
alias -l qcr { if (($1 == colors) && (+colors isin $did(qcalc,50,$2))) { return 0 $c-rgb($r(1,16)) } | return $readini $scriptdirqcalc3.ini $1 $2 }
alias -l ma { set -u %qcalc.ma 1 | :i | if ($gettok($3-,%qcalc.ma,32)) { did -a $1 $2 $replace($ifmatch,&,$chr(32)) | inc %qcalc.ma | goto i } }
alias -l zoom {
  writeini $scriptdirqcalc3.ini win x-min $$1
  writeini $scriptdirqcalc3.ini win x-max $$2
  writeini $scriptdirqcalc3.ini win y-min $$3
  writeini $scriptdirqcalc3.ini win y-max $$4
  graph
}
alias -l win { writeini $scriptdirqcalc3.ini win win-w $$1 | writeini $scriptdirqcalc3.ini win win-h $$2 | graph }
alias -l parse {
  set -u %parse $iif($right($parse2($1-),1) isin */,$left($parse2($1-),$calc($len($parse2($1-))-1)),$parse2($1-))
  set -u %qcalc.f1 (* *)
  return $replace($iif($left(%parse,1) isin */,$right(%parse,$calc($len(%parse)-1)),%parse),$gettok(%qcalc.f1,1,32),$chr(40),$gettok(%qcalc.f1,2,32),$chr(41))
}
alias -l parse2 { return $str($chr(40),$calc($count($1-,$chr(41)) - $count($1-,$chr(40)))) $+ $replace($1-,sum,~sum,!,~n!,e^,~e,round,~round,rand,~rnd,root,~root,sqrt,~sqrt,log,~clog,ln,~log2,cos,~cos2,sin,~sin2,tan,~tan2,a~sin2,~asin2,a~cos2,~acos2,a~tan2,~atan2,abs,~abs2,int,~int,[,*[,],]*,~,*$,+*,+,-*,-,**,*,/*,/,*+,+,*-,-,*/,/,*^,^,[,$chr(40),],$chr(41)) $+ $str($chr(41),$calc($count($1-,$chr(40)) - $count($1-,$chr(41)))) }
alias -l gdata {
  if ($1 == 51) {
    did -o qcalc 51 1 win-w= $+ $qcr(win,win-w)
    did -o qcalc 51 2 win-h= $+ $qcr(win,win-h)
    did -o qcalc 51 3 x-min= $+ $qcr(win,x-min)
    did -o qcalc 51 4 x-max= $+ $qcr(win,x-max)
    did -o qcalc 51 5 y-min= $+ $qcr(win,y-min)
    did -o qcalc 51 6 y-max= $+ $qcr(win,y-max)
    did -o qcalc 51 7 x-res= $+ $qcr(win,x-res)
  }
  elseif ($1 == 53) {
    did -o qcalc 53 1 t-min= $+ $qcr(tblset,t-min)
    did -o qcalc 53 2 t-max= $+ $qcr(tblset,t-max)
    did -o qcalc 53 3 t-start= $+ $qcr(tblset,t-start)
    did -o qcalc 53 4 t-scale= $+ $qcr(tblset,t-scale)
  }
}
alias c-rgb {
  if ($1 == 1) { return 255,255,255 }
  elseif ($1 == 2) { return 0,0,0 }
  elseif ($1 == 3) { return 0,0,128 }
  elseif ($1 == 4) { return 0,128,0 }
  elseif ($1 == 5) { return 255,0,0 }
  elseif ($1 == 6) { return 128,0,0 }
  elseif ($1 == 7) { return 128,0,128 }
  elseif ($1 == 8) { return 255,128,0 }
  elseif ($1 == 9) { return 255,255,0 }
  elseif ($1 == 10) { return 0,255,0 }
  elseif ($1 == 11) { return 0,128,128 }
  elseif ($1 == 12) { return 0,255,255 }
  elseif ($1 == 13) { return 0,0,255 }
  elseif ($1 == 14) { return 255,0,128 }
  elseif ($1 == 15) { return 128,128,128 }
  elseif ($1 == 16) { return 192,192,192 }
}
alias -l grid {
  if ($sclfact(x) >= 1) {
    %qcalc.g = $qcr(win,x-min) + 1
    :i
    if (%qcalc.g < $qcr(win,x-max)) { drawline -r @Graphing $rgb(228,228,228) 1 $scale(%qcalc.g,$qcr(win,y-max)) $scale(%qcalc.g,$calc($qcr(win,y-min)-5)) | inc %qcalc.g | goto i }
  }
  if ($sclfact(y) >= 1) {
    %qcalc.g = $qcr(win,y-max) - 1
    :i2
    if (%qcalc.g > $calc($qcr(win,y-min)-5)) { drawline -r @Graphing $rgb(228,228,228) 1 $scale($qcr(win,x-min),%qcalc.g) $scale($qcr(win,x-max),%qcalc.g) | dec %qcalc.g | goto i2 }
  }
  unset %qcalc.g
  if ($mouse.key == 2) { drawrect -rfi @Graphing $rgb(face) 1 0 0 $qcr(win,win-w) $window(@graphing).h }
}
alias -l qc { 
  if ($qcr(mode,digits) < 11) { return $round($1,$calc($ifmatch -1)) }
  elseif ($qcr(mode,digits) == 11) { return $1 }
  elseif ($len($gettok($1,2,46)) > $calc(13 - $qcr(mode,digits))) { return $round($1,$calc(-11+$qcr(mode,digits))) }
  else { return $1 }
}
alias -l dialog { if ($dialog($3) == $null) { dialog $1- } }
alias -l catalog { did -a qcalc 2 $dialog(qcalc-c,qcalc-c)  }
alias -l clog { if ( $calc($1-) > 0 ) { return $calc(.434294481903 * $log($calc($1-))) } }
alias -l e { return $iif($1 == $null,2.71828182846,$calc(2.71828182846^($1-))) }
alias -l sumfact { 
  set %qcalc.f $calc($2) 
  set -u %qcalc.f2 $calc($2 -1) 
  :next 
  if (%qcalc.f2 > 0) { set -u %qcalc.f %qcalc.f $1 %qcalc.f2 | dec %qcalc.f2 | goto next } 
  return $calc(%qcalc.f)
}
alias -l n! { return $sumfact(*,$1-) }
alias -l sum { return $sumfact(+,$1-) }
alias -l rnd { return $r($iif($2 isnum,$1,1),$iif($2 isnum,$2,$1))) }
alias -l abs2 { return $abs($calc($1-)) }
alias -l log2 { return $log($calc($1-)) }
alias -l sin2 { return $sin($iif($qcr(mode,angle) == 1,$calc(($1-)*(3.14158265/180)),$calc($1-))) }
alias -l cos2 { return $cos($iif($qcr(mode,angle) == 1,$calc(($1-)*(3.14158265/180)),$calc($1-))) }
alias -l tan2 { return $tan($iif($qcr(mode,angle) == 1,$calc(($1-)*(3.14158265/180)),$calc($1-))) }
alias -l asin2 { return $iif($qcr(mode,angle) == 1,$calc($asin($calc($1-))*(180/3.14158265)),$asin($calc($1-))) }
alias -l acos2 { return $iif($qcr(mode,angle) == 1,$calc($acos($calc($1-))*(180/3.14158265)),$acos($calc($1-))) }
alias -l atan2 { return $iif($qcr(mode,angle) == 1,$calc($atan($calc($1-))*(180/3.14158265)),$atan($calc($1-))) }