All pastes #418392 Raw Edit

Miscellany

public text v1 · immutable
#418392 ·published 2007-03-31 16:39 UTC
rendered paste body
alias inverse { var %x = $len($1-),%z
  while (%x >= 1) {
    %z = $+(%z,$mid($replace($1-,$chr(32),$chr(160)),%x,1))
    dec %x
  }
  return %z
}
alias themeit {
  var %tok 1, %output $1-, %tmp
  while ($gettok(%output,%tok,32)) {
    %tmp = $+($chr(3),07,$left($v1,1),$chr(3),14,$mid($v1,2),$chr(3))
    %output = $reptok_(%output,$v1,%tmp,32)
    inc %tok
  }
  return %output
}
alias reptok_ {
  if ($prop) {
    if ($regex($prop,/(mcs|cs|m)/)) {
      if ($regml(1) == cs) { return $reptokcs($1,$2,$3,$4) }
      elseif ($regml(1) == m) {
        var %t $1,%k $2,%r $3,%x $4,%f $findtok($1,$2,0,$4)
        while (%f) {
          %t = $reptok(%t,%k,%r,%f,%x)
          dec %f
        }
        return %t
      }
      else {
        var %t $1,%k $2,%r $3,%x $4,%f $findtok($1,$2,0,$4)
        while (%f) {
          %t = $reptokcs(%t,%k,%r,%f,%x)
          dec %f
        }
        return %t
      }
    }
    else { beep 2 | echo $color(ctcp) -a ERROR - $upper($prop) is not a valid property of $reptok }
  }
  else { return $reptok($1,$2,$3,$4) }
}