pouët.net

Go to bottom

Nested by Resident [web]

//                   Nested
//             an 64k by Resident
//               September 2005
//      (will be shown) at 7D5 Demoparty
//
//                  Credits
//             code:  anesthetic
//            music:  flexi
//              gfx:  spritus
//
//           beta nesting: tesla
//
//                Tools used
//             graphics: OpenGL
//                sound: minifmod
//              packing: UPack
//
//    Should work fine with GeForce cards
//        Radeon users may try turning
//         display lists on and off.
//       Requires 512mb ram but 256mb
//      could do it as well, who knows?
//
//       We will not greet anyone here.
//               See the intro.
//
//     http://resident.tr-demoscene.info
//
//           The rest is quine code.
//        Compile this file to end with
//             readme.exe again.

#include <stdio.h>

#define CUTLINE 42
#define ENDLINE 69

void main (void)
{
        int i, j ;
        FILE *out ;
        char *line[] = {
                "//                   Nested",
                "//             an 64k by Resident",
                "//               September 2005",
                "//      (will be shown) at 7D5 Demoparty",
                "//",
                "//                  Credits",
                "//             code:  anesthetic",
                "//            music:  flexi",
                "//              gfx:  spritus",
                "//",
                "//           beta nesting: tesla",
                "//",
                "//                Tools used",
                "//             graphics: OpenGL",
                "//                sound: minifmod",
                "//              packing: UPack",
                "//",
                "//    Should work fine with GeForce cards",
                "//        Radeon users may try turning",
                "//         display lists on and off.",
                "//       Requires 512mb ram but 256mb",
                "//      could do it as well, who knows?",
                "//",
                "//       We will not greet anyone here.",
                "//               See the intro.",
                "//",
                "//     http://resident.tr-demoscene.info",
                "//",
                "//           The rest is quine code.",
                "//        Compile this file to end with",
                "//             readme.exe again.",
                "",
                "#include <stdio.h>",
                "",
                "#define CUTLINE 42",
                "#define ENDLINE 69",
                "",
                "void main (void)",
                "{",
                "        int i, j ;",
                "        FILE *out ;",
                "        char *line[] = {",
                "        } ;",
                "",
                "        out = fopen (\"quine-readme.c\", \"w\") ;",
                "",
                "        for (i = 0 ; i < CUTLINE ; i++)",
                "        {",
                "                fputs (line[i], out) ;",
                "                fputc ('\\n'   , out) ;",
                "        }",
                "        for (i = 0 ; i < ENDLINE ; i++)",
                "        {",
                "                fputs (\"                \\\"\", out) ;",
                "                for (j = 0 ; line[i][j] ; j++)",
                "                {",
                "                        if (line[i][j] == '\"' || line[i][j] == '\\\\') fputc ('\\\\', out) ;",
                "                        fputc (line[i][j], out) ;",
                "                }",
                "                fputs (\"\\\",\\n\", out) ;",
                "        }",
                "        for (i = CUTLINE ; i < ENDLINE ; i++)",
                "        {",
                "                fputs (line[i], out) ;",
                "                fputc ('\\n'   , out) ;",
                "        }",
                "",
                "        return ;",
                "}",
        } ;

        out = fopen ("quine-readme.c", "w") ;

        for (i = 0 ; i < CUTLINE ; i++)
        {
                fputs (line[i], out) ;
                fputc ('\n'   , out) ;
        }
        for (i = 0 ; i < ENDLINE ; i++)
        {
                fputs ("                \"", out) ;
                for (j = 0 ; line[i][j] ; j++)
                {
                        if (line[i][j] == '"' || line[i][j] == '\\') fputc ('\\', out) ;
                        fputc (line[i][j], out) ;
                }
                fputs ("\",\n", out) ;
        }
        for (i = CUTLINE ; i < ENDLINE ; i++)
        {
                fputs (line[i], out) ;
                fputc ('\n'   , out) ;
        }

        return ;
}
Go to top