Error processing request

Parameters

CONTENT_LENGTH0
REQUEST_METHODGET
REQUEST_URI/revision/Simple+proc+tracing?V=3
QUERY_STRINGV=3
CONTENT_TYPE
DOCUMENT_URI/revision/Simple+proc+tracing
DOCUMENT_ROOT/var/www/nikit/nikit/nginx/../docroot
SCGI1
SERVER_PROTOCOLHTTP/1.1
HTTPSon
REMOTE_ADDR172.70.131.99
REMOTE_PORT51432
SERVER_PORT4443
SERVER_NAMEwiki.tcl-lang.org
HTTP_HOSTwiki.tcl-lang.org
HTTP_CONNECTIONKeep-Alive
HTTP_ACCEPT_ENCODINGgzip, br
HTTP_X_FORWARDED_FOR18.117.227.194
HTTP_CF_RAY87f48b6afcc4812d-ORD
HTTP_X_FORWARDED_PROTOhttps
HTTP_CF_VISITOR{"scheme":"https"}
HTTP_ACCEPT*/*
HTTP_USER_AGENTMozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; [email protected])
HTTP_CF_CONNECTING_IP18.117.227.194
HTTP_CDN_LOOPcloudflare
HTTP_CF_IPCOUNTRYUS

Body


Error

Unknow state transition: LINE -> END

-code

1

-level

0

-errorstack

INNER {returnImm {Unknow state transition: LINE -> END} {}} CALL {my render_wikit {Simple proc tracing} \[Richard\ Suchenwirth\]\ 2004-05-09\ —\ One\ of\ the\ simplest\ ways\ to\ndebug\ a\ \[proc\]\ is\ to\ edit\ in\ \[puts\]\ commands\ at\ interesting\ places.\ When\nsatisfied,\ one\ should\ remove\ those,\ else\ they\ may\ do\ their\ work\ at\nunwelcome\ times.\ One\ simple\ way\ to\ avoid\ this\ is\ the\ following:\n======\n\ proc\ dputs\ args\ \{puts\ \[join\ \$args\]\}\n\ #proc\ dputs\ args\ \{\}\n\ ...\n\ dputs\ value:\ \$value\n\ ...\n======\nIn\ your\ script,\ call\ ''dputs''\ wherever\ needed.\ With\ simple\ removal\ of\nthe\ #\ at\ the\ second\ definition,\ they\ will\ not\ have\ any\ effect\ (and\ be\noptimized\ out\ of\ the\ bytecode),\ and\ by\nediting\ a\ single\ character\ (the\ #)\ you\ can\ turn\ on\ or\ off\ the\ ''dputs''\nfunctionality.\n\nBut\ another\ idea\ I\ tried\ today\ is\ to\ \"instrument\"\ a\ proc's\ body\ for\ndebugging\ behavior.\ Now,\ parsing\ a\ proc\ body\ for\ suitable\ instrumentation\npoints\ is\ hard\ and\ bug-prone\ work,\ considering\ the\ many\ possibilities.\nBut\ one\ place\ in\ a\ proc\ body\ is\ bullet-proof\ to\ be\ executed\ in\ any\ case,\nnamely,\ its\ very\ beginning.\ To\ observe\ how\ procs\ are\ called,\ ''\[info\]\ level\ ?n?''\ gives\ us\ a\ great\ tool.\ So\ the\ following\ was\ easily\ written:\n======\n\ proc\ +trace\ proc\ \{\n\ \ \ \ proc\ \$proc\ \[info\ args\ \$proc\]\ \\\n\ \ \ \ \ \ \ \ \"puts\ \\\[info\ level\]:\\\[info\ level\ 0\]\\n#:\\n\[info\ body\ \$proc\]\"\n\ \}\n======\nEvery\ time\ a\ proc\ is\ called,\ which\ has\ been\ instrumented\ by\n''+trace'',\ it\ reports\ the\ whole\ call\ line,\ including\ its\ name\ and\narguments\ (by\ value).\ This\ modification\ to\ the\ proc\ body\ happens\ only\ in\ memory\ (not\ in\ the\ source\ file),\nso\ when\ next\ starting\ the\ app,\ the\ trace\ is\ gone.\ This\ simple\ mechanism\nmakes\ experimenting,\ expecially\ with\ recursion,\ even\ easier\ than\ it\ was.\nTo\ remove\ a\ +trace\ from\ a\ proc\ body\ is\ easy\ too,\ and\ harmless\ when\ it\ is\naccidentally\ called\ on\ a\ not-instrumented\ proc,\ if\ you\ just\ choose\ a\nmarker\ comment\ (#:\ here)\ that\ doesn't\ appear\ elsewhere\ in\ your\ code:\n======\n\ proc\ -trace\ proc\ \{\n\ \ \ \ regsub\ .+#:\\n\ \[info\ body\ \$proc\]\ \"\"\ body\n\ \ \ \ proc\ \$proc\ \[info\ args\ \$proc\]\ \$body\n\ \}\n#--\ Testing,\ with\ the\ indispensable\ GCD\ example:\n\ proc\ gcd\ \{u\ v\}\ \{expr\ \{\$u?\ \[gcd\ \[expr\ \$v%\$u\]\ \$u\]:\ \$v\}\}\n\ +trace\ gcd\n\ puts\ with:\[gcd\ 360\ 123\]\n\ -trace\ gcd\n\ puts\ without:\[gcd\ 360\ 123\]\ \n======\nproduces\ first\ the\ traced\ call\ history,\ and\ then\ nothing\ but\ the\ result:\n\ 1:gcd\ 360\ 123\n\ 2:gcd\ 123\ 360\n\ 3:gcd\ 114\ 123\n\ 4:gcd\ 9\ 114\n\ 5:gcd\ 6\ 9\n\ 6:gcd\ 3\ 6\n\ 7:gcd\ 0\ 3\n\ with:3\n\ without:3\nDocumented\ feature\ (=bug\ :):\ the\ code\ above\ works\ only\ for\ procs\ without\ndefault\ arguments.\ If\ you\ want\ these\ too,\ replace\ the\ calls\ to\ ''info\nargs''\ in\ +trace\ and\ -trace\ with\ just\ ''args'',\ and\ add\ this\ one:\n======\n\ proc\ args\ proc\ \{\n\ \ \ \ set\ res\ \{\}\n\ \ \ \ foreach\ a\ \[info\ args\ \$proc\]\ \{\n\ \ \ \ \ \ \ \ if\ \[info\ default\ \$proc\ \$a\ def\]\ \{lappend\ a\ \$def\}\n\ \ \ \ \ \ \ \ lappend\ res\ \$a\n\ \ \ \ \}\n\ \ \ \ set\ res\n\ \}\n#--\ Testing\ again:\n\ proc\ foo\ \{a\ \{b\ 1\}\}\ \{expr\ \$a+\$b\}\n\ puts\ args:\[args\ foo\]\n=====\n\ args:a\ \{b\ 1\}\n----\nSee\ also\ \[trace\]\ for\ the\ new\ ''trace\ execution''\ features\ -\ however,\ my\ 8.4a2\ doesn't\ have\ them\ yet,\ and\ just\ to\ use\ that\ appeared\ to\ me\ more\ complex\ than\ +/-trace...\n<<categories>>Arts\ and\ crafts\ of\ Tcl-Tk\ programming regexp2} CALL {my render {Simple proc tracing} \[Richard\ Suchenwirth\]\ 2004-05-09\ —\ One\ of\ the\ simplest\ ways\ to\ndebug\ a\ \[proc\]\ is\ to\ edit\ in\ \[puts\]\ commands\ at\ interesting\ places.\ When\nsatisfied,\ one\ should\ remove\ those,\ else\ they\ may\ do\ their\ work\ at\nunwelcome\ times.\ One\ simple\ way\ to\ avoid\ this\ is\ the\ following:\n======\n\ proc\ dputs\ args\ \{puts\ \[join\ \$args\]\}\n\ #proc\ dputs\ args\ \{\}\n\ ...\n\ dputs\ value:\ \$value\n\ ...\n======\nIn\ your\ script,\ call\ ''dputs''\ wherever\ needed.\ With\ simple\ removal\ of\nthe\ #\ at\ the\ second\ definition,\ they\ will\ not\ have\ any\ effect\ (and\ be\noptimized\ out\ of\ the\ bytecode),\ and\ by\nediting\ a\ single\ character\ (the\ #)\ you\ can\ turn\ on\ or\ off\ the\ ''dputs''\nfunctionality.\n\nBut\ another\ idea\ I\ tried\ today\ is\ to\ \"instrument\"\ a\ proc's\ body\ for\ndebugging\ behavior.\ Now,\ parsing\ a\ proc\ body\ for\ suitable\ instrumentation\npoints\ is\ hard\ and\ bug-prone\ work,\ considering\ the\ many\ possibilities.\nBut\ one\ place\ in\ a\ proc\ body\ is\ bullet-proof\ to\ be\ executed\ in\ any\ case,\nnamely,\ its\ very\ beginning.\ To\ observe\ how\ procs\ are\ called,\ ''\[info\]\ level\ ?n?''\ gives\ us\ a\ great\ tool.\ So\ the\ following\ was\ easily\ written:\n======\n\ proc\ +trace\ proc\ \{\n\ \ \ \ proc\ \$proc\ \[info\ args\ \$proc\]\ \\\n\ \ \ \ \ \ \ \ \"puts\ \\\[info\ level\]:\\\[info\ level\ 0\]\\n#:\\n\[info\ body\ \$proc\]\"\n\ \}\n======\nEvery\ time\ a\ proc\ is\ called,\ which\ has\ been\ instrumented\ by\n''+trace'',\ it\ reports\ the\ whole\ call\ line,\ including\ its\ name\ and\narguments\ (by\ value).\ This\ modification\ to\ the\ proc\ body\ happens\ only\ in\ memory\ (not\ in\ the\ source\ file),\nso\ when\ next\ starting\ the\ app,\ the\ trace\ is\ gone.\ This\ simple\ mechanism\nmakes\ experimenting,\ expecially\ with\ recursion,\ even\ easier\ than\ it\ was.\nTo\ remove\ a\ +trace\ from\ a\ proc\ body\ is\ easy\ too,\ and\ harmless\ when\ it\ is\naccidentally\ called\ on\ a\ not-instrumented\ proc,\ if\ you\ just\ choose\ a\nmarker\ comment\ (#:\ here)\ that\ doesn't\ appear\ elsewhere\ in\ your\ code:\n======\n\ proc\ -trace\ proc\ \{\n\ \ \ \ regsub\ .+#:\\n\ \[info\ body\ \$proc\]\ \"\"\ body\n\ \ \ \ proc\ \$proc\ \[info\ args\ \$proc\]\ \$body\n\ \}\n#--\ Testing,\ with\ the\ indispensable\ GCD\ example:\n\ proc\ gcd\ \{u\ v\}\ \{expr\ \{\$u?\ \[gcd\ \[expr\ \$v%\$u\]\ \$u\]:\ \$v\}\}\n\ +trace\ gcd\n\ puts\ with:\[gcd\ 360\ 123\]\n\ -trace\ gcd\n\ puts\ without:\[gcd\ 360\ 123\]\ \n======\nproduces\ first\ the\ traced\ call\ history,\ and\ then\ nothing\ but\ the\ result:\n\ 1:gcd\ 360\ 123\n\ 2:gcd\ 123\ 360\n\ 3:gcd\ 114\ 123\n\ 4:gcd\ 9\ 114\n\ 5:gcd\ 6\ 9\n\ 6:gcd\ 3\ 6\n\ 7:gcd\ 0\ 3\n\ with:3\n\ without:3\nDocumented\ feature\ (=bug\ :):\ the\ code\ above\ works\ only\ for\ procs\ without\ndefault\ arguments.\ If\ you\ want\ these\ too,\ replace\ the\ calls\ to\ ''info\nargs''\ in\ +trace\ and\ -trace\ with\ just\ ''args'',\ and\ add\ this\ one:\n======\n\ proc\ args\ proc\ \{\n\ \ \ \ set\ res\ \{\}\n\ \ \ \ foreach\ a\ \[info\ args\ \$proc\]\ \{\n\ \ \ \ \ \ \ \ if\ \[info\ default\ \$proc\ \$a\ def\]\ \{lappend\ a\ \$def\}\n\ \ \ \ \ \ \ \ lappend\ res\ \$a\n\ \ \ \ \}\n\ \ \ \ set\ res\n\ \}\n#--\ Testing\ again:\n\ proc\ foo\ \{a\ \{b\ 1\}\}\ \{expr\ \$a+\$b\}\n\ puts\ args:\[args\ foo\]\n=====\n\ args:a\ \{b\ 1\}\n----\nSee\ also\ \[trace\]\ for\ the\ new\ ''trace\ execution''\ features\ -\ however,\ my\ 8.4a2\ doesn't\ have\ them\ yet,\ and\ just\ to\ use\ that\ appeared\ to\ me\ more\ complex\ than\ +/-trace...\n<<categories>>Arts\ and\ crafts\ of\ Tcl-Tk\ programming} CALL {my revision {Simple proc tracing}} CALL {::oo::Obj6370511 process revision/Simple+proc+tracing} CALL {::oo::Obj6370509 process}

-errorcode

NONE

-errorinfo

Unknow state transition: LINE -> END
    while executing
"error $msg"
    (class "::Wiki" method "render_wikit" line 6)
    invoked from within
"my render_$default_markup $N $C $mkup_rendering_engine"
    (class "::Wiki" method "render" line 8)
    invoked from within
"my render $name $C"
    (class "::Wiki" method "revision" line 31)
    invoked from within
"my revision $page"
    (class "::Wiki" method "process" line 56)
    invoked from within
"$server process [string trim $uri /]"

-errorline

4