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