/* Automatic code generation program * Copyright Richard Heathfield 1999 * binary@eton.powernet.co.uk */ #include int main(void) { char *Lines[] = { "/* Automatic code generation program", " * Copyright Richard Heathfield 1999", " * binary@eton.powernet.co.uk", " */", "", "#include ", "", "int main(void)", "{", " char *Lines[] =", " {", " \"/* Automatic code generation program\",", " \" * Copyright Richard Heathfield 1999\",", " \" * binary@eton.powernet.co.uk\",", " \" */\",", " \"\",", " \"#include \",", " \"\",", " \"int main(void)\",", " \"{\",", " \" char *Lines[] =\",", " \" {\",", " \" \\\"/* Automatic code generation program\\\",\",", " \" \\\" * Copyright Richard Heathfield 1999\\\",\",", " \" \\\" * binary@eton.powernet.co.uk\\\",\",", " \" \\\" */\\\",\",", " \" \\\"\\\",\",", " \" \\\"#include \\\",\",", " \" \\\"\\\",\",", " \" \\\"int main(void)\\\",\",", " \" \\\"{\\\",\",", " \" \\\" char *Lines[] =\\\",\",", " \" \\\" {\\\",\",", " \" \\\" \\\\\\\"/* Automatic code generation program\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" * Copyright Richard Heathfield 1999\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" * binary@eton.powernet.co.uk\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" */\\\\\\\",\\\",\",", " \" \\\" \\\\\\\"\\\\\\\",\\\",\",", " \" \\\" \\\\\\\"#include \\\\\\\",\\\",\",", " \" \\\" \\\\\\\"\\\\\\\",\\\",\",", " \" \\\" \\\\\\\"int main(void)\\\\\\\",\\\",\",", " \" \\\" \\\\\\\"{\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" char *Lines[] =\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" {\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"/* GCG - The code generator generator\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" * Copyright 1999 Richard Heathfield\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" * binary@eton.powernet.co.uk\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" */\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"#include \\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"#include \\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"int main(void)\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"{\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" char *Intro[] =\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" {\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"/* Automatic code generation program\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" * Copyright Richard Heathfield 1999\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" * binary@eton.powernet.co.uk\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" */\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"#include \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"int main(void)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"{\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" char *Lines[] =\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" {\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" };\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" char *Outro[] =\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" {\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" };\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" int LineCount = sizeof Lines / sizeof Lines[0];\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" int i;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" for(i = 0; i < LineCount; i++)\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\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\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" int LineCount;\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" int i, ch;\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" int AtLineStart = 1;\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" LineCount = sizeof Intro / sizeof Intro[0];\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" for(i = 0; i < LineCount; i++)\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" {\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" printf(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"%s\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\", Intro[i]);\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" }\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" while((ch = getchar()) != EOF)\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" {\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" if(AtLineStart)\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" {\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" printf(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\" \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\");\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" AtLineStart = 0;\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" }\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" if(ch == \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\')\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" {\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" printf(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\");\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" AtLineStart = 1;\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" }\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" else if(strchr(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\", ch) != NULL)\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" {\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" putchar(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\');\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" }\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" putchar(ch);\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" }\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" LineCount = sizeof Outro / sizeof Outro[0];\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" for(i = 0; i < LineCount; i++)\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" {\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" printf(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"%s\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\", Outro[i]);\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" }\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\" return 0;\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"}\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" \\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\",\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" };\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" int LineCount = sizeof Lines / sizeof Lines[0];\\\\\\\",\\\",\",", " \" \\\" \\\\\\\"\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" int i;\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" for(i = 0; i < LineCount; i++)\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" {\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" printf(\\\\\\\\\\\\\\\"%s\\\\\\\\\\\\\\\\n\\\\\\\\\\\\\\\", Lines[i]);\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" }\\\\\\\",\\\",\",", " \" \\\" \\\\\\\"\\\\\\\",\\\",\",", " \" \\\" \\\\\\\" return 0;\\\\\\\",\\\",\",", " \" \\\" \\\\\\\"}\\\\\\\",\\\",\",", " \" \\\" };\\\",\",", " \" \\\" int LineCount = sizeof Lines / sizeof Lines[0];\\\",\",", " \" \\\"\\\",\",", " \" \\\" int i;\\\",\",", " \" \\\" for(i = 0; i < LineCount; i++)\\\",\",", " \" \\\" {\\\",\",", " \" \\\" printf(\\\\\\\"%s\\\\\\\\n\\\\\\\", Lines[i]);\\\",\",", " \" \\\" }\\\",\",", " \" \\\"\\\",\",", " \" \\\" return 0;\\\",\",", " \" \\\"}\\\",\",", " \" };\",", " \" int LineCount = sizeof Lines / sizeof Lines[0];\",", " \"\",", " \" int i;\",", " \" for(i = 0; i < LineCount; i++)\",", " \" {\",", " \" printf(\\\"%s\\\\n\\\", Lines[i]);\",", " \" }\",", " \"\",", " \" return 0;\",", " \"}\",", " };", " int LineCount = sizeof Lines / sizeof Lines[0];", "", " int i;", " for(i = 0; i < LineCount; i++)", " {", " printf(\"%s\\n\", Lines[i]);", " }", "", " return 0;", "}", }; int LineCount = sizeof Lines / sizeof Lines[0]; int i; for(i = 0; i < LineCount; i++) { printf("%s\n", Lines[i]); } return 0; }