|
|
1.1 ! root 1: # IPSPLIT ! 2: # ! 3: # Split Icon program into separate files ! 4: # ! 5: # Ralph E. Griswold ! 6: # ! 7: # Last modified 4/29/86 ! 8: # ! 9: ! 10: procedure main(o) ! 11: local line, x, i, proctable, proclist, comments, gfile, ofile ! 12: comments := [] ! 13: if o[1] := "-g" then gfile := open(o[2],"w") | ! 14: stop("usage: i-split [-g file]") ! 15: proctable := table() ! 16: while line := read() do { ! 17: if line ? { ! 18: ="procedure" & # procedure declaration ! 19: tab(many(' ')) & ! 20: proctable[tab(upto('('))] := x := [] ! 21: } then { ! 22: while put(x,get(comments)) # save it ! 23: put(x,line) ! 24: i := 1 ! 25: while line := read() do { ! 26: put(x,line) ! 27: if line == "end" then break ! 28: } ! 29: } ! 30: # other declarations ! 31: else if \gfile & line ? =("global" | "record" | "link") ! 32: then { ! 33: while write(gfile,get(comments)) ! 34: write(gfile,line) ! 35: } ! 36: else put(comments,line) ! 37: } ! 38: while write(\gfile,get(comments)) ! 39: proclist := sort(proctable,3) # sort procedures ! 40: while x := get(proclist) do { # output procedures ! 41: ofile := open(x || ".icn","w") | stop("cannot write ",x,".icn") ! 42: every write(ofile,!get(proclist)) ! 43: close(ofile) ! 44: } ! 45: end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.