Created
November 14, 2017 23:41
-
-
Save aaangeletakis/2aa369a8d9bb5734e8c436879a270f0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def indent (O0O0O0OOO0OO0OOOO ): | |
OOOO0O0O00O0O00OO ="" | |
for OOOOO0O00OOO0O00O in range (0 ,O0O0O0OOO0OO0OOOO ): | |
OOOO0O0O00O0O00OO +=" " | |
return OOOO0O0O00O0O00OO | |
funcName ="introCredit" | |
lines ="""By Alexios Angel | |
""" | |
startOfLineThingToAdd ="return \"" | |
endOfLineThingToAdd ="\";" | |
a =0 | |
f =lines .splitlines () | |
c =len (f ) | |
"unsigned char& line" | |
funcky ="std::string %s(%s)"%(funcName ,""if c ==1 else ("unsigned char& line"if c <=255 else "unsigned short& line")) | |
print (funcky ) | |
print ("{") | |
if c >1 :print ("%sswitch(line){"%(indent (1 ))) | |
for line in f : | |
if line !="": | |
print (("%scase %s: %s%s%s break;"%(indent (2 ),a ,startOfLineThingToAdd ,line ,endOfLineThingToAdd ))if c >1 else "%s%s%s%s"%(indent (1 ),startOfLineThingToAdd ,line ,endOfLineThingToAdd )) | |
a +=1 | |
if c >1 :print ("%sdefualt:\n%sstd::cout << \"ERROR: \\\"%s\\\"\" << std::endl;\n%sbreak;\n%s}"%(indent (2 ),indent (3 ),funcky ,indent (3 ),indent (1 ))) | |
print ("%s}"%(""if c ==1 else " return \"\";\n")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment