From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- web/noweb/src/icon/icondefs.icn | 77 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 web/noweb/src/icon/icondefs.icn (limited to 'web/noweb/src/icon/icondefs.icn') diff --git a/web/noweb/src/icon/icondefs.icn b/web/noweb/src/icon/icondefs.icn new file mode 100644 index 0000000000..2a36826fb6 --- /dev/null +++ b/web/noweb/src/icon/icondefs.icn @@ -0,0 +1,77 @@ +#line 2 "icondefs.nw" +global showlocal +procedure main(args) + showlocal := !args == "-local" + go() +end +#line 8 "icondefs.nw" +procedure postpass(name, arg) + static kind, definers + initial { kind := "bogus" + definers := ["global"] + if \showlocal then every put(definers, "local" | "static") + } + case name of { + "begin" : arg ? kind := tab(upto(' ')|0) + "text" : if kind == "code" then arg ? + if =("procedure "|"record ") then { + tab(many(' ')) + writedefn(tab(upto(' ()'))) + } else if (tab(many(' ')) | "", =!definers, tab(many(' '))) then { + while (not any('#')) & writedefn(tab(upto(', #'))) do tab(many(', ')) + if not any('#') then writedefn(tab(0)) + } + } + return +end + +procedure prepass(name, arg) + if name == "end" then writedefn(&null) # force newline +end +#line 32 "icondefs.nw" +procedure rcsinfo () + return "$Id: icondefs.nw,v 1.18 2008/10/06 01:03:05 nr Exp nr $" || + "$Name: v2_12 $" +end +#line 1 "defns.nw" +procedure go() + local line + while line := read() do { + apply(prepass, line) + write(line) + if match("@fatal ", line) then exit(1) + apply(postpass, line) + } +end + +procedure apply(pass, line) + line ? (="@" & pass(tab(upto(' ')|0), if =" " then tab(0) else &null)) +end +#line 18 "defns.nw" +procedure writedefn(defn, locl) + static indextext + initial indextext := "" + if /defn then + *indextext > 0 & +#line 31 "defns.nw" +{ # write("@index nl") # don't! + indextext := "" +} +#line 23 "defns.nw" + else { + if *indextext + *defn > 65 then +#line 31 "defns.nw" +{ # write("@index nl") # don't! + indextext := "" +} +#line 25 "defns.nw" + write(if \locl then "@index localdefn " else "@index defn ", defn) + indextext ||:= " " || defn + } + return +end +#line 35 "defns.nw" +procedure rcsinfo_too () + return "$Id: defns.nw,v 1.18 2008/10/06 01:03:05 nr Exp nr $" || + "$Name: v2_12 $" +end -- cgit v1.2.3