Warning: this is an htmlized version!
The original is across this link,
and the conversion rules are here.
#######
#
# E-scripts on Icon
#
# 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.
#
# 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/icon.e>
#           or at <http://angg.twu.net/e/icon.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/>.
#
#######





# «.icone»		(to "icone")
# «.one-line-demos»	(to "one-line-demos")
# «.unicon»		(to "unicon")
# «.unicon-2009»	(to "unicon-2009")
# «.unicon-book»	(to "unicon-book")
# «.icon_src»		(to "icon_src")
# «.itweak»		(to "itweak")

# «.icon-sarge»		(to "icon-sarge")
# «.icon-sarge-source»	(to "icon-sarge-source")
# «.pending_events»	(to "pending_events")
# «.tron.icn»		(to "tron.icn")
# «.icon-lua-0»		(to "icon-lua-0")
# «.icon-lua-1»		(to "icon-lua-1")
# «.icon-lua»		(to "icon-lua")

# «.mapr»		(to "mapr")
# «.noweb»		(to "noweb")
# «.unicon-2010»	(to "unicon-2010")





#####
#
# icone
# 2000jun04
#
#####

# «icone»  (to ".icone")
# Like an "expect -c" or a "perl -e", but for Icon.
#
# The first argument is the code that goes between $include "zinc.icn"
# and "procedure main(args)"; the second goes between "procedure
# main(args)" and "end". Note that the Icon program can access not
# only the other arguments but also stdin; there are some examples
# below.
#
# (eeman "icont" "IPATH")
# (find-fline "~/ICON/zinc.icn")
# (find-fline "~/ICON/zlib.icn")
# (find-angg ".zshrc" "Icon")
# (find-angg "LATEX/desenhos.014" "godement")

function icone () {
  print -l '$include "zinc.icn"' $1 'procedure main(args)' $2 'end' \
    > ~/tmp/tmp.icn
  icont -s -o ~/tmp/tmpicn ~/tmp/tmp.icn -x $*[3,-1]
}

icone '' 'w(args)' foo bar
echo "foo\n  bar" \
  | icone '' 'w([read(), read()])'




#####
#
# some tests
# 2000dec17
#
#####

# «one-line-demos»  (to ".one-line-demos")
# (find-angg ".zshrc" "Icon")
#*
iconw 'args[1:0]'  a b c d e		;# ["a", "b", "c", "d", "e"]
iconw 'args[2:-1]' a b c d e		;# ["b", "c", "d"]
iconw 'args[5:0]'  a b c d e		;# ["e"]
iconw 'args[6:0]'  a b c d e		;# []
iconw 'args[7:0]'  a b c d e		;#
iconw 'args[3:2]'  a b c d e		;# ["b"]
iconw 'args[5:2]'  a b c d e		;# ["b", "c", "d"]
#*
iconw '10<20'				;# 20
iconw '10<20<30'			;# 30
iconw '10>20'				;#
iconw '10>20 | "failed"'		;# "failed"
iconw '10 < (1|2|14|17|25) < 20'	;# 20
iconw '10 < (1|2|14|17|25)'		;# 14
#*
icone '' 'every w(10 < (1|2|5|14|17|25))'		;# 14,17,25
icone '' 'every w((10|4) < (1|2|5|14|17|25))'		;# 14,17,25,5,14,17,25
icone '' 'every w(("aa"|"bb"|"cc") || ("xx"|"yy"))'
#*
echo "foo\n  bar"     | iconw '[read(), read()]'	;# ["foo", "  bar"]
#*




#####
#
# system() in Icon
# 2000jun04
#
#####

# «system»

# (code-c-d "hicon" "$S/http/www.cs.arizona.edu/icon/")
# (find-hiconw3 "www/reference/funclist.html")
# (find-hiconw3 "www/reference/funcsz.html#system")
# (eeman "3 system")
# (find-node "(libc)Running a Command")
# (find-node "(bash)Invoking Bash" "`-c STRING'")
# (find-angg ".zshrc" "Icon")




#####
#
# unicon (2009)
# 2009oct21
#
#####

# «unicon-2009»  (to ".unicon-2009")
# http://groups.google.com/group/comp.lang.icon/browse_thread/thread/f7131de29302138b
# http://www.unicon.org/
# http://www.unicon.org/downloads.html
# http://unicon.org/book/ub.pdf
# http://unicon.org/ubooks.html
# http://www.unicon.org/cvs.html
# http://unicon.sourceforge.net/



#####
#
# Programming with Unicon (draft)
# 2000jun23
#
#####

# «unicon-book»  (to ".unicon-book")
# (find-shttpw3 "icon.cs.unlv.edu/index.html")
gv	     $S/http/icon.cs.unlv.edu/ib/ib.pdf	&
gv -page  37 $S/http/icon.cs.unlv.edu/ib/ib.pdf	&
gv -page  95 $S/http/icon.cs.unlv.edu/ib/ib.pdf	&
gv -page 277 $S/http/icon.cs.unlv.edu/ib/ib.pdf	&





#####
#
# unicon
# 2000oct25
#
#####

# «unicon»  (to ".unicon")
apti libgdbmg1-dev

#*
rm -Rv /usr/src/unicon/
mkdir  /usr/src/unicon/
cd     /usr/src/unicon/
tar -xvzf $S/http/www.drones.com/unicon.tar.gz
mv -v  icon/* .
rmdir  icon/

cd /usr/src/unicon/
find | sort > .files

cd /usr/src/unicon/
make X-Configure name=intel_linux	|& tee omXC
sed -e '/\#define ICONC_XLIB/d'  < src/h/define.h \
  | (cat -; echo '#define ICONC_XLIB "-L/usr/X11R6/lib -lX11"') \
  > src/h/define.h.$$ \
  && mv src/h/define.h.$$ src/h/define.h

make Icon-icont XLIB="-L/usr/X11R6/lib -lX11" \
  CFLAGS="-I/usr/include/db1"		|& tee omIit

#*
# (find-uniconfile "tests/posix/Makefile")
# (find-uniconfile "tests/posix/Test-icont")
# (find-uniconfile "unicon/")

cd /usr/src/unicon/tests/posix/
IPATH=/usr/src/unicon/unicon \
  sh Test-icont icont	|& tee oTii
diff -r stand/ local/	|& tee od

# (find-uniconfile "tests/posix/")
# (find-uniconfile "tests/posix/oTii")
# (find-uniconfile "tests/posix/od")
# (find-uniconfile "tests/posix/stand/")
# (find-uniconfile "tests/posix/local/")

#*

cd /usr/src/unicon/
cd src/icont/
cc -I/usr/include/db1 -E link.c  > link.E

touch build-icont

cd /usr/src/unicon/
agrep -w exec $(<.files)	| l
agrep -w iconxloc $(<.files)	| l

# (code-c-d "unicon" "/usr/src/unicon/")
# (find-uniconfile "")
# (find-uniconfile ".files")
# (find-uniconfile "omXC")
# (find-uniconfile "omIit")
# (find-uniconfile "src/h/define.h")
# (find-uniconfile "tests/")
# (find-uniconfile "tests/posix/")
# (find-uniconfile "tests/posix/select")
# (find-uniconfile "src/icont/link.c" "exec ")




#####
#
# icon 9.3.2 source (potato)
# 2000oct25
#
#####

# «icon_src»  (to ".icon_src")
#*
rm -Rv /usr/src/icon-9.3.2/
pdsc $SDEBIAN/dists/potato/main/source/devel/icon_9.3.2-2.dsc
cd /usr/src/icon-9.3.2/

#cd /usr/src/icon-9.3.2/; agrep strip $(find *)
#cd /usr/src/icon-9.3.2/; agrep CFLAGS $(find *)
# (find-iconfile "config/unix/Config/")
A=(config/unix/Config/iconc.make
   config/unix/Config/icont.make
   config/unix/Config/rtt.make
   config/unix/Config/runtime.make)
for i in $A; do
  mv -v $i $i.orig
  cat $i.orig			\
    | sed s/strip/#strip/g	\
    > $i
done 

patch -p0 config/unix/intel_linux/runtime.hdr <<'%%%'
2c2,3
< CFLAGS= -O2
---
> #CFLAGS= -O2
> CFLAGS= -g
%%%

# (find-iconfile "src/runtime/Makefile")
# (find-iconfile "odrb" "cat runtime.hdr ../Config/runtime.make")
# (find-iconfile "config/unix/intel_linux/runtime.hdr")
# (find-iconfile "config/unix/Config/runtime.make")

debian/rules binary	|& tee odrb

#*
cd /usr/src/icon-9.3.2/
agrep -il rtt $(find * | grep -i make) | tee ~/o

#*
# Remake the ".c"s that rtt produces from the ".r"s.
# (find-iconfile "odrb" "make iconx")
# (find-iconfile "odrb" "cat runtime.hdr ../Config/runtime.make")
# (find-iconfile "config/unix/intel_linux/")
# (find-iconfile "config/unix/Config/")
# (find-iconfile "src/runtime/")
# (find-iconfile "src/runtime/Makefile")

cd /usr/src/icon-9.3.2/src/runtime/
A=(cnv data def errmsg extcall fconv fload fmath fmisc fmonitr fscan
  fstr fstranl fstruct fsys fwindow imain imisc init interp invoke
  keyword lmisc oarith oasgn ocat ocomp omisc oref oset ovalue ralc
  rcoexpr rcomp rdebug rlocal rlrgint rmemmgt rmisc rstruct rsys
  rwinrsc rgfxsys rwinsys rwindow fxtra)
for i in $A; do
  echo ../../bin/rtt -x $i.r
       ../../bin/rtt -x $i.r
done

#*
cd /tmp/
cat > test.icn <<'---'
procedure main(args)
  every write(!args)
end
---
icont test.icn
iconx test foo bar

#*
# (gdbk-gdb t "/usr/src/icon-9.3.2/src/runtime/iconx")
set args /tmp/test foo bar
br main
br interp
run

#*









# (find-iconfile "src/runtime/rt.db")
# (find-iconfile "src/runtime/rttcur.lst")
# (find-iconfile "src/runtime/rttfull.lst")

# (find-iconfile "")
# (find-iconfile "debian/rules")
# (find-iconfile "odrb")
# (find-iconfile "odrb" "make iconx")
# (find-node "(ld)Options" "`-E'")

pdsc $SDEBIAN/dists/potato/main/source/devel/icon-ipl_9.3.2-1.dsc





#####
#
# icon (hamm)
#
#####

# (find-fline "/var/lib/dpkg/info/icont.list")
# (find-fline "/var/lib/dpkg/info/iconx.list")
# (find-fline "/var/lib/dpkg/info/icon-ipl.list")

rm -Rv /usr/doc/icon-ipl/
rm -Rv /usr/lib/icon/ipl/

dpkg --purge icon-ipl
dpkg -i ~/HASH/icon-ipl




#####
#
# Icon 9.3
# 97apr27
#
#####

cd /usr/src/
rm -R icon
mkdir icon
cd icon
tar -xzf /snarf/ftp/ftp.cs.arizona.edu/icon/packages/unix/unix.tar.gz
#
#
# Apply the Posix interface patch:
cd /usr/src/icon/
tar -xvzf /snarf/ftp/ftp.crl.com/users/sp/spm/unicon-patches.tar.gz
patch -p < Unicon/unicon.patch		|& tee op
#
#
cd /usr/src/icon/
make Status name=ix86_linux_elf		|& tee omS
# hora do patch manual, se for o caso
make X-Configure name=ix86_linux_elf	|& tee omXC
make Icon				|& tee omI
#
# Isso dá merda. Tire o -Wl,-E de LDFLAGS.
# Now that (^) works without the patch but I had to change dbm to gdbm
# (find-fline "/usr/src/icon/src/runtime/Makefile" 4)
# (find-fline "/usr/src/icon/config/unix/ix86_linux_elf/runtime.hdr")
# make Icon |& tee omI2
#
# To keep the intermediate C files:
# (find-fline "/usr/src/icon/config/unix/Config/runtime.make" 47)
# (find-fline "/usr/src/icon/src/runtime/Makefile" 54)
#
cd /usr/src/icon/bin/
tar -cvzf /home/compiled/icon9.3.tgz icont iconx patchstr
patchstr icont /usr/bin/iconx
cp -iv icont iconx patchstr /usr/bin/
#
cd /usr/src/icon/ipl/
Translate-icont				|& tee oTi





#####
#
# Icon 9.3.1
#
#####

cd /usr/src/
rm -Rv icon/
mkdir /usr/src/icon/
cd /usr/src/icon/
tar -xvzf /snarf/http/www.cs.arizona.edu/icon/ftp/packages/unix/unix.tgz

echo '#define MultiThread' >> /usr/src/icon/config/unix/intel_linux/define.h

sleep 2
echo -n > .start
sleep 2

make Supported
make Status name=intel_linux
# make Configure name=intel_linux |& tee omc
make X-Configure name=intel_linux |& tee omXC
make Icon |& tee omI

cd /usr/src/icon/
find * -type f -and -anewer .start > .files.used
glimpseindex -H . -F < .files.used

cd /usr/src/icon/bin/
patchstr icont /usr/src/icon/bin/iconx
rm -v /usr/bin/icon{_vt,t,x}
ln -s /usr/src/icon/bin/icont /usr/bin/icont
ln -s /usr/src/icon/bin/iconx /usr/bin/iconx

rm -Rv /usr/src/icon/ipl/
mkdir /usr/src/icon/ipl/
cd /usr/src/icon/ipl/
tar -xvzf /snarf/http/www.cs.arizona.edu/icon/ftp/library/info.tgz
tar -xvzf /snarf/http/www.cs.arizona.edu/icon/ftp/library/bipl.tgz
tar -xvzf /snarf/http/www.cs.arizona.edu/icon/ftp/library/gipl.tgz
tar -xvzf /snarf/http/www.cs.arizona.edu/icon/ftp/library/mipl.tgz

# (find-fline "/usr/src/icon/ipl/README")
export IPATH="/usr/src/icon/ipl/mprocs /usr/src/icon/ipl/procs /usr/src/icon/ipl/gprocs"
export LPATH="/usr/src/icon/ipl/mincl /usr/src/icon/ipl/incl /usr/src/icon/ipl/gincl"
cd /usr/src/icon/ipl/procs/;  for i (*.icn); do icont -c $i; done
cd /usr/src/icon/ipl/mprocs/; for i (*.icn); do icont -c $i; done
cd /usr/src/icon/ipl/gprocs/; for i (*.icn); do icont -c $i; done
cd /usr/src/icon/ipl/gprogs/; for i (*.icn); do icont $i; done
cd /usr/src/icon/ipl/mprogs/; for i (*.icn); do icont $i; done


# (find-fline "/usr/src/icon/ipl/ipd283.txt" "mticont")
# (find-fline "/usr/src/icon/ipl/docs/ipd169.doc")
# (find-fline "/usr/src/icon/src/runtime/fmisc.r")
# (find-fline "/usr/src/icon/src/h/fdefs.h")
# (find-fline "/usr/src/icon/src/runtime/interp.r" "switch ((int)lastop)")

cd /usr/src/icon/src/runtime/
agrep '^function' * | sort -t' ' +2

cd /usr/src/icon/
glimpse -y -H . MultiThread
glimpse -y -H . TallyOpt
glimpse -y -H . FncTrace
glimpse -y -H . MultipleRuns

cd /usr/src/icon/
cat $(<.files.used) | agrep '^#ifdef' | sort | uniq
agrep '^#ifdef' $(<.files.used)
#
# (find-fline "/usr/src/icon/bin/t.icn")
# (find-fline "/usr/src/icon/src/h/features.h" "multiple programs")
# cd /usr/src/icon/bin/
# ./icont t.icn
# ./t

# (find-fline "/usr/src/icon/omI" "rt.h")
# (find-fline "/usr/src/icon/src/common/doincl.c")
# (find-fline "/usr/src/icon/src/h/rt.h")
# (find-fline "/usr/src/icon/bin/rt.h")
# (find-fline "/usr/src/icon/src/h/define.h")
# (find-fline "/usr/src/icon/omXC")
# (find-fline "/usr/src/icon/config/unix/intel_linux/define.h")
# (find-fline "/usr/src/icon/src/common/")

# (find-k2tag "time_t")
# (find-node "(libc)Top")
# (find-node "(libc)High-Resolution Calendar")
# (find-fline "/usr/include/sys/time.h")

cd /usr/src/icon/bin/
cat > t.icn <<'EOF'
procedure main()
  every write(&features)
  every write(function())
end
EOF
./icont -o t931 t.icn
/usr/bin/icont -o trh t.icn
./t931 | sort > o931
./trh | sort > orh
diff o931 orh





# find * -name '*.[chS]' -and      -anewer .mkzImage-start > .files.chS.used
# etags `cat .files.chS.used`






#####
#
# Icon 9.3
# 97apr27
#
#####

cd /usr/src/
rm -R icon
mkdir icon
cd icon
tar -xzf /snarf/ftp/ftp.cs.arizona.edu/icon/packages/unix/unix.tar.gz
#
#
# Apply the Posix interface patch:
cd /usr/src/icon/
tar -xvzf /snarf/ftp/ftp.crl.com/users/sp/spm/unicon-patches.tar.gz
patch -p < Unicon/unicon.patch		|& tee op
#
#
cd /usr/src/icon/
make Status name=ix86_linux_elf		|& tee omS
# hora do patch manual, se for o caso
make X-Configure name=ix86_linux_elf	|& tee omXC
make Icon				|& tee omI
#
# Isso dá merda. Tire o -Wl,-E de LDFLAGS.
# Now that (^) works without the patch but I had to change dbm to gdbm
# (find-fline "/usr/src/icon/src/runtime/Makefile" 4)
# (find-fline "/usr/src/icon/config/unix/ix86_linux_elf/runtime.hdr")
# make Icon |& tee omI2
#
# To keep the intermediate C files:
# (find-fline "/usr/src/icon/config/unix/Config/runtime.make" 47)
# (find-fline "/usr/src/icon/src/runtime/Makefile" 54)
#
cd /usr/src/icon/bin/
tar -cvzf /home/compiled/icon9.3.tgz icont iconx patchstr
patchstr icont /usr/bin/iconx
cp -iv icont iconx patchstr /usr/bin/
#
cd /usr/src/icon/ipl/
Translate-icont				|& tee oTi


# or...
rpm -ihv /snarf/ftp/ftp.redhat.com/pub/contrib/i386/icon-9.3-1.i386.rpm






#####
#
# Icon 9.3 under Debian 2.0
#
#####

# Também falta o symlink X11 -> X11R6 em /usr.
dpkg -iEG xlib6g-dev
dpkg -iEG libelfg0 libelfg0-dev

debsource /debian/main/source/devel icon 9.3 -1
#
# (find-iconfile "debian/rules" 13)
# Change "i486_linux" to "ix86_linux_elf"
#
debian/rules binary-iconx |& tee odrbx



# (find-iconfile "debian/rules")
# (find-iconfile "odrbx")
# (find-iconfile "config/unix/ix86_linux_elf/")

# (find-iconfile "debian/rules" "dpkg")

cd /usr/src/icon-9.3/config/unix/ix86_linux_elf/
mycat * > ~/oelf
cd /usr/src/icon-9.3/config/unix/i486_linux/
mycat * > ~/o486
diff ~/oelf ~/o486

find /usr/include/ -follow

# (find-iconfile "src/runtime/fload.r")
# (find-iconfile "src/runtime/extcall.r")
# (find-iconfile "src/h/fdefs.h" "loadfunc")
# (find-iconfile "tests/calling/Makefile")
# (find-iconfile "tests/calling/loadfunc/Makefile")
# (find-iconfile "tests/calling/loadfunc/btest.icn")
# (find-iconfile "tests/calling/loadfunc/README")
# (find-iconfile "tests/calling/README")

# (find-iconfile "bin/rt.h" "LoadFunc")
# (find-iconfile "config/unix/ix86_linux_elf/define.h" "LoadFunc")
# (find-iconfile "docs/ipd238.txt")
# (find-iconfile "src/runtime/fload.r")
# (find-iconfile "src/h/fdefs.h")
# (find-iconfile "src/h/features.h" "LoadFunc")
# (find-iconfile "src/h/sys.h")




#####
#
# imt (meta translators)
#
#####

rm -Rv /usr/src/imt/
mkdir  /usr/src/imt/
cd     /usr/src/imt/
tar -xvzf $S/ftp/ftp.cs.arizona.edu/icon/imt/source/meta.taz
# (find-fline "$S/ftp/ftp.cs.arizona.edu/icon/imt/")

make |& tee om

# Oops. In tlex.c, tree.h, ttoken.h: problems with yylval.




#####
#
# icon-ipl (potato)
# 2000may18
#
#####

# (find-vldifile "icon-ipl.list")
# (find-fline "/usr/doc/icon-ipl/")

# Hey, zillions of .u1s and .u2s and almost no .icns??? 






# (find-shttpw3 "www.cs.arizona.edu/icon/")
# (find-shttpw3 "www.cs.arizona.edu/icon/intro.htm")
# (find-shttpw3 "www.cs.arizona.edu/icon/docs/")
# (find-shttpw3 "www.cs.arizona.edu/icon/docs/ipd266.htm")
# (find-shttpw3 "www.toolsofcomputing.com/IconHandbook/")

psne http://www.toolsofcomputing.com/IconHandbook/IconHandbook.pdf
psne http://www.toolsofcomputing.com/2000/iconprog.pdf

gv $S/http/www.toolsofcomputing.com/IconHandbook/IconHandbook.pdf



#####
#
# itweak
# 2000dec17
#
#####

# «itweak»  (to ".itweak")
# (find-shttpw3 "www.cs.arizona.edu/icon/docs/itweak.htm")
# (find-shttpw3 "www.soder-labs.com/icon/")
# (find-shttpw3 "www.soder-labs.com/icon/itweak.html")
#*
rm -Rv /usr/src/itweak-2.32/
cd /usr/src/
tar -xvzf $S/http/www.soder-labs.com/icon/itweak-2.32.tar.gz
cd /usr/src/itweak-2.32/

make		|& tee om
make demo
# Oops.

#*
# (code-c-d "itweak" "/usr/src/itweak-2.32/")
# (find-itweakfile "")
# (find-itweakfile "README" "INSTANT ITWEAK -- UNIX")
# (find-itweakfile "Makefile")

# (find-itweakw3 "itweak.html")






#####
#
# icon on sarge
# 2005jan23
#
#####

# «icon-sarge»  (to ".icon-sarge")
# (find-status   "icont")
# (find-vldifile "icont.list")
# (find-udfile   "icont/")
# (find-status   "iconx")
# (find-vldifile "iconx.list")
# (find-udfile   "iconx/")
# (find-status   "icon-ipl")
# (find-vldifile "icon-ipl.list")
# (find-udfile   "icon-ipl/")
# (find-fline "/usr/lib/icon-ipl/")
# (find-man "1 unzip" "-q")
# (find-man "1 icont" "-s")

# Note: sarge's icon-ipl package is very poor, it's better to install
# bipl instead.
# http://www.cs.arizona.edu/icon/ftp/library/bipl.zip
# http://www.cs.arizona.edu/icon/ftp/library/gipl.zip

#*
rm -Rf ~/usrc/ipl/
mkdir  ~/usrc/ipl/
cd     ~/usrc/ipl/
unzip -q $S/http/www.cs.arizona.edu/icon/ftp/library/gipl.zip
unzip -q $S/http/www.cs.arizona.edu/icon/ftp/library/bipl.zip

cd ~/usrc/ipl/procs/;  for i in *.icn; do          icont -s -c $i; done
cd ~/usrc/ipl/progs/;  for i in *.icn; do echo $i; icont -s    $i; done
cd ~/usrc/ipl/gprocs/; for i in *.icn; do          icont -s -c $i; done
cd ~/usrc/ipl/gprogs/; for i in *.icn; do echo $i; icont -s    $i; done

# cd ~/usrc/ipl/mprocs/; for i in *.icn; do icont -s -c $i; done
# cd ~/usrc/ipl/mprogs/; for i in *.icn; do icont -s    $i; done

#*
# (find-node "(find)Permissions")
cd ~/usrc/ipl/gprogs/
find . -perm +100 -and -type f | sort | tee ~/o

for i in $(find * -perm +100 -and -type f | sort ); do
  echo $i
  ./$i
done

#*




mkdir                  ~/usrc/ipl/procs/
cp /usr/lib/icon-ipl/* ~/usrc/ipl/procs/

#*
cd     /tmp/ipl/gprocs/
for i in *.icn; do icont $i; done

#*



# (code-c-d "ipl" "/usr/lib/icon-ipl/")
# (find-iplsh "grep -l 'procedure main' *.icn")
# (find-iplsh "grep graphic $(grep -l 'procedure main' *.icn)")
# (find-sh "cd /usr/lib/icon-ipl/; grep -l 'procedure main' *.icn")

# (find-iplfile "")
# (find-iplfile "barchart.icn" "procedure main")

# (find-man "1 icont")
# (find-man "1 iconx")
#*
rm -Rf /tmp/ipl/
mkdir  /tmp/ipl/
cp /usr/lib/icon-ipl/* /tmp/ipl/
cd     /tmp/ipl/

#*





#####
#
# icon on sarge from the debian sources
# 2006aug11
#
#####

# «icon-sarge-source»  (to ".icon-sarge-source")
# http://ftp.debian.org/debian/pool/main/i/icon/icon_9.4.2-2.6.diff.gz
# http://ftp.debian.org/debian/pool/main/i/icon/icon_9.4.2-2.6.dsc
# http://ftp.debian.org/debian/pool/main/i/icon/icon_9.4.2.orig.tar.gz
# (code-c-d "icon" "~/usrc/icon/icon-9.4.2/")
# (find-iconfile "")
#*
rm -Rv ~/usrc/icon/
mkdir  ~/usrc/icon/
cd     ~/usrc/icon/
cp -v $S/http/ftp.debian.org/debian/pool/main/i/icon/icon_9.4.2* .
dpkg-source -sn -x icon_9.4.2-2.6.dsc
cd     ~/usrc/icon/icon-9.4.2/
dpkg-buildpackage -us -uc -b -rfakeroot    |& tee odb

#*
# (find-status   "icont")
# (find-vldifile "icont.list")
# (find-udfile   "icont/")
# (find-status   "iconx")
# (find-vldifile "iconx.list")
# (find-udfile   "iconx/")
cd     ~/usrc/icon/
sudo dpkg -i icont_9.4.2-2.6_i386.deb \
             iconx_9.4.2-2.6_i386.deb
#*
# The icon-ipl package is needed to compile the upstream bipl and gipl
# (find-status   "icon-ipl")
# (find-vldifile "icon-ipl.list")
# (find-udfile   "icon-ipl/")

# (find-vldifile "icon-ipl.list" "/usr/lib/icon-ipl/graphics.u1")
# (find-angg ".zshrc" "Icon")

cd     ~/usrc/icon/
sudo dpkg -i icon-ipl_9.4.2-2.6_all.deb

# aptrm icon-ipl

#*
# Compile bipl and gipl:
# http://www.cs.arizona.edu/icon/ftp/library/bipl.zip
# http://www.cs.arizona.edu/icon/ftp/library/gipl.zip

rm -Rf ~/usrc/ipl/
mkdir  ~/usrc/ipl/
cd     ~/usrc/ipl/
unzip -q $S/http/www.cs.arizona.edu/icon/ftp/library/gipl.zip
unzip -q $S/http/www.cs.arizona.edu/icon/ftp/library/bipl.zip

cd ~/usrc/ipl/procs/;  for i in *.icn; do          icont -s -c $i; done  |& tee oisc
cd ~/usrc/ipl/progs/;  for i in *.icn; do echo $i; icont -s    $i; done  |& tee ois
cd ~/usrc/ipl/gprocs/; for i in *.icn; do          icont -s -c $i; done  |& tee oisc
cd ~/usrc/ipl/gprogs/; for i in *.icn; do echo $i; icont -s    $i; done  |& tee ois

# cd ~/usrc/ipl/mprocs/; for i in *.icn; do icont -s -c $i; done
# cd ~/usrc/ipl/mprogs/; for i in *.icn; do icont -s    $i; done

#*
# (find-node "(find)Permissions")
# (find-fline "~/usrc/ipl/gprogs/")
# (find-fline "~/usrc/ipl/gprogs/.files.x.el")
cd ~/usrc/ipl/gprogs/
find * -perm +100 -and -type f | sort | tee .files.x
cat .files.x | gsub.lua '' '(find-fline "~/usrc/ipl/gprogs/%1.icn")
  (find-sh0 "~/usrc/ipl/gprogs/%1")' \
  | tee .files.x.el

#*
# (find-fline "~/usrc/ipl/gprogs/.files.x.el")
# (find-fline "~/usrc/ipl/gprogs/chernoff.icn")
#   (find-sh0 "~/usrc/ipl/gprogs/chernoff")

# (code-c-d "iconipl" "~/usrc/ipl/" :grep)
# (find-iconiplfile "")
# (find-iconiplgrep "grep -nH -e Event $(find * -name '*.icn')")




#####
#
# Pending Events
# 2006aug27
#
#####

# «pending_events»  (to ".pending_events")
# (find-angg "ICON/tron.icn")
# (find-icongrbookpage (+ 24 183))
# (find-iconiplgrep "grep -nH -e Pending $(find *)")
# (find-iconfile "src/runtime/fwindow.r" "function{0,1} Pending(argv[argc])")
# (find-iconfile "src/runtime/rt.db")

*Pending() > 0



#####
#
# tron.el in Icon
# 2006aug11
#
#####

# «tron.icn»  (to ".tron.icn")
# (find-anggfile "elisp/")
# (find-anggfile "elisp/tron.el")
# (find-anggfile "elisp/tron.el.png")

# (find-iconbooktext "delay(i) : n")
# (find-iconbooktext)
# (find-iconbookpage (+ 22 155))
# (find-iconbookpage)
# (find-anggfile "ICON/lslR2find2.icn")

# (find-iconiplfile "gprogs/")
# (find-iconiplfile "gprogs/breakout.icn")

# (find-anggfile "usrc/ipl/gprogs/breakout.icn" "image(WAttrib(\"pointerx\"))")

Acho que o Event sempre retorna imediatamente... melhor roda-lo com um delay.

# (find-iconiplfile "gprogs/breakout.icn" "if e := Event() then")
# (find-iconiplfile "")
# (find-iconiplgrep "grep -nH -e Event $(find * -name '*.icn')")
# (find-iconiplgrep "grep -nH -e GetEvents $(find * -name '*.icn')")

# (find-iconbookpage (+ 22 318))
# (find-iconbooktext "")

# (find-angg ".zshrc" "Icon")
# (find-fline "zinc.icn")
# (find-fline "zlib.icn")
# (find-man "1 icont")
# (find-iconbookpage (+ 22 12) "$include")
# (find-iconbooktext           "$include")
# (find-angg "ICON/zinc.icn")
#$include "zinc.icn"
# (find-zsh0 "iconw 'type(a := [33, 44]) || a[1]'")





#####
#
# an Icon<->Lua bridge: calling Lua from C without Icon
# 2006oct21
#
#####

# «icon-lua-0»  (to ".icon-lua-0")
# (find-es "lua5" "pil24.1")
#*
rm -Rv /tmp/iconlua/
mkdir  /tmp/iconlua/
cd     /tmp/iconlua/

cat > test.c <<'---'
#include <stdio.h>
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
#include <string.h>   // for strlen

static lua_State *L = NULL;
static void lua_run(char *buff) {
  int error;
  if (L == NULL) {
    L = luaL_newstate();   /* opens Lua */
    luaL_openlibs(L);      /* opens the standard libraries */
  }
  error = luaL_loadbuffer(L, buff, strlen(buff), "buff") ||
          lua_pcall(L, 0, 0, 0);
  if (error) {
    fprintf(stderr, "%s", lua_tostring(L, -1));
    lua_pop(L, 1);         /* pop error message from the stack */
  }
}

int main (void) {
  char buff[256];
  while (fgets(buff, sizeof(buff), stdin) != NULL) {
    lua_run(buff);
  }
  return 0;
}
---

export LUA51SRC=$HOME/usrc/lua-5.1.1
gcc -O2 -Wall -I$LUA51SRC/src -c -o test.o test.c
# (find-lua51file "oml" "liblua.a")
# (find-lua51file "oml" "gcc -o lua ")
gcc -o test test.o $LUA51SRC/src/liblua.a -lm -Wl,-E -ldl

echo 'print(1+2, "hello")' | ./test

#*




#####
#
# an Icon<->Lua bridge: calling C from Icon
# 2006oct22
#
#####

# «icon-lua-1»  (to ".icon-lua-1")
# (find-iconfile "")
#*
cd ~/usrc/icon/icon-9.4.2/
find * | sort > .files
grep '\.[chsr]$' < .files > .files.chsr

#*
# (find-iconfile ".files")
# (find-iconfile ".files.chsr")
# (find-iconfile "ipl/cfuncs/")
# (find-iconfile "ipl/cfuncs/cfunc.icn")
# (find-iconfile "ipl/cfuncs/mkfunc.sh")
# (find-iconfile "ipl/cfuncs/mklib.sh")
# (find-iconfile "ipl/cfuncs/Makefile")
# (find-es "icon" "icon-sarge-source")
# (find-iconfile "odb")
# (find-iconfile "odb" "sh mkfunc.sh")
# (find-iconfile "odb" ">cfunc.icn")
# (find-iconfile "odb" "sh mklib.sh")
# (find-icongrep "grep -niH -e RetString ipl/cfuncs/*.c")
#*
rm -Rv /tmp/cfuncs/
mkdir  /tmp/cfuncs/
cd     /tmp/cfuncs/

