comparison src/c/lacweb.c @ 189:20bf7487c370

Update bool to follow datatype representation change
author Adam Chlipala <adamc@hcoop.net>
date Sun, 03 Aug 2008 19:52:37 -0400
parents 88d46972de53
children 3eb53c957d10
comparison
equal deleted inserted replaced
188:8e9f97508f0d 189:20bf7487c370
337 ctx->heap_front = p; 337 ctx->heap_front = p;
338 return r; 338 return r;
339 } 339 }
340 340
341 char *lw_Basis_urlifyBool(lw_context ctx, lw_Basis_bool b) { 341 char *lw_Basis_urlifyBool(lw_context ctx, lw_Basis_bool b) {
342 if (b->tag == lw_Basis_False) 342 if (b == lw_Basis_False)
343 return "0"; 343 return "0";
344 else 344 else
345 return "1"; 345 return "1";
346 } 346 }
347 347
381 } 381 }
382 } 382 }
383 } 383 }
384 384
385 void lw_Basis_urlifyBool_w(lw_context ctx, lw_Basis_bool b) { 385 void lw_Basis_urlifyBool_w(lw_context ctx, lw_Basis_bool b) {
386 if (b->tag == lw_Basis_False) 386 if (b == lw_Basis_False)
387 lw_writec(ctx, '0'); 387 lw_writec(ctx, '0');
388 else 388 else
389 lw_writec(ctx, '1'); 389 lw_writec(ctx, '1');
390 } 390 }
391 391
446 } 446 }
447 *s1++ = 0; 447 *s1++ = 0;
448 return s1; 448 return s1;
449 } 449 }
450 450
451 static struct lw_Basis_bool lw_False = { lw_Basis_False },
452 lw_True = { lw_Basis_True };
453
454 lw_Basis_bool lw_Basis_unurlifyBool(lw_context ctx, char **s) { 451 lw_Basis_bool lw_Basis_unurlifyBool(lw_context ctx, char **s) {
455 char *new_s = lw_unurlify_advance(*s); 452 char *new_s = lw_unurlify_advance(*s);
456 lw_Basis_bool r; 453 lw_Basis_bool r;
457 454
458 if (*s[0] == 0 || !strcmp(*s, "0") || !strcmp(*s, "off")) 455 if (*s[0] == 0 || !strcmp(*s, "0") || !strcmp(*s, "off"))
459 r = &lw_False; 456 r = lw_Basis_False;
460 else 457 else
461 r = &lw_True; 458 r = lw_Basis_True;
462 459
463 *s = new_s; 460 *s = new_s;
464 return r; 461 return r;
465 } 462 }
466 463