removed exploded files from gitignore
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -58,4 +58,7 @@ a.out
|
|||||||
Colleen_*.c
|
Colleen_*.c
|
||||||
Grace_*.c
|
Grace_*.c
|
||||||
Sully_*.c
|
Sully_*.c
|
||||||
|
!Colleen_exploded.c
|
||||||
|
!Grace_exploded.c
|
||||||
|
!Sully_exploded.c
|
||||||
*test*
|
*test*
|
||||||
|
|||||||
32
1_Colleen/Colleen_exploded.c
Normal file
32
1_Colleen/Colleen_exploded.c
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
comment outside
|
||||||
|
*/
|
||||||
|
#include <stdio.h>
|
||||||
|
\
|
||||||
|
char *second_function() \
|
||||||
|
{ \
|
||||||
|
return "\
|
||||||
|
/*%c comment outside%c*/%c\
|
||||||
|
#include <stdio.h>%c\
|
||||||
|
char *second_function() \
|
||||||
|
{ \
|
||||||
|
return %c%s%c; \
|
||||||
|
}%c\
|
||||||
|
int main() \
|
||||||
|
{ \
|
||||||
|
char *program = second_function(); \
|
||||||
|
printf(program, 10, 10, 10, 10, 34, program, 34, 10, 10, 10, 10, 10, 10); \
|
||||||
|
return 0;%c \
|
||||||
|
/*%c comment inside%c */%c\
|
||||||
|
}%c\
|
||||||
|
"; \
|
||||||
|
}
|
||||||
|
int main() \
|
||||||
|
{ \
|
||||||
|
char *program = second_function(); \
|
||||||
|
printf(program, 10, 10, 10, 10, 34, program, 34, 10, 10, 10, 10, 10, 10); \
|
||||||
|
return 0;
|
||||||
|
/*
|
||||||
|
comment inside
|
||||||
|
*/
|
||||||
|
}
|
||||||
18
2_Grace/Grace_exploded.c
Normal file
18
2_Grace/Grace_exploded.c
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#define xstr(s) #s
|
||||||
|
#define str(s) xstr(s)
|
||||||
|
#define MAIN(s) \
|
||||||
|
int main() \
|
||||||
|
{ \
|
||||||
|
char *before = "#include <stdio.h>\n#define xstr(s) #s\n#define str(s) xstr(s)\n#define MAIN(s) "; \
|
||||||
|
char *quine = s; \
|
||||||
|
char *after = "\n/*\n comment\n*/\nMAIN(str(MAIN(s)))\n"; \
|
||||||
|
FILE *file = fopen("Grace_kid.c", "w"); \
|
||||||
|
fprintf(file, "%s%s%s", before, quine, after); \
|
||||||
|
fclose(file); \
|
||||||
|
return 0; \
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
comment
|
||||||
|
*/
|
||||||
|
MAIN(str(MAIN(s)))
|
||||||
56
3_Sully/Sully_exploded.c
Normal file
56
3_Sully/Sully_exploded.c
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
#define _GNU_SOURCE /* for asprintf */
|
||||||
|
#include <stdlib.h> /* for free and system */
|
||||||
|
#include <stdio.h>
|
||||||
|
#define xstr(s) #s
|
||||||
|
#define str(s) xstr(s)
|
||||||
|
#define FT(s) \
|
||||||
|
int main() \
|
||||||
|
{ \
|
||||||
|
\
|
||||||
|
char *before = \
|
||||||
|
"\
|
||||||
|
#define _GNU_SOURCE /* for asprintf */\n\
|
||||||
|
#include <stdlib.h> /* for free and system */\n\
|
||||||
|
#include <stdio.h>\n\
|
||||||
|
#define xstr(s) #s\n\
|
||||||
|
#define str(s) xstr(s)\n\
|
||||||
|
#define FT(s) \
|
||||||
|
"; \
|
||||||
|
char *quine = s; \
|
||||||
|
char *after = \
|
||||||
|
"\
|
||||||
|
\n\
|
||||||
|
int i = %i;\n\
|
||||||
|
FT(str(FT(s)))\n\
|
||||||
|
"; \
|
||||||
|
\
|
||||||
|
i--; \
|
||||||
|
\
|
||||||
|
char *kid_name; \
|
||||||
|
char *kid_name_c; \
|
||||||
|
char *decremented_after; \
|
||||||
|
char *cmd; \
|
||||||
|
asprintf(&kid_name, "Sully_%i", i); \
|
||||||
|
asprintf(&kid_name_c, "%s.c", kid_name); \
|
||||||
|
\
|
||||||
|
FILE *file = fopen(kid_name_c, "w"); \
|
||||||
|
asprintf(&decremented_after, after, i); \
|
||||||
|
fprintf(file, "%s%s%s", before, quine, decremented_after); \
|
||||||
|
fclose(file); \
|
||||||
|
\
|
||||||
|
asprintf(&cmd, "clang %1$s -o %2$s ; ./%2$s", kid_name_c, kid_name); \
|
||||||
|
printf("cmd: %s\n", cmd); \
|
||||||
|
if (i > 0) \
|
||||||
|
{\
|
||||||
|
system(cmd); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
free(kid_name_c); \
|
||||||
|
free(kid_name); \
|
||||||
|
free(decremented_after); \
|
||||||
|
free(cmd); \
|
||||||
|
\
|
||||||
|
return 0; \
|
||||||
|
}
|
||||||
|
int i = 5;
|
||||||
|
FT(str(FT(s)))
|
||||||
Reference in New Issue
Block a user