{"id":497,"date":"2018-03-21T12:25:46","date_gmt":"2018-03-21T11:25:46","guid":{"rendered":"https:\/\/www.hsu-hh.de\/hisalt\/?page_id=497"},"modified":"2018-03-21T12:25:46","modified_gmt":"2018-03-21T11:25:46","slug":"scd","status":"publish","type":"page","link":"https:\/\/www.hsu-hh.de\/hisalt\/scd","title":{"rendered":"SCD"},"content":{"rendered":"<p>********************************************************************************<br \/>\n* *<br \/>\n* *<br \/>\n* SNOBOL4 Program to adapt DUKE DDP &#8222;beta code&#8220; output *<br \/>\n* to beta code standards *<br \/>\n* (c) B.Meissner, Universitaet der Bundeswehr, Hamburg *<br \/>\n* *<br \/>\n********************************************************************************<br \/>\n-plusops 1<br \/>\n&amp;trim = 1<br \/>\n&amp;anchor = 1<br \/>\nnumbers = &#8222;0123456789&#8220;<br \/>\nucase = &amp;ucase<br \/>\nlcase = &amp;lcase<br \/>\nhtmlcodes = table(1001)<br \/>\nhtmlcodes&lt;&#8222;rpar&#8220;&gt; = &#8222;]1&#8220;<br \/>\nhtmlcodes&lt;&#8222;lpar&#8220;&gt; = &#8222;[1&#8220;<br \/>\nhtmlcodes&lt;&#8222;lt&#8220;&gt; = &#8222;]2&#8220;<br \/>\nhtmlcodes&lt;&#8222;gt&#8220;&gt; = &#8222;[2&#8220;<br \/>\nhtml_pat = pos(0) breakx(&#8222;&amp;&#8220;) . fp len(1) break(&#8222;;&#8220;) . code &#8222;;&#8220;<br \/>\nemptypat = pos(0) span(char(32) numbers char(9)) rpos(0)<br \/>\n* REPL(S1,S2,S3) WILL DO A STRING-BY-STRING REPLACEMENT ON S1<br \/>\n* (with the anchored, improved algorithm using BREAKX):<br \/>\n*<br \/>\nDEFINE(&#8218;REPL(S1,S2,S3)C,T,FINDC&#8216;) :(REPL_END)<br \/>\nREPL S2 LEN(1) . C :F(FRETURN)<br \/>\nFINDC = BREAKX(C) . T S2<br \/>\nREPL_1 S1 FINDC = :F(REPL_2)<br \/>\nREPL = REPL T S3 :(REPL_1)<br \/>\nREPL_2 REPL = REPL S1 :(RETURN)<br \/>\nREPL_END<br \/>\ndefine(&#8222;html_code(string)fp,code,c&#8220;) :(html_code_end)<br \/>\nhtml_code<br \/>\n+ string ? html_pat = :f(html_code_return)<br \/>\nc = htmlcodes&lt;code&gt;<br \/>\nc = ident(c) &#8220; &amp;&#8220; code &#8222;; &#8220;<br \/>\nhtml_code = html_code<br \/>\n+ fp<br \/>\n+ c :(html_code)<br \/>\nhtml_code_return<br \/>\n+ html_code = html_code string :(return)<br \/>\nhtml_code_end<br \/>\n*<br \/>\n*<br \/>\n* DOT_REPLACE replaces the idiosyncratic &#8222;.c 12&#8220; etc.<br \/>\n* signs by a kind of coding ahich is more beta code conformant:<br \/>\n*<br \/>\n*<br \/>\ndefine(&#8222;dot_replace(string)ifp,numberer&#8220;) :(dot_replace_end)<br \/>\ndot_replace<br \/>\n+ string ? pos(0) breakx(&#8222;.&#8220;) . fp len(1) &#8222;c&#8220; span(char(32))<br \/>\n+ span(numbers) . number = :f(dot_replace_ret)<br \/>\ndot_replace = dot_replace fp<br \/>\n+ dupl(char(32) &#8222;?&#8220;,number) :(dot_replace)<br \/>\ndot_replace_ret<br \/>\n+ dot_replace = dot_replace string :(return)<br \/>\ndot_replace_end<br \/>\n*<br \/>\n*<br \/>\n* Count() is used to take away leading line numbers<br \/>\n* it determines if a number is by step larger as the last<br \/>\n* counter, and if so, regards the number as the next counter<br \/>\n* (and eventually it will be removed), increasing the counter by step<br \/>\n*<br \/>\n*<br \/>\ncounter = 0<br \/>\ndefine(&#8222;count(argument,step)&#8220;) :(count_end)<br \/>\ncount eq(argument,counter + step) :f(freturn)<br \/>\ncounter = counter + step :(return)<br \/>\ncount_end<br \/>\n+ system = &#8222;Snobol4+&#8220;<br \/>\n&amp;ERRLIMIT = 4; SETEXIT(CONTINUE)<br \/>\nsystem = host()<br \/>\n* Get system type:<br \/>\n&amp;ERRLIMIT = 0<br \/>\nsystem =<br \/>\n+ ?(system ? breakx(&#8222;C&#8220;) &#8222;CSNOBOL&#8220; )<br \/>\n+ &#8222;Linux&#8220;<br \/>\nsystem = ?(system ? breakx(&#8222;M&#8220;) &#8222;Macro SPITBOL&#8220;) &#8222;Spitbol&#8220;<br \/>\n*<br \/>\n* Write stand-alone modules or runtime save files:<br \/>\n*<br \/>\n*<br \/>\n* If MacroSPITBOL is present, we write an execution module:<br \/>\n*<br \/>\nident(system,&#8220;Spitbol&#8220;) exit(3,&#8220;duke.exe&#8220;)<br \/>\n*<br \/>\n* If running under Snobol4+, we open a new output channel and write a save module:<br \/>\n*<br \/>\nident(system,&#8220;Snobol4+&#8220;) output(.saveout,16,,&#8220;duke.sav&#8220;)<br \/>\nident(system,&#8220;Snobol4+&#8220;) save(16) :s(end)<br \/>\n*<br \/>\n&amp;ERRLIMIT = 4; SETEXIT(CONTINUE)<br \/>\nparms = &amp;parm<br \/>\n*<br \/>\n* Special command line treatment for SNOBOL4+ (program name as first parameter):<br \/>\n*<br \/>\nparms pos(0) (SPAN(SPACE) | &#8220;) break(space) rem . parms<br \/>\n*<br \/>\n* Get parameters for SPITBOL\/CSnobol4:<br \/>\n*<br \/>\nparms = host(0)<br \/>\n*<br \/>\n* Reset error limit to zero:<br \/>\n*<br \/>\n&amp;ERRLIMIT = 0<br \/>\nterminal = &#8222;DUKE &#8211; program to normalize DDP &#8218;beta code'&#8220;<br \/>\nterminal = &#8220; (c) Burkhard Meissner, 2006&#8243;<br \/>\nparms pos(0) (span(&#8220; &#8222;) | &#8222;&#8220;) break(&#8220; &#8220; char(9)) . infile<br \/>\n+ span(char(32) char(9)) (break(&#8220; &#8220; char(9) &#8222;\/-&#8222;) | rem) . outfile<br \/>\n+ :f(nofile)<br \/>\nterminal = &#8222;Opening files:&#8220;<br \/>\nterminal = &#8222;In: &#8220; infile<br \/>\nterminal = &#8222;Out: &#8220; outfile<br \/>\n*<br \/>\n* Open files. We open the output file in binary mode to continue lines,<br \/>\n* if necessary:<br \/>\n* (1) SNOBOL4 Version:<br \/>\n*<br \/>\n(<br \/>\n+ ident(system,&#8220;Linux&#8220;)<br \/>\n+ ,<br \/>\n+ ident(system,&#8220;Snobol4+&#8220;)<br \/>\n+ )<br \/>\n+ :f(test_linux)<br \/>\n* open input file:<br \/>\ninput(.in,1, ,infile) :f(nofile)<br \/>\n* open output file:<br \/>\noutput(.out,2, ,outfile) :s(program_start)f(nofile)<br \/>\n*<br \/>\n* (2) SPITBOL Version:<br \/>\n*<br \/>\ntest_linux<br \/>\n+ ident(system,&#8220;Spitbol&#8220;) :f(system_error)<br \/>\nsetexit(continue)<br \/>\n&amp;errlimit = 2<br \/>\ninput(.in,1,infile &#8222;[-l1000]&#8220;) :f(nofile)<br \/>\noutput(.out,2,outfile &#8222;[-l1000]&#8220;) :f(nofile)<br \/>\n&amp;errlimit = 0<br \/>\nsetexit() :(program_start)<br \/>\nprogram_start<br \/>\n*<br \/>\nagain line = in :f(done)<br \/>\nnumber =<br \/>\npad =<br \/>\n(<br \/>\n+ ident(line)<br \/>\n+ ,<br \/>\n+ ?(line ? emptypat)<br \/>\n+ ) :s(again)<br \/>\nline pos(0) span(numbers) . number<br \/>\n+ (<br \/>\n+ char(9)<br \/>\n+ |<br \/>\n+ span(char(32))<br \/>\n+ ) . pad<br \/>\n+ = :f(kill_number)<br \/>\n*<br \/>\n*<br \/>\n* We determine, if line counter:<br \/>\n*<br \/>\n*<br \/>\ncount(number,5)<br \/>\n+ (<br \/>\n+ ident(pad,char(9))<br \/>\n+ ,<br \/>\n+ ident(size(pad),8 &#8211; size(number))<br \/>\n+ ) :s(kill_number)<br \/>\nline = line number pad<br \/>\nkill_number<br \/>\n+ line = dot_replace(line)<br \/>\nline = html_code(line)<br \/>\nline = repl(line,&#8220;[[&#8222;,&#8220;[4&#8243;)<br \/>\nline = repl(line,&#8220;]]&#8220;,&#8220;]4&#8243;)<br \/>\nline = repl(line,&#8220;&lt;&#8222;,&#8220;[2&#8243;)<br \/>\nline = repl(line,&#8220;&gt;&#8220;,&#8220;]2&#8243;)<br \/>\nline = repl(line,&#8220;[chirho&#8220;,&#8220;#322&#8243;)<br \/>\nline = replace(line,lcase,ucase)<br \/>\nout = line :(again)<br \/>\nsystem_error<br \/>\n+ terminal = &#8222;*** Unknown SNOBOL4 system &#8211; aborted ***&#8220;<br \/>\n+ :(end)<br \/>\ndone terminal = &#8222;Finished converting file&#8220; :(end)<br \/>\nnofile<br \/>\n+ terminal = &#8222;Usage: DUKE infile outfile&#8220; :(end)<br \/>\nend<\/p>\n","protected":false},"excerpt":{"rendered":"<p>******************************************************************************** * * * * * SNOBOL4 Program to adapt DUKE DDP &#8222;beta code&#8220; output * * to beta code standards * * (c) B.Meissner, Universitaet der Bundeswehr, Hamburg * [&hellip;]<\/p>\n","protected":false},"author":185,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-497","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.hsu-hh.de\/hisalt\/wp-json\/wp\/v2\/pages\/497","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hsu-hh.de\/hisalt\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.hsu-hh.de\/hisalt\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.hsu-hh.de\/hisalt\/wp-json\/wp\/v2\/users\/185"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hsu-hh.de\/hisalt\/wp-json\/wp\/v2\/comments?post=497"}],"version-history":[{"count":1,"href":"https:\/\/www.hsu-hh.de\/hisalt\/wp-json\/wp\/v2\/pages\/497\/revisions"}],"predecessor-version":[{"id":498,"href":"https:\/\/www.hsu-hh.de\/hisalt\/wp-json\/wp\/v2\/pages\/497\/revisions\/498"}],"wp:attachment":[{"href":"https:\/\/www.hsu-hh.de\/hisalt\/wp-json\/wp\/v2\/media?parent=497"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hsu-hh.de\/hisalt\/wp-json\/wp\/v2\/categories?post=497"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hsu-hh.de\/hisalt\/wp-json\/wp\/v2\/tags?post=497"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}