From 7254f5f3b2fd9e1e3bcbb656ffa8fb1cdd2eeb13 Mon Sep 17 00:00:00 2001 From: asus Date: Tue, 23 Jan 2024 21:05:47 +0100 Subject: [PATCH] wip trying to do grace --- 2_Grace/Grace.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/2_Grace/Grace.c b/2_Grace/Grace.c index dfa4ada..523320c 100644 --- a/2_Grace/Grace.c +++ b/2_Grace/Grace.c @@ -1,14 +1,20 @@ #include -#define not_main main +#include -char *second_function() { - return "#include %c#define not_main main%c%cchar *second_function() {%c return %c%s%c;%c}%c%cint not_main() {%c /*comment*/%c FILE *file = fopen(%cGrace_kid.c%c, %cw%c);%c char *program = second_function();%c fprintf(file, program, 10, 10, 10, 10, 34, program, 34, 10, 10, 10, 10, 10, 34, 34, 34, 34, 10, 10, 10, 10, 10);%c return 0;%c}%c"; +#define QUINE(parenthesis) "\ +#include %c\ +#include %c\ +%c\ +#define QUINE(%c##parenthesis##%c) %C%s\ +%c\ +#define FT##parenthesis##x##parenthesis FT(x)%c\ +%c\ +FT(QUINE(()) + +#define FT(x) int main(){\ + FILE *file = fopen("Grace_kid.c", "w");\ + fprintf(file, x, 10, 10, 10, 10, 34, x, 34, 10, 10, 10, 10, 10, 34, 34, 34, 34, 10, 10, 10, 10, 10);\ + return 0;\ } -int not_main() { - /*comment*/ - FILE *file = fopen("Grace_kid.c", "w"); - char *program = second_function(); - fprintf(file, program, 10, 10, 10, 10, 34, program, 34, 10, 10, 10, 10, 10, 34, 34, 34, 34, 10, 10, 10, 10, 10); - return 0; -} +FT(QUINE('('))