view src/c/lacweb.c @ 109:813e5a52063d

Remove closure conversion in favor of zany fun with modules, which also replaces 'page'
author Adam Chlipala <adamc@hcoop.net>
date Sun, 13 Jul 2008 10:17:06 -0400
parents d101cb1efe55
children 94856a3b4752
line wrap: on
line source
#include <stdio.h>
#include <ctype.h>

#include "types.h"

lw_unit lw_unit_v = {};

void lw_writec(char c) {
  fputc(c, stdout);
}

void lw_write(const char* s) {
  fputs(s, stdout);
}

char *lw_Basis_attrifyInt(lw_Basis_int n) {
  return "0";
}

char *lw_Basis_attrifyFloat(lw_Basis_float n) {
  return "0.0";
}

char *lw_Basis_attrifyString(lw_Basis_string s) {
  return "";
}

char *lw_Basis_attrifyInt_w(lw_Basis_int n) {
  printf("%d", n);
}

char *lw_Basis_attrifyFloat_w(lw_Basis_float n) {
  printf("%g", n);
}

char *lw_Basis_attrifyString_w(lw_Basis_string s) {
  for (; *s; s++) {
    char c = *s;

    if (c == '"')
      lw_write("&quot;");
    else if (isprint(c))
      lw_writec(c);
    else {
      lw_write("&#");
      lw_Basis_attrifyInt_w(c);
      lw_writec(';');
    }
  }
  lw_write(s);
}