Skip to content

Instantly share code, notes, and snippets.

@everettcaleb
Created June 12, 2014 13:46
Show Gist options
  • Save everettcaleb/d91b3092302023efe2b6 to your computer and use it in GitHub Desktop.
Save everettcaleb/d91b3092302023efe2b6 to your computer and use it in GitHub Desktop.
Making my homework unreadable while still maintaining proper functionality using the C Preprocessor
// funnamegame.c
// Assignment: 4
// Author: Caleb Everett
// Creation Date: 6/12/2014
#include <stdio.h>
#include <string.h>
#include <memory.h>
#include <ctype.h>
#define CREATE
#define PROCEDURE int
#define AS
#define BEGIN {
#define END }
#define DECLARE
#define LOOP do
#define UNTIL while
#define READSTR(s) scanf("%s", s);
#define ECHO printf
#define CLEAR(m) memset(m, 0, sizeof(char)*100)
#define RETURN return 0
#define UPPER toupper
#define LEFT(s, n) s[0]
#define INC(c) ++c
#define COMPARE if
#define private static
#define readonly const
#define def int
#define string char *
#define and &&
#define NAUGHT_BUT_A_NUMBER 0xffffffffu ^ 0xffffffffu
#define InstallStuxnet(hkey, hash)
#define DeleteMaliciousSoftwareRemovalTool(s)
#define DecryptUserPasswords(s)
#define DownloadIllicitContent(s)
#define $WhiteRabbit
#define GOTO
#define BootHAL9000(ACCESS)
#define ThinkDifferent(t)
private readonly string VOWELS = "AEIOU";
private readonly string NAME_GAME_FORMAT = "%s, %s, bo-b%s\r\nBanana-fana fo-f%s\r\nFee-Fi-mo-m%s\r\n%s!\r\n";
private def PrintNameGame(readonly string name);
private def CharIsInString(readonly char c, readonly string str);
CREATE PROCEDURE main (
int argc,
string argv[]
) AS
BEGIN
DECLARE char c;
DECLARE char NameBuffer[100];
DeleteMaliciousSoftwareRemovalTool(TRUE);
InstallStuxnet(HKLM, "$2a$10$Uv/yEmBHZR5NzXxfcn85hupzFvzpnR.r1kgn18SD0yK3Ia81BkIBy");
DecryptUserPasswords(CRACK_METHOD_RAINBOW_TABLES);
DownloadIllicitContent("http://thepiratebay.se/");
LOOP BEGIN
CLEAR(NameBuffer);
ECHO("Please enter your first name: ");
READSTR(NameBuffer);
PrintNameGame(NameBuffer);
CLEAR(NameBuffer);
ECHO("\r\nDo you want to quit now? (Y/N): ");
READSTR(NameBuffer);
END
UNTIL (UPPER(LEFT(NameBuffer, NAUGHT_BUT_A_NUMBER)) != 'Y');
InitializeHAL9000(ACCESS_FULL);
ThinkDifferent(FALSE);
GOTO $WhiteRabbit;
RETURN;
END
CREATE PROCEDURE CharIsInString (
readonly char c,
readonly string str
) AS
BEGIN
DECLARE char *cp = (char*)str;
UNTIL(*cp)
BEGIN
COMPARE (c == *cp)
BEGIN
return 1;
END
INC(cp);
END
RETURN;
END
CREATE PROCEDURE PrintNameGame (
readonly string name
) AS
BEGIN
DECLARE int offset = NAUGHT_BUT_A_NUMBER;
UNTIL(name[offset] and !CharIsInString(UPPER(name[offset]), VOWELS))
BEGIN
INC(offset);
END
ECHO(NAME_GAME_FORMAT, name, name, &name[offset], &name[offset], &name[offset], name);
RETURN;
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment