Skip to Content

What follows is an old C program rebuilt as a SAP NetWeaver Portal component. Enjoy!

 

<*<strong> <p>package com.me;<p> </p></p></strong>

import com.sapportals.portal.prt.component.;</p>public classMichaelextendsAbstractPortalComponent

{

IPortalComponentResponse r;

charp = ‘!’;publicvoiddoContent(IPortalComponentRequest request, IPortalComponentResponse response)

{

r = response;

main(1, 0, null);

}

/* this code practically comments itself /</p>public<font size=”2″> </font>int<font size=”2″> main(</font>int<font size=”2″> t, </font>int<font size=”2″> ,</font>char<font size=”2″>[] a)</font> <p>{</p>return<font size=”2″> 1<t?(t<3?main(-79,-13,boink(a,main(-87,1-,</font> <p>boink(a, main(-86,0,boink(a,1))))))&0:0)(t<_?main(t1,_,a)&0:0)</p><p>main(-94,-27t,a)!=0&&t==2?_<13?</p>main(2,_+1,null<font size=”2″>):9:16:t<0?t<-72?main(_,t,</font>”@n’+,#’/{}w/w#cdnr/,{}r/de}+,/{,/w{%,/w#q#n,/#{l,/n{n,/#n,/#;#q#n,/+k#;,/’r :’d*’3,}{wK w’K:’}e#’;dq#’l q#’d’K#!/k#;q#’r}eKK#}w’r}eKK{nl]’/#;#q#n’){)#}w’){){nl]’/#n’;d}rw’ i;# ){nl]!/n{n#’; r{#w’r nc{nl]’/#{l,‘K {rw’ iK{;[{nl]’/w#q#n’wk nw’ iwk{KK{nl]!/w{%’l##w#’ i; :{nl]’/{q#’ld;r’}{nlwb!/de}’c ;;{nl’-{}rw]’/,}##’}#nc,’,#nw]’/kd’e};#’rdq#w! nr’/ ‘) }}{rl#'{n’ ‘)# }’}##(!!/”<font size=”2″>.toCharArray())</font> <p>:t<-50?_==(a[0])?putchar(a[31]):main(-65,_,boink(a,1)):</p>main(((a[0])==’/'<font size=”2″>?1:0)t,_,boink(a,1))</font> <p>:0<t?main(2,2,null<font size=”2″>):(a[0])==</font>’/'<font size=”2″>||(main(0,main(-61,a[0],</font></p>”!ek;dc i@bK'(q)-[w]%n+r3#l,{}:\nuwloca-O;m .vpbks,fxntdCeghiry”.toCharArray()),boink(a,1))!=0)?1:0;

}

/* boink pretends to do pointer arithmetic /</p>public<font size=”2″> </font>char<font size=”2″>[] boink(</font>char<font size=”2″>[] orig, </font>int<font size=”2″> start) {</font> <p>if<font size=”2″>(orig == </font>null<font size=”2″>) { </font>return<font size=”2″> </font>null<font size=”2″>; }</font></p>return<font size=”2″> </font>new<font size=”2″> String(orig, start, orig.length – start).toCharArray();</font> <p>}</p><p>/ this isn’t exactly what the “real” putchar does /</p><font size=”2″><p>int<font size=”2″> putchar(</font>char<font size=”2″> c) { </font></p></font><p>// if (_out == null) {</p><p>// r.write(new Character(p).toString());</p>r.write(new<font size=”2″> Character(c).toString());</font>if<font size=”2″> (c==</font>’.'<font size=”2″>) r.write(</font>”<p>”<font size=”2″>); </font><p>p = c;</p><p> </p><p>// } else {</p><p>// _out.appendText(new Character(c).toString());</p><p>// }</p>return*27;

}

}

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

  1. Dagfinn Parnas
    This really puts the holiday spirit in me (except from the headache from reading the self-commenting code).

    PS main method is called 69606 times and boink 66977 times

    (0) 

Leave a Reply