UTF-8 library

Alastair Reid alastair@reid-consulting-uk.ltd.uk
07 Aug 2002 11:19:45 +0100


> In the documentation of GHC it says: 
>
>   data CChar = CChar Int8 
>
> Is this determined during compilation of GHC?

It's done at configure time.  fptools/configure.in contains these lines:

  dnl ** map standard C types and ISO types to Haskell types
  FPTOOLS_CHECK_HTYPE(char)
  FPTOOLS_CHECK_HTYPE(signed char)
  FPTOOLS_CHECK_HTYPE(unsigned char)
  FPTOOLS_CHECK_HTYPE(short)
  FPTOOLS_CHECK_HTYPE(unsigned short)
  FPTOOLS_CHECK_HTYPE(int)
  FPTOOLS_CHECK_HTYPE(unsigned int)
  FPTOOLS_CHECK_HTYPE(long)
  FPTOOLS_CHECK_HTYPE(unsigned long)
  if test "$fptools_cv_have_long_long" = yes; then
  FPTOOLS_CHECK_HTYPE(long long)
  FPTOOLS_CHECK_HTYPE(unsigned long long)
  fi
  FPTOOLS_CHECK_HTYPE(float)
  FPTOOLS_CHECK_HTYPE(double)
  FPTOOLS_CHECK_HTYPE(ptrdiff_t)
  FPTOOLS_CHECK_HTYPE(size_t)
  FPTOOLS_CHECK_HTYPE(wchar_t)
  dnl Int32 is a HACK for non-ISO C compilers
  FPTOOLS_CHECK_HTYPE(sig_atomic_t, Int32)
  FPTOOLS_CHECK_HTYPE(clock_t)
  FPTOOLS_CHECK_HTYPE(time_t)
  FPTOOLS_CHECK_HTYPE(dev_t, Word32)
  FPTOOLS_CHECK_HTYPE(ino_t)
  FPTOOLS_CHECK_HTYPE(mode_t)
  FPTOOLS_CHECK_HTYPE(off_t)
  FPTOOLS_CHECK_HTYPE(pid_t)
  FPTOOLS_CHECK_HTYPE(gid_t)
  FPTOOLS_CHECK_HTYPE(uid_t)
  FPTOOLS_CHECK_HTYPE(cc_t)
  FPTOOLS_CHECK_HTYPE(speed_t)
  FPTOOLS_CHECK_HTYPE(tcflag_t)
  FPTOOLS_CHECK_HTYPE(nlink_t)
  FPTOOLS_CHECK_HTYPE(ssize_t)

where CHECK_HTYPE (defined in fptools/aclocal.m4) figures out the best
match out of {{Int,Word}{8,16,32,64},Float,Double}

-- 
Alastair Reid                 alastair@reid-consulting-uk.ltd.uk  
Reid Consulting (UK) Limited  http://www.reid-consulting-uk.ltd.uk/alastair/