Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
#######
#
# E-scripts on srf.
#
# Note 1: use the eev command (defined in eev.el) and the
# ee alias (in my .zshrc) to execute parts of this file.
# Executing this file as a whole makes no sense.
# An introduction to eev can be found here:
#
#   (find-eev-quick-intro)
#   http://angg.twu.net/eev-intros/find-eev-quick-intro.html
#
# Note 2: be VERY careful and make sure you understand what
# you're doing.
#
# Note 3: If you use a shell other than zsh things like |&
# and the for loops may not work.
#
# Note 4: I always run as root.
#
# Note 5: some parts are too old and don't work anymore. Some
# never worked.
#
# Note 6: the definitions for the find-xxxfile commands are on my
# .emacs.
#
# Note 7: if you see a strange command check my .zshrc -- it may
# be defined there as a function or an alias.
#
# Note 8: the sections without dates are always older than the
# sections with dates.
#
# This file is at <http://angg.twu.net/e/srf.e>
#           or at <http://angg.twu.net/e/srf.e.html>.
#        See also <http://angg.twu.net/emacs.html>,
#                 <http://angg.twu.net/.emacs[.html]>,
#                 <http://angg.twu.net/.zshrc[.html]>,
#                 <http://angg.twu.net/escripts.html>,
#             and <http://angg.twu.net/>.
#
#######





# «.lua-port»	(to "lua-port")
# «.Host»	(to "Host")




# (find-esgrep "grep --color -nH --null -e srf *.e")
# (find-es "rexx")

# (find-srffile "")
# (find-srffile "srf")
# (find-srffile "eg/")

# (find-srffile "doc/")
# (find-srffile "doc/readme")
# ht tp://fossil.0branch.com/srf/dir?ci=tip&name=doc
# ht tp://fossil.0branch.com/srf/file?name=doc/readme&ci=tip

ht tp://fossil.0branch.com/srf/dir?ci=tip&name=doc
ht tp://fossil.0branch.com/srf/info/2c368fc945c87a82
ht tp://fossil.0branch.com/srf/timeline?r=lua&c=2020-02-02+05:02:16
ht tp://fossil.0branch.com/srf/brlist




# (find-srffile "eg/dot-srfrc")
# (find-srfgrep "grep --color -nRH --null -e '.%' *")
# (find-srfgrep "grep --color -nRH --null -e '[.]%' *")
# (find-srfgrep "grep --color -nRH --null -e 'expand' *")
# (find-angg ".srfrc")

# (find-man "grep")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd ~/usrc/srf/
fossil up


* (eepitch-srf)
* (eepitch-kill)
* (eepitch-srf)
: .%    100 *  2 places  '%' concat .
: x     / dup .% ..                 -- needs a better name
1 3 x

'/home/edrx/usrc/srf/eg/dot-srfrc' include
see x

'x' expand .
 / dup  '100' * '2' places '%' concat .  '2' places .
it won't delve into literals, so branches of conditionals, but still
maybe a better example,
: when-one 1 = when
: .foo '"foo!" .' swap when-one
5 .foo
0 .foo
1 .foo
foo!
see .foo
'"foo!" .' swap when-one
'.foo' expand .
'"foo!" .' swap '1' = '' swap either do









'secondary.srf' include


'juggling.srf' eg

'hello' 'world'
10 20
2over
.s

see 2swap
'2swap' expand .


'dollars.srf' eg
dollar-sum: $3.95 $10.99 $101.45
see dollar-sum:
see dollar-sum


* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd ~/usrc/srf/
fossil merge trunk
fossil commit -m 'merge trunk fix'


'juggling.srf' eg

'hello' 'world'
10 20
2over
.s

see 2swap
'2swap' expand .

see 2tuck
'2tuck' expand .
-- i think that's it





#####
#
# lua-port
# 2021apr18
#
#####

# «lua-port»  (to ".lua-port")
# (find-fline "~/usrc/srf/ports/lua/srfish.lua")
# (find-srffile "ports/lua/srfish.lua")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd ~/usrc/srf/ports/lua/
./srfish.lua
1 2 + .




#####
#
# Host
# 2021nov23
#
#####

# «Host»  (to ".Host")

* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)

Host = Class {
  type = "Host",
  parse2 = function (src)
      local vars,rest = src:match("^%s*([%w_,]+)%s*=>(.*)$")
      if not vars then error("Host.parse2 can't parse: "..src) end
      return vars, rest
    end,
  format2 = function (fmt, src)
      return format(fmt, Host.parse2(src))
    end,
  ve = function (src)                       -- src is "vars => expression"
      local fmt = "local %s=...; return %s"
      return Host {src=src, code=Host.format2(fmt, src)}
    end,
  vc = function (src)                       -- src is "vars => code"
      local fmt = "local %s=...; %s"
      return Host {src=src, code=Host.format2(fmt, src)}
    end,
  __tostring = function (h) return h.src end,
  __call = function (h, ...) return assert(loadstring(h.code))(...) end,
  __index = {
  },
}

h = Host { src = "a*b", code = "local a,b=...; return a*b" }
= h
= h(2,3)

PP(Host.parse2 [[ a,b => a*b ]])
= Host.lr [[ a,b => a*b ]]
= Host.lr [[ a,b => a*b ]] .code
= Host.lr [[ a,b => a*b ]] (2,3)

= Host.




#  Local Variables:
#  coding:               utf-8-unix
#  End: