|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
#######
#
# E-scripts on Crim.
#
# 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/crim.e>
# or at <http://angg.twu.net/e/crim.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/>.
#
#######
# «.compiling» (to "compiling")
# «.gprof» (to "gprof")
# «.tclstuff2» (to "tclstuff2")
# «.crim1a» (to "crim1a")
# «.crim1b» (to "crim1b")
# «.flua-0.01» (to "flua-0.01")
# «.uploading_flua» (to "uploading_flua")
# «.flua-0.03» (to "flua-0.03")
# (find-es "anatocc" "nasm_crim1")
# (find-fline "~/CRIM1/")
#####
#
# Compiling the various blocks of crim1
# 2000jul15
#
#####
# «compiling» (to ".compiling")
# (find-fline "~/CRIM1/")
# (find-fline "~/CRIM1/demo1.tf1")
# (find-fline "~/CRIM1/demo1.tf2")
# (find-fline "~/CRIM1/engine0.c")
# (find-fline "~/CRIM1/tclstuff")
# (find-fline "~/CRIM1/demo1.tf2")
# (find-fline "~/CRIM1/tclstuff")
# (find-fline "~/CRIM1/engine1.c")
# (find-fline "~/CRIM1/engine1.complete.c")
# (find-fline "~/CRIM1/demo1.tf2.asm")
# (find-es "anatocc" "nasm_crim1")
#*
cd ~/CRIM1/
make CFLAGS=-1 |& tee om
cat > $EEG <<'---'
br engine
#br 79
#br 118
run
---
#*
cd ~/CRIM1/
make clean
#make
make CFLAGS=-g
demo1
#*
# (find-fline "~/CRIM1/engine1.c")
# (gdb "gdb ~/CRIM1/demo")
#define H_COL 0xFF
#define H_RSR 0xFE
#define H_CON 0xFD
#define H_TO 0xFC
#define H_AT 0xFB
#define SF_EXIT 0xFF
#define SF_PLUS 0xFE
#define SF_2DUP 0xFD
#define F_COUNT 0xFA00
#define F_TYPE 0xFA01
#define F_CR 0xFA02
#define F_STO 0xFA03
#define F_TOS 0xFA04
#define FIP_RETURN 0xFFFF
#define FIP_RSREXIT 0xFFFE
#####
#
# gprof
# 2000oct09
#
#####
# «gprof» (to ".gprof")
# (find-node "(gprof)Compiling")
# (find-node "(gprof)Compiling" "basic-block")
# (find-node "(gprof)Executing" "`gmon.out'")
# (find-node "(gprof)How do I?")
# (find-node "(gcc)Debugging Options" "`-a'")
# (find-node "(gprof)Output Options")
#*
cd ~/CRIM1/
rm -v gmon.out bb.out
make demo1.clean
make CFLAGS="-g -pg" LDFLAGS=-pg demo1
demo1
gprof demo1 > ~/o
# (find-fline "~/o")
#*
cd ~/CRIM1/
rm -v gmon.out bb.out
make demo1.clean
make CFLAGS="-g -pg -a" LDFLAGS=-pg demo1
demo1
gprof -l -C demo1
# gprof with these options gives no output,
# but bb.out has all the interesting information, it seems.
#*
cd ~/CRIM1/
cat bb.out | sort -k 3 -n -r | tee ~/o | l -S
# (progn (find-fline "~/o") (wrap 0))
#*
#####
#
# Notes on the "gobble" words
# 2000oct19
#
#####
@@ - gobble (read and advance pointer)
S@@ - sgobble (read and advance pointer, using SS)
F$ - forth string
C$ - C string
!! - ungobble (like gobble, but for writing)
S!! - s-ungobble (like gobble, but for writing; using SS)
So, for example, it's
: S@@F$ S> COUNT DDUP + >S ;
: S@@C$ S> DUP strlen DDUP + 1+ >S ;
# (find-node "(gforth)Word Index")
# (find-node "(gforth)String Formats" "`count'")
What's a good way to write stack diagrams for these words? Maybe this:
@@F$ ( ::s adr ::d -- ::s adr+ ::d len )
#####
#
# tclstuff2 (with the prims going in the ".th"s)
# 2000nov14
#
#####
# «tclstuff2» (to ".tclstuff2")
# (find-fline "~/CRIM1/tclstuff2")
#*
cd ~/CRIM1/
chmod 755 tclstuff2
./tclstuff2
(cd /tmp; nasm -f elf -o x.o -l x.lst x.asm; gcc -c -g -o engine.o engine.c)
(cd /tmp; gcc -g engine.o x.o -o crimtest && ./crimtest)
# (gdbk-gdb nil "/tmp/crimtest")
#*
#*
expect -c '
set s [exec cat /home/root/CRIM1/engine0.skel.c]
regexp {^(.*)/\*-- (.*) --\*/(.*)$} $s -> a b c
puts $a
puts -----------------------
puts $b
puts -----------------------
puts $c
'
#*
# (find-fline "~/CRIM1/")
# (find-fline "~/CRIM1/engine0.skel.c")
expect -c '
set Fprims_code Hello
set FIPprims_code Hi
set Hprims_code Bye
set SF_TO_F_code Foof
set C_defs Cdf
set s [exec cat /home/root/CRIM1/engine0.skel.c]
set tail {}
while {[regexp {^(.*)/\*-- (.*) --\*/(.*)$} $s -> a b c]} {
puts $b
set tail "/*--{ $b }--*/[uplevel #0 $b]\n$c$tail"
set s $a
}
puts $s$tail
'
#*
expect -c '
set a 33
puts [uplevel #0 {concat $a}]
puts ha!
'
#*
#####
#
# crim1a
# 2001feb14
#
#####
# «crim1a» (to ".crim1a")
# (find-fline "~/CRIM1/Makefile" "crim1a-demos")
# (find-angg "CRIM1/crim1a-lib.tcl")
# (find-angg "CRIM1/crim1a-prims.tcl")
# (find-angg "CRIM1/crim1a.tcl")
#*
cd ~/CRIM1/
make crim1a-demos
#*
#####
#
# crim1b (in Lua)
# 2001feb14
#
#####
# «crim1b» (to ".crim1b")
# This was superseded by flua-0.01: (to "flua-0.01")
# (find-angg "LUA/inc.lua" "px")
# (find-angg "LUA/flua2.lua")
# (find-fline "~/tmp/lua-manual.txt")
#*
cd ~/LUA/
lua flua2.lua
#*
cd ~/LUA/
lua flua2.lua
cd /tmp/
nasm -f elf -o bytecode.o -l bytecode.lst bytecode.asm
#gcc -o engine bytecode.o engine.c
gcc -lm -ldl -llua -llualib -o engine bytecode.o engine.c
./engine 0
./engine
#*
#####
#
# flua-0.01
# 2001apr06
#
#####
# «flua-0.01» (to ".flua-0.01")
# (find-es "lua" "flua")
# (find-fline "~/LUA/flua-0.01/")
# (find-fline "~/LUA/flua-0.01/inc.lua")
# (find-fline "~/LUA/flua-0.01/flua-comp.lua")
# (find-fline "~/LUA/flua-0.01/flua-demos.lua")
# (find-fline "~/LUA/flua-0.01/flua.lua")
#*
cd ~/LUA/flua-0.01/
make clean
make
make v
make out.tgz
#*
#####
#
# uploading flua
# 2001apr29
#
#####
# «uploading_flua» (to ".uploading_flua")
#*
# (find-fline "~/LUA/flua-0.01/")
# (find-fline "~/LUA/flua-0.01/Makefile")
cd ~/LUA/flua-0.01/
rm -v *gz
make clean
make tgz out.tgz
mv -v flua-0.01.tar.gz ..
mv -v flua-0.01.out.tar.gz ..
#*
# (find-fline "~/LUA/flua-0.02/")
# (find-fline "~/LUA/flua-0.02/Makefile")
cd ~/LUA/flua-0.02/
rm -v *gz
make clean
make tgz out.tgz
mv -v flua-0.02.tar.gz ..
mv -v flua-0.02.out.tar.gz ..
#*
cd ~/LUA/
anonftp angg.twu.net \
'cd ~/slow_html/LUA/' \
'put flua-0.01.tar.gz' \
'put flua-0.01.out.tar.gz' \
'put flua-0.02.tar.gz' \
'put flua-0.02.out.tar.gz' \
'quit'
#*
# (eevt-bounded 'once)
# First remove the possible leftovers of previous versions from
# ~/public_html, that the "cp" in minimakepage wouldn't overwrite:
(cd ~/public_html/LUA/flua-0.01/ && make clean)
(cd ~/public_html/LUA/flua-0.02/ && make clean)
# (find-angg ".zshrc" "minimakepage")
cd ~/slow_html/LUA/
mkdir flua-0.01/ flua-0.02/
rm -v flua-latest.tar.gz
ln -s flua-0.02.tar.gz flua-latest.tar.gz
tar -xvzf flua-0.01.out.tar.gz -C flua-0.01/
tar -xvzf flua-0.02.out.tar.gz -C flua-0.02/
cd ~/public_html/LUA/
rm -v flua-latest.tar.gz
ln -s flua-0.02.tar.gz flua-latest.tar.gz
# Then use minimakepage by hand to copy ~/slow_html -> ~/public_html/ ...
# (find-angg ".zshrc" "minimakepage")
#*
# To make the links in my local pages work:
tar -xvzf ~/LUA/flua-0.01.out.tar.gz -C ~/TH/L/LUA/flua-0.01/
tar -xvzf ~/LUA/flua-0.02.out.tar.gz -C ~/TH/L/LUA/flua-0.02/
tar -xvzf ~/LUA/flua-0.01.out.tar.gz -C ~/TH/R/LUA/flua-0.01/
tar -xvzf ~/LUA/flua-0.02.out.tar.gz -C ~/TH/R/LUA/flua-0.02/
#*
#####
#
# flua-0.03
# 2001aug06
#
#####
# «flua-0.03» (to ".flua-0.03")
# (find-fline "~/LUA/flua-0.03/")
# (code-c-d "flua" "~/LUA/flua-0.03/")
# (find-flua "")
# (find-flua "flua-comp.lua")
# (find-flua "flua-demos.lua")
# (find-flua "flua-lua.lua")
# (find-flua "flua.lua")
# (find-flua "inc.lua")
#####
#
# Notes on my very old notes
# 1999mmmdd
#
#####
rm -Rv ~/CRIMNOTES/
mkdir ~/CRIMNOTES/
cd ~/CRIMNOTES/
cp ~/CRIM/crim1.html index.html
A=(
1-autod.4th
1.4th
1.aud
2-autod.4th
2.4th
2.aud
ETC
announce
autodoc.4th
crim.c
crimcomp.4th
letter
patchpfe
)
for i in $A; do cp ~/CRIM.old/CRIM000/$i $i.txt; done
mail -s 'Playing with inner interpreters' MISC@pisa.rockefeller.edu <<'---'
This is slightly off-topic but as Jeff was talking about instruction
sets (and as I'm not in condition to contribute directly to the F21
project right now -- no money, no time, finishing MsC thesis) I
decided to put some old notes on a toy inner interpreter on the web.
The address is
http://www.mat.puc-rio.br/~edrx/crim/
It was stupid to keep them for myself for so long.
Also I was able to run the F21 emulator under Linux using the DOS
emulator. It is trivial in some sense but it took me some hours to
configure everything, as I never used the DOS emulator before and I
don't have access to a DOS/Windows box. I'll try to write an
instructions-for-dummies-like-me text and make it available very soon.
If someone is anxious, please mail me.
[],
Eduardo Ochs
edrx@inx.com.br
edrx@mat.puc-rio.br
---
# Local Variables:
# coding: utf-8-unix
# End: