[Vala] Vala Quine?



using GLib;

/* Do we have a Vala quine yet? */
public class Quine
{
  public static void main(string[] args)
  {
    var s0 = "using GLib;%c%c/* Do we have a Vala quine yet? */%c";
    var s1 = "public class Quine%c{%c  ";
    var s2 = "public static void main(";
    var s3 = "string[] args)%c  {%c";
    var s4 = "    var s%d = %c%s%c;%c    var s%d = %c%s%c;%c";
    var s5 = "    var n = '%cn', q='%c', b = '%c%c';%c";
    var s6 = "    stdout.printf (";
    var s7 = "%ss0,n,n,n);%ss1,n,n);%c%ss2);%ss3,n,n);%c";
    var s8 = "%ss4,0,q,s0,q,n,1,q,s1,q,n);%c%ss4,2,q,s2,q,n,3,q,s3,q,n);%c";
    var s9 = "%ss4,4,q,s4,q,n,5,q,s5,q,n);%c%ss4,6,q,s6,q,n,7,q,s7,q,n);%c";
    var s10 = "%ss4,8,q,s8,q,n,9,q,s9,q,n);%c%ss4,10,q,s10,q,n,11,q,s11,q,n);%c";
    var s11 = "%ss4,12,q,s12,q,n,13,q,s13,q,n);%c%ss4,14,q,s14,q,n,15,q,s15,q,n);%c";
    var s12 = "%ss5,b,q,b,b,n);%ss7,s6,s6,n,s6,s6,n);%c%ss8,s6,n,s6,n);";
    var s13 = "%ss9,s6,n,s6,n);%c%ss10,s6,n,s6,n);%ss11,s6,n,s6,n);%c%ss12,s6,s6,n,s6);";
    var s14 = "%ss13,s6,n,s6,s6,n,s6);%c%ss14,s6,n,s6,s6,n);%ss15,n,n,n);%c";
    var s15 = "  }%c}%c/* Ref: http://www.madore.org/~david/computers/quine.html */%c";
    var n = '\n', q='"', b = '\\';
    stdout.printf (s0,n,n,n);    stdout.printf (s1,n,n);
    stdout.printf (s2);    stdout.printf (s3,n,n);
    stdout.printf (s4,0,q,s0,q,n,1,q,s1,q,n);
    stdout.printf (s4,2,q,s2,q,n,3,q,s3,q,n);
    stdout.printf (s4,4,q,s4,q,n,5,q,s5,q,n);
    stdout.printf (s4,6,q,s6,q,n,7,q,s7,q,n);
    stdout.printf (s4,8,q,s8,q,n,9,q,s9,q,n);
    stdout.printf (s4,10,q,s10,q,n,11,q,s11,q,n);
    stdout.printf (s4,12,q,s12,q,n,13,q,s13,q,n);
    stdout.printf (s4,14,q,s14,q,n,15,q,s15,q,n);
    stdout.printf (s5,b,q,b,b,n);    stdout.printf (s7,s6,s6,n,s6,s6,n);
    stdout.printf (s8,s6,n,s6,n);    stdout.printf (s9,s6,n,s6,n);
    stdout.printf (s10,s6,n,s6,n);    stdout.printf (s11,s6,n,s6,n);
    stdout.printf (s12,s6,s6,n,s6);    stdout.printf (s13,s6,n,s6,s6,n,s6);
    stdout.printf (s14,s6,n,s6,s6,n);    stdout.printf (s15,n,n,n);
  }
}
/* Ref: http://www.madore.org/~david/computers/quine.html */

Attachment: signature.asc
Description: Digital signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]