H__PAGEZERO(__TEXT@@__text__TEXTx }x __symbol_stub1__TEXTx__cstring__TEXTpp__stub_helper__TEXTR<R<__unwind_info__TEXT0=p0=__eh_frame__TEXT=X= `__DATA@@__program_vars__DATA@(@__nl_symbol_ptr__DATA(@(@__la_symbol_ptr__DATA8@8@__data__DATA@(@H__LINKEDITPP"0PP(@QPR*U P0U* /usr/lib/dyld[a%жc*x  8}/usr/lib/libSystem.B.dylibjHHH}HuHHHH9uH/ OUHH`}HuEHEH8HhHEHEHHEE}u*HEHEH8YH3HEHEHHEHEHEH}H5'HEH}uHuH='H}H5'HEH}tDHuH='}yt'}nuHEE}uEH}kuH}3EHcdHEH}H5$'HEЋEHcHMH}HUHuH=q'!uH}EHEEHMUHuH}9HEUHH@EH}E HEZEHH}H 'K HuH= ' H}H5H&> HEH}t,H=&u L E}t}yt EH}H5& HEETEHHE<@u)HUH‹EHH<@uHuH}(EEHHEHu EEHHEu EEUHH0H5f%H=U&U HEH}t EH50&H=+&+ HEEEoEHHH/H<@u0H/HPEHH E7E. ~ EEE%<#%>#%@#%B#%D#%F#%H#%J#%L#%N#%P#%R#%T#%V#%X#%Z#%\#%^#%`#%b##include #include char *libdata = @! char *precompile( int argc, char **argv, float version ); int outputSource( float version, char *progdata); char *precompile( int argc, char **argv, float version ) { char *replace(char *filedata, char *filename, int len, char *replacement, float version); char *constructString( float version, char *fileData, int len); char *inFilename = malloc(strlen(*argv)); inFilename = *argv; char *fileData; char *progdata; int len = 0; char *outFilename; if (argc == 2) { outFilename = malloc(strlen(*++argv)); outFilename = *argv; } else { outFilename = inFilename; } FILE *file = fopen(inFilename, "r"); if(file == NULL){ printf("The file \"%s\" does not exist and 'cannot' be (pre)compiled.\n", inFilename); return; } FILE *outFile = fopen(outFilename, "r"); if(outFile != NULL) { printf("The file \"%s\" already exists. Overwrite it? [y/n]\n", outFilename); char c; while ((c = getchar()) != EOF) { if(c == 'y') break; else if(c == 'n') return 0; } } while(getc(file) != EOF) len++; fclose(file); fileData = malloc(len); file = fopen(inFilename, "r"); fread(fileData, sizeof(char), len, file); printf("Precompile: %s - Output as: %s\n", inFilename, outFilename); progdata = constructString( version, fileData, len ); replace( fileData, outFilename, len, progdata, version ); } int outputSource( float version, char *progdata ) { int outputLibrary(); void quote(FILE *output, char *s); FILE *output; int i = 0; char *filename = malloc(23); sprintf( filename, "wabbitware_v%f.c", version); //do not increment version printf("Output file: %s\n", filename); FILE *exists = fopen(filename, "r"); if(exists){ printf("\nThis file already exists. Overwrite it? [y/n]\n"); char c; while ((c = getchar()) != EOF) { if(c == 'y') break; else return 0; } } output= fopen(filename, "w"); for (i=0; progdata[i]; ++i) { if (progdata[i] == '@' && progdata[i+1] == '@') { quote(output, progdata); i++; } else { fprintf(output,"%c", progdata[i]); } } outputLibrary(); return 0; } int outputLibrary() { void quote(FILE *output, char *s); FILE *exists = fopen("wabbitlib.c", "r"); if(exists != NULL) return 0; FILE *outFile = fopen("wabbitlib.c", "w"); int i = 0; for (i=0; libdata[i]; ++i) { if (libdata[i] == '@' && libdata[i+1] == '!') { quote(outFile, libdata); i++; } else { fprintf(outFile,"%c", libdata[i]); } } return 0; } char *replace(char *filedata, char *filename, int len, char *replacement, float version) { FILE *output; char *strtNeedle = "char *progdata ="; char *endNeedle = "/*!!!*/"; char *versionNeedle = "int version = "; int foundProgData = 0; int i =0 ,j = 0, k = 0, skipOldVersion = 0; char c; char *versionChar = malloc(12); sprintf(versionChar," %f", version); output = fopen(filename, "w"); //printf("Precompiled output file: %s\n", "_testoutput.c"); for (i=0; i < len && (c=filedata[i]) != EOF; i++) { if(c == strtNeedle[j] && foundProgData == 0){ j++; if(j >= strlen(strtNeedle)){ foundProgData = 1; j = 0; } } if(c == versionNeedle[k]) { k++; if(k >= strlen(versionNeedle)) { fprintf(output, "%s", versionChar); skipOldVersion = 10; } } if(foundProgData == 1) { if(c == endNeedle[j]){ j++; if(j >= strlen(endNeedle)){ foundProgData = -1; fprintf(output, "= %s; \n /*!!!*/", replacement); } } } else if(--skipOldVersion <= 0) { putc(c, output); } } } char *constructString( float version, char *filedata, int len) { char *combined; int i, j=0, k=0, l=0, m = 0; int foundProgData = 0; combined = malloc(len*2); strcat(combined, "\n \""); j += strlen("\n \""); char *strtNeedle = "char *progdata ="; char *endNeedle = "/*!!!*/"; char *versionNeedle = "int version = "; char *versionChar = malloc(12); int skipOldVersion = 0; sprintf(versionChar," %f", version); char c; char nextC; for (i=0; i < len && (c=filedata[i]) != EOF; i++) { if(c == strtNeedle[k]){ k++; if(k >= strlen(strtNeedle)){ foundProgData = 1; } } if(c == versionNeedle[m]) { m++; if(m >= strlen(versionNeedle)) { strcat(combined, versionChar); j += strlen(versionChar); skipOldVersion = 10; } } if(foundProgData == 1) { if(c == endNeedle[l]){ l++; if(l >= strlen(endNeedle)){ foundProgData = 0; strcat(combined, "= @@\\n"); j += strlen("= @@\\n"); } } else l=0; } else if(c == '\\' && (nextC=filedata[i+1]) == 'n') { char *escapeNl = "\\\\"; strcat(combined, escapeNl); j += strlen(escapeNl); } else if(c == '\\' && (nextC=filedata[i+1]) == '"') { char *ecapedQ = "\\\\"; strcat(combined, ecapedQ); j += strlen(ecapedQ); } else if(c == '\\') { strcat(combined, "\\"); j += strlen("\\"); } else if (c == '"') { strcat(combined, "\\\""); j += strlen("\\\""); } else if (c == '\n') { strcat(combined, "\\n"); j += strlen("\\n"); } else if(--skipOldVersion <= 0) { combined[j] = c; j++; } if ((i % 48 == 47) && foundProgData == 0) { strcat(combined, "\"\n \""); j += strlen("\"\n \""); } } strcat(combined, "\""); j += strlen("\""); //fp = fopen("combined.txt", "a"); //fprintf(fp, "%s", combined); return combined; } void quote(FILE *output, char *s) /* This function takes a character string s and prints the * textual representation of s as it might appear formatted * in C code. */ { int i; fprintf(output, "%s", " \""); for (i=0; s[i]; ++i) { /* Certain characters are quoted. */ if (s[i] == '\\') fprintf(output, "%s","\\\\"); else if (s[i] == '"') fprintf(output, "%s","\\\""); else if (s[i] == '\n') fprintf(output, "%s","\\n"); /* Others are just printed as such. */ else fprintf(output, "%c", s[i]); /* Also insert occasional line breaks. */ if (i % 48 == 47) fprintf(output, "%s","\"\n \""); } fprintf(output, "%s","\";\n /*!!!*/"); }rThe file "%s" does not exist and 'cannot' be (pre)compiled. The file "%s" already exists. Overwrite it? [y/n] Precompile: %s - Output as: %s wabbitware_v%f.cOutput file: %s This file already exists. Overwrite it? [y/n]wwabbitlib.cchar *progdata =/*!!!*/int version = %f= %s; /*!!!*/ "= @@\n\\\\"\n" "" ""; /*!!!*//* * collatestring.c * * * Created by Gareth Foote on 24/06/2010. * Copyright 2010 __MyCompanyName__. All rights reserved. * */ #include #include "wabbitlib.c"; void wabbitWaresGoesHere(); int main(int argc, char *argv[]) { float version = 0.000001; float versionIncrement = 0.000001; int i, c; int pc = 0, op = 0; char *progdata = @@ while (--argc > 0 && (*++argv)[0] == '-'){ while (c = *++argv[0]) { switch ( c ) { case 'i': pc = 1; break; case 'o': op = 1; break; default: printf("illegal option %c\n", c ); break; } } } if(pc == 1 && (argc > 2 || argc < 1)){ printf("\nUsage: wabbitware -i [inputfile.c] [outputfile.c](optional)\n"); return; } if(pc > 0) { version += versionIncrement; //increment version precompile( argc, argv, version ); } else outputSource( version, progdata ); wabbitWaresGoesHere(); } void wabbitWaresGoesHere() { /* * -{WABBITS GO UNDER HERE}- */ } illegal option %c Usage: wabbitware -i [inputfile.c] [outputfile.c](optional)--- --- --- --- --- --- --- ---Is Tim Crook awake???-> Tim Crook is awake-> Tim Crook is not awake-> Sorry...LAS%hh)h5hh hh_hlhyhhhxhnhdhZhPhFh