comparison src/c/urweb.c @ 1025:7facf72aaf0a

Initial form for paper assignment
author Adam Chlipala <adamc@hcoop.net>
date Sun, 01 Nov 2009 14:26:20 -0500
parents e46227efcbba
children be1aec7333a5
comparison
equal deleted inserted replaced
1024:93415bcf54c0 1025:7facf72aaf0a
1222 *s2++ = c; 1222 *s2++ = c;
1223 else { 1223 else {
1224 sprintf(s2, "\\%3o", c); 1224 sprintf(s2, "\\%3o", c);
1225 s2 += 4; 1225 s2 += 4;
1226 } 1226 }
1227 }
1228 }
1229
1230 strcpy(s2, "\"");
1231 ctx->heap.front = s2 + 2;
1232 return r;
1233 }
1234
1235 uw_Basis_string uw_Basis_jsifyChar(uw_context ctx, uw_Basis_char c) {
1236 char *r, *s2;
1237
1238 uw_check_heap(ctx, 6);
1239
1240 r = s2 = ctx->heap.front;
1241 *s2++ = '"';
1242
1243 switch (c) {
1244 case '"':
1245 strcpy(s2, "\\\"");
1246 s2 += 2;
1247 break;
1248 case '\\':
1249 strcpy(s2, "\\\\");
1250 s2 += 2;
1251 break;
1252 default:
1253 if (isprint(c))
1254 *s2++ = c;
1255 else {
1256 sprintf(s2, "\\%3o", c);
1257 s2 += 4;
1227 } 1258 }
1228 } 1259 }
1229 1260
1230 strcpy(s2, "\""); 1261 strcpy(s2, "\"");
1231 ctx->heap.front = s2 + 2; 1262 ctx->heap.front = s2 + 2;