cd ~/usrc/icon/icon-9.4.2/ipl/cfuncs
cp -dipPvR * /tmp/cfuncs/

cd /tmp/cfuncs/
sh mkfunc.sh libcfunc.so bitcount.o files.o fpoll.o internal.o lgconv.o osf.o pack.o ppm.o process.o tconnect.o >cfunc.icn
icont -us -c cfunc.icn

# (find-iconfile "ipl/cfuncs/")
# (find-iconfile "ipl/cfuncs/icall.h")
# (find-fline "/tmp/cfuncs/")

gcc -Wall -g -O0 -fPIC -c bitcount.c
gcc -Wall -g -O0 -fPIC -c files.c
gcc -Wall -g -O0 -fPIC -c fpoll.c
gcc -Wall -g -O0 -fPIC -c internal.c
gcc -Wall -g -O0 -fPIC -c lgconv.c
gcc -Wall -g -O0 -fPIC -c osf.c
gcc -Wall -g -O0 -fPIC -c pack.c
gcc -Wall -g -O0 -fPIC -c ppm.c
gcc -Wall -g -O0 -fPIC -c process.c
gcc -Wall -g -O0 -fPIC -c tconnect.c
CC="gcc" CFLAGS="-Wall -g -O0" sh mklib.sh libcfunc.so bitcount.o files.o fpoll.o internal.o lgconv.o osf.o pack.o ppm.o process.o tconnect.o
#   gcc -shared -o libcfunc.so -fPIC                   bitcount.o files.o fpoll.o internal.o lgconv.o osf.o pack.o ppm.o process.o tconnect.o


#*
# (find-icongrep "grep -nH -e cnv_c_str $(find *)")
# (find-icongrep "grep -nH -e rproto.h $(find *)")
# (find-icongrep "grep -nH -e pathload $(find *)")
# (find-icongrep "grep -nH -e loadfunc $(find *)")
# (find-iconfile "src/runtime/fload.r" "loadfunc(filename,funcname)")
# (find-iconfile "src/runtime/fload.r" "dlsym(handle, funcname)")
# (find-node "(libc)Function Index" "* sprintf:")
# (find-icongrep "grep -niH -e RetString ipl/cfuncs/*.c")
# (find-iconfile "ipl/cfuncs/")
# (find-iconfile "ipl/cfuncs/files.c")

cat > /tmp/cfuncs/edrx.c <<'---'
#include "icall.h"
#include <stdio.h>    // for sprintf
int icon_angbrack (int argc, descriptor argv[])  /* wrap as "<%s>" */
{ char buffer[256];
  ArgString(1);
  sprintf(buffer, "<%s>", StringVal(argv[1]));
  RetString(buffer);
}
---

cd  /tmp/cfuncs/
gcc -Wall -g -O0 -fPIC -c edrx.c
gcc -shared -o edrx.so -fPIC edrx.o

cat > edrx.icn <<'---'
link io
$define LIB "/tmp/cfuncs/edrx.so"
procedure angbrack(a[])
  return(angbrack:=pathload(LIB,"icon_angbrack"))!a;end
procedure main()
  write(angbrack("foo"))
  write(angbrack("bar"))
end
---

cd /tmp/cfuncs/
icont -s edrx.icn -x

#*













#####
#
# 
#
#####




# (find-iconfile "src/h/rproto.h" "cnv_c_str")
cp -v ~/usrc/icon/icon-9.4.2/src/h/rproto.h .

// #include "rproto.h"
//

# (find-iconfile "ipl/procs/io.icn")

# (find-iconfile "doc/faq.txt" "loadfunc()")
# http://www.cs.arizona.edu/icon/docs/ipd240.htm


   if (  StringVal(argv[1]), IntegerVal(argv[2])) == 0)
      RetNull();
   else
      Fail;
   }



#*
# (find-iconfile "ipl/cfuncs/")
# (find-iconfile "ipl/cfuncs/README")
# (find-iconfile "ipl/cfuncs/README" "FPATH")
# (find-man "iconx")

# (find-icongrep "grep -nH -e FPATH $(find *)")
# (find-iconfile "src/runtime/imain.r" "Append to FPATH the bin directory from which iconx was executed")
# (find-iconfile "ipl/procs/io.icn" "load C function from $FPATH")


# gcc -shared -o libcfunc.so -fPIC bitcount.o files.o fpoll.o internal.o lgconv.o osf.o pack.o ppm.o process.o tconnect.o
# make[4]: Leaving directory `/home/edrx/usrc/icon/icon-9.4.2/ipl/cfuncs'
cp cfuncs/*.u? ../lib
cp cfuncs/libcfunc.so ../bin
# make[3]: Leaving directory `/home/edrx/usrc/icon/icon-9.4.2/ipl'





# «icon-lua»  (to ".icon-lua")

// (find-luamanualw3m "#3.14")


static void lua_run(char *prog) {
  // (find-lua51file "src/lua.c" "lua_open()")
  // (find-lua51file "src/lua.c" "luaL_openlibs(L)")
  // (find-lua51file "src/lua.c" "dostring")
  // (find-lua51file "src/linit.c" "luaL_openlibs")
  // (find-lua51tag "luaL_loadbuffer")
  // (find-lua51tag "lua_load")
  // (find-pilw3m "24.1.html")

  if (!L) {
    L = lua_open();
    luaL_openlibs(L);
  }
}









every i := 1 to Limit do

#*
# (find-efunction 'eeicon-ow)
# (eeb-icon)
# (eeb-icon-ow)
# (eev ee-script-icon)
# (find-fline "~/ICON/")
# (find-anggfile "ICON/tmp.icn")
# (find-anggfile "ICON/ee.icn")
# (find-anggfile ".zshrc" "Icon")

  print(233)

#*



# cat > ~/ICON/ee.icn


#*
# (find-evariable 'ee-script-icon)
# (setq ee-script-icon "cd ~/ICON/ && icont -s tmp.icn -x")

# (find-status   "icon-ipl")
# (find-vldifile "icon-ipl.list")
# (find-udfile   "icon-ipl/")
# (find-man "1 icont" "IPATH")
# (find-man "1 icont" "LPATH")
# (find-fline "/usr/lib/icon-ipl/" "graphics.icn")

export LPATH="$HOME/ICON /usr/lib/icon/ipl/incl /usr/lib/icon/ipl/gincl"
#export IPATH="$HOME/ICON /usr/lib/icon/ipl/ucode"
export IPATH="$HOME/ICON /usr/lib/icon-ipl"

cat > /tmp/foo.icn <<'---'
procedure main()
  every i = 1 to 200 do {
    write(i)
  }
end
---
cd /tmp/
strace-to ~/s \
  icont -s foo.icn -x

#*
# (find-fline "~/s")


$include "zinc.icn"
link graphics
  # WOpen("size=293,320") | stop("can't open window") 
    # print(Event())
    # delay(100)



# (find-angg ".emacs" "find-iconbooktext")




# (find-iconbookpage (+ 22 143))
# (find-iconbookpage (+ 22 155))



# (find-w3m "~/TH/L/icon.html")

# (find-esgrep "grep -nH -e dpkg-source *.e")

# (code-c-d "icon" "~/usrc/icon/icon-9.4.2/" :grep)
# (find-iconfile "")
# 

find-grep



chernoff






#####
#
# mapr (later renamed to iee)
# 2007jan24
#
#####

# «mapr»  (to ".mapr")
# http://www.costarricense.cr/pagina/ernobe/mapr.txt
# http://www.costarricense.cr/pagina/ernobe/iee.txt
# From comp.lang.icon, 21 jan 2007...

I've created an Icon evaluator called Mapr (short for main procedure).
It evaluates every Icon expression that is entered, and if you want
the result of several, you have two options, either use brackets and
parenthesis in the usual fashion, or declare your own procedures. The
user declared procedures can be used in subsequent expressions and
procedures, and can be saved to a file. Type 'bye' to exit the program
and 'mapr ?' or 'mapr help' for help. You can see the source code at:

  http://www.costarricense.cr/pagina/ernobe/mapr.txt

The program prints out that which the expressions or procedures write
and the result of them.  For example,

  $ mapr
  procedure main()
  _

it begins printing out the main procedure declaration, then if you
write this:

  $ mapr
  procedure main()
  write( "hello world" )

it will respond with this:

  $ mapr
  procedure main()
  write( "hello world" )
  end

  hello world
  result : "hello world"

I have only one problem, and it is that I haven't been able to get it
to work on Windows (in Windows emulator Wine). It reports that it is
unable to execute nticonx (with nticont -s mapr.icn -x). Can anyone
help me get it to work on Windows?

PS: User declared procedures can occur anywhere in the program.  For
example,

The Mapr prompt is:

  $ mapr
  procedure main()
  _

if the user enters this:

  $ mapr
  procedure main()
  { g := 34
  #uio( b )
  # if b = 34 then write( "hello 34" ) #
  uio( g )
  if uio( g ) then 342 else 222 }

the result is:

  procedure main()
  { g := 34
  #uio( b )
  # if b = 34 then write( "hello 34" ) #
  uio( g )
  if uio( g ) then 342 else 222 }
  end

  hello 34
  hello 34
  result : 222

  procedure main()
  _ 







#####
#
# noweb-2.11b
# 2007mar29
#
#####

# «noweb»  (to ".noweb")
# http://www.eecs.harvard.edu/~nr/noweb/dist/noweb.tgz
#*
rm -Rfv ~/usrc/noweb-2.11b/
tar -C  ~/usrc/ -xvzf \
  $S/http/www.eecs.harvard.edu/~nr/noweb/dist/noweb.tgz
cd     ~/usrc/noweb-2.11b/

make |& tee om

#*
# (code-c-d "noweb" "~/usrc/noweb-2.11b/")
# (find-nowebfile "")
# (find-nowebfile "README")
# (find-nowebfile "src/INSTALL")



#####
#
# Unicon (2010)
# 2010oct30
#
#####

# «unicon-2010»  (to ".unicon-2010")
# http://www.unicon.org/
# http://www.unicon.org/downloads.html
# http://www.unicon.org/dist/uni.zip
# http://www.unicon.org/book/ub.pdf
# http://www.unicon.org/interesting.html
# http://www.unicon.org/mailing.html

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rv   ~/usrc/unicon/
mkdir    ~/usrc/unicon/
unzip -d ~/usrc/unicon/ $S/http/www.unicon.org/dist/uni.zip
cd       ~/usrc/unicon/
make X-Configure name=intel_linux |& tee oc
make Unicon                       |& tee om

# (code-c-d "unicon" "~/usrc/unicon/")
# (find-uniconfile "")
# (find-uniconfile "README")
# (find-uniconfile "om")


# http://www.unicon.org/cvs.html

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
rm -Rv   ~/usrc/unicon-cvs/
mkdir    ~/usrc/unicon-cvs/
cd       ~/usrc/unicon-cvs/
tar -xvzf ~/tmp/unicon-cvs.tgz

# cvs -d:pserver:anonymous@unicon.cvs.sourceforge.net:/cvsroot/unicon login
# just press enter when asked for a password, no password needed
cvs -z8 -d:pserver:anonymous@unicon.cvs.sourceforge.net:/cvsroot/unicon co unicon
tar -cvzf ~/tmp/unicon-cvs.tgz unicon/

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
cd       ~/usrc/unicon-cvs/unicon/
make X-Configure name=intel_linux |& tee oc
make Unicon                       |& tee om

# (code-c-d "unicon" "~/usrc/unicon-cvs/unicon/")
# (find-uniconfile "")
# (find-uniconfile "bin/")

# (find-uniconfile "README")
# (find-uniconfile "oc")
# (find-uniconfile "oc" "sh ./configure")
# (find-uniconfile "om")
# (find-uniconfile "doc/build.htm")
# (find-uniconfile "uni/udb/lib/")
# (find-uniconfile "uni/udb/lib/Makefile")
# (find-uniconfile "uni/udb/lib/Makefile" "listener.u:")

# Test:
cd ~/usrc/unicon-cvs/unicon/
bin/icont -s ~/ICON/tron.icn -x




# (find-fline "~/.cvspass")




# "Create a procedures at runtime" (2008jun):
# http://groups.google.com/group/comp.lang.icon/browse_thread/thread/5113b1d07d24fd73

# http://www.mitchellsoftwareengineering.com/icon/icon.sli.pdf







#  Local Variables:
#  coding:               raw-text-unix
#  ee-delimiter-hash:    "\n#*\n"
#  ee-delimiter-percent: "\n%*\n"
#  ee-anchor-format:     "«%s»"
#  End: