summaryrefslogtreecommitdiff
path: root/6
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2012-08-06 22:22:33 -0400
committerOri Bernstein <ori@eigenstate.org>2012-08-06 22:22:33 -0400
commit84dc4bb3cb9d70c182341918e91aa5ffc0af2e15 (patch)
treecb4bd789f250ad0f4c751e87bcbe6eec0d405c96 /6
parentb1c03eec08fe0d951121ead8f1c52c8271e4d420 (diff)
downloadmc-84dc4bb3cb9d70c182341918e91aa5ffc0af2e15.tar.gz
String handling changes.
Diffstat (limited to '6')
-rw-r--r--6/isel.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/6/isel.c b/6/isel.c
index 87d376c..d685c66 100644
--- a/6/isel.c
+++ b/6/isel.c
@@ -815,25 +815,20 @@ static Asmbb *mkasmbb(Bb *bb)
return as;
}
-#define Nper 30
static void writeblob(FILE *fd, char *p, size_t sz)
{
size_t i;
- char sep;
for (i = 0; i < sz; i++) {
- if (i % Nper == 0) {
- sep = ' ';
- fprintf(fd, "\t.byte");
- }
+ if (i % 60 == 0)
+ fprintf(fd, "\t.ascii \"");
if (isprint(p[i]))
- fprintf(fd, "%c'%c'", sep, p[i]);
+ fprintf(fd, "%c", p[i]);
else
- fprintf(fd, "%c0x%x", sep, (unsigned)p[i] & 0xff);
+ fprintf(fd, "\\%03o", (uint8_t)p[i] & 0xff);
/* line wrapping for readability */
- if (i % Nper == Nper - 1 || i == sz - 1)
- fprintf(fd, "\n");
- sep = ',';
+ if (i % 60 == 59 || i == sz - 1)
+ fprintf(fd, "\"\n");
}
}