wip grace - using macro to print program less macro
This commit is contained in:
@@ -1,20 +1,9 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define QUINE(parenthesis) "\
|
||||
#include <stdio.h>%c\
|
||||
#include <unistd.h>%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);\
|
||||
#define PRINT quine, 10, 10, 34, quine, 34, 10, 10, 10, 10, 10
|
||||
#define FT int main(){\
|
||||
char *quine = "#include <stdio.h>%c#define FT int main(){%c char *quine = %c%s%c;%c printf(PRINT);%c return 0;%c}%cFT%c";\
|
||||
printf(PRINT);\
|
||||
return 0;\
|
||||
}
|
||||
|
||||
FT(QUINE('('))
|
||||
FT
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
NAME = Grace
|
||||
SRCS = Grace.c
|
||||
CLONE = $(NAME)_kid.c
|
||||
CREATE_CLONE = ./$(NAME)
|
||||
CREATE_CLONE = ./$(NAME) > $(CLONE)
|
||||
|
||||
include ../MakefileCommon
|
||||
|
||||
|
||||
Reference in New Issue
Block a user