Full Code of haskell/c2hs for AI

master 6f699f611b81 cached
298 files
885.7 KB
257.3k tokens
238 symbols
1 requests
Download .txt
Showing preview only (961K chars total). Download the full file or copy to clipboard to get everything.
Repository: haskell/c2hs
Branch: master
Commit: 6f699f611b81
Files: 298
Total size: 885.7 KB

Directory structure:
gitextract_ckd6s0y2/

├── .boring
├── .github/
│   └── workflows/
│       └── haskell-ci.yml
├── .gitignore
├── .travis.yml
├── AUTHORS
├── C2HS.hs
├── COPYING
├── ChangeLog
├── ChangeLog.CTKlight
├── ChangeLog.old
├── INSTALL
├── README
├── README.CTKlight
├── README.md
├── REGRESSION-SUITE
├── Setup.hs
├── TODO
├── TODO.CTKlight
├── appveyor.yml
├── c2hs.cabal
├── cabal.haskell-ci
├── custom-setup.hs
├── doc/
│   ├── Makefile
│   ├── c2hs.css
│   ├── c2hs.xml
│   └── man1/
│       └── c2hs.1
├── examples/
│   └── libghttpHS/
│       ├── Ghttp.chs
│       ├── Makefile
│       ├── ghttpHS.c
│       └── ghttpHS.h
├── import-handling.md
├── regression-suite-vm/
│   ├── Vagrantfile
│   ├── Vagrantfile-full
│   └── run-regression
├── src/
│   ├── C2HS/
│   │   ├── C/
│   │   │   ├── Attrs.hs
│   │   │   ├── Builtin.hs
│   │   │   ├── Info.hs
│   │   │   ├── Names.hs
│   │   │   └── Trav.hs
│   │   ├── C.hs
│   │   ├── CHS/
│   │   │   └── Lexer.hs
│   │   ├── CHS.hs
│   │   ├── Config.hs
│   │   ├── Gen/
│   │   │   ├── Bind.hs
│   │   │   ├── Header.hs
│   │   │   ├── Monad.hs
│   │   │   └── Wrapper.hs
│   │   ├── State.hs
│   │   ├── Switches.hs
│   │   ├── Version.hs
│   │   ├── config.c
│   │   └── config.h
│   ├── Control/
│   │   ├── State.hs
│   │   ├── StateBase.hs
│   │   └── StateTrans.hs
│   ├── Data/
│   │   ├── Attributes.hs
│   │   ├── Errors.hs
│   │   └── NameSpaces.hs
│   ├── Main.hs
│   ├── System/
│   │   └── CIO.hs
│   └── Text/
│       └── Lexers.hs
└── tests/
    ├── bugs/
    │   ├── call_capital/
    │   │   ├── Capital.c
    │   │   ├── Capital.chs
    │   │   └── Capital.h
    │   ├── issue-10/
    │   │   ├── Issue10.chs
    │   │   ├── issue10.c
    │   │   └── issue10.h
    │   ├── issue-102/
    │   │   └── Issue102.chs
    │   ├── issue-103/
    │   │   ├── Issue103.chs
    │   │   ├── Issue103A.chs
    │   │   ├── issue103.c
    │   │   └── issue103.h
    │   ├── issue-107/
    │   │   └── Issue107.chs
    │   ├── issue-113/
    │   │   ├── Issue113.chs
    │   │   ├── issue113.c
    │   │   └── issue113.h
    │   ├── issue-115/
    │   │   ├── Issue115.chs
    │   │   ├── issue115.c
    │   │   └── issue115.h
    │   ├── issue-116/
    │   │   ├── Issue116.chs
    │   │   ├── issue116.c
    │   │   └── issue116.h
    │   ├── issue-117/
    │   │   ├── Issue117.chs
    │   │   ├── issue117.c
    │   │   └── issue117.h
    │   ├── issue-123/
    │   │   ├── Issue123.chs
    │   │   ├── issue123.c
    │   │   └── issue123.h
    │   ├── issue-127/
    │   │   ├── Issue127.chs
    │   │   ├── issue127.c
    │   │   └── issue127.h
    │   ├── issue-128/
    │   │   ├── Issue128.chs
    │   │   ├── issue128.c
    │   │   └── issue128.h
    │   ├── issue-130/
    │   │   ├── Issue130.chs
    │   │   ├── issue130.c
    │   │   └── issue130.h
    │   ├── issue-131/
    │   │   ├── Issue131.chs
    │   │   ├── issue131.c
    │   │   └── issue131.h
    │   ├── issue-133/
    │   │   ├── Issue133.chs
    │   │   └── issue133.h
    │   ├── issue-134/
    │   │   ├── Issue134.chs
    │   │   └── issue134.h
    │   ├── issue-136/
    │   │   ├── Issue136.chs
    │   │   ├── issue136.c
    │   │   └── issue136.h
    │   ├── issue-140/
    │   │   ├── Issue140.chs
    │   │   ├── issue140.c
    │   │   └── issue140.h
    │   ├── issue-141/
    │   │   ├── Issue141A.chs
    │   │   ├── Issue141B.chs
    │   │   ├── Issue141C.chs
    │   │   └── issue141.h
    │   ├── issue-149/
    │   │   ├── Issue149.chs
    │   │   ├── issue149.c
    │   │   └── issue149.h
    │   ├── issue-15/
    │   │   ├── Issue15.chs
    │   │   ├── issue15.c
    │   │   └── issue15.h
    │   ├── issue-151/
    │   │   ├── Issue151.chs
    │   │   └── issue151.h
    │   ├── issue-152/
    │   │   ├── Issue152.chs
    │   │   └── issue152.h
    │   ├── issue-155/
    │   │   ├── Issue155.chs
    │   │   ├── Types.chs
    │   │   └── types.h
    │   ├── issue-16/
    │   │   ├── Issue16.chs
    │   │   ├── issue16.c
    │   │   └── issue16.h
    │   ├── issue-180/
    │   │   ├── Issue180.chs
    │   │   └── issue180.h
    │   ├── issue-19/
    │   │   ├── Issue19.chs
    │   │   ├── issue19.c
    │   │   └── issue19.h
    │   ├── issue-192/
    │   │   ├── Issue192.chs
    │   │   └── issue-192.h
    │   ├── issue-20/
    │   │   ├── Issue20.chs
    │   │   ├── issue20.c
    │   │   └── issue20.h
    │   ├── issue-22/
    │   │   ├── Issue22.chs
    │   │   ├── issue22.c
    │   │   └── issue22.h
    │   ├── issue-23/
    │   │   ├── Issue23.chs
    │   │   ├── issue23.c
    │   │   ├── issue23.h
    │   │   └── issue23x.h
    │   ├── issue-230/
    │   │   ├── Issue230.chs
    │   │   ├── issue230.c
    │   │   └── issue230.h
    │   ├── issue-242/
    │   │   ├── Issue242.chs
    │   │   ├── issue242.c
    │   │   └── issue242.h
    │   ├── issue-25/
    │   │   └── Issue25.chs
    │   ├── issue-257/
    │   │   ├── Issue257.chs
    │   │   ├── issue257.c
    │   │   └── issue257.h
    │   ├── issue-29/
    │   │   ├── Issue29.chs
    │   │   └── issue29.h
    │   ├── issue-30/
    │   │   ├── Issue30.chs
    │   │   ├── Issue30Aux1.chs
    │   │   ├── Issue30Aux2.chs
    │   │   ├── issue30.c
    │   │   ├── issue30.h
    │   │   ├── issue30aux1.c
    │   │   ├── issue30aux1.h
    │   │   ├── issue30aux2.c
    │   │   └── issue30aux2.h
    │   ├── issue-31/
    │   │   ├── Issue31.chs
    │   │   ├── issue31.c
    │   │   └── issue31.h
    │   ├── issue-32/
    │   │   ├── Issue32.chs
    │   │   ├── issue32.c
    │   │   └── issue32.h
    │   ├── issue-36/
    │   │   ├── Issue36.chs
    │   │   └── issue36.h
    │   ├── issue-37/
    │   │   ├── Issue37.chs
    │   │   ├── issue37.c
    │   │   └── issue37.h
    │   ├── issue-38/
    │   │   ├── Issue38.chs
    │   │   ├── issue38.c
    │   │   └── issue38.h
    │   ├── issue-43/
    │   │   ├── Issue43.chs
    │   │   ├── issue43.c
    │   │   └── issue43.h
    │   ├── issue-44/
    │   │   ├── Issue44.chs
    │   │   ├── issue44.c
    │   │   └── issue44.h
    │   ├── issue-45/
    │   │   ├── Issue45.chs
    │   │   ├── issue45.c
    │   │   └── issue45.h
    │   ├── issue-46/
    │   │   ├── Issue46.chs
    │   │   ├── issue46.c
    │   │   └── issue46.h
    │   ├── issue-47/
    │   │   ├── Issue47.chs
    │   │   ├── issue47.c
    │   │   └── issue47.h
    │   ├── issue-48/
    │   │   ├── Issue48.chs
    │   │   ├── issue48.c
    │   │   └── issue48.h
    │   ├── issue-51/
    │   │   ├── Issue51_GNU.chs
    │   │   ├── Issue51_nonGNU.chs
    │   │   ├── issue51.c
    │   │   └── issue51.h
    │   ├── issue-54/
    │   │   ├── Issue54.chs
    │   │   ├── issue54.c
    │   │   └── issue54.h
    │   ├── issue-60/
    │   │   ├── Issue60.chs
    │   │   ├── _mingw.h
    │   │   ├── issue60.c
    │   │   └── stdlib.h
    │   ├── issue-62/
    │   │   ├── Issue62.chs
    │   │   ├── issue62.c
    │   │   └── issue62.h
    │   ├── issue-65/
    │   │   ├── Issue65.chs
    │   │   ├── issue65.c
    │   │   └── issue65.h
    │   ├── issue-69/
    │   │   ├── Issue69.chs
    │   │   ├── issue69.c
    │   │   └── issue69.h
    │   ├── issue-7/
    │   │   ├── Issue7.chs
    │   │   └── issue7.h
    │   ├── issue-70/
    │   │   ├── Issue70.chs
    │   │   ├── issue70.c
    │   │   └── issue70.h
    │   ├── issue-73/
    │   │   ├── Issue73.chs
    │   │   ├── issue73.c
    │   │   └── issue73.h
    │   ├── issue-75/
    │   │   ├── Issue75.chs
    │   │   ├── issue75.c
    │   │   ├── issue75.h
    │   │   └── sndfile.h
    │   ├── issue-79/
    │   │   ├── Issue79.chs
    │   │   ├── issue79.c
    │   │   └── issue79.h
    │   ├── issue-80/
    │   │   ├── Issue80.chs
    │   │   ├── issue80.c
    │   │   └── issue80.h
    │   ├── issue-82/
    │   │   ├── Issue82.chs
    │   │   └── include/
    │   │       ├── Availability.h
    │   │       ├── AvailabilityInternal.h
    │   │       ├── TargetConditionals.h
    │   │       ├── _types.h
    │   │       ├── secure/
    │   │       │   ├── _common.h
    │   │       │   └── _string.h
    │   │       ├── string.h
    │   │       ├── strings.h
    │   │       ├── sys/
    │   │       │   └── cdefs.h
    │   │       └── xlocale/
    │   │           └── _string.h
    │   ├── issue-83/
    │   │   └── Issue83.chs
    │   ├── issue-9/
    │   │   ├── Issue9.chs
    │   │   ├── issue9.c
    │   │   └── issue9.h
    │   ├── issue-93/
    │   │   ├── Issue93.chs
    │   │   ├── issue93.c
    │   │   └── issue93.h
    │   ├── issue-95/
    │   │   ├── Issue95.chs
    │   │   ├── issue95.c
    │   │   └── issue95.h
    │   ├── issue-96/
    │   │   ├── Issue96.chs
    │   │   ├── issue96.c
    │   │   └── issue96.h
    │   ├── issue-97/
    │   │   ├── Issue97.chs
    │   │   ├── Issue97A.chs
    │   │   ├── issue97.c
    │   │   └── issue97.h
    │   └── issue-98/
    │       ├── Issue98.chs
    │       ├── issue98.c
    │       └── issue98.h
    ├── regression-suite.hs
    ├── regression-suite.yaml
    ├── system/
    │   ├── Makefile
    │   ├── calls/
    │   │   ├── Calls.chs
    │   │   └── calls.h
    │   ├── clean
    │   ├── cpp/
    │   │   └── Cpp.chs
    │   ├── enums/
    │   │   ├── Enums.chs
    │   │   ├── enums.c
    │   │   └── enums.h
    │   ├── interruptible/
    │   │   ├── Interruptible.chs
    │   │   ├── interruptible.c
    │   │   └── interruptible.h
    │   ├── marsh/
    │   │   ├── Marsh.chs
    │   │   └── marsh.h
    │   ├── pointer/
    │   │   ├── Pointer.chs
    │   │   ├── pointer.c
    │   │   └── pointer.h
    │   ├── simple/
    │   │   ├── Simple.chs
    │   │   ├── simple.c
    │   │   └── simple.h
    │   ├── sizeof/
    │   │   ├── Sizeof.chs
    │   │   ├── sizeof.c
    │   │   └── sizeof.h
    │   └── structs/
    │       ├── Structs.chs
    │       ├── structs.c
    │       └── structs.h
    ├── test-bugs.hs
    └── test-system.hs

================================================
FILE CONTENTS
================================================

================================================
FILE: .boring
================================================
# Project specific
\.setup-config$
autom4te\.cache
c2hs\.spec$
c2hs/c/CLexer\.hs$
c2hs/c/CParser\.hs$
c2hs/c2hs$
c2hs/c2hs-inplace$
c2hs/tests/.*\.hs$
c2hs/tests/.*\.h$
\.chi$
c2hs/tests/enums$
c2hs/tests/marsh$
c2hs/tests/pointer$
c2hs/tests/structs$
c2hs/toplevel/C2HSConfig\.hs$
c2hs/toplevel/Version\.hs$
config\.log$
config\.status$
configure$
^dist
doc/c2hs/Makefile$
doc/c2hs/.*\.html$
doc/c2hs/.*\.txt$
doc/c2hs/man1/c2hs.1
postInst\.sh
#
# Boring file regexps:
\.hi$
\.o$
\.o\.cmd$
\.ko$
\.ko\.cmd$
\.mod\.c$
(^|/)\.tmp_versions($|/)
(^|/)CVS($|/)
(^|/)RCS($|/)
~$
#(^|/)\.[^/]
(^|/)_darcs($|/)
\.bak$
\.BAK$
\.orig$
(^|/)vssver\.scc$
\.swp$
(^|/)MT($|/)
(^|/)\{arch\}($|/)
(^|/).arch-ids($|/)
(^|/),
\.class$
\.prof$
(^|/)\.DS_Store$
(^|/)BitKeeper($|/)
(^|/)ChangeSet($|/)
(^|/)\.svn($|/)
\.py[co]$
\#
\.cvsignore$
(^|/)Thumbs\.db$


================================================
FILE: .github/workflows/haskell-ci.yml
================================================
# This GitHub workflow config has been generated by a script via
#
#   haskell-ci 'github' 'c2hs.cabal'
#
# To regenerate the script (for example after adjusting tested-with) run
#
#   haskell-ci regenerate
#
# For more information, see https://github.com/haskell-CI/haskell-ci
#
# version: 0.16.4
#
# REGENDATA ("0.16.4",["github","c2hs.cabal"])
#
name: Haskell-CI
on:
  - push
  - pull_request
jobs:
  linux:
    name: Haskell-CI - Linux - ${{ matrix.compiler }}
    runs-on: ubuntu-20.04
    timeout-minutes:
      60
    container:
      image: buildpack-deps:bionic
    continue-on-error: ${{ matrix.allow-failure }}
    strategy:
      matrix:
        include:
          - compiler: ghc-9.6.2
            compilerKind: ghc
            compilerVersion: 9.6.2
            setup-method: ghcup
            allow-failure: false
          - compiler: ghc-9.4.5
            compilerKind: ghc
            compilerVersion: 9.4.5
            setup-method: ghcup
            allow-failure: false
          - compiler: ghc-9.2.8
            compilerKind: ghc
            compilerVersion: 9.2.8
            setup-method: ghcup
            allow-failure: false
          - compiler: ghc-9.0.2
            compilerKind: ghc
            compilerVersion: 9.0.2
            setup-method: ghcup
            allow-failure: false
          - compiler: ghc-8.10.7
            compilerKind: ghc
            compilerVersion: 8.10.7
            setup-method: ghcup
            allow-failure: false
          - compiler: ghc-8.8.4
            compilerKind: ghc
            compilerVersion: 8.8.4
            setup-method: hvr-ppa
            allow-failure: false
          - compiler: ghc-8.6.5
            compilerKind: ghc
            compilerVersion: 8.6.5
            setup-method: hvr-ppa
            allow-failure: false
          - compiler: ghc-8.4.4
            compilerKind: ghc
            compilerVersion: 8.4.4
            setup-method: hvr-ppa
            allow-failure: false
          - compiler: ghc-8.2.2
            compilerKind: ghc
            compilerVersion: 8.2.2
            setup-method: hvr-ppa
            allow-failure: false
          - compiler: ghc-8.0.2
            compilerKind: ghc
            compilerVersion: 8.0.2
            setup-method: hvr-ppa
            allow-failure: false
          - compiler: ghc-7.10.3
            compilerKind: ghc
            compilerVersion: 7.10.3
            setup-method: hvr-ppa
            allow-failure: false
      fail-fast: false
    steps:
      - name: apt
        run: |
          apt-get update
          apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
          if [ "${{ matrix.setup-method }}" = ghcup ]; then
            mkdir -p "$HOME/.ghcup/bin"
            curl -sL https://downloads.haskell.org/ghcup/0.1.19.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup"
            chmod a+x "$HOME/.ghcup/bin/ghcup"
            "$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
            "$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
          else
            apt-add-repository -y 'ppa:hvr/ghc'
            apt-get update
            apt-get install -y "$HCNAME"
            mkdir -p "$HOME/.ghcup/bin"
            curl -sL https://downloads.haskell.org/ghcup/0.1.19.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup"
            chmod a+x "$HOME/.ghcup/bin/ghcup"
            "$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
          fi
        env:
          HCKIND: ${{ matrix.compilerKind }}
          HCNAME: ${{ matrix.compiler }}
          HCVER: ${{ matrix.compilerVersion }}
      - name: Set PATH and environment variables
        run: |
          echo "$HOME/.cabal/bin" >> $GITHUB_PATH
          echo "LANG=C.UTF-8" >> "$GITHUB_ENV"
          echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV"
          echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
          HCDIR=/opt/$HCKIND/$HCVER
          if [ "${{ matrix.setup-method }}" = ghcup ]; then
            HC=$HOME/.ghcup/bin/$HCKIND-$HCVER
            echo "HC=$HC" >> "$GITHUB_ENV"
            echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV"
            echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV"
            echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
          else
            HC=$HCDIR/bin/$HCKIND
            echo "HC=$HC" >> "$GITHUB_ENV"
            echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV"
            echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV"
            echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
          fi

          HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
          echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
          if [ $((HCNUMVER >= 80000)) -ne 0 ] ; then echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV" ; else echo "ARG_TESTS=--disable-tests" >> "$GITHUB_ENV" ; fi
          echo "ARG_BENCH=--enable-benchmarks" >> "$GITHUB_ENV"
          echo "HEADHACKAGE=false" >> "$GITHUB_ENV"
          echo "ARG_COMPILER=--$HCKIND --with-compiler=$HC" >> "$GITHUB_ENV"
          echo "GHCJSARITH=0" >> "$GITHUB_ENV"
        env:
          HCKIND: ${{ matrix.compilerKind }}
          HCNAME: ${{ matrix.compiler }}
          HCVER: ${{ matrix.compilerVersion }}
      - name: env
        run: |
          env
      - name: write cabal config
        run: |
          mkdir -p $CABAL_DIR
          cat >> $CABAL_CONFIG <<EOF
          remote-build-reporting: anonymous
          write-ghc-environment-files: never
          remote-repo-cache: $CABAL_DIR/packages
          logs-dir:          $CABAL_DIR/logs
          world-file:        $CABAL_DIR/world
          extra-prog-path:   $CABAL_DIR/bin
          symlink-bindir:    $CABAL_DIR/bin
          installdir:        $CABAL_DIR/bin
          build-summary:     $CABAL_DIR/logs/build.log
          store-dir:         $CABAL_DIR/store
          install-dirs user
            prefix: $CABAL_DIR
          repository hackage.haskell.org
            url: http://hackage.haskell.org/
          EOF
          cat >> $CABAL_CONFIG <<EOF
          program-default-options
            ghc-options: $GHCJOBS +RTS -M3G -RTS
          EOF
          cat $CABAL_CONFIG
      - name: versions
        run: |
          $HC --version || true
          $HC --print-project-git-commit-id || true
          $CABAL --version || true
      - name: update cabal index
        run: |
          $CABAL v2-update -v
      - name: install cabal-plan
        run: |
          mkdir -p $HOME/.cabal/bin
          curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.7.3.0/cabal-plan-0.7.3.0-x86_64-linux.xz > cabal-plan.xz
          echo 'f62ccb2971567a5f638f2005ad3173dba14693a45154c1508645c52289714cb2  cabal-plan.xz' | sha256sum -c -
          xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan
          rm -f cabal-plan.xz
          chmod a+x $HOME/.cabal/bin/cabal-plan
          cabal-plan --version
      - name: checkout
        uses: actions/checkout@v3
        with:
          path: source
      - name: initial cabal.project for sdist
        run: |
          touch cabal.project
          echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project
          cat cabal.project
      - name: sdist
        run: |
          mkdir -p sdist
          $CABAL sdist all --output-dir $GITHUB_WORKSPACE/sdist
      - name: unpack
        run: |
          mkdir -p unpacked
          find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \;
      - name: generate cabal.project
        run: |
          PKGDIR_c2hs="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/c2hs-[0-9.]*')"
          echo "PKGDIR_c2hs=${PKGDIR_c2hs}" >> "$GITHUB_ENV"
          rm -f cabal.project cabal.project.local
          touch cabal.project
          touch cabal.project.local
          echo "packages: ${PKGDIR_c2hs}" >> cabal.project
          if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package c2hs" >> cabal.project ; fi
          if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "    ghc-options: -Werror=missing-methods" >> cabal.project ; fi
          cat >> cabal.project <<EOF
          EOF
          $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(c2hs)$/; }' >> cabal.project.local
          cat cabal.project
          cat cabal.project.local
      - name: dump install plan
        run: |
          $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
          cabal-plan
      - name: restore cache
        uses: actions/cache/restore@v3
        with:
          key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
          path: ~/.cabal/store
          restore-keys: ${{ runner.os }}-${{ matrix.compiler }}-
      - name: install dependencies
        run: |
          $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all
          $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all
      - name: build w/o tests
        run: |
          $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
      - name: build
        run: |
          $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always
      - name: tests
        run: |
          if [ $((HCNUMVER >= 80000)) -ne 0 ] ; then $CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct ; fi
      - name: cabal check
        run: |
          cd ${PKGDIR_c2hs} || false
          ${CABAL} -vnormal check
      - name: haddock
        run: |
          $CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
      - name: unconstrained build
        run: |
          rm -f cabal.project.local
          $CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
      - name: save cache
        uses: actions/cache/save@v3
        if: always()
        with:
          key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
          path: ~/.cabal/store


================================================
FILE: .gitignore
================================================
/.cabal-sandbox/*
/cabal.sandbox.config
*.chi
*.chs.h
/dist/
/dist-newstyle/
*.hi
/issues/
*.o
/.shelly/*.txt
/tests/bugs/call_capital/Capital
/tests/bugs/call_capital/Capital.chi
/tests/bugs/call_capital/Capital.chs.h
/tests/bugs/call_capital/Capital.hs
/tests/bugs/issue-09/Issue09.hs
/tests/bugs/issue-10/Issue10
/tests/bugs/issue-10/Issue10.hs
/tests/bugs/issue-10/Issue10.i
/tests/bugs/issue-102/Issue102
/tests/bugs/issue-102/Issue102.hs
/tests/bugs/issue-102/issue-102.txt
/tests/bugs/issue-103/Issue103
/tests/bugs/issue-103/Issue103.hs
/tests/bugs/issue-103/Issue103A.hs
/tests/bugs/issue-107/Issue107
/tests/bugs/issue-107/Issue107.hs
/tests/bugs/issue-113/Issue113
/tests/bugs/issue-113/Issue113.hs
/tests/bugs/issue-115/Issue115
/tests/bugs/issue-115/Issue115.hs
/tests/bugs/issue-116/Issue116
/tests/bugs/issue-116/Issue116.hs
/tests/bugs/issue-117/Issue117
/tests/bugs/issue-117/Issue117.chs.c
/tests/bugs/issue-117/Issue117.hs
/tests/bugs/issue-123/Issue123
/tests/bugs/issue-123/Issue123.hs
/tests/bugs/issue-127/Issue127
/tests/bugs/issue-127/Issue127.hs
/tests/bugs/issue-128/Issue128
/tests/bugs/issue-128/Issue128.chs.c
/tests/bugs/issue-128/Issue128.hs
/tests/bugs/issue-130/Issue130
/tests/bugs/issue-130/Issue130.hs
/tests/bugs/issue-131/Issue131
/tests/bugs/issue-131/Issue131.chs.c
/tests/bugs/issue-131/Issue131.hs
/tests/bugs/issue-133/Issue133
/tests/bugs/issue-133/Issue133.hs
/tests/bugs/issue-134/Issue134
/tests/bugs/issue-134/Issue134.hs
/tests/bugs/issue-136/Issue136
/tests/bugs/issue-136/Issue136.hs
/tests/bugs/issue-140/Issue140
/tests/bugs/issue-140/Issue140.hs
/tests/bugs/issue-141/Issue141A.hs
/tests/bugs/issue-141/Issue141B.hs
/tests/bugs/issue-149/Issue149
/tests/bugs/issue-149/Issue149.hs
/tests/bugs/issue-15/Issue15
/tests/bugs/issue-15/Issue15.hs
/tests/bugs/issue-151/Issue151.hs
/tests/bugs/issue-152/Issue152
/tests/bugs/issue-152/Issue152.hs
/tests/bugs/issue-152/Issue152.hs
/tests/bugs/issue-155/Issue155
/tests/bugs/issue-155/Issue155.hs
/tests/bugs/issue-155/Types.hs
/tests/bugs/issue-16/Issue16
/tests/bugs/issue-16/Issue16.hs
/tests/bugs/issue-19/Issue19
/tests/bugs/issue-19/Issue19.hs
/tests/bugs/issue-192/Issue192.hs
/tests/bugs/issue-20/Issue20
/tests/bugs/issue-20/Issue20.hs
/tests/bugs/issue-20/Issue20.i
/tests/bugs/issue-22/Issue22
/tests/bugs/issue-22/Issue22.hs
/tests/bugs/issue-23/Issue23
/tests/bugs/issue-23/Issue23.hs
/tests/bugs/issue-230/Issue230
/tests/bugs/issue-230/Issue230.hs
/tests/bugs/issue-242/Issue242
/tests/bugs/issue-242/Issue242.hs
/tests/bugs/issue-25/Issue25
/tests/bugs/issue-25/Issue25.hs
/tests/bugs/issue-257/Issue257
/tests/bugs/issue-257/Issue257.chs.c
/tests/bugs/issue-257/Issue257.hs
/tests/bugs/issue-29/Issue29.hs
/tests/bugs/issue-29/Issue29.i
/tests/bugs/issue-30/Issue30
/tests/bugs/issue-30/Issue30.hs
/tests/bugs/issue-30/Issue30Aux1.hs
/tests/bugs/issue-30/Issue30Aux2.hs
/tests/bugs/issue-31/Issue31
/tests/bugs/issue-31/Issue31.hs
/tests/bugs/issue-32/Issue32
/tests/bugs/issue-32/Issue32.hs
/tests/bugs/issue-36/Issue36
/tests/bugs/issue-36/Issue36.hs
/tests/bugs/issue-37/Issue37
/tests/bugs/issue-37/Issue37.hs
/tests/bugs/issue-38/Issue38
/tests/bugs/issue-38/Issue38.hs
/tests/bugs/issue-43/Issue43
/tests/bugs/issue-43/Issue43.hs
/tests/bugs/issue-44/Issue44
/tests/bugs/issue-44/Issue44.hs
/tests/bugs/issue-45/Issue45
/tests/bugs/issue-45/Issue45.hs
/tests/bugs/issue-46/Issue46
/tests/bugs/issue-46/Issue46.hs
/tests/bugs/issue-47/Issue47
/tests/bugs/issue-47/Issue47.hs
/tests/bugs/issue-48/Issue48
/tests/bugs/issue-48/Issue48.hs
/tests/bugs/issue-51/Issue51
/tests/bugs/issue-51/Issue51.hs
/tests/bugs/issue-51/Issue51_GNU
/tests/bugs/issue-51/Issue51_GNU.hs
/tests/bugs/issue-51/Issue51_nonGNU
/tests/bugs/issue-51/Issue51_nonGNU.hs
/tests/bugs/issue-54/Issue54
/tests/bugs/issue-54/Issue54.hs
/tests/bugs/issue-60/Issue60
/tests/bugs/issue-60/Issue60.hs
/tests/bugs/issue-60/Issue60.i
/tests/bugs/issue-62/Issue62
/tests/bugs/issue-62/Issue62.hs
/tests/bugs/issue-65/Issue65
/tests/bugs/issue-65/Issue65.hs
/tests/bugs/issue-69/Issue69
/tests/bugs/issue-69/Issue69.hs
/tests/bugs/issue-7/Issue7.hs
/tests/bugs/issue-7/Issue7.i
/tests/bugs/issue-70/Issue70.hs
/tests/bugs/issue-73/Issue73
/tests/bugs/issue-73/Issue73.hs
/tests/bugs/issue-75/Issue75
/tests/bugs/issue-75/Issue75.hs
/tests/bugs/issue-79/Issue79
/tests/bugs/issue-79/Issue79.hs
/tests/bugs/issue-80/Issue80
/tests/bugs/issue-80/Issue80.hs
/tests/bugs/issue-82/Issue82
/tests/bugs/issue-82/Issue82.hs
/tests/bugs/issue-83/Issue83
/tests/bugs/issue-83/Issue83.hs
/tests/bugs/issue-9/Issue9
/tests/bugs/issue-9/Issue9.hs
/tests/bugs/issue-93/Issue93
/tests/bugs/issue-93/Issue93.hs
/tests/bugs/issue-95/Issue95
/tests/bugs/issue-95/Issue95.hs
/tests/bugs/issue-96/Issue103
/tests/bugs/issue-96/Issue96
/tests/bugs/issue-96/Issue96.hs
/tests/bugs/issue-97/Issue97
/tests/bugs/issue-97/Issue97.hs
/tests/bugs/issue-97/Issue97A.hs
/tests/bugs/issue-98/Issue98
/tests/bugs/issue-98/Issue98.hs
/tests/system/calls/Calls.hs
/tests/system/cpp/Cpp.hs
/tests/system/enums/Enums.hs
/tests/system/enums/enums
/tests/system/interruptible/Interruptible.hs
/tests/system/interruptible/interruptible
/tests/system/marsh/Marsh.hs
/tests/system/marsh/marsh
/tests/system/pointer/Pointer.hs
/tests/system/pointer/pointer
/tests/system/simple/Simple.hs
/tests/system/simple/simple
/tests/system/sizeof/Sizeof.hs
/tests/system/sizeof/sizeof
/tests/system/structs/Structs.hs
/tests/system/structs/structs


================================================
FILE: .travis.yml
================================================
env:
  global:
    - AWS_ACCESS_KEY_ID=AKIAIKUEH2ETWTBS2CKQ
    - secure: "Jzawnhgk3dX2INzbZIlnHCH+aKWqy96B9T1hzBh/Fqp4whglaZDO0mTLHQnhypqAt1rXO2o3yBNcKgGOcgfUuE71uBCzzaXieB0p8BhYn7cwYeANbuKNOGrsP6oDutS5F57FNWwgRp+2oanpgJNOs/6wvfElA7W6ibN8tZiLQrw="
  matrix:
    - GHCVER=8.0.1

before_install:
 - travis_retry sudo add-apt-repository -y ppa:hvr/ghc
 - travis_retry sudo apt-get update
 - travis_retry sudo apt-get install libnetcdf-dev libgsl0-dev liblapack-dev
 - travis_retry sudo apt-get install cabal-install-2.4 ghc-$GHCVER-prof ghc-$GHCVER-dyn happy
 - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/2.4/bin:$PATH

install:
  - sudo apt-get update -qq
  - sudo pip install awscli
  - cabal update
  - |
    if [ $GHCVER = "head" ] || [ ${GHCVER%.*} = "7.8" ] || [ ${GHCVER%.*} = "7.10" ] || [ ${GHCVER%.*} = "8.0.1" ]; then
      travis_retry sudo apt-get install happy-1.19.5 alex-3.1.7
      export PATH=/opt/alex/3.1.7/bin:/opt/happy/1.19.5/bin:$PATH
    else
      travis_retry sudo apt-get install happy alex
    fi
  - cabal install --only-dependencies --enable-tests -fregression

script:
  - cabal install && cabal configure --enable-tests -fregression && cabal build && cabal test
  - ./dist/build/regression-suite/regression-suite


================================================
FILE: AUTHORS
================================================
Manuel M T Chakravarty  <chak@cse.unsw.edu.au>
Duncan Coutts           <duncan@haskell.org>

with contributions from (alphabetical order)

Bertram Felgenhauer     <int-e@gmx.de>
Benedikt Huber          <benedikt.huber@gmail.com>
John Lato               <jwlato@gmail.com>
Ian Lynagh              <igloo@earth.li>
André Pang             <ozone@algorithm.com.au>
Jens-Ulrik Petersen     <petersen@haskell.org>
Armin Sander            <armin@mindwalker.org>
Sean Seefried           <sseefried@cse.unsw.edu.au>
Udo Stenzel             <u.stenzel@web.de>
Axel Simon              <A.Simon@ukc.ac.uk>
Michael Weber           <michaelw@debian.org>

Thanks for comments and suggestions to 

Roman Leshchinskiy      <rl@cs.tu-berlin.de>
Jan Kort                <kort@science.uva.nl>
Seth Kurtzberg          <seth@cql.com>
Simon Marlow            <simonmar@microsoft.com>
Matthias Neubauer       <neubauer@informatik.uni-freiburg.de>
Sven Panne              <sven.panne@aedion.de>
Simon L. Peyton Jones   <simonpj@microsoft.com>
Volker Wysk             <post@volker-wysk.de>


================================================
FILE: C2HS.hs
================================================
--  C->Haskell Compiler: Marshalling library
--
--  Copyright (c) [1999...2005] Manuel M T Chakravarty
--
--  Redistribution and use in source and binary forms, with or without
--  modification, are permitted provided that the following conditions are met:
--
--  1. Redistributions of source code must retain the above copyright notice,
--     this list of conditions and the following disclaimer.
--  2. Redistributions in binary form must reproduce the above copyright
--     notice, this list of conditions and the following disclaimer in the
--     documentation and/or other materials provided with the distribution.
--  3. The name of the author may not be used to endorse or promote products
--     derived from this software without specific prior written permission.
--
--  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
--  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
--  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
--  NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
--  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
--  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
--  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
--  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
--  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
--  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--
--- Description ---------------------------------------------------------------
--
--  Language: Haskell 98
--
--  This module provides the marshaling routines for Haskell files produced by
--  C->Haskell for binding to C library interfaces.  It exports all of the
--  low-level FFI (language-independent plus the C-specific parts) together
--  with the C->HS-specific higher-level marshalling routines.
--

module C2HS {-# DEPRECATED "The C2HS module should no longer be used." #-} (

  -- * Re-export the language-independent component of the FFI
  module Foreign,

  -- * Re-export the C language component of the FFI
  module Foreign.C,

  -- * Composite marshalling functions
  withCStringLenIntConv, peekCStringLenIntConv, withIntConv, withFloatConv,
  peekIntConv, peekFloatConv, withBool, peekBool, withEnum, peekEnum,

  -- * Conditional results using 'Maybe'
  nothingIf, nothingIfNull,

  -- * Bit masks
  combineBitMasks, containsBitMask, extractBitMasks,

  -- * Conversion between C and Haskell types
  cIntConv, cFloatConv, cToBool, cFromBool, cToEnum, cFromEnum
) where


import Foreign
import Foreign.C

import Monad (liftM)


-- Composite marshalling functions
-- -------------------------------

-- Strings with explicit length
--
withCStringLenIntConv :: Num n => String -> ((CString, n) -> IO a) -> IO a
withCStringLenIntConv s f    = withCStringLen s $ \(p, n) -> f (p, fromIntegral n)

peekCStringLenIntConv :: Integral n => (CString, n) -> IO String
peekCStringLenIntConv (s, n) = peekCStringLen (s, fromIntegral n)

-- Marshalling of numerals
--

withIntConv   :: (Storable b, Integral a, Integral b)
              => a -> (Ptr b -> IO c) -> IO c
withIntConv    = with . fromIntegral

withFloatConv :: (Storable b, RealFloat a, RealFloat b)
              => a -> (Ptr b -> IO c) -> IO c
withFloatConv  = with . realToFrac

peekIntConv   :: (Storable a, Integral a, Integral b)
              => Ptr a -> IO b
peekIntConv    = liftM fromIntegral . peek

peekFloatConv :: (Storable a, RealFloat a, RealFloat b)
              => Ptr a -> IO b
peekFloatConv  = liftM realToFrac . peek


-- Everything else below is deprecated.
-- These functions are not used by code generated by c2hs.

{-# DEPRECATED withBool        "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-}
{-# DEPRECATED peekBool        "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-}
{-# DEPRECATED withEnum        "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-}
{-# DEPRECATED peekEnum        "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-}
{-# DEPRECATED nothingIf       "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-}
{-# DEPRECATED nothingIfNull   "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-}
{-# DEPRECATED combineBitMasks "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-}
{-# DEPRECATED containsBitMask "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-}
{-# DEPRECATED extractBitMasks "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-}
{-# DEPRECATED cIntConv        "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-}
{-# DEPRECATED cFloatConv      "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-}
{-# DEPRECATED cFromBool       "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-}
{-# DEPRECATED cToBool         "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-}
{-# DEPRECATED cToEnum         "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-}
{-# DEPRECATED cFromEnum       "The C2HS module will soon stop providing unnecessary\nutility functions. Please use standard FFI library functions instead." #-}


-- Passing Booleans by reference
--

withBool :: (Integral a, Storable a) => Bool -> (Ptr a -> IO b) -> IO b
withBool  = with . fromBool

peekBool :: (Integral a, Storable a) => Ptr a -> IO Bool
peekBool  = liftM toBool . peek


-- Passing enums by reference
--

withEnum :: (Enum a, Integral b, Storable b) => a -> (Ptr b -> IO c) -> IO c
withEnum  = with . cFromEnum

peekEnum :: (Enum a, Integral b, Storable b) => Ptr b -> IO a
peekEnum  = liftM cToEnum . peek


-- Storing of 'Maybe' values
-- -------------------------

--TODO: kill off this orphan instance!

instance Storable a => Storable (Maybe a) where
  sizeOf    _ = sizeOf    (undefined :: Ptr ())
  alignment _ = alignment (undefined :: Ptr ())

  peek p = do
             ptr <- peek (castPtr p)
             if ptr == nullPtr
               then return Nothing
               else liftM Just $ peek ptr

  poke p v = do
               ptr <- case v of
                        Nothing -> return nullPtr
                        Just v' -> new v'
               poke (castPtr p) ptr


-- Conditional results using 'Maybe'
-- ---------------------------------

-- Wrap the result into a 'Maybe' type.
--
-- * the predicate determines when the result is considered to be non-existing,
--   i.e. it is represented by `Nothing'
--
-- * the second argument allows to map a result wrapped into `Just' to some
--   other domain
--
nothingIf       :: (a -> Bool) -> (a -> b) -> a -> Maybe b
nothingIf p f x  = if p x then Nothing else Just $ f x

-- |Instance for special casing null pointers.
--
nothingIfNull :: (Ptr a -> b) -> Ptr a -> Maybe b
nothingIfNull  = nothingIf (== nullPtr)


-- Support for bit masks
-- ---------------------

-- Given a list of enumeration values that represent bit masks, combine these
-- masks using bitwise disjunction.
--
combineBitMasks :: (Enum a, Bits b) => [a] -> b
combineBitMasks = foldl (.|.) 0 . map (fromIntegral . fromEnum)

-- Tests whether the given bit mask is contained in the given bit pattern
-- (i.e. all bits set in the mask are also set in the pattern).
--
containsBitMask :: (Bits a, Enum b) => a -> b -> Bool
bits `containsBitMask` bm = let bm' = fromIntegral . fromEnum $ bm
                            in
                            bm' .&. bits == bm'

-- |Given a bit pattern, yield all bit masks that it contains.
--
-- * This does *not* attempt to compute a minimal set of bit masks that when
--   combined yield the bit pattern, instead all contained bit masks are
--   produced.
--
extractBitMasks :: (Bits a, Enum b, Bounded b) => a -> [b]
extractBitMasks bits =
  [bm | bm <- [minBound..maxBound], bits `containsBitMask` bm]


-- Conversion routines
-- -------------------

-- |Integral conversion
--
cIntConv :: (Integral a, Integral b) => a -> b
cIntConv  = fromIntegral

-- |Floating conversion
--
cFloatConv :: (RealFloat a, RealFloat b) => a -> b
cFloatConv  = realToFrac

-- |Obtain C value from Haskell 'Bool'.
--
cFromBool :: Num a => Bool -> a
cFromBool  = fromBool

-- |Obtain Haskell 'Bool' from C value.
--
cToBool :: Num a => a -> Bool
cToBool  = toBool

-- |Convert a C enumeration to Haskell.
--
cToEnum :: (Integral i, Enum e) => i -> e
cToEnum  = toEnum . fromIntegral

-- |Convert a Haskell enumeration to C.
--
cFromEnum :: (Enum e, Integral i) => e -> i
cFromEnum  = fromIntegral . fromEnum


================================================
FILE: COPYING
================================================
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.



                    GNU GENERAL PUBLIC LICENSE
                       Version 2, June 1991

 Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The licenses for most software are designed to take away your
freedom to share and change it.  By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.  This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it.  (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.)  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.

  To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have.  You must make sure that they, too, receive or can get the
source code.  And you must show them these terms so they know their
rights.

  We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.

  Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software.  If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.

  Finally, any free program is threatened constantly by software
patents.  We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary.  To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.

  The precise terms and conditions for copying, distribution and
modification follow.

                    GNU GENERAL PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License.  The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language.  (Hereinafter, translation is included without limitation in
the term "modification".)  Each licensee is addressed as "you".

Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope.  The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.

  1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.

You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.

  2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:

    a) You must cause the modified files to carry prominent notices
    stating that you changed the files and the date of any change.

    b) You must cause any work that you distribute or publish, that in
    whole or in part contains or is derived from the Program or any
    part thereof, to be licensed as a whole at no charge to all third
    parties under the terms of this License.

    c) If the modified program normally reads commands interactively
    when run, you must cause it, when started running for such
    interactive use in the most ordinary way, to print or display an
    announcement including an appropriate copyright notice and a
    notice that there is no warranty (or else, saying that you provide
    a warranty) and that users may redistribute the program under
    these conditions, and telling the user how to view a copy of this
    License.  (Exception: if the Program itself is interactive but
    does not normally print such an announcement, your work based on
    the Program is not required to print an announcement.)

These requirements apply to the modified work as a whole.  If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works.  But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.

Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.

In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.

  3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:

    a) Accompany it with the complete corresponding machine-readable
    source code, which must be distributed under the terms of Sections
    1 and 2 above on a medium customarily used for software interchange; or,

    b) Accompany it with a written offer, valid for at least three
    years, to give any third party, for a charge no more than your
    cost of physically performing source distribution, a complete
    machine-readable copy of the corresponding source code, to be
    distributed under the terms of Sections 1 and 2 above on a medium
    customarily used for software interchange; or,

    c) Accompany it with the information you received as to the offer
    to distribute corresponding source code.  (This alternative is
    allowed only for noncommercial distribution and only if you
    received the program in object code or executable form with such
    an offer, in accord with Subsection b above.)

The source code for a work means the preferred form of the work for
making modifications to it.  For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable.  However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.

If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.

  4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License.  Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.

  5. You are not required to accept this License, since you have not
signed it.  However, nothing else grants you permission to modify or
distribute the Program or its derivative works.  These actions are
prohibited by law if you do not accept this License.  Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.

  6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions.  You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.

  7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all.  For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.

If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.

It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices.  Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.

This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.

  8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded.  In such case, this License incorporates
the limitation as if written in the body of this License.

  9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

Each version is given a distinguishing version number.  If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation.  If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.

  10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission.  For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this.  Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.

                            NO WARRANTY

  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.

  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Also add information on how to contact you by electronic and paper mail.

If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:

    Gnomovision version 69, Copyright (C) year name of author
    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.

You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary.  Here is a sample; alter the names:

  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  `Gnomovision' (which makes passes at compilers) written by James Hacker.

  <signature of Ty Coon>, 1 April 1989
  Ty Coon, President of Vice

This General Public License does not permit incorporating your program into
proprietary programs.  If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library.  If this is what you want to do, use the GNU Lesser General
Public License instead of this License.


================================================
FILE: ChangeLog
================================================
0.28.8.*
 - Bump upper bounds of language-c to 0.10 [#261]
0.28.7
 - Support for InterruptibleFFI (Alex Wied)
 - Support for equality in C macros (Vanessa McHale)
 - Make c2hs source comments more Haddock friendly (George Thomas)
 - (Un)Marshal a C bool into a CUChar instead of CInt
 - The lowest GHC version supported is now 8.0.1, this is due to
   upgrading Shelly to 1.9.0 for tests but generally the
   medium-to-long term plan is to update app code to use 8.0.1
   features as well.
0.28.6
 - Support for binding to anonymous nested structs and unions.
0.28.6
 - Update for GHC 8.6.*
0.28.3
 - Switch to language-c 0.7.1 [#192]
0.28.2
 - Switch to language-c 0.6 [#176]
0.28.1
 - Switch to language-c 0.5 [#157]
 - Fix class hook problem with imports [#155]

0.27.1
 - Alternate specification for sizes in "+" parameters [#140]
 - Fix regression to do with incomplete structure types [#152]
 - Fix pattern match error [PR #153] (deech)

0.26.2
 - Missing import bug [#151]
 - Parameter count checking for {#fun ...#} [#149]
 - Error message for "incomplete types" [#141]

0.26.1
 - Better error messages [PR #139] (Noam Lewis)
 - Fix for OS X block syntax [#138] (Anthony Cowley)
 - Minimal support for va_list [PR #137] (Andy Adams-Moran)
 - Reorganise treatment of standard library imports used by C2HS
   [#136] (https://github.com/haskell/c2hs/blob/master/import-handling.md)
 - C structure tag/typedef confusion bug (caused problems for flock on
   OS X) [#134]
 - C typedefs to void pointers [#133]
 - Bool wrappers for unnamed parameters in C function definitions
   [#131]
 - Incorrect wrapping of some pure C functions [#130]

0.25.2
 - Test fixes to work with GHC 7.10.1

0.25.1
 - Marshalling for C bool values [#128]

0.24.1
 - Revert bad fix for bool handling [#127]
 - Wrapper generation for bare structure arguments [#117] plus custom
   setup script to support Cabal builds on versions of Cabal without
   explicit support for extra C sources generated by preprocessors
   (@RyanGIScott)
 - Arrays in structuress bug [#123]
 - Test fixes for Windows

0.23.1
 - Typedef and default marshalling hooks [#20, #25, #48]
 - Test fixes for 32-bit platforms (Jürgen Keck: @j-keck)
 - Multi-character constants for OS X [#15]
 - Better support for binding to variadic functions [#102]

0.22.1
 - First (not very good) implementation of support for variadic
   functions [#102]
 - Default marshallers for Char types [#98]
 - Improve sizeof computations [#9, #10]

0.21.1
 - Parametrized pointer types in pointer hooks [#36]
 - Special "+" parameters for efficient foreign pointer marshalling [#46]
 - Add default marshallers for C types [#83]
 - Fix treatment of arrays within structs [#115]
 - Add ability to omit given enum values [#116]
 - Regression suite tidy-ups


0.20.1
 - Get CUDA Travis tests working again (hopefully...)
 - Modify approach for defining C2HS_MIN_VERSION macro to work with
   NVIDIA's nvcc CUDA compiler [#111]
 - Fix problem with parser for {#enum ...#} renamings [#113]


0.19.1
 - Add {#const ...#} hook for accessing #defined constants [#65]
 - Persist enumeration definitions across modules [#103]
 - Add nocode keyword for enumeration definitions [#70]
 - Bump version for language-c to fix OS X problems [#82, #85] (thanks to
   Anthony Cowley and Benedikt Huber for help with this)
 - Add finalizer support to foreign pointer definitions [#73]
 - Comment parsing cleanups (Sivert Berg: @sivertb)


0.18.2
 - Add C2HS_MIN_VERSION(major,minor,revision) preprocessor macro
 - Suppress regression suite build (and associated dependency
   installation) for non-Travis cases
 - Fix Cabal file to include previously missing tests


0.18.1
 - Numerous improvements to Enum handling [#78] (Philipp Balzarek:
   @Philonous)
 - Handle Haddock comments within C2HS hook definitions [#62] (@tangboyun)
 - Better error messages for missing files (Zejun Wu: @watashi)
 - Write CHS dump files to output directory (Zejun Wu: @watashi)
 - Handle C calling conventions within function pointer declarations [#88]
   (Michael Steele: @mikesteele81)
 - Fix FreeBSD libssh2 problem [#87] (Cindy Wang: @CindyLinz)
 - Better error messages for hook syntax errors (Ryan Scott: @RyanGIScott)
 - Fixes for GHC 7.9 [#100] (@int-index)
 - Fix test suite to use C2HS from dist directory [#81]
 - Allow free intermixing of command line options and input files [#86]
 - Treat CLang "block" syntax and other "non-GNU" issues differently:
   always undefine __BLOCKS__ CPP symbol to avoid problems with blocks;
   add nonGNU directive to trigger undefine of GNU-specific pre-processor
   symbols [#77]
 - Handle indented CPP directives correctly [#80]
 - Handle #sizeof and #alignof on non-typedef's structures [#95]
 - Fix #get and #set hooks to access newtyped pointers [#96]
 - Fix round-trip problem for interface files caused by changes in
   language-c [#87]
 - Treat "with" specially so that it can appear both as a marshaller
   identifier in an input parameter definition and as a keyword in enum
   definitions [#93]
 - Temporarily disable CUDA regression suite examples (CUDA install
   problems on Travis)


0.17.2
 - Fix more regressions from 0.16.6 (affected packages included
   gnome-keyring, hsndfile and cuda)
 - Add regression suite tests to reduce chances of future regressions


0.17.1

 - Fix regressions from 0.16.6 (caused by fix for issue #45)
 - Version number bump (should have been done in the last release)


0.16.6

 - Trivial integer casts in enum defines supporting typedefs [Anton Dessiatov]
 - Allow forward definition of enums (issue #23)
 - Binding of C enums with aliases (issue #38)
 - Default marshallers for enum and pointer hooks (issue #31)
 - Remove dependencies on C2HS module from marshalling code (issue #37)
 - Problem with MacOS blocks notation (issue #29)
 - Include directive on first line produces invalid Haskell (issue #16)
 - Add command-line switch to suppress GNU preprocessor symbols (issue #60)
 - Fix size and alignment computation of bitfields [Facundo Dominguez]
 - Allow prefixes to be replaced, not just removed (issue #19)
 - Allow reference to structure tags from accessors (issue #54)
   For access paths for {#get#}, {#set#}, etc., one can now specify
   that structure tags are to be searched preferentially by saying,
   for example, {#get struct _point->y#} instead of {#get _point->y#}.
   The latter case will search for typedef names first and only then
   structure tags.
 - Support for anonymous enums (issue #43)
 - with... unwrapper type declarations for pointer hooks (issue #44)
 - {#fun...#} indentation for use in where clauses (issue #45)
 - incorrect method names from terminal class in superclass
   instances (issue #21)
 - "offsetof" directive (issue #22)
 - --include flag cannot handle windows paths (issue #30)
   Now uses System.FilePath splitSearchPath function, which should be
   platform-agnostic.
 - Void functions produce "defined but not used" warning (issue #47)
   Handle fun hooks with a void result using ">>" instead of ">>=".
 - Add CPP undefine flags for Gnu compiler defines (issue #51)
 - Cabal test suite


0.16.5

 - Migration to GitHub; documentation changes.


CHANGES ABOVE THIS POINT ARE FOR VERSIONS AFTER THE MOVE OF THE REPOSITORY
TO GITHUB.  FOR EARLIER CHANGES SEE ChangeLog.old.


================================================
FILE: ChangeLog.CTKlight
================================================
2005-05-18  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* Makefile: Evil Hack to be able create base.build.conf before
	building `libctk.a'

2005-05-18  Andr Pang  <ozone@algorithm.com.au>

	* Adaptation to GHC 6.4 and the Cabal package system

2005-05-18  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* admin/BaseVersion.hs (versnum): 0.27.0

2004-05-15  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* configure.in: Using `egrep' is available (as grep on SunOS
	doesn't handle regular expressions) noticed by Matthias Neubauer
	<neubauer@informatik.uni-freiburg.de>

	* syntax/Parsers.hs (execParser): Added a token mapping as an
	extra argument

2003-10-19  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* configure.in: Support for Mac OS X by Sean Seefried
	<sseefried@cse.unsw.edu.au>

2003-10-19  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* sysdep/Makefile: Posix (and hence, `runPiped') support disabled,
	as `runPiped' (1) isn't really used at the moment, (2) should be
	rewritten anyway, and (3) breaks with GHC 6.3 as the signature of
	`forkProcess' changed.

	* admin/BaseVersion.hs (versnum): 0.26.0

2003-06-10  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* ../mk/common.mk (MKDEPENDFILES): defined ghc6

	* syntax/Makefile (RANK2): defined ghc6

	* sysdep/Makefile (SRCS): defined SysDepGHC6.hs as an alias for
	SysDepGHC4.hs

	* admin/BaseVersion.hs (versnum): 0.25.1

2003-03-13  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* general/Sets.hs (domSetFM): added

	* general/FiniteMaps.hs (domFM): added
	(imageFM): added

	* admin/BaseVersion.hs (versnum): 0.25.0

2003-02-12  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* general/UNames.hs: we derive `Show Name' explicitly to print the
	number only

2003-02-05  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* general/FileOps.hs (mktemp): added

2003-02-01  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* ../common.mk: I wasn't careful when removing the ability (for
	the user) to invoke make in the part directories and hence the
	ability to check dependencies in these directories.  As a result,
	recursive invocations of make tried to check dependencies in part
	directories and erroneously decided that the target is alreasy up
	to date.  Now the object file are removed before descending into
	the recursive make.

	* ../common.mk (gendepend): remove $(DEPEND) first

	* admin/BaseVersion.hs (versnum): 0.24.3

2002-09-16  Manuel M T Chakravarty  <chak@AttitudeAdjuster>

	* Makefile (libctk.o): generating library for GHCi

2002-09-06  Manuel M T Chakravarty  <chak@AttitudeAdjuster>

	* Makefile (OBJS): excluded state/DynArrays.o from the target
	objects for nhc98 (as it chokes on that module)

2002-05-16  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* changed name if base package to `ctk' to not clash with GHC's
	new package naming scheme

	* admin/BaseVersion.hs (versnum): 0.24.2

2002-03-22  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* ../configure.in: test for availability of the `posix' package
	made more reliable
	
	* admin/BaseVersion.hs (versnum): 0.24.1

2002-03-12  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* Makefile: revised to new build system

	* admin/BaseVersion.hs (versnum): 0.24.0

2002-03-06  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* general/Sets.hs (isSuperSet): cut'n'pasto

2002-03-05  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* Makefile: fixed libctk.a target

	* ../configure.in: make sure to include the posix package only for
	GHC (and not for nhc98)

	* admin/BaseVersion.hs (versnum): 0.23.1

2002-02-11  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* Makefile: we are now creating a library archive to use packages

2002-02-10  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* ../mk/common.mk: added package support

	* ../configure.in: added package support; replaced -syslib by -package

	* admin/BaseVersion.hs (versnum): 0.23.0

2002-01-06  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* common.mk: removed TMP as it causes problems on cygwin as
	reported by Karl M. Syring <syring@web.de>

	* admin/BaseVersion.hs (versnum): 0.22.5

2001-09-26  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* general/UNames.hs: nhc98 1.08 doesn't grok deriving Ix

	* ../configure.in: better support for nhc98 

	* admin/BaseVersion.hs (versnum): 0.22.4

2001-05-20  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* state/CIO.hs (doesFileExistCIO): added by Axel Simon <simona_@web.de>

2001-05-13  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* Makefile (spotless): remove config.cache

2001-04-21  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* ../configure.in: Adapted to support ghc 5.x and removed support
	for ghc 3.x

	* admin/BaseVersion.hs (versnum): 0.22.3

2000-10-05  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* ../configure.in: uses the fptools macro for determining ghc's
	version number

2000-10-02  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* errors/Errors.hs (showError): special handling of internal positions

	* admin/Common.hs: added internal positions

	* admin/BaseVersion.hs (versnum): 0.22.2

2000-09-15  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* ../configure.in: corrected ghc version number extraction to
	correctly handle patch levels; added happy - most have gone lost
	earlier...

2000-09-12  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* syntax/Pretty.hs (<>): debugged

2000-09-11  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* syntax/Pretty.hs (Pretty): type class for pretty printing
	(infixOp): added
	(usedWhen): added
	(punctuate): added
	(dot): added

	* admin/BaseVersion.hs (versnum): 0.22.1

2000-09-07  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* syntax/Pretty.hs: Revision of the interface; the interface is
	now 90% compatible to SimonPJ's `Pretty' module; debugging
	(fullRender): dropping leading '\n's
	some more combinators

	* admin/BaseVersion.hs (versnum): 0.22.0

2000-09-03  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* admin/Common.hs (tabPos): Roman pointed out that tab stops
	should be at 1, 9, ... rather than 0, 8, ...

2000-09-02  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* admin/BaseVersion.hs (versnum): 0.21.1

2000-08-18  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* sysdep/Makefile: Moved the posix stuff into an extra module,
	which can be enabled individually

	* ../configure.in: CygWin support; based on suggestions by Anibal
	Maffioletti Rodrigues de DEUS <anibaldedeus@email.com>

	* ../configure.in: uses -silent on lndir only if supported (isn't
	supported before X11R6, says Jan Kort <kort@wins.uva.nl>)

	* admin/BaseVersion.hs (versnum): 0.21.0

2000-08-08  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* syntax/Lexers.hs: Changed the associativity of `quest`, `star`,
	and `plus`.  This change was suggested by Martin Norbck
	<d95mback@dtek.chalmers.se>.

	** WARNING **  This change may break some existing code!!!

2000-06-19  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* admin/BaseVersion.hs (versnum): 0.20.2

2000-04-06  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* ../configure.in: -fasm-x86 is used only if --with-ghc-native is given

	* general/Sets.hs (powerSet): impl

2000-04-05  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* general/Sets.hs: derived Eq and Ord for FMs, which allows sets
	of sets and added `isSubSet' and `isSuperSet'

	* general/FiniteMaps.hs: derived Eq and Ord for FMs

	* admin/BaseVersion.hs (date): 0.20.1

2000-03-04  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* ../configure.in: fixes re compiler & option selection

2000-03-01  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* ../mk/common.mk: fixed dependency computations

	* ../configure.in: polished; on Linux, uses native code generator
	when compiling with GHC 4.0x, x >= 7

2000-02-27  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* syntax/Parsers.hs: table handling substantially rewritten to
	improve the space behaviour

	* general/Utils.hs: `Tag' class

	* admin/BaseVersion.hs (versnum): 0.20.0

2000-02-23  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* ../mk/config.mk.in: set correct access modes in INSTALL_DATA

1999-12-06  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* graphs/Marks.hs: newly implemented

	* admin/BaseVersion.hs (versnum): 0.19.1

1999-12-03  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* syms/Attributes.hs: instance Ord Attrs

1999-12-02  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* sysdep/SysDepNHC1.hs: debugging

1999-12-01  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* ../configure.in,../mk/common.mk: better dependency tool computation

	* syms/Idents.hs: uses `Attributed'

	* syms/Attributes.hs: `Attributed' type class, as suggested by
 	Roman Lechtchinsky

	* admin/BaseVersion.hs (versnum): 0.19.0

	* sysdep/SysDepNHC1.hs: Started the system dependent module for
	nhc98 with assistance from Malcolm Wallace

1999-11-30  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* state/StateTrans.hs: Adapted to new names in mutable variables API

	* general/UNames.hs: Adapted to new names in mutable variables API

	* sysdep/SysDepGHC3.hs: adapted to new names of exported entities

	* sysdep/SysDepGHC4.hs: Cleaned up; no GHC internal stuff is used
	anymore (some of the names of exported entities changed!)

	* sysdep/Makefile: Added support for nhc98

	* ../configure.in & friends: Added support for nhc98

	* admin/BaseVersion.hs (versnum): 0.18.2

1999-11-17  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* ../mk/config.mk.in: introduced `docdir' and `pkgdocdir'
	
	* Make system debianised, according to the suggestions and the
 	patches of Michael Weber <michael.weber@Post.RWTH-Aachen.DE>

	* admin/BaseVersion.hs (versnum): 0.18.1

1999-11-07  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* general/FileOps.hs (fileFindIn): debugged

1999-11-06  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* general/FileOps.hs: new module; implemented `fileFindIn'

	* general/FNameOps.hs (addPath): added

	* admin/BaseVersion.hs (versnum): 0.18.0

1999-10-29  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* admin/BaseVersion.hs (versnum): 0.17.17; fully modularised the
	make system

1999-10-25  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* state/CIO.hs (removeFileCIO): added

	* admin/BaseVersion.hs (versnum): 0.17.16

1999-10-24  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* syms/NameSpaces.hs (nameSpaceToList): added

	* admin/BaseVersion.hs (versnum): 0.17.15

1999-10-21  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* syms/Idents.hs (isLegalIdent): corrected `checkTail' - thanx Sven

1999-10-16  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* syms/NameSpaces.hs (defLocal): uses `defGloal' if there is no
	local range

	
Pre GNU-style change log
------------------------

0.17.13
~~~~~~~
09Oct99 Debugging

0.17.12
~~~~~~~
27Sep99 `CIO.systemCIO'
26Sep99 Debugging and some more clean up of `Lexers'
25Sep99 Some convenience function on `Position's in `Common'
23Sep99 Added `\v' to the control lexer

0.17.11
~~~~~~~
22Sep99 Optimised and extended `Lexers' (meta actions can now return tokens or 
	error messages); prepared the first separate distribution of CTKlight
21Sep99 Debugged `Lexers'

0.17.10
~~~~~~~
29Aug99 Added `Utils.lookupBy'

0.17.9
~~~~~~
22Aug99 Throughly revised `Lexers' (according to SPJ's suggestions)
12Aug99 Revised `Lexers.execLexer' (returns final state, changed semantics
	of meta actions slightly, and structure simplified)

0.17.8
~~~~~~
30Jul99 Clarified `NameSpaces'
19Jul99 Using Roman's `Parsers.seplist1'

0.17.7
~~~~~~
05Jul99 `Lexers' exports `ctrlLexer'

0.17.6
~~~~~~
07Jun99 Small additions to `Idents'
03Jun99 Small additions to `Attributes'

0.17.5
~~~~~~
05Apr99 Configurable makefile variables from common.mk into new config.mk
02Apr99 Small bug fixes
31Mar99 `Parsers': Support for parsing prefixes
30Mar99 Bug fixes (incl. `Parsers.sep')

0.17.4
~~~~~~
13Mar99 Added meta actions to `Parsers'
12Mar99 Revised for GHC 4.02 and Haskell 98
11Mar99 Extension of parser library with threaded state
04Mar99 Self-optimizing lexer library for regular expressions
27Feb99 Self-optimizing LL(1) parser library a la Swierstra/Duponcheel 

0.16.0
~~~~~~
11Feb99 `Idents.cloneIdent' & standard attributes in `Attributes'

0.15.0
~~~~~~
02Feb99 `Set' module

0.14.2
~~~~~~
23Jan99 `Ident' got an instance for `Show'

0.14.1
~~~~~~
01Dec98 Extracted mk/dhc.mk and mk/nepal.mk from mk/common.mk

0.14.0
~~~~~~
13Nov98 Rewrote `CST' into `PreCST' that provides an extra state (part of the
	base state) that can be instantiated by an client compiler using the
	Toolkit.  As a consequence, `state/Switches' can be moved into DHC.

0.13.0
~~~~~~
10Nov98 admin/Version.hs

0.12.0
~~~~~~
19Oct98 Added Sven Panne's `GetOpt' to general/

0.11.1
~~~~~~
23Sep98	Completely overhauled Makefile system.

29Jul98	Finished extraction from what was originally called the HiPar toolkit.


================================================
FILE: ChangeLog.old
================================================
CHANGES ABOVE THIS POINT ARE FOR VERSIONS AFTER THE MOVE OF THE REPOSITORY
TO GITHUB AND ARE DESCRIBED IN THE MAIN ChangeLog FILE.


2005-12-12  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* c2hs/gen/GenBind.hs: When translating the target type of a
	pointer hook into a Haskell type, don't take the pointer hook
	alias map into account.

	* c2hs.cabal: version 0.14.5

	* c2hs/gen/GenBind.hs: Suppress code generation if requested

	* c2hs/chs/CHS.hs: Added `nocode' to pointer hooks

	* c2hs/chs/CHSLexer.hs: Added `nocode'

2005-12-05	Jelmer Vernooij <jelmer@samba.org>

	* c2hs/c/CTrav.hs: only match in `checkForOneCUName' if there are 
	no indirections

2005-12-05	Jelmer Vernooij <jelmer@samba.org>

	* c2hs/gen/GenBind.hs: support mapping struct and union names to haskell
	types

	* c2hs/c/CTrav.hs: added `checkForOneCUName'

Fri Nov 25 10:54:56 EST 2005  Jelmer Vernooij <jelmer@samba.org>

	* add prettify functions for structs, enums and unions

2005-08-10  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* c2hs/gen/GBMonad.hs: apply `upcaseFirstLetter' and
	`downcaseFirstLetter' if specified

	* c2hs/chs/CHS.hs: added `upcaseFirstLetter' and `downcaseFirstLetter'

2005-08-09  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* c2hs/gen/CInfo.hs: exports `getPlatform'

2005-08-08  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* c2hs/toplevel/Main.hs: Added --platform switch for cross compilation

	* c2hs.cabal: 0.14.3

2005-08-08  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* c2hs.cabal: 0.14.2
	* Support asm construct (Duncon Coutts)
	* Hierachical modules  (Duncon Coutts)

2005-07-13  Duncan Coutts  <duncan.coutts@worc.ox.ac.uk>

	* Remove old C lexer & parser and replace them with new ones using
	alex and happy

2005-07-14  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* C2HS library as a single file added to the generated binding
	code

2005-07-13  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* Cabal-ised the build system
	* c2hs.cabal (Version): 0.14.0

2005-05-18  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* toplevel/Version.hs (versnum): 0.13.6

2005-03-14  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* c/CParser.hs: Allow lists of GNU C attributes (patch contributed
	by Duncan Coutts <duncan.coutts@worc.ox.ac.uk>)

	* chs/CHSLexer.hs (instr): Allow 8-bit characters (Volker Wysk
	<post@volker-wysk.de> requested support for umlauts in strings)

	* toplevel/Version.hs (versnum): 0.13.5

2004-10-18  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* chs/CHS.hs (showCHSModule): Don't add extra '\n' after directive
	during pretty printing

	* chs/CHSLexer.hs (cpp): forgot to adapt lexing of #c to the new
	situation where directives don't consume the following '\n'

2004-10-17  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* c2hs.conf.in: Modernised package deps and options

	* gen/GenBind.hs (expandHook): We use the shadow identifier for
	generating the Haskell name.

	* chs/CHSLexer.hs (identOrKW): Identifier may be put in single quotes

	* toplevel/Version.hs (versnum): 0.13.4

2004-10-13  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* chs/CHSLexer.hs (cpp): fixed lexing of directives such that they
	don't consume the '\n' that ends them

	* toplevel/Version.hs (versnum): 0.13.3

	* toplevel/Main.hs (Flag): Added `--output-dir' option and removed
	`--old-ffi'.

	* gen/GenBind.hs (noDftMarshErr): better error message when
	default marshallers are not available
	(isIntegralCPrimType): handle C chars as integral types for marshalling

	* toplevel/Main.hs (process): if there is no explicit output file
	specified, the header file is put in the same directory as the
	binding file; otherwise, it goes in the directory where the output
	file is put

2004-10-09  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* toplevel/Main.hs (process): store header file name in switch board

	* state/Switches.hs: Store the name of the generated header file
	(needed to generate complete foreign import declarations)

	* gen/GenBind.hs (foreignImport): Add name of header file to
	extent strings of generated foreign import declarations

	* c/CAttrs.hs (applyPrefix): never create empty shadow identifiers

2004-10-08  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* chs/CHS.hs (dumpCHS): Header doesn't contain the "-- **"
	sequence anymore that Haddock dislikes.

	* c/CParser.hs (parseCStructUnion): We allow structs and unions
	with no declarations, as GNU C does

	* toplevel/Version.hs (versnum): 0.13.2

2004-08-21  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* tests/Makefile: use configured $HC (courtesy Don Stewart
	<dons@cse.unsw.edu.au>)

2004-06-11  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs (pointerDef): Adapted to the standard interface
	for foreign pointers

2004-06-10  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* c/CParser.hs: Added parsing of function bodies

	* c/CLexer.hs: Added tokens occuring in the statement syntax

2004-06-09  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* c/CAST.hs: Added function bodies

	* c/CPretty.hs: Added `auto' and `register' storage specifiers

	* c/CLexer.hs: Added tokens for `auto' and `register' keywords

	* toplevel/Version.hs (versnum): 0.13.1

2004-05-15  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* c/CParser.hs (parseCHeader): Duncan Coutts
	<duncan.coutts@worcester.oxford.ac.uk> identified a space (and
	time) leak in the old typedef-name morphing setup; this has been
	rewritten now

2004-05-14  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* toplevel/Version.hs (versnum): 0.13.0 "Pressing Forward"

2003-10-20  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs (foreignImport): brought generated foreign import
	declarations in line with FFI Addendum

	* toplevel/C2HSConfig.hs.in: removed legacy FFI support

	* configure.in: removed legacy FFI support

	* mk/config.mk.in: removed legacy FFI support

	* lib/Makefile: Removed all deprecated code and support code for
	old versions of the FFI

	* toplevel/Version.hs (versnum): 0.12.1

2003-10-19  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* c2hs.spec.in: Contributions by Jens Petersen
	<petersen@haskell.org>: specify ghc version to build with;
	don't redundantly provide c2hs; separate library out into
	separate ghc version specific subpackage; put docs into separate
	subpackage; disable empty debuginfo subpackage generation -
	remove buildroot before installing; remove installed doc files,
	since they're explicitly listed

	* c/CLexer.hs (linedir): allow an arbitrary number of ints after
	the filename in a #line directive; problem was first reported by Sean
	Seefried <sseefried@cse.unsw.edu.au>

	* gen/GBMonad.hs (delayCode): Generate appropriate line numbers
	for delayed code; problem reported by Sean Seefried
	<sseefried@cse.unsw.edu.au>

	* chs/CHS.hs (showCHSModule): Never generate negative line numbers

	* toplevel/Version.hs (versnum): 0.12.0 "Springtime"

2003-06-10  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* toplevel/Version.hs (versnum): 0.11.5

2003-05-30  Jens Petersen  <petersen@redhat.com>

	* configure.in: Search for compiler named HC too.

2003-05-30  Jens Petersen  <petersen@redhat.com>

	* c2hs.spec.in (Version): Set directly.
	(Release): Ditto.
	(%prep): Quieten setup.
	(%build): Use configure macro.
	(%install): Use makeinstall macro.
	(%post): Use _bindir.
	(%files): Make root own files.  Use _bindir, _libdir and _mandir.

2003-05-22  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs (Ord): Need instance for `<=' for indirectly
	defined `compare'; bug reported by Ian Lynagh <igloo@earth.li>

	* toplevel/Version.hs (versnum): 0.11.4

2003-04-16  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenHeader.hs (ghFrag): sentries for conditionals must not be
	turned into internal identifiers, as this spoils later equality
	tests with identifiers read from the pre-processed header file;
	bug reported by Axel Simon <A.Simon@ukc.ac.uk>

	* toplevel/Version.hs (versnum): 0.11.3

2003-03-04  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs (evalConstCExpr): supporting enumerators in
	constant expressions

	* toplevel/Version.hs (versnum): 0.11.2

2003-02-13  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* chs/CHS.hs: removed the "header" tag (we now support the CPP
	#include directive)

	* Configuration-related patch by Ian Lynagh <igloo@earth.li> that
	removes issues with GHC 5.05

2003-02-12  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs (expandFrag): Expanding conditionals

	* chs/CHSLexer.hs (haskell): the lexeme for one-line comments
	shouldn't include the terminating newline, as this removes the
	newline for following lexemes (eg CPP directives) and is not
	really necessary due to the Principle of the Longest Match

	* gen/GenHeader.hs: debugging

2003-02-05  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenHeader.hs: New module extracting CPP directives and
	inline-C from a .chs file

	* toplevel/Main.hs (process): Integrated generation of custom C header

	* c/CParser.hs (parseCHeader): Header file may be empty

2003-02-01  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* chs/CHS.hs (showCHSModule): emitting GHC line pragmas
	(CHSFrag): added representations for cpp directives and inline-C
	code, and adapted the functions processind the representations

	* chs/CHSLexer.hs: Added support for pre-processor directives and
	inline-C code

2003-01-31  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* toplevel/Main.hs (process): Now reading the binding module
	before the C header

2003-01-30  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* c/CParser.hs: Allow more GNU attributes contributed by Axel
	Simon <A.Simon@ukc.ac.uk>

2002-09-17  Manuel M T Chakravarty  <chak@AttitudeAdjuster>

	* gen/GBMonad.hs (HsObject): working around a problem with
	deriving Read in GHC 5.04.1

2002-09-16  Manuel M T Chakravarty  <chak@AttitudeAdjuster>

	* Makefile (ghci): target to load all of c2hs into GHCi

2002-09-13  Manuel M T Chakravarty  <chak@AttitudeAdjuster>

	* toplevel/c2hs_config.c: removed the `signed' modifier on
	suggestion of Seth Kurtzberg <seth@cql.com> as it apparently
	confuses the Solaris 8 C compiler

2002-09-07  Manuel M T Chakravarty  <chak@AttitudeAdjuster>

	* c2hs.spec.in: add post install and uninstall scripts to register
	and deregister the package with GHC

	* configure.in: fixed REQUIRES_HASKELL for ghc

	* toplevel/Version.hs (versnum): 0.10.17

2002-09-06  Manuel M T Chakravarty  <chak@AttitudeAdjuster>

	* toplevel/C2HSConfig.hs.in (cppopts): Added "-x c" on suggestion
	by Axel Simon

	* Makefile (install): using --update-package instead of --add-package

	* configure.in: Fixed some nhc98 related issues

	* toplevel/Version.hs (versnum): 0.10.16

2002-07-12  Manuel M T Chakravarty  <chak@AttitudeAdjuster>

	* c2hs-config.in: added the system for which the package was
	compiled to the output of the --version option

	* c/CParser.hs (parseCStructUnion): Allow __extension__ in
	structure declarations and added `inline'.

	* c/CAST.hs: Added `inline'

	* c/CLexer.hs: Added support for `inline' keyword

2002-07-06  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* toplevel/Version.hs (versnum): 0.10.15

2002-05-16  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* lib/C2HSMarsh.hs: added support for bit masks

	* toplevel/Version.hs (versnum): 0.10.14

2002-05-10  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs (setGet): corrected bug in bit fiddling

2002-05-02  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* toplevel/Version.hs (versnum): 0.10.13

2002-04-16  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* toplevel/Version.hs (versnum): 0.10.12

2002-03-20  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* chs/CHSLexer.hs (haskell): Debug the handling of character literals

	* toplevel/Version.hs (versnum): 0.10.11

2002-03-12  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* c2hs.spec.in: we now require the Haskell compiler to be the one
	for which the package was build

	* Makefile: adapted to revised build system

	* toplevel/Version.hs (versnum): 0.10.10

2002-03-06  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* chs/CHSLexer.hs (haskell): Escape characters in Haskell strings
	haven't been handled correctly in all cases as reported by Volker
	Wysk <post@volker-wysk.de>; we also have to handle character
	constants specially, because '"' is a legal Haskell character
	constant

2002-03-03  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* configure.in: Package handling fix by Jens Petersen

	* toplevel/Version.hs (versnum): 0.10.9

2002-02-25  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs: debugging

2002-02-24  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* chs/CHS.hs (parseOptAs): `^' as synonym for previous identifier,
	but with underscores rewritten to caps

	* chs/CHSLexer.hs: added `CHSTokHat'

2002-02-23  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* lib/C2HSMarsh.hs: added some more convenience functions

2002-02-21  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs: Completed processing of function hooks

2002-02-18  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* chs/CHSLexer.hs: Added `CHSTokMinus'

	* chs/CHS.hs: Revised the syntax of fun hooks

	* chs/CHSLexer.hs: Added `CHSTokAmp' (representing `&')

	* gen/GenBind.hs (foreignImport): factorised the code for call
	hook generation to make those portions that are also useful for
	fun hooks reusable
	(expandHook): implemented fun hooks

	* gen/GBMonad.hs: extracted monad-related code from `GenBind.hs'

	* gen/GenBind.hs: split off the monad definition and operations
	into `GBMonad.hs'

2002-02-17  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* chs/CHSLexer.hs: introduced `hsverb' tokens

	* chs/CHS.hs: `pure' instead of `fun' to indicate calls to pure
	C functions (`fun' retained for backwards compatibility)

	* chs/CHSLexer.hs: introduced the keyword `pure'

2002-02-13  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* Makefile: adapted to using GHC package management

2002-02-11  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* lib/Makefile (depend): increase portability

2002-02-06  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* configure.in: probe for `grep'

2002-02-05  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* aclocal.m4 (CTK_GHC_VERSION): no \+ in sed on Solaris

	* toplevel/Version.hs (versnum): 0.10.7

2002-01-15  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs (mergeMaps): now, the read map overrides any
	entires for shared keys in the map that is already in the monad;
	this is so that, if multiple import hooks add entries for shared
	keys, the textually latest prevails; any local entries are entered
	after all import hooks anyway

	* toplevel/Version.hs (versnum): 0.10.6

2002-01-10  Jens Petersen  <juhp@01.246.ne.jp>

	* c/CParser.hs (parseC): corrected "contained contained" in
	proceeding comments.

	* ../doc/c2hs/c2hs.sgml (Set Hooks): correct #get to #set

	* ../doc/c2hs/Makefile (TOP): "../../.." to "../.."

2002-01-10  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* toplevel/Version.hs (versnum): 0.10.5

2001-12-20  Manuel M T Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs (expandHook): fixed a sizeof bug pointed out by Jens
	Petersen <petersen@redhat.com>

	* toplevel/Version.hs (versnum): 0.10.4

2001-12-11  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* toplevel/c2hs_config.c: now conforms to ISO C

	* toplevel/Version.hs (versnum): 0.10.3

2001-11-14  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs (setGet): debugged

2001-11-13  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs (setGet): reading and writing of bitfields
	(alignOffset): now handles alignment of bit fields
	(extractCompType): debugging

2001-11-12  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs (specType): added bitfield handling
	(BitSize): introduced size specs for partially filled storage units

	* toplevel/C2HSConfig.hs.in (bitfieldDirection): added
	(bitfieldPadding): added
	(bitfieldIntSigned): added

	* toplevel/c2hs_config.c: runtime configuration query functions

	* gen/CInfo.hs (CPrimType): extended by variants for bitfields
	(size): now a function instead of an array
	(alignment): now a function instead of an array

	* gen/GenBind.hs (showExtType): simplified `showExtType' again;
	the brace level idea doen't work for `DefinedET' anyway; so, let's
	simplify the code

2001-11-08  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* toplevel/Version.hs (versnum): 0.10.2

2001-10-17  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* c/CParser.hs (parseCDecl): corrected the precise locatio where
	an __attribute__ annotation may occur.

2001-10-16  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs (evalConstCExpr): added `alignof'

	* c/CNames.hs (naCExpr): added `alignof'

	* c/CAST.hs: added `alignof'

	* c/CParser.hs (parseCUnaryExpr): added `alignof' expressions

	* c/CLexer.hs: added keyword `alignof'

	* toplevel/Version.hs (versnum): 0.10.1

2001-10-08  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* chs/CHS.hs: debugged

2001-10-07  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs: handling class hooks

	* Makefile: improved cleaning targets

	* chs/CHS.hs (parseClass): added class hooks

	* chs/CHSLexer.hs: added tokens `class' and `=>'

	* gen/GenBind.hs (isFunExtType): IO types are function types

	* toplevel/Version.hs (versnum): 0.10.0 "Altocumulus Stratiformis
	Perlucidus Undulatus"

2001-08-26  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs (foreignImport): `libName' removed until the new
	FFI conventions for libs are implemented in GHC

	* c/CTrav.hs (dropPtrDeclr): fixed pointer to pointer case

	* c/CPretty.hs: implemented pretty-printing for part of the C AST

2001-08-25  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs (setGet): missed ";" in code generation

	* c/CParser.hs (cidOrTN): after struct or union tag we may have a
	normal idenifier or a type name; spotted by Simon Bowden
	<simonb@cse.unsw.edu.au> and Michael Zinn <michaelz@cse.unsw.edu.au>

2001-08-23  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs (expandHook): adding parenthesis around the
	generated type; problem pointed out by Matthew Tarnawsky
	<matthewt@ics.mq.edu.au>

	* toplevel/Version.hs (versnum): 0.9.9

2001-06-20  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs (expandHook): added sizeof hook
	(sizeAlignOf): corrected size computation for structures to
	conform to [K&R A7.4.8]
	(sizeAlignOf): improved handling of `DefinedET', which led to an
	endless loop

	* chs/CHS.hs: added sizeof hook

	* chs/CHSLexer.hs: added keyword `sizeof'

	* gen/GenBind.hs (evalConstCExpr): sizeof now supported

	* lib/C2HSDeprecated.hs: includes Storable methods of the new
	Storable in addition to those of the old

	* toplevel/Version.hs (versnum): 0.9.8

2001-06-18  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* c/CParser.hs (parseCExpr): `CComma' requires at least two
	expressions; patch by Armin Sander <armin@mindwalker.org>

	* toplevel/Version.hs (versnum): 0.9.7

2001-06-16  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* chs/CHS.hs: local prefix for enum hooks; courtesy of Armin
	Sander <armin@mindwalker.org>

	* gen/GenBind.hs (expandHook): correctly uses a `FunPtr' for
	pointers to functional types
	(setGet): no deep check required as set/get do not perform a deep
	copy; bug reported by Armin Sander <armin@mindwalker.org>
	(expandHook): local prefix for enum hooks; courtesy of Armin
	Sander <armin@mindwalker.org>

	* toplevel/Version.hs (versnum): 0.9.6

2001-05-20  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs (enumInst): Fix for avoiding warnings when
	generated bindings are compiled with -Wall contributed by Armin
	Sander <armin@mindwalker.org>

2001-05-14  Axel Simon <simona@i2.informatik.rwth-aachen.de>

 	* toplevel/Main.hs, state/Switchboard.hs, chs/CHS.hs: add
 	-i flag which takes a colon separated list of search paths for 
 	.chi files.
 
 	* fixed some bugs in parsing import hooks
 	
2001-05-13  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* toplevel/Version.hs (versnum): 0.9.5

	* gen/GenBind.hs (expandHook): revised to properly handle struct,
	union, and enum tags as C identifiers in pointer hooks; also
	handles non-abstract pointers with explicit "*" now better; the
	problems were pointed out by Marcin Kowalczyk <qrczak@knm.org.pl>

	* c/CTrav.hs (findTypeObjMaybe): added
	(lookupDeclOrTag): added
	(enumName): added
	(tagName): added

	* c/CLexer.hs (charconst): Patch from Armin Sander
	<armin@mindwalker.org> regarding character constants

2001-05-11  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* c2hs-config.in: Patch from Jens-Ulrik Petersen
	<juhp@01.246.ne.jp> fixes $sys variable setting

	* toplevel/Version.hs (versnum): 0.9.4

2001-05-06  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs (extractCompType): rewrote that thing again

	* c/CTrav.hs (checkForOneAliasName): added

2001-05-05  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* c/CTrav.hs (chaseDecl): simplified

	* gen/GenBind.hs (expandHook): debugged the pointer hook

	* c/CTrav.hs (findAndChaseDecl): correction

	* toplevel/Version.hs (versnum): 0.9.3

2001-05-03  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs (expandHook): added import hook
	(mergePtrMap): added
	(dumpPtrMap): added

	* chs/CHS.hs (loadCHI): added
	(dumpCHI): added
	(CHSHook): added `import' hook

	* chs/CHSLexer.hs: Added the keywords `import' and `qualified'

	* toplevel/Version.hs (versnum): 0.9.2

2001-05-02  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs (extractCompType): as pointed out by Axel Simon,
	we can't return `ForeignPtr's from imported foreign functions
	(setGet): the `accessType' story is largely redundant with the new
	formulation of `extractCompType', but we still need to check the
	marshaled type
	(setGet): `DefinedET' now takes a declaration rather than an
	identifier as its first argument; this is necessary for anonymous
	declerators
	(extractCompType): functions are now extracted correctly

	* c/CTrav.hs (isPtrDecl): works on identifiers now and chases
	declarations
	(dropPtrDeclr): added

	* gen/GenBind.hs (extractCompType): completely rewrote this
	function to properly handle pointer and function types and honour
	aliases introduced by pointer hooks

2001-05-01  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* c/CTrav.hs (isPtrDeclr): functions types without an explizit
	pointer constructor are no longer regarded as pointers

	* gen/CInfo.hs: renamed `CAddrPT' and `CFunAddrPT' to `CPtrPT' and
	`CFunPtrPT', respectively

	* gen/GenBind.hs (extractCompType): revised for pointer hooks

2001-04-30  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs (setGet): uses FunPtr for functions
	(extractPtrType): added

2001-04-28  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs (expandHook): rewrote `alias'hook into `pointer' hook

	* chs/CHS.hs: rewrote the `alias' hook into the `pointer' hook

	* chs/CHSLexer.hs: removed `alias' token and added `pointer' and
	`newtype'

	* toplevel/Version.hs (versnum): 0.9.1

	* gen/GenBind.hs: clean up

2001-04-21  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* chs/CHSLexer.hs: Added `(' and `)'

	* chs/CHS.hs: Added code implementing the `alias' hook and the
	`deriving' option for the `enum' hook.  This code was contributed
	by Axel Simon <simona_@web.de> (also related code in CHSLexer.hs);
	but added parenthesis to `deriving'

	* c/CTrav.hs: Added code implementing the `alias' hook, which
	was contributed by Axel Simon <simona_@web.de>

	* gen/GenBind.hs: The following patch was contributed by Axel
	Simon <simona_@web.de>: `extractCompType' generates addresses
	of type `Ptr <type>' instead of `Addr' (if `--old-ffi=no', which
	is the default)

	* configure.in: Adapted for ghc 5.00

	* toplevel/Version.hs (versnum): 0.9.0 "Blue Ginger"

2001-02-22  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* lib/C2HSDeprecated.hs: Corrected String marshalling for 4.11;
	suggested by Marcin 'Qrczak' Kowalczyk <qrczak@knm.org.pl>

2001-02-19  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* c2hs-config.in: generated code needs -package lang for
	compilation and linking

	* toplevel/Version.hs (versnum): 0.8.3 "Gentle Moon"

2001-02-13  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* lib/NewStablePtr.hs.in: Adaptation layer for StablePtr for the
	legacy FFI interface

2001-02-12  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* lib/C2HS.hs: Forgot to export `FunPtr' and associated functions

	* lib/C2HSDeprecated.hs: Some exports had been missing

	* c/CTrav.hs: Handle `CAttrs.BuiltinCO'

	* c/CNames.hs (nameAnalysis): add builtin type definitions

	* c/CBuiltin.hs: predefine `__builtin_va_list' as a
	typedef'd name

	* c/CParser.hs (parseCHeader): use `CBuiltin'

	* toplevel/Version.hs (versnum): 0.8.2

2001-02-11  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* releasing version 0.8.1 "Gentle Moon"
	* ../doc/c2hs/: Documentation updated & added the Haskell FFI
	Marshalling Library specification

2001-02-09  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* lib/Makefile: Debugging for 4.11

2001-02-05  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* toplevel/C2HSConfig.hs.in: Moved the primitive characteristics
	table to `CInfo' (it is based now on getting the information from
	the FFI of the Haskell compiler compiling c2hs)

	* gen/CInfo.hs: Added

2001-02-04  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* lib/C2HSMarsh.hs: Moved almost everything to `C2HSDeprecated'

	* lib/C2HSBase.hs: Much simplified conversion routines and the old
	`Storable' definition died

2001-02-03  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* configure.in: Removed all the stuff that had to be there for the
	late `lib/C2HSConfig.hs.in'

	* lib/C2HSConfig.hs.in: RIP - All the relevant information is now
	available from the Standard FFI

	* C2HSDeprecated.hs: Added old C type names

	* lib/C2HS.hs: Added support for the New FFI Libraries (so that
	they are also useable with Haskell systems only supporting the old
	libraries)

2000-08-22  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* lib/C2HSDeprecated.hs: contains a compatibility interface to the
	"Afterthought" series

2000-08-18  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* toplevel/Version.hs (versnum): 0.8.0 "Gentle Moon"

	** WARNING: Only the FFI of GHC 4.08 upwards is supported **

	** WARNING: Code breaking changes to the marshalling library **
	**          Compatibility library provided		     **

2000-08-12  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* lib/C2HSBase.hs (IntConv): instances for Int8, Word8, and Char

	* toplevel/Version.hs (versnum): 0.7.10

2000-08-06  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* chs/CHS.hs (showCHSTrans): corrected syntax
	(parseTrans): comma now correctly required after underscoreToCase

	* gen/GenBind.hs (transTabToTransFun): properly handles prefixes
	in the translation function
	(enumDef): prefixes are now generally removed from enumerators
	without the constraint that the prefix has to be removed from all
	enumerators or none

2000-08-04  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs (usualArithConv): forgot a case; patch
	contributed by Axel Simon <simona@pool.Informatik.rwth-aachen.de>

	* toplevel/Version.hs (versnum): 0.7.9

2000-07-06  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs (specType.matches): forgot a case; bug spotted by
	Axel Simon <simona@pool.Informatik.rwth-aachen.de>

	* lib/C2HSBase.hs (plusAddr): ugly kludge for GHC 4.08 (doesn't
	work with any older version for the moment)

	* toplevel/Version.hs (versnum): 0.7.8

2000-04-15  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* c/CLexer.hs (pragma): ignores `#pragma's

	* toplevel/Version.hs (versnum): 0.7.7

2000-04-09  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* mk/config.mk.in: added

	* gen/GenBind.hs: added `long long's
	(specType): added error message for unsupported types

	* lib/C2HSConfig.hs.in: added `long long's

	* toplevel/C2HSConfig.hs.in: added `long long's

	* toplevel/Version.hs (versnum): 0.7.6

2000-04-08  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* configure.in: corrected sed expression for Solaris

2000-03-02  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* tests/Makefile: added & revised all the tests

	* configure.in: debugging

2000-03-01  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* lib/C2HSMarsh.hs (addrWithMarkerToList): debugged

2000-02-28  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs (expandHook): adapted to new `CHSContext' def

	* c/CParser.hs: Using `Utils.Tag' class to make `CToken' an instance of
	`Token'

	* c/CLexer.hs: Making `CToken' an instance of `Utils.Tag' instead
	of `Eq'

2000-02-25  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* chs/CHS.hs: added `header' tag in context hook

	* chs/CHSLexer.hs: added keyword `header'

	* c/CLexer.hs, c/CParser.hs, c/CAST.hs: added C99 type qualifier
	  `restrict'; thanks to "Marcin 'Qrczak' Kowalczyk"
	  <qrczak@knm.org.pl> for pointing this out

2000-02-24  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* gen/GenBind.hs (foreignImport): system-dependent library suffix

	* configure.in,toplevel/C2HSConfig.hs.in: DLSUFFIX

2000-02-23  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>

	* toplevel/Version.hs (versnum): 0.7.5

1999-12-04  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* lib/C2HSBase.hs (BoolConv): added

1999-11-24  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* ../doc/c2hs/Makefile: corrections by Michael Weber
 	<michael.weber@Post.RWTH-Aachen.DE>

1999-11-17  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* Man pages and debianisation, courtesy of Michael Weber
	<michael.weber@Post.RWTH-Aachen.DE>

	* c/CNames.hs: no new range for tag definitions is started when
	entering a struct declaration list or a parameter list; thanks to
	Volker Wysk <volker.wysk@student.uni-tuebingen.de> for the bug report

	* c/CAttrs.hs (enterNewObjRangeC): added
	(leaveObjRangeC): added

1999-11-16  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* c/CTrav.hs (extractAlias): now correctly handles anonymous
	declarations; introduced new function `declaredDeclr'; thanks to
	Michael Weber <michael.weber@Post.RWTH-Aachen.DE> for the bug report

	* toplevel/Version.hs (versnum): 0.7.4

1999-11-07  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* lib/C2HSBase.hs: adapted to new `assign' and `deref' routines

	* gen/GenBind.hs: debugged

	* c/CTrav.hs (extractStruct): takes care that forward declerations 
	of structs are followed to the full definition

	* lib/C2HSMarsh.hs: added `nothingIf', `nothingIfNull';
	generalised string handling to `listToAddrWithLen' and
	`addrWithLenToList' 

1999-11-06  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* toplevel/Main.hs: Header file search in standard directories and 
	directories passed in `-IDIR' options to cpp.

	* c2hs-config.in: Added `--c2hs' option to `c2hs-config'

	* lib/C2HSMarsh.hs: Michael's `Int'/`Word' patch

1999-11-03  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* lib/C2HSMarsh.hs: more instances for `ToAddr' & `FromAddr'

	* toplevel/Version.hs (versnum): 0.7.3

1999-10-30  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* Makefile: adapted to modularised CTK and added installation support

	* c2hs-config.in: added

	* toplevel/Version.hs (versnum): 0.7.2

1999-10-28  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* c/CNames.hs: multiple declarations for the same object are
	now allowed (thanx Michael)

	* lib/C2HSMarsh.hs: added some suggestions from Michael Weber

	* c/CLexer.hs: #line directives

1999-10-26  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* configure.in: no sizeof or align tests for char

1999-10-25  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* gen/GenBind.hs: some clean up and improved error message with
	more position information

	* chs/CHS.hs: Positions are maintained for improved error messages.

	* toplevel/Main.hs: removes intermediate file (but it can be
	retained on explicit request)

	* toplevel/Version.hs (versnum): 0.7.1

1999-10-24  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* examples/libghttpHS/Ghttp.chs: adapted to new syntax & features

	* configure.in: Solaris patch from Michael Weber
	<michael.weber@Post.RWTH-Aachen.DE>

	* gen/GenBind.hs: new hook syntax

	* chs/CHS.hs (and friends): grok new hook syntax

1999-10-23  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* toplevel/Version.hs (versnum): 0.7.0 (align hook syntax with paper)

	* c/CTrav.hs: routines from `CNames' and `GenBind' generalised and 
	exported from `CTrav'
	(defTag): handles enum tags now correctly

1999-10-22  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* c/CNames.hs: sets up the object associations for usage positions

1999-10-21  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* c/CTrav.hs (defTag): handles refined struct definitions

	* toplevel/Main.hs: Command line option patch from Michael Weber
	<michael.weber@Post.RWTH-Aachen.DE>

	* c/CNames.hs: computes the object reference attributes now

	* c/CTrav.hs (isTypedef): added

	* toplevel/Version.hs (versnum): 0.6.2

1999-10-20  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* examples/libghttpHS/Ghttp.chs: uses `C2HS's exception handling

	* lib/C2HSMarsh.hs: debugging

	* toplevel/Version.hs (versnum): 0.6.1

1999-10-18  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* c/CLexer.hs: computes attributes for identifiers

1999-10-17  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* c/CNames.hs: moved gathering of definitions from `C', starting a 
	more standard name analysis pass

	* c/CTrav.hs: basic traversal support for name space and
	definition attribute operations

	* c/CAttrs.hs: C definition attribute data type and operations

	* toplevel/Version.hs: 0.6.0

1999-10-16  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* lib/C2HSMarsh.hs: Marshaling idioms & exception handling

1999-10-13  Manuel M. T. Chakravarty  <chak@is.tsukuba.ac.jp>

	* examples/libghttpHS/Ghttp.chs: compiles

	* toplevel/Main.hs (execute): debugged

	* lib/C2HS.hs: Advanced marshaling support

	
Pre-GNU style change log
------------------------

0.5.1
~~~~~
12Oct99 lib/C2HSMarsh -> lib/C2HSBase; lib/C2HSMarsh new

0.5.0
~~~~~
08Oct99 Debugging
06Oct99 (# ... #) to {# ... #}; extended `C2HSMarsh'; `Ghttp' example

0.4.1
~~~~~
01Oct99 Improved autoconf support for computing the information necessary for
	determining struct offsets & corresponding changes in `GenBind'
	plus full struct and union support

0.4.0
~~~~~
29Sep99 Debugging
28Sep99 Improving marshaling lib
27Sep99 Autoconf support
26Sep99 More lexer debugging, typedef chasing & field hooks with indirections;
	preprocessing of the C header implemented
21Sep99 Debugged CHS lexer (Haskell comments etc)

0.3.0
~~~~~
06Sep99 Enums correctly lead to `CInt's in foreign import declarations
01Sep99 Added dot syntax for field hooks

0.2.2
~~~~~
01Sep99 Added support for explicit tag values in enumerations
31Aug99 added tag objects to `CAttrs.hs' and `C.hs'; enumeration hooks are
	partial functional

0.2.1
~~~~~
30Aug99 context and call hooks are functional

0.2.0
~~~~~
29Aug99 full path completed
19Aug99 started `lib' part
17Aug99 started `gen' part
17Aug99 finished the CHS parser and printing routines in `CHS.hs'
16Aug99 finished first version of CHS lexer; added `CHS.hs'
15Aug99 started `chs' part

0.1.1
~~~~~
12Aug99 Various fixes to the C lexer and parser; added toplevel/Main.hs and
	c/C.hs

0.1.0
~~~~~
03Apr99 Finished first complete version of C lexer and parser
27Feb99 starting project


================================================
FILE: INSTALL
================================================
                     C->Haskell Installation Instructions            -*-text-*-
                     ------------------------------------

Prerequisites
~~~~~~~~~~~~~

You need GHC, the Haskell compiler. Currently, this has to be GHC 6.8 upwards,
which you can get from

  http://haskell.org/ghc


Simple install procedure
~~~~~~~~~~~~~~~~~~~~~~~~

  % tar -xzf <package>.tar.gz           # unpack the sources
  % cd <package>                        # change to the toplevel directory
  % runghc Setup.hs configure           # configure the build system
  % runghc Setup.hs build               # build everything
  [ Become root if necessary ]
  % runghc Setup.hs install             # install c2hs


The Nitty-Gritty
~~~~~~~~~~~~~~~~

The './Setup.hs configure' command understands the following options:

*  --prefix=PREFIX         install architecture-independent files in PREFIX
                           [ Defaults to /usr/local ]

*  --with-compiler=HC      use Haskell compiler HC

This needs to be the full path to the compiler executable.

*  --with-happy=HAPPY      ditto for parser generator Happy

*  --with-alex=ALEX        ditto for lexer generator Alex

*  --user                  allow the use of packages from user database

*  --global                only allow packages from the global database


Documentation
~~~~~~~~~~~~~
Documentation can be formatted with

  $ make -C doc

Currently there is no support for installing the documentation. That step
has to be done manually.

The generated html pages for the user guide live in:

  docs/user_guide/*

The man page is:

  docs/man1/c2hs.1

Supported Systems and Porting
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Tested with GHC version 6.8.2 and 6.10.1.

In principle it should work with any 6.x version since 6.4.2 however the
current releases of the language-c package only work with ghc-6.8 and later.

The actual c2hs sources might also compile with nhc98, but Cabal doesn't fully
support nhc98 yet.



================================================
FILE: README
================================================
`c2hs` is a interfacing tool that eases Haskell access to C libraries.
The tool gets information about the C data type definitions and
function signatures by analysing the C header files of the library.
It uses this information to compute the missing details in the
template of a Haskell module &mdash; called the binding file &mdash;
that implements a Haskell binding to the C library.  Hooks embedded in
the binding file signal where, which, and how C objects are accessed
from Haskell.  The Haskell code in the binding file determines Haskell
types signatures and marshaling details.

Further information is on the
[wiki](https://github.com/haskell/c2hs/wiki/Home).  Also see the
[user guide](https://github.com/haskell/c2hs/wiki/User-Guide) (also
available in the `doc` directory of the repository).


## Installing

See the file `INSTALL`.


## Copyleft

This system is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.

This system is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with this system; if not, write to the Free Software Foundation,
Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

> **NOTE HOWEVER**, all code included into generated bindings is under
> a BSD-style license that does not place any restrictions on the
> license of the inteface produced with `c2hs` (i.e. closed proprietary
> licenses are possible, too).  In other words, I do not care what you
> use `c2hs` for or to whom you are giving `c2hs` or any interfaces
> generated with `c2hs`, only if you modify or improve `c2hs` itself,
> you have to contribute your changes back to the community.
> Nevertheless, I will of course be particularly delighted if you
> choose to make your work freely available.


## Credits

See the file `AUTHORS`.


================================================
FILE: README.CTKlight
================================================
		       Compiler Toolkit - Light			     -*-text-*-
		       ========================

Contents:

  README.CTKlight -- This file
  LICENSE.LIB	  -- GNU Library General Public License (LGPL)
  BaseVersion.hs  -- Version, copyright, and disclaimer
  Config.hs	  -- Configuration module
  Common.hs	  -- Basic definitions, such as representation of positions
  DLists.hs	  -- Difference lists - provide O(1) append
  Errors.hs	  -- Types and functions for error handling
  FNameOps.hs	  -- Common operations on file names
  FiniteMaps.hs	  -- Finite maps based on 2-3 trees
  GetOpt.hs	  -- Sven Panne's Haskell version of the GNU getopt library
  Lexers.hs	  -- Self-optimising lexer combinators
  Parsers.hs	  -- Self-optimising parser combinators
  Pretty.hs	  -- Pretty printing combinators (the interface is essentially
		     a superset of SimonPJ's pretty printing library)
  Sets.hs	  -- Sets as an instance of the above mentioned finite maps
  Utils.hs	  -- Utility routines

The Compiler Toolkit Light (CTKlight) is a subset of the Compiler Toolkit
(CTK) - an infrastructure for writing compilers in Haskell.  CTKlight
essentially provides support for implementing syntactical analysis without the
more heavy-weight state management (like compiler switches, global error pool,
and exceptions), identifier and attribute management, and various other
utilities included in the full CTK.  Both packages can be obtained from

  http://www.cse.unsw.edu.au/~chak/ctk/


-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- BUILDING -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

In contrast to full CTK, CTKlight is simply a set of Haskell modules without
any complicated makefile structure.  The code is Haskell 98 compliant with the 
exception that `Parser.hs' makes use of existentially quantified type
variables - unfortunately, I do not believe that the same method of
self-optimisation would work without existential types.

The modules are tested with

* GHC 4.02 and upwards (use `-fglasgow-exts' to compile `Parsers.hs') and
* Hugs98 (use `-98' when using `Parsers.hs').

If you want autoconf, a ready-made makefile structure, and much more
additional library functionality, then use full CTK.


-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- COPYLEFT -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Library General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option) any
later version.

This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.  See the GNU Library General Public License for more
details.

You should have received a copy of the GNU Library General Public License
along with this system; if not, write to the Free Software Foundation, Inc.,
675 Mass Ave, Cambridge, MA 02139, USA.

Note: In essence this means that you can use this library in any program
      whether it is free or proprietary.  However, if you modify or extend the
      library itself, you are bound to distribute these modifications or
      extensions according to the terms and conditions of the LGPL.  For
      details consult the license itself, which is located in the file
      `LICENSE.LIB'.


-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- CREDITS -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Author & Maintainer: Manuel M. T. Chakravarty <chak@cse.unsw.edu.au>

Thanks to Simon L. Peyton Jones <simonpj@microsoft.com> and Roman Lechtchinsky
<wolfro@cs.tu-berlin.de> for their helpful suggestions that improved the
design and implementation of the `Lexers' module.


================================================
FILE: README.md
================================================
[![Build Status](https://travis-ci.org/haskell/c2hs.svg?branch=master)](https://travis-ci.org/haskell/c2hs)

`c2hs` is a interfacing tool that eases Haskell access to C libraries.
The tool gets information about the C data type definitions and
function signatures by analysing the C header files of the library.
It uses this information to compute the missing details in the
template of a Haskell module &mdash; called the binding file &mdash;
that implements a Haskell binding to the C library.  Hooks embedded in
the binding file signal where, which, and how C objects are accessed
from Haskell.  The Haskell code in the binding file determines Haskell
types signatures and marshaling details.

Further information is on the
[wiki](https://github.com/haskell/c2hs/wiki/Home).  Also see the
[user guide](https://github.com/haskell/c2hs/wiki/User-Guide) (also
available in the `doc` directory of the repository).


## Installing

To install `c2hs` from Hackage:

    cabal install c2hs

If you like to build from the GitHub repository, see the file
`INSTALL`.  See the `REGRESSION-SUITE` file for a description of how
to run the regression suite for checking C2HS performance against
existing Haskell packages that use it.


## License

All code **generated by** `c2hs` is under a BSD licence. Hence, `c2hs` is useful for both open and closed source projects.

The tool itself is released under the GPLv2. This is the same situation as for the GNU C Compiler. For details, see the file `COPYING`.


================================================
FILE: REGRESSION-SUITE
================================================
                        C2HS REGRESSION SUITE
                        ~~~~~~~~~~~~~~~~~~~~~

C2HS is flexible enough that it's difficult to write a test suite that
covers all the cases of interest to users.  As well as a general test
suite and tests for individual issues, it makes sense to test for C2HS
regressions by installing a range of packages that use C2HS.

The regression suite is managed as a single Cabal test suite called
regression-suite.  This reads a YAML configuration file giving a list
of packages to test against.  The test suite succeeds if a "cabal
install" of each of the test packages succeeds without error, using
the current version of C2HS.

This process requires care for two reasons:

 1. Because C2HS is an FFI tool, packages that use C2HS almost always
    have dependencies on external libraries, so writing a simple test
    suite is not straightforward.

 2. It's undesireable to install a whole set of Haskell packages for
    C2HS regression testing into the user's environment.

To handle these two issues, the regression-suite test suite behaves as
follows:

 ON TRAVIS

  - Always run the regression suite.

  - Install all library dependencies before attempting to install
    Haskell packages.  These dependencies are given in the regression
    suite configuration file as lists of APT package names, optionally
    with PPAs to install them from, or as lists of shell commands to
    use to install the dependencies.

 ON NON-TRAVIS SYSTEMS

  - Only run the regression suite if the C2HS_REGRESSION_SUITE
    environment variable is defined.

  - Assume that all C library dependencies are already installed.

  - Set Cabal flags from environment variables called
    C2HS_REGRESSION_FLAGS_<package> if these variables exist.


The idea is to test for regressions under well-controlled conditions
at each commit on Travis, but maintain the possibility of running the
regression suite locally as well.


================================================
FILE: Setup.hs
================================================
#!/usr/bin/env runhaskell

import Distribution.Simple

main = defaultMain


================================================
FILE: TODO
================================================
								     -*-text-*-
                                C2HS TODO
                                =========

Next: - enum hooks should define cFromEnum/cToEnum as the default marshallers
       (see comment at GenBind.lookupDftMarshIn).

      - Especially with function hooks, it is not sufficient to emit line
	pragmas whenever a new CHS fragment starts.  As some hooks expand to
	multiple lines of Haskell code, we need to reemit the line number of
	the hook once for each line of Haskell generated from it.

      - Points raised by PeteG:
	* The initial comment put by c2hs shouldn't be put in the first line,
	  as this makes it difficult to add {-# OPTIONS #-} pragma to the .chs
	  file, as this pragma must be in the first line.

          The only sensible solution seems to be to copy the first line of the
          .chs file on top if it starts with the string "{-# OPTIONS".

      - Ian requests {#const SYM#} where SYM is a pre-preprocessor symbol to 
        evaluate to the C value of SYM.  Main problem is that the value might
        be of various C types.

      - Tutorial

      - GenBind.setGet: How is it justified that `bitsPerField' is
        fixed to the size of `CInt'?  Does the C def guarantee
	that bitfields types are of the same size?

      Next Major feature to be added: structure marshalling.

      - the `hsverb' should be normalised with respect to white space and
        parenthesis 

      - have an option to compute .chi dependencies; do this on a
        module-by-module basis generating many small depend files rather than
        one big one

      - Pending suggestions from Axel Simon:
	+ succ/pred definitions for enum hooks

      - marshalling of structs

      - We need to handle the time stamps of .chi files more carefully;
        otherwise, we often get lots of unnecessary re-runs of c2hs.

      - Conceptual problem with import hooks: Currently, everything imported
        from a .chi file by a binding module is also dumped into its own .chi
        file.  Is is not generally correct, but it would also not be correct
        to omit everything that has been imported.  The conceptually correct
        solution would be to dump an entry for a type into a .chi file if the
        corresponding Haskell type is exported by the binding module.  To
        achieve this, we would also need an export hook.  Moreover, we may
        import the same object from different modules, due to an implicit
        reexport at the moment.  Either eliminate those reexports, or we have
        the same problems as in Haskell to determine object identity.

      - c2hs has to properly process GNU C "aligned" attributes.  Otherwise,
        it's routine to calculate structure layout may deviate from that of
        the C compiler, which may lead to nasty bugs in bindings.

      - the use of get/set hooks with `class'ed newtypes is complicated, as
        the type doesn't match `Ptr a'; see, e.g. `GtkCList.cListGetNoOfRows'

      - class methods should be able to get user-defined names (needed for
        GtkData.chs)

      - GenBind.mergePtrMap could be improved (see the comment)

      - {#enum ...#} should create an instance of Storable as follows:
	  instance Storable MyEnum where
	    sizeOf    _ = sizeOf    (undefined :: CInt)
	    alignment _ = alignment (undefined :: CInt)

	    peek p   = liftM cToEnum $ peek (castPtr p :: Ptr CInt)
	    poke p v = poke (castPtr p :: Ptr CInt) (cFromEnum v)

      - `GenBind.setGet' needs to take `C2HSConfig.bitfieldDirection' into
        account; otherwise, setting and getting of bitfields won't work on
        architectures where bitfields start at the MSB (rather than the LSB)

      - Vorschlag von Axel Krauth <krauth@infosun.fmi.uni-passau.de>:
        An option with which c2hs prints a list of all functions that have not
        been bound in a header file.  The Position info schould be sufficient
        to determine this.  Maybe also add {#ignore foo#}, which makes it not
        list a given identifier (for private functions listed in the header).
      - In `GdkGL.chs', the prefix is not properly removed from the
        constructors of `GdkGL.Configs'; same problem with
        `GdkEvents.EventType'
      - install the executable (c2hs and c2hs-config) with a version number
        suffix and make a symbolic link for the name without version number
        (makes installing multiple versions easier)
      - #define enum's (see below)
      - intro a safe flag (as opposite to unsafe, but make safe the default)
      - overload stdAddr etc for ForeignObj (stable ptr & cast)
      - C2HSMarsh: from qrczak@knm.org.pl (Marcin 'Qrczak' Kowalczyk)
	  mallocForeignObj:: Int -> IO ForeignObj     -- malloc + freeing finalizer
      - C2HSMarsh: 
	  (!!!)   :: FromAddr a => Ptr a -> Int -> IO a
	  p !!! i  = do
		       v <- fixIO $ deref (p `plusAddr` sizeof v * i)
		       return v
          (Use in GdkColor, then)
	  Part of New FFI, so use that in GdkColor!
      - C2HSMarhs:
	for compound structures it is inconvenient that in a pointer-based
        out, an initial value is needed; thus
	  out   :: (Storable a, FromAddr a) => a -> Marsh a Addr
	  out x  = malloc x :> addrStd
	and this is also convenient
	  inp   :: ToAddr a => a -> Marsh () Addr
	  inp x  = stdAddr x :> free
        Axel also proposes this
	  byValue :: b -> Marsh () b
	  byValue x = use x :> forget
      - Axel suggests,
	  2b. Automatisches Marshalling von Strukturen.
	  Eigentlich mte es doch mglich sein, automatisch Instanzen von
	  Storable fr Strukturen zu erstellen. Falls man mal einen generische
	  Pointer hat, kann man ja mit der ... as ... Methode eigene
	  Marshalling Funktionen zur Verfgung stellen. Oder habe ich da etwas
	  grundstzliches bersehen? 

Short term
~~~~~~~~~~
* cpp directives on the very first line of the .chs file are ignored
  because the lexer looks for \n#  This is very confusing to users.

* The C99 spec says (sec. 6.7.2.1):

       [#4] Each  enumerated  type  shall  be  compatible  with  an
       integer     type.      The     choice     of     type     is
       implementation-defined   but   shall   be   capable   of
       representing  the  values  of  all  the   members   of   the
       enumeration. [...]

  Hence, c2hs has to be a bit more clever about determining the integral type
  used to represent an enum.

* The definition of `GenBind.HsObjectMap' doesn't take into account that in
  Haskell a single name can be used for both a type and a class.

* See FIXME at `GenBind.mergeMaps'.

* Explain the grabbing of cpp -I options from -cppopts= (aka -C) values better 
  in the docu and add something like:

    I prefer that to giving an option to c2hs and passing it to
    cpp, because - as you say - you usually already have a
    variable with the cpp options in your makefile and this way
    you can easily reuse it.

* #define enums in C: siehe unten - scheinen aber wichtig

* In pointer hooks after a `->', we currently allow only type identifiers;
  other forms of Haskell types would be nice, too (especially, `()').

* A function prototype that uses a defined type on its left hand side may
  declare a function, while that is not obvious from the declaration itself
  (without also considering the `typedef').  This is not understood by
  `GenBind' so far.

* Why is a stable name an `unsigned long' in C land?  How about a `void *' and 
  being able to get the `Addr' also in Haskell land?

* if in a binding file erroneously `t->m' is used instead of `t.m' and `t' is
  the tag of a struct, the error message just complains that there is no type
  object for called `t'; it would be more user friendly to report in addition
  that the tag `t' exists, but cannot be used in this expression

* Should it be possible to specify a calling convention in context hook?
  Isn't it a mitake to have explicit calling convention in the FFI?  Shouldn't 
  that be adapted automatically depending on the target architecture?

* Sven: How about exporting Haskell functions (also dynamic export)?
  - callback registration function that explicitly have the type of the
    callback function (from which we might want to generate a foreign export
    dynamic). 

* `mapM raise errs' in `lexC' increases the heap usage by a factor of _8_ when 
  running the lexer alone on `gtkext.h' - probably because the whole analysis
  has to be completed before we can be sure to have no error (and this kills
  an interlocked produced/consumer scheme for the lexer and whatever function
  is consuming the tokens).

* sizeof and type hooks do only allow defined, but not basic types as
  arguments.  This is not a real problem as C2HS provides all the needed
  information to circumvent such usage, but it would still be more elegant to
  support basic types as arguments, too.

Middle term
~~~~~~~~~~~

* A hook {#const <C expr>#} would be nice (as in hsc2hs).  Unfortunately, it
  is not that easy to realise.  We need to parse the <C expr> in the binding
  module.  Moreover, the main value of this would be when the <C expr> is
  put into the C field together with `enum define' stuff, so that all
  pre-processor symbols in it are resolved.  However, this can easily give us
  C compiler errors.  A cheap way out would be {#const "C expr"#} to avoid
  parsing the C expression, but then we can get even more errors during
  compiling the C.

* C->HS might get a lot easier to use by providing as optional marshalling
  libraries modules that handle often occurring standard stuff like converting 
  `time_t' to `CalendarTime' or handle sockets etc.  We would, then, probably
  like to have a matching Posix or so library.

------------ Pre-1.0 rewrite ---------------

Problems:

* There are some implicit requirements on the position of binding hooks, which
  the tool doesn't really enforce: context must be first, context and enum may
  only occur where a toplevel definition is allowed. (This should be checked
  before `GenBind' is used.)  We can not really check that a hook is in a
  position where a toplevel definition is allowed (without analysing
  significant parts of the Haskell code), but we can at least guarantee that
  these hooks occur in column position 0.

* Sven: #define enums in C: Introduce (#enum define SomeEnum {...}#) hooks
  that collect `#define' symbols into an enumeration type; see also
  +haskell/4025.  One probem: If identifiers with the same lexeme as
  `SomeEnum' or the enum members are already defined in the C header, we might 
  get conflicts.

  The problem of this approach is that if the macro expands to something that
  is not a constant expression C, we will get error messages from the
  preprocessor, which are strange to the user.

  Further idea, Michael's: extensible enums

  There are, however, a number of interesting options supported by gcc -E that
  might make alternative solutions to the problem feasible.

END of ----- Pre-1.0 rewrite ---------------

* Do we like direct support for mapping complete structs (if they are
  sufficiently wellbehaved?) into Haskell data structures - both by generating
  the Haskell data type definitions and by generating a `cFrom<Struct>' and a
  `cTo<Struct>' routine.  The latter would be generated as a cascade of field
  hooks.  H/Direct's formal definition of structure marshalling might be
  helpful here.

* Support for evaluating constants is not complete yet.  In this context, it
  should probably also be checked, when there are two overlapping tags in an
  enum (this is allowed in C, but is problematic for marshaling). 

* How about Hugs support?  Is it already possible with current Hugs?


Release Checklist
~~~~~~~~~~~~~~~~~

(1) In root of working directory,

      % make tar-c2hs

(2) Compile the resulting source distribution with latest ghc stable release:

      % tar xzf c2hs-x.y.z.tar.gz
      % cd c2hs-x.y.z
      % ./configure
      % make

(3) Install and regression testing:

    - Installation procedure

        % make install

    - Tests in build/ghc?/c2hs/tests/ directory

(4) Check documentation and add release notes

(5) Extended build test: build with older stable release of ghc and with the
    cvs version

(6) Register CVS tags for CTK and C->HS (syntax: Release-c2hs_x_y_z)

(7) Make newest `tar' and build rpm

(8) Put tar.gz and rpm sources and binaries up on Web page

(9) Optionally also release the current version of CTK

(10) Update the documentation under the Web page's docu/ directory

(11) Announce: haskell@haskell.org, freshmeat.net


================================================
FILE: TODO.CTKlight
================================================
								     -*-text-*-
			  Compiler Base TODO
			  ==================

Next: 


Short Term:
~~~~~~~~~~~
* See general/UNames.hs for nhc98 induced ugliness; change when nhc98 is fixed

* Lexers: For unicode `Char', we need to explicit support for positive and
  negated ranges such as ['\0'..'\255'] and ['\0'..'\255'] \\ ['a'..'c'],
  where the latter is usually written [^abc] (see the haskell-cafe
  discussion).

* Roman introduced the class `Printable'.  A general class based pretty-print
  system would be nice.

* Parsers: Roman had the idea of allowing boolean functions to disambiguate
  the parse table where two rules cannot be distinguished by the usual LL
  mechanism alone (see emails).

* Identifiers in any of the intermediate languages that have the same lexeme as
  a keyword or a predefined identifier should always been pretty-printed in
  their quoted form.

  Difficult to know for each IL which identifiers have to be treated specially.
  We need a kind of IL-dependent exception list.

Middle Term:
~~~~~~~~~~~~
* Use a different attribute mechanism.  The stuff started for the flatten
  prototype looks quite promising.  Observations:

  - Current hipar system with a unique in every node => makes it complicated
    to construct/transform trees, as we always have to clone subtress in a
    monad.
  - GHC's system => when attributes of an identifier are updated, the
    "new" identifiers have to substituted into all expression that contain
    usage occurrences.

* Graph processing support: Does it need to be a new mechanism or can we
  realise it via Attrs (what kind of generic functions could we provide).  One
  possibility is the use of an `Bool' attribute used to implement fast sets
  (e.g. marking).  (If there is a lot of marking, we might want to realise
  indexing with attributes via hashing to be able to work with sparse keys and 
  to already have O(1) during attribute table construction.)

* `FiniteMap' should be an instance of `Functior' with `fmap = mapFM'

* configuration shouldn't be in

* FNameOps, FileOps: Introduce an autoconf set variable that determines
  whether "/" or "\" is used as a delimiter in paths

* Lexers: * After a certain number of errors (say 50); abort lexing.

* Parsers (maybe similar problem with Lexers): If the grammar is not LL(1), we 
  just get an `ambiguous grammar' error message at runtime without any hint,
  which part of the grammer might be ambiguous.  This is too hard to debug!

* In the language-specific `XXXAttrs.hs' modules, the routines for handling 
  the different on the attribute tables have always the same structure;  Only
  the access to the `AttrXXX' datatype is different.  It should be possible to
  generalize them.

  Moreover, the `referring identifier information' is always needed and might
  be generalized.

* The handling of state could be improved by revising the state modules and
  using constructor classes and monad transformers.

  Currently, we only define the state type abstractly when generating a new
  instance of `CST'.  This is in order to be able to use the generic
  operations, such as I/O, also in the monad instance.  But this comprises the 
  security of the monad encapsulation as also the generic functions that allow 
  to extract and copy the state can be used.  Ideally, we want to lift generic 
  operations like I/O automagically into the new monad and to protect it from
  access to its state.  Furthermore, some support for stripping and attaching
  of the type-tag (intro with `newtype') would be nice.


================================================
FILE: appveyor.yml
================================================
build: off

before_test:
# http://help.appveyor.com/discussions/problems/6312-curl-command-not-found
- set PATH=C:\Program Files\Git\mingw64\bin;%PATH%

- curl -sS -ostack.zip -L --insecure http://www.stackage.org/stack/windows-i386
- 7z x stack.zip stack.exe

clone_folder: "c:\\stack"
environment:
  global:
    STACK_ROOT: "c:\\sr"

test_script:
- stack setup > nul
- stack init
# The ugly echo "" hack is to avoid complaints about 0 being an invalid file
# descriptor
- echo "" | stack --no-terminal test

================================================
FILE: c2hs.cabal
================================================
Cabal-Version:  >= 1.10
Name:           c2hs
Version:        0.28.8
License:        GPL-2
License-File:   COPYING
Copyright:      Copyright (c) 1999-2007 Manuel M T Chakravarty
                              2005-2013 Duncan Coutts
                              2008      Benedikt Huber
Author:         Manuel M T Chakravarty
Maintainer:     chak@cse.unsw.edu.au, duncan@community.haskell.org, ian@skybluetrades.net, aditya.siram@gmail.com
Stability:      Stable
Homepage:       https://github.com/haskell/c2hs
Bug-Reports:    https://github.com/haskell/c2hs/issues
Synopsis:       C->Haskell FFI tool that gives some cross-language type safety
Description:    C->Haskell assists in the development of Haskell bindings to C
                libraries. It extracts interface information from C header
                files and generates Haskell code with foreign imports and
                marshaling. Unlike writing foreign imports by hand (or using
                hsc2hs), this ensures that C functions are imported with the
                correct Haskell types.
Category:       Development
Build-Type:     Simple

Tested-With:
  GHC == 9.6.2
  GHC == 9.4.5
  GHC == 9.2.8
  GHC == 9.0.2
  GHC == 8.10.7
  GHC == 8.8.4
  GHC == 8.6.5
  GHC == 8.4.4
  GHC == 8.2.2
  GHC == 8.0.2
  GHC == 7.10.3

--TODO: Cabal should allow 'Data-Files' in the executable stanza
Data-Files:     C2HS.hs
Extra-Source-Files:
  src/C2HS/config.h
  AUTHORS INSTALL README ChangeLog ChangeLog.old
  doc/c2hs.xml doc/c2hs.css doc/man1/c2hs.1 doc/Makefile
  tests/system/calls/*.chs tests/system/calls/*.h
  tests/system/cpp/*.chs
  tests/system/enums/*.chs tests/system/enums/*.h tests/system/enums/*.c
  tests/system/interruptible/*.chs tests/system/interruptible/*.h tests/system/interruptible/*.c
  tests/system/marsh/*.chs tests/system/marsh/*.h
  tests/system/pointer/*.chs tests/system/pointer/*.h tests/system/pointer/*.c
  tests/system/simple/*.chs tests/system/simple/*.h tests/system/simple/*.c
  tests/system/sizeof/*.chs tests/system/sizeof/*.h tests/system/sizeof/*.c
  tests/system/structs/*.chs tests/system/structs/*.h tests/system/structs/*.c
  tests/system/Makefile
  tests/bugs/call_capital/*.chs
  tests/bugs/call_capital/*.h
  tests/bugs/call_capital/*.c
  tests/bugs/issue-7/*.chs tests/bugs/issue-7/*.h
  tests/bugs/issue-9/*.chs tests/bugs/issue-9/*.h tests/bugs/issue-9/*.c
  tests/bugs/issue-10/*.chs tests/bugs/issue-10/*.h tests/bugs/issue-10/*.c
  tests/bugs/issue-15/*.chs tests/bugs/issue-15/*.h tests/bugs/issue-15/*.c
  tests/bugs/issue-16/*.chs tests/bugs/issue-16/*.h tests/bugs/issue-16/*.c
  tests/bugs/issue-19/*.chs tests/bugs/issue-19/*.h tests/bugs/issue-19/*.c
  tests/bugs/issue-20/*.chs tests/bugs/issue-20/*.h tests/bugs/issue-20/*.c
  tests/bugs/issue-22/*.chs tests/bugs/issue-22/*.h tests/bugs/issue-22/*.c
  tests/bugs/issue-23/*.chs tests/bugs/issue-23/*.h tests/bugs/issue-23/*.c
  tests/bugs/issue-25/*.chs
  tests/bugs/issue-29/*.chs tests/bugs/issue-29/*.h
  tests/bugs/issue-30/*.chs tests/bugs/issue-30/*.h tests/bugs/issue-30/*.c
  tests/bugs/issue-31/*.chs tests/bugs/issue-31/*.h tests/bugs/issue-31/*.c
  tests/bugs/issue-32/*.chs tests/bugs/issue-32/*.h tests/bugs/issue-32/*.c
  tests/bugs/issue-36/*.chs tests/bugs/issue-36/*.h
  tests/bugs/issue-38/*.chs tests/bugs/issue-38/*.h tests/bugs/issue-38/*.c
  tests/bugs/issue-43/*.chs tests/bugs/issue-43/*.h tests/bugs/issue-43/*.c
  tests/bugs/issue-44/*.chs tests/bugs/issue-44/*.h tests/bugs/issue-44/*.c
  tests/bugs/issue-45/*.chs tests/bugs/issue-45/*.h tests/bugs/issue-45/*.c
  tests/bugs/issue-46/*.chs tests/bugs/issue-46/*.h tests/bugs/issue-46/*.c
  tests/bugs/issue-47/*.chs tests/bugs/issue-47/*.h tests/bugs/issue-47/*.c
  tests/bugs/issue-48/*.chs tests/bugs/issue-48/*.h tests/bugs/issue-48/*.c
  tests/bugs/issue-51/*.chs tests/bugs/issue-51/*.h tests/bugs/issue-51/*.c
  tests/bugs/issue-54/*.chs tests/bugs/issue-54/*.h tests/bugs/issue-54/*.c
  tests/bugs/issue-60/*.chs tests/bugs/issue-60/*.h tests/bugs/issue-60/*.c
  tests/bugs/issue-62/*.chs tests/bugs/issue-62/*.h tests/bugs/issue-62/*.c
  tests/bugs/issue-65/*.chs tests/bugs/issue-65/*.h tests/bugs/issue-65/*.c
  tests/bugs/issue-69/*.chs tests/bugs/issue-69/*.h tests/bugs/issue-69/*.c
  tests/bugs/issue-70/*.chs tests/bugs/issue-70/*.h tests/bugs/issue-70/*.c
  tests/bugs/issue-73/*.chs tests/bugs/issue-73/*.h tests/bugs/issue-73/*.c
  tests/bugs/issue-75/*.chs tests/bugs/issue-75/*.h tests/bugs/issue-75/*.c
  tests/bugs/issue-79/*.chs tests/bugs/issue-79/*.h tests/bugs/issue-79/*.c
  tests/bugs/issue-80/*.chs tests/bugs/issue-80/*.h tests/bugs/issue-80/*.c
  tests/bugs/issue-82/*.chs
  tests/bugs/issue-83/*.chs
  tests/bugs/issue-93/*.chs tests/bugs/issue-93/*.h tests/bugs/issue-93/*.c
  tests/bugs/issue-95/*.chs tests/bugs/issue-95/*.h tests/bugs/issue-95/*.c
  tests/bugs/issue-96/*.chs tests/bugs/issue-96/*.h tests/bugs/issue-96/*.c
  tests/bugs/issue-97/*.chs tests/bugs/issue-97/*.h tests/bugs/issue-97/*.c
  tests/bugs/issue-98/*.chs tests/bugs/issue-98/*.h tests/bugs/issue-98/*.c
  tests/bugs/issue-102/*.chs
  tests/bugs/issue-103/*.chs tests/bugs/issue-103/*.h tests/bugs/issue-103/*.c
  tests/bugs/issue-107/*.chs
  tests/bugs/issue-113/*.chs tests/bugs/issue-113/*.h tests/bugs/issue-113/*.c
  tests/bugs/issue-115/*.chs tests/bugs/issue-115/*.h tests/bugs/issue-115/*.c
  tests/bugs/issue-116/*.chs tests/bugs/issue-116/*.h tests/bugs/issue-116/*.c
  tests/bugs/issue-117/*.chs tests/bugs/issue-117/*.h tests/bugs/issue-117/*.c
  tests/bugs/issue-123/*.chs tests/bugs/issue-123/*.h tests/bugs/issue-123/*.c
  tests/bugs/issue-127/*.chs tests/bugs/issue-127/*.h tests/bugs/issue-127/*.c
  tests/bugs/issue-128/*.chs tests/bugs/issue-128/*.h tests/bugs/issue-128/*.c
  tests/bugs/issue-130/*.chs tests/bugs/issue-130/*.h tests/bugs/issue-130/*.c
  tests/bugs/issue-131/*.chs tests/bugs/issue-131/*.h tests/bugs/issue-131/*.c
  tests/bugs/issue-133/*.chs tests/bugs/issue-133/*.h
  tests/bugs/issue-134/*.chs tests/bugs/issue-134/*.h
  tests/bugs/issue-136/*.chs tests/bugs/issue-136/*.h tests/bugs/issue-136/*.c
  tests/bugs/issue-140/*.chs tests/bugs/issue-140/*.h tests/bugs/issue-140/*.c
  tests/bugs/issue-141/*.chs tests/bugs/issue-141/*.h
  tests/bugs/issue-149/*.chs tests/bugs/issue-149/*.h tests/bugs/issue-149/*.c
  tests/bugs/issue-151/*.chs tests/bugs/issue-151/*.h
  tests/bugs/issue-152/*.chs tests/bugs/issue-152/*.h
  tests/bugs/issue-155/*.chs tests/bugs/issue-155/*.h
  tests/bugs/issue-180/*.chs tests/bugs/issue-180/*.h
  tests/bugs/issue-192/*.chs tests/bugs/issue-192/*.h
  tests/bugs/issue-230/*.chs tests/bugs/issue-230/*.h tests/bugs/issue-230/*.c
  tests/bugs/issue-242/*.chs tests/bugs/issue-242/*.h tests/bugs/issue-242/*.c
  tests/bugs/issue-257/*.chs tests/bugs/issue-257/*.h tests/bugs/issue-257/*.c

source-repository head
  type:         git
  location:     git://github.com/haskell/c2hs.git

flag base3

Executable c2hs
    Build-Depends:  base >= 2 && < 5,
                    bytestring,
                    language-c >= 0.7.1 && < 0.10,
                    filepath,
                    dlist

    if flag(base3)
        Build-Depends: base >= 3, process, directory, array, containers, pretty
    else
        Build-Depends: base < 3

    if !impl(ghc >= 8.0)
        Build-Depends: fail

    hs-source-dirs: src
    main-is:        Main.hs
    other-modules:
      C2HS.C
      C2HS.C.Attrs
      C2HS.C.Builtin
      C2HS.C.Info
      C2HS.C.Names
      C2HS.C.Trav
      C2HS.CHS
      C2HS.CHS.Lexer
      C2HS.Gen.Monad
      C2HS.Gen.Bind
      C2HS.Gen.Header
      C2HS.Gen.Wrapper
      C2HS.State
      C2HS.Switches
      C2HS.Config
      C2HS.Version

      Control.StateBase
      Control.State
      Control.StateTrans
      Data.Attributes
      Data.Errors
      Data.NameSpaces
      Paths_c2hs
      System.CIO
      Text.Lexers

    default-extensions:     ForeignFunctionInterface
    c-sources:      src/C2HS/config.c
    --TODO: eliminate the need to suppress these warnings:
    ghc-options:      -Wall
                      -fno-warn-incomplete-patterns
    if impl(ghc >= 8.0)
      ghc-options:    -Wcompat
    default-language: Haskell2010

Test-Suite test-bugs
  type:                exitcode-stdio-1.0
  hs-source-dirs:      tests
  main-is:             test-bugs.hs
  other-modules:       Paths_c2hs
  build-tools:         c2hs
  build-depends:       base,
                       filepath,
                       ghc-paths,
                       test-framework,
                       test-framework-hunit,
                       HUnit,
                       shelly >= 1.9.0,
                       text,
                       transformers
  default-language: Haskell2010

Test-Suite test-system
  type:                exitcode-stdio-1.0
  hs-source-dirs:      tests
  main-is:             test-system.hs
  other-modules:       Paths_c2hs
  build-tools:         c2hs
  build-depends:       base,
                       ghc-paths,
                       test-framework,
                       test-framework-hunit,
                       HUnit,
                       shelly >= 1.9.0,
                       text,
                       transformers
  default-language: Haskell2010

Flag regression
  description: Enable regression suite build.
  default:     False

Executable regression-suite
  main-is:             regression-suite.hs
  hs-source-dirs:      tests
  if flag(regression)
    build-depends:       base,
                         filepath,
                         shelly >= 1.9.0,
                         text,
                         yaml >= 0.8
  else
    buildable: False
  default-language: Haskell2010


================================================
FILE: cabal.haskell-ci
================================================
-- shelly >= 1.9 requires GHC >= 8.0
tests: >= 8.0


================================================
FILE: custom-setup.hs
================================================
--
-- This Cabal setup script should ONLY be used in cases WHERE:
--
--   the bare structure wrapper capability of C2HS is used (i.e. '%'
--   characters on pointer type arguments in "fun" hooks);
--
-- AND
--
--   a version of Cabal is being used that does not allow
--   preprocessors to specify extra C sources (versions of
--   cabal-install <= 1.22.0.0).
--
-- Otherwise Cabal should be able to deal with the extra C sources
-- itself.
--
-- If in doubt, ask...
--

module Main (main) where

import Control.Exception (catch)
import Control.Monad (forM)

import Distribution.PackageDescription
    (BuildInfo(..), Executable(..), Library(..), PackageDescription(..))
import Distribution.Simple (UserHooks(..),
                            defaultMainWithHooks, simpleUserHooks)
import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..))
import Distribution.Simple.Setup (BuildFlags)
-- Test-suites require Cabal-1.10 or greater
import Distribution.PackageDescription (TestSuite(..))
-- Benchmarks require Cabal-1.14 or greater
import Distribution.PackageDescription (Benchmark(..))

import System.Directory (doesDirectoryExist, getDirectoryContents)
import System.Exit (ExitCode)
import System.FilePath ((</>), takeExtensions)

main :: IO ()
main = defaultMainWithHooks simpleUserHooks { buildHook = chsBuildHook }

addCSources :: [FilePath] -> BuildInfo -> BuildInfo
addCSources newSrcs bi@(BuildInfo { cSources = oldSrcs }) =
  bi { cSources = newSrcs ++ oldSrcs }

hasChsCExtension :: FilePath -> Bool
hasChsCExtension file = takeExtensions file == ".chs.c"

getRecursiveContents :: FilePath -> IO [FilePath]
getRecursiveContents topdir = do
    topdirExists <- doesDirectoryExist topdir
    if (not topdirExists)
       then return []
       else do
           names <- getDirectoryContents topdir
           let properNames = filter (`notElem` [".", ".."]) names
           paths <- forM properNames $ \name -> do
               let path = topdir </> name
               isDirectory <- doesDirectoryExist path
               if isDirectory
                  then getRecursiveContents path
                  else return [path]
           return (concat paths)

chsBuildHook :: PackageDescription -> LocalBuildInfo -> UserHooks ->
                BuildFlags -> IO ()
chsBuildHook pd lbi uh bf = hook `catchExitCode` \_ -> hook
  where
    hook :: IO ()
    hook = chsBuildHook' pd lbi uh bf

    catchExitCode :: IO a -> (ExitCode -> IO a) -> IO a
    catchExitCode = catch

chsBuildHook' :: PackageDescription -> LocalBuildInfo -> UserHooks ->
                 BuildFlags -> IO ()
chsBuildHook' pd@(PackageDescription
                   { library     = mbLib
                   , executables = exes
                   , testSuites  = tss
                   , benchmarks  = bms
                   })
             lbi uh bf = do
    let distBuildDir = buildDir lbi
    chsCFiles <- fmap (filter hasChsCExtension) $
                 getRecursiveContents distBuildDir
    let pd' = pd { library     = fmap (\lib -> lib { libBuildInfo       = addCSources chsCFiles (libBuildInfo lib)      }) mbLib
                 , executables = fmap (\exe -> exe { buildInfo          = addCSources chsCFiles (buildInfo exe)         }) exes
                 , testSuites  = fmap (\ts  -> ts  { testBuildInfo      = addCSources chsCFiles (testBuildInfo ts)      }) tss
                 , benchmarks  = fmap (\bm  -> bm  { benchmarkBuildInfo = addCSources chsCFiles (benchmarkBuildInfo bm) }) bms
                 }
    buildHook simpleUserHooks pd' lbi uh bf


================================================
FILE: doc/Makefile
================================================
#  C->Haskell Compiler: documentation makefile
#
#  Author : Manuel M T Chakravarty
#  Created: 30 October 1999
#
#  Version $Revision: 1.9 $ from $Date: 2002/07/06 09:59:40 $
#
#  Copyright (c) [1999..2002] Manuel M T Chakravarty
#
#  This file is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This file is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  = DOCU =====================================================================
#
#  * Nothing is installed at the moment. That has to be done manually.

# must be first
#
default: html

XMLLINT=xmllint
XMLLINT_OPTIONS=--nonet --noout --valid

XSLTPROC=xsltproc
XSLTPROC_HTML_OUTDIR=users_guide/
XSLTPROC_HTML_CSS=c2hs.css
XSLTPROC_HTML_PARAMS=\
	--param use.id.as.filename 1 \
	--stringparam base.dir $(XSLTPROC_HTML_OUTDIR) \
	--stringparam html.stylesheet $(XSLTPROC_HTML_CSS)
XSLTPROC_HTML_STYLESHEET=http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl
XSLTPROC_OPTIONS=--nonet $(XSLTPROC_HTML_PARAMS) $(XSLTPROC_HTML_STYLESHEET)

# build targets
#
.PHONY: html pdf
html: c2hs.xml
	$(XMLLINT) $(XMLLINT_OPTIONS) $<
	$(XSLTPROC) $(XSLTPROC_OPTIONS) $<
	cp $(XSLTPROC_HTML_CSS) $(XSLTPROC_HTML_OUTDIR)

pdf: c2hs.xml
	sgml2pdf $<

# auxiliary targets
#
.PHONY: clean
clean:
	-rm -rf users_guide/ c2hs.pdf


================================================
FILE: doc/c2hs.css
================================================
div {
  font-family: sans-serif;
  color: black;
  background: white
}

h1, h2, h3, h4, h5, h6, p.title { color: #005A9C }

h1 { font:            170% sans-serif }
h2 { font:            140% sans-serif }
h3 { font:            120% sans-serif }
h4 { font: bold       100% sans-serif }
h5 { font: italic     100% sans-serif }
h6 { font: small-caps 100% sans-serif }

pre {
  font-family: monospace;
  border-width: 1px;
  border-style: solid;
  padding: 0.3em
}

pre.screen         { color: #006400 }
pre.programlisting { color: maroon }

div.example {
  margin: 1ex 0em;
  border: solid #412e25 1px;
  padding: 0ex 0.4em
}

div.example, div.example-contents {
  background-color: #fffcf5
}

a:link    { color:      #0000C8 }
a:hover   { background: #FFFFA8 }
a:active  { color:      #D00000 }
a:visited { color:      #680098 }


================================================
FILE: doc/c2hs.xml
================================================
<?xml version="1.0" encoding="UTF8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
    <!ENTITY C2hs 'C&#10132;Haskell'>
    <!ENTITY c2hs '<command>c2hs</command>'>
  ]>

<!-- C->Haskell documentation
 -->
<article>
<articleinfo>
  <title>The Binding Generator &C2hs;</title>
  <authorgroup>
    <author>
      <firstname>Manuel</firstname>
      <surname>Chakravarty</surname>
      <email>chak@cse.unsw.edu.au</email>
    </author>
<!--    <author>
      <firstname>Duncan</firstname>
      <surname>Coutts</surname>
      <email>duncan@haskell.org</email>
    </author>-->
  </authorgroup>
  <pubdate>November 2007</pubdate>
</articleinfo>
<abstract>
  <para>
  &C2hs; is an interface generator that simplifies the development of
  <ulink url="http://haskell.org">Haskell</ulink> bindings to C libraries.  The
  tool processes existing C header files that determine data layout and function
  signatures on the C side in conjunction with Haskell modules that specify
  Haskell-side type signatures and marshaling details.  Hooks embedded in the
  Haskell code signal access to C structures and functions -- they are expanded
  by the interfacing tool in dependence on information from the corresponding C
  header file.  Another noteworthy property is the lightweight nature of the
  approach.
  </para>
</abstract>

<para>
More background information is available in a research paper discussing
&C2hs;, which is at
<ulink url="http://www.cse.unsw.edu.au/~chak/papers/papers.html#c2hs"/>.
However, this paper does not cover the more recent advanced features such as
function hooks and conditional compilation.
</para>

<sect1 id="installation">
  <title>Installation</title>
  <para>
  It follows a brief discussion of the installation from source.  There is,
  however, a file <filename>INSTALL</filename> in the source distribution, which is
  more frequently updated and should be consulted in any case.
  </para>

  <sect2>
    <title>Where is the Source?</title>
    <para>
    The master site of &C2hs; is at
    <ulink url="http://www.cse.unsw.edu.au/~chak/haskell/c2hs/"/>.  It has all the
    latest information and sources.  Furthermore, it explains how to get access to
    the &C2hs; Darcs repository and has references to pre-compiled binaries.
    </para>
  </sect2>

  <sect2>
    <title>What Else Do I Need?</title>
    <para>
    You need a Haskell system supported by &C2hs;. Currently, this is only
    the <firstterm>Glasgow Haskell Compiler (GHC)</firstterm>, which you can obtain
    from <ulink url="http://haskell.org/ghc/"/>.  Furthermore, you need the Haskell
    package system Cabal. See the <filename>INSTALL</filename> file for details on
    supported versions.
    </para>

    <para>
    To build the documentation, you will also need the <firstterm>SGML
    Tools</firstterm>, which you find at your nearest sunsite or Linux mirror or at
    <ulink url="ftp://ftp.lip6.fr/pub/sgml-tools/"/>.  On an up-to-date Linux
    system, the tools are probably already installed.
    </para>
  </sect2>

  <sect2>
    <title>I Got Everything, and Now?</title>
    <para>
    The short answer is
<screen>
$ tar -xzf <replaceable>package</replaceable>.tar.gz      # unpack the sources
$ cd <replaceable>package</replaceable>                   # change to the toplevel directory
$ runghc Setup.hs configure    # configure the build system
$ runghc Setup.hs build        # build everything
[ Become root if necessary ]
$ runghc Setup.hs install      # install c2hs
</screen>
    </para>

    <para>
    In the <filename>INSTALL</filename> file, there are more details.
    </para>

    <para>
    Optionally, you can build the documentation by issuing <userinput>make
    doc</userinput> and install it with <userinput>make install-doc</userinput>.
    </para>
  </sect2>
</sect1>

<sect1 id="usage">
  <title>Usage of &C2hs;</title>
  <para>
  Let's have a brief look at how to call the tool and how to use the generated
  interfaces.
  </para>

  <sect2>
    <title>Usage of &c2hs;</title>
    <para>
    &C2hs; is implemented by the executable &c2hs;. The simplest form of usage
    is

<screen>
c2hs <replaceable>Lib</replaceable><literal>.chs</literal>
</screen>

    where <replaceable>Lib</replaceable><literal>.chs</literal> is the Haskell
    binding module defining the Haskell interface to a C library together with
    the required marshalling code. If &c2hs; is invoked in this manner, the
    binding module must contain a cpp <literal>#include</literal> directive to
    determine the C-side interface of the library. Alternatively, a C header
    file can be specified on the command line, as in

<screen>
c2hs <replaceable>lib</replaceable><literal>.h </literal><replaceable>Lib</replaceable><literal>.chs</literal>
</screen>

    However, the latter option is only preserved for backwards compatibility and
    not recommended.  If no errors occur, &c2hs; generates three files:
    <orderedlist>
      <listitem>
        <para>
        a pure Haskell module <replaceable>Lib</replaceable><literal>.hs</literal>,
        which implements the Haskell API of the library
        </para>
      </listitem>
      <listitem>
        <para>
         a C header file <replaceable>Lib</replaceable><literal>.h</literal>
         which some Haskell systems need to compile the generated Haskell code.
        </para>
      </listitem>
      <listitem>
        <para>
        a &c2hs; interface file
        <replaceable>Lib</replaceable><literal>.chi</literal> that is used by
        other binding modules that import
        <replaceable>Lib</replaceable><literal>.hs</literal> using an import
        hook (see <xref linkend="import"/>the section on import hooks for details).
        </para>
      </listitem>
    </orderedlist>
    </para>

    <para>
    The executable &c2hs; has a couple more options:
<screen>
Usage: c2hs [ option... ] [header-file] binding-file

  -C CPPOPTS   --cppopts=CPPOPTS    pass CPPOPTS to the C preprocessor
  -c CPP       --cpp=CPP            use executable CPP to invoke C preprocessor
  -d TYPE      --dump=TYPE          dump internal information (for debugging)
  -h, -?       --help               brief help (the present message)
  -i INCLUDE   --include=INCLUDE    include paths for .chi files
  -k           --keep               keep pre-processed C header
  -l           --copy-library       copy `C2HS' library module in
  -o FILE      --output=FILE        output result to FILE (should end in .hs)
  -p PLATFORM  --platform=PLATFORM  platform to use for cross compilation
  -t PATH      --output-dir=PATH    place generated files in PATH
  -v           --version            show version information
               --numeric-version    show version number

The header file must be a C header file matching the given binding file.
The dump TYPE can be
  trace   -- trace compiler phases
  genbind -- trace binding generation
  ctrav   -- trace C declaration traversal
  chs     -- dump the binding file (adds `.dump' to the name)
PLATFORM can be x86_64-linux, i686-linux, m68k-palmos
</screen>

    The most useful of these is probably <literal>--cppopts=</literal> (or
    <literal>-C</literal>).  If the C header file needs any special options
    (like <literal>-D</literal> or <literal>-I</literal>) to go through the C
    pre-processor, here is the place to pass them.  A call may look like this:

<screen>
c2hs --cppopts='-I/some/obscure/dir' --cppopts=-DEXTRA' <replaceable>Lib</replaceable>.chs
</screen>

    If you have more than one option that you want to pass to the pre-processor
    it is best to use multiple <literal>--cppopts=</literal> flags. That way
    there is no need to worry about quoting.
    </para>
    
    <para>
    Often, <replaceable>lib</replaceable><literal>.h</literal> will not be in
    the current directory, but in one of the header file directories. &c2hs;
    leaves locating the header file to the standard C preprocessor, which
    usually looks in two places for the header: first, in the standard include
    directory of the used system, this is usually <filename>/usr/include</filename> and
    <filename>/usr/local/include</filename>; and second, it will look in every directory
    that is mentioned in a <literal>-IDIR</literal> option passed to the
    pre-processor via <literal>--cppopts</literal>.
    </para>

    <para>
    If the compiled binding module contains import hooks, &C2hs; needs to
    find the <literal>.chi</literal> (&C2hs; interface files) produced while compiling
    the corresponding binding modules.  By default, they will be searched for in
    the current working directory.  If they are located elsewhere, the
    <literal>--include=<replaceable>INCLUDE</replaceable></literal> option has
    to be used to indicate the location, where
    <replaceable>INCLUDE</replaceable> is a colon-separated list of
    directories.  Multiple such options are admissible.  Paths specified later
    are searched first.
    </para>
  </sect2>
  
  <sect2>
    <title>Compilation of a Generated Haskell API</title>
    <para>
    &C2hs; comes with a marshalling library, called <literal>C2HS</literal>,
    which needs to be explicitly imported into Haskell binding modules.  The
    library contains functions that users might use explicitly, but also
    functions that &C2hs; will generate for some classes of bindings.  The
    library takes the form of a single Haskell module, which &c2hs; places in
    the same directory as the generated binding whenever it is given the
    <literal>--copy-library</literal> (or <literal>-l</literal>) option.
    </para>
  </sect2>
</sect1>

<sect1 id="implementing">
  <title>Implementation of Haskell Binding Modules</title>
  <para>
  A discussion of binding modules, the principles behind the tool, and a
  discussion of related work can be found in a research paper located at <ulink
  url="http://www.cse.unsw.edu.au/~chak/papers/papers.html#c2hs" />.  All
  features described in the paper, except <literal>enum define</literal> hooks
  are implemented in the tool, but since the publication of the paper, the tool
  has been extended further.  The library interface essentially consists of the
  new Haskell FFI Marshalling Library.  More details about this library are
  provided in the next section.
  </para>

  <para>
  The remainder of this section describes the hooks that are available in
  binding modules.
  </para>

  <sect2 id="import">
    <title>Import Hooks</title>
    <para>
<programlisting>
{#import [qualified] <replaceable>modid</replaceable>#}
</programlisting>

    Is translated into the same syntactic form in Haskell, which implies that
    it may be followed by an explicit import list.  Moreover, it implies that
    the module <replaceable>modid</replaceable> is also generated by &C2hs; and
    instructs the tool to read the file
    <replaceable>modid</replaceable><literal>.chi</literal>.
    </para>
    <para>
    If an explicit output file name is given (<literal>--output</literal>
    option), this name determines the basename for the <literal>.chi</literal>
    file of the currently translated module. 
    </para>
    <para>
    Currently, only pointer hooks generate information that is stored in a
    <literal>.chi</literal> file and needs to be incorporated into any client
    module that makes use of these pointer types.  It is, however, regarded as
    good style to use import hooks for any module generated by &C2hs;.
    </para>
    <note>
      <title>Restriction</title>
      <para>
      &C2hs; does not use qualified names.  This can be a problem, for example,
      if two pointer hooks are defined to have the same unqualified Haskell
      name in two different modules, which are then imported by a third module.
       To partially work around this problem, it is guaranteed that the
       declaration of the textually later import hook dominates.
      </para>
    </note>
  </sect2>

  <sect2>
  <title>Context Hooks</title>
    <para>
<programlisting>
{#context [lib = <replaceable>lib</replaceable>] [prefix = <replaceable>prefix</replaceable>]#}
</programlisting>

    Context hooks define a set of global configuration options.  Currently,
    there are two parameters which are both strings
    <itemizedlist>
      <listitem>
        <para>
        <replaceable>lib</replaceable> is a dynamic library that contains
        symbols needed by the present binding.
        </para>
      </listitem>
      <listitem>
        <para><replaceable>prefix</replaceable> is an identifier prefix that
        may be omitted in the lexemes of identifiers referring to C definitions
        in any binding hook.  The is useful as C libraries often use a prefix,
        such as <literal>gtk_</literal>, as a form of poor man's name spaces. 
        Any occurrence of underline characters between a prefix and the main
        part of an identifier must also be dropped.  Case is not relevant in a
        prefix.  In case of a conflict of the abbreviation with an explicitly
        defined identifier, the explicit definition takes preference.
        </para>
      </listitem>
    </itemizedlist>

    Both parameters are optional.  An example of a context hook is the
    following:
<programlisting>
{#context prefix = "gtk"#}
</programlisting>
    </para>
    <para>
    If a binding module contains a binding hook, it must be the first hook in
    the module.
    </para>
  </sect2>

  <sect2>
    <title>Type Hooks</title>
    <para>
<programlisting>
{#type <replaceable>ident</replaceable>#}
</programlisting>

    A type hooks maps a C type to a Haskell type.  As an example, consider

<programlisting>
type GInt = {#type gint#}
</programlisting>

    The type must be a defined type, primitive types, such as
    <literal>int</literal>, are not admissible.
    </para>
  </sect2>

  <sect2>
    <title>Sizeof Hooks</title>
    <para>
<programlisting>
{#sizeof <replaceable>ident</replaceable>#}
</programlisting>

    A sizeof hooks maps a C type to its size in bytes.  As an example, consider

<programlisting>
gIntSize :: Int
gIntSize  = {#sizeof gint#}
</programlisting>

    The type must be a defined type, primitive types, such as
    <literal>int</literal>, are not admissible.  The size of primitive types can
    always be obtained using <literal>Storable.sizeOf</literal>. 
    </para>
  </sect2>

  <sect2>
    <title>Enumeration Hooks</title>
    <para>
<programlisting>
{#enum <replaceable>cid</replaceable> [as <replaceable>hsid</replaceable>] {<replaceable>alias1</replaceable> , ... , <replaceable>aliasn</replaceable>}
  [with prefix = <replaceable>pref</replaceable>] [deriving (<replaceable>clid1</replaceable> , ... , <replaceable>clidn</replaceable>)]#}
</programlisting>

    Rewrite the C enumeration called <replaceable>cid</replaceable> into a
    Haskell data type declaration, which is made an instance of
    <literal>Enum</literal> such that the ordinals match those of the
    enumeration values in C.  This takes explicit enumeration values in the C
    definitions into account.  If <replaceable>hsid</replaceable> is given, this
    is the name of the Haskell data type.  The identifiers
    <replaceable>clid1</replaceable> to <replaceable>clidn</replaceable> are
    added to the deriving clause of the Haskell type.
    </para>

    <para>
    By default, the names of the C enumeration are used for the constructors in
    Haskell.  If <replaceable>alias1</replaceable> is
    <literal>underscoreToCase</literal>, the original C names are capitalised
    and the use of underscores is rewritten to caps.  If it is
    <literal>upcaseFirstLetter</literal> or
    <literal>downcaseFirstLetter</literal>, the first letter of the original C
    name changes case correspondingly.  It is also possible to combine
    <literal>underscoreToCase</literal> with one of
    <literal>upcaseFirstLetter</literal> or
    <literal>downcaseFirstLetter</literal>. Moreover,
    <replaceable>alias1</replaceable> to <replaceable>aliasn</replaceable> may
    be aliases of the form <replaceable>cid</replaceable> <literal>as</literal>
    <replaceable>hsid</replaceable>, which map individual C names to Haskell
    names.  Instead of the global prefix introduced by a context hook, a local
    prefix <replaceable>pref</replaceable> can optionally be specified.
    </para>

    <para>
    As an example, consider

<programlisting>
{#enum WindowType {underscoreToCase} deriving (Eq)#}
</programlisting>
 </para>

  </sect2>
    <sect2>
	    <title><literal>enum define</literal> hooks</title>
      <para>Many C libraries do not use enum types, but macro definitions to implement constants.	          
c2hs provides <literal>enum define</literal> hooks generate a haskell datatype from a collection of macro definitions.											
       </para>

<programlisting>
{#enum define <replaceable>hsid</replaceable> {<replaceable>alias1</replaceable> , ... , <replaceable>aliasn</replaceable>} [deriving (<replaceable>clid1</replaceable> , ... , <replaceable>clidn</replaceable>)]#}
</programlisting>
<para>
Create a haskell datatype <replaceable>hsid</replaceable>, with nullary constructors as given by the aliases <replaceable>alias1</replaceable> through <replaceable>aliasn</replaceable>. Each alias has to be of the form <replaceable>macrodef as hsid</replaceable>, where <replaceable>hsid</replaceable> is the name of the nullary haskell constructor, and <replaceable>macrodef</replaceable> the C macro which the haskell constructor should map to. The deriving part is handled as in ordinary <literal>enum</literal> hooks.
</para>
<para>
	Here's an example
<programlisting>
#define X 0
#define Y 1
</programlisting>	
<programlisting>
{#enum define Axis {X as Axis0, Y as Axis1} deriving (Eq,Ord) #}
</programlisting>	
</para>        
    </sect2>

  <sect2>
    <title>Call Hooks</title>
    <para>
<programlisting>
{#call [pure] [unsafe] [interruptible] <replaceable>cid</replaceable> [as (<replaceable>hsid</replaceable> | ^)]#}
</programlisting>

    A call hook rewrites to a call to the C function
    <replaceable>cid</replaceable> and also ensures that the appropriate foreign
    import declaration is generated.  The tags <literal>pure</literal> and
    <literal>unsafe</literal> specify that the external function is purely
    functional and cannot re-enter the Haskell runtime, respectively.  The
    <literal>interruptible</literal> flag is intended to be used in conjunction
    with the InterruptibleFFI extension. If <replaceable>hsid</replaceable> is
    present, it is used as the identifier for the foreign declaration, which
    otherwise defaults to the <replaceable>cid</replaceable>.  When instead of
    <replaceable>hsid</replaceable>, the symbol <literal>^</literal> is given,
    the <replaceable>cid</replaceable> after conversion from C's underscore
    notation to a capitalised identifier is used.
    </para>

    <para>
    As an example, consider

<programlisting>
sin :: Float -> Float
sin  = {#call pure sin as "_sin"#}
</programlisting>
    </para>
  </sect2>

  <sect2>
    <title>Function Hooks</title>
    <para>
<programlisting>
{#fun  [pure] [unsafe] [interruptible] <replaceable>cid</replaceable> [as (<replaceable>hsid</replaceable> | ^)]
[<replaceable>ctxt</replaceable> =>] { <replaceable>parm1</replaceable> , ... , <replaceable>parmn</replaceable> } -> <replaceable>parm</replaceable>
</programlisting>

    Function hooks are call hooks including parameter marshalling.  Thus, the
    components of a function hook up to and including the <literal>as</literal>
    alias are the same as for call hooks.  However, an <literal>as</literal>
    alias has a different meaning; it specifies the name of the generated
    Haskell function.  The remaining components use literals enclosed in
    backwards and foward single quotes (<literal>`</literal> and
    <literal>'</literal>) to denote Haskell code fragments (or more precisely,
    parts of the Haskell type signature for the bound function).  The first one
    is the phrase <replaceable>ctxt</replaceable> preceding
    <literal>=></literal>, which denotes the type context.  This is followed by
    zero or more type and marshalling specifications
    <replaceable>parm1</replaceable> to <replaceable>parmn</replaceable> for the
    function arguments and one <replaceable>parm</replaceable> for the function
    result.  Each such specification <replaceable>parm</replaceable> has the
    form

<programlisting>
[<replaceable>inmarsh</replaceable> [* | -]] <replaceable>hsty</replaceable>[&amp;] [<replaceable>outmarsh</replaceable> [*] [-]]
</programlisting>

    where <replaceable>hsty</replaceable> is a Haskell code fragment denoting a
    Haskell type.  The optional information to the left and right of this type
    determines the marshalling of the corresponding Haskell value to and from C;
    they are called the <firstterm>in</firstterm> and <firstterm>out</firstterm>
    marshaller, respectively.
    </para>

    <para>
    Each marshalling specification <replaceable>parm</replaceable> corresponds
    to one or two arguments of the C function, in the order in which they are
    given.  A marshalling specification in which the symbol
    <literal>&amp;</literal> follows the Haskell type corresponds to two C
    function arguments; otherwise, it corresponds only to one argument.  The
    <replaceable>parm</replaceable> following the left arrow
    <literal>-></literal> determines the marshalling of the result of the C
    function and may not contain the symbol <literal>&amp;</literal>.
    </para>

    <para>
    The <literal>*-</literal> output marshal specification is for monadic
    actions that must be executed but whose results are discarded. This is very
    useful, e.g. for checking an error value and throwing an exception if needed.
    </para>

    <para>
    Both <replaceable>inmarsh</replaceable> and
    <replaceable>outmarsh</replaceable> are identifiers of Haskell marshalling
    functions.  By default they are assumed to be pure functions; if they have
    to be executed in the <literal>IO</literal> monad, the function name needs
    to be followed by a star symbol <literal>*</literal>.  Alternatively, the
    identifier may be followed by a minus sign <literal>-</literal>, in which
    case the Haskell type does <emphasis>not</emphasis> appear as an argument
    (in marshaller) or result (out marshaller) of the generated Haskell
    function.  In other words, the argument types of the Haskell function is
    determined by the set of all marshalling specifications where the in
    marshaller is not followed by a minus sign.  Conversely, the result tuple of
    the Haskell function is determined by the set of all marshalling
    specifications where the out marshaller is not followed by a minus sign. 
    The order of function arguments and components in the result tuple is the
    same as the order in which the marshalling specifications are given, with
    the exception that the value of the result marshaller is always the first
    component in the result tuple if it is included at all.
    </para>
    <para>
    For a set of commonly occuring Haskell and C type combinations,
    <emphasis>default marshallers</emphasis> are provided by &C2hs; if no
    explicit marshaller is given.   The out marshaller for function arguments
    is by default <literal>void-</literal>. The defaults for the in marshallers
    for function arguments are as follows: 

    <itemizedlist>
      <listitem>
        <para>
        <literal>Bool</literal> and integral C type (including chars):
        <literal>cFromBool</literal>
        </para>
      </listitem>
      <listitem>
        <para>
        Integral Haskell and integral C type: <literal>cIntConv</literal>
        </para>
      </listitem>
      <listitem>
        <para>
        Floating Haskell and floating C type: <literal>cFloatConv</literal>
        </para>
      </listitem>
      <listitem>
        <para>
        <literal>String</literal> and <literal>char*</literal>:
        <literal>withCString*</literal>
        </para>
      </listitem>
      <listitem>
        <para>
        <literal>String</literal> and <literal>char*</literal> with
        explicit length: <literal>withCStringLen*</literal>
        </para>
      </listitem>
      <listitem>
        <para>
        <replaceable>T</replaceable> and
        <replaceable>T</replaceable><literal>*</literal>:
        <literal>with*</literal>
        </para>
      </listitem>
      <listitem>
        <para>
        <replaceable>T</replaceable> and
        <replaceable>T</replaceable><literal>*</literal> where
        <replaceable>T</replaceable> is an integral type:
        <literal>withIntConv*</literal>
        </para>
      </listitem>
      <listitem>
        <para>
        <replaceable>T</replaceable> and
        <replaceable>T</replaceable><literal>*</literal> where
        <replaceable>T</replaceable> is a floating type:
        <literal>withFloatConv*</literal>
        </para>
      </listitem>
      <listitem>
        <para>
        <literal>Bool</literal> and
        <replaceable>T</replaceable><literal>*</literal> where
        <replaceable>T</replaceable> is an integral type:
        <literal>withFromBool*</literal>
        </para>
      </listitem>
    </itemizedlist>

    The defaults for the out marshaller of the result are the converse of the
    above; i.e. instead of the <literal>with</literal> functions, the
    corresponding <literal>peek</literal> functions are used.  Moreover, when
    the Haskell type is <literal>()</literal>, the default marshaller is
    <literal>void-</literal>.
    </para>

    <para>
    As an example, consider

<programlisting>
{#fun notebook_query_tab_label_packing as ^
  `(NotebookClass nb, WidgetClass cld)' => 
  {notebook `nb'                , 
   widget   `cld'               , 
   alloca-  `Bool'     peekBool*, 
   alloca-  `Bool'     peekBool*,
   alloca-  `PackType' peekEnum*} -> `()'#}
</programlisting>

    which results in the Haskell type signature

<programlisting>
notebookQueryTabLabelPacking :: (NotebookClass nb, WidgetClass cld)
			     => nb -> cld -> IO (Bool, Bool, PackType)
</programlisting>

    which binds the following C function:

<programlisting>
void gtk_notebook_query_tab_label_packing (GtkNotebook *notebook,
					   GtkWidget   *child,
					   gboolean    *expand,
					   gboolean    *fill,
					   GtkPackType *pack_type);
</programlisting>
    </para>
  </sect2>

  <sect2>
    <title>Get Hooks</title>
    <para>
<programlisting>
{#get <replaceable>apath</replaceable>#}
</programlisting>

    A get hook supports accessing a member value of a C structure.  The hook
    itself yields a function that, when given the address of a structure of the
    right type, performs the structure access.  The member that is to be
    extracted is specified by the access path <replaceable>apath</replaceable>. 
    Access paths are formed as follows (following a subset of the C expression
    syntax):

    <itemizedlist>
      <listitem>
        <para>
        The root of any access path is a simple identifier, which denotes either
        a type name or <literal>struct</literal> tag.
        </para>
      </listitem>
      <listitem>
        <para>
        An access path of the form
        <literal>*</literal><replaceable>apath</replaceable> denotes
        dereferencing of the pointer yielded by accessing the access path
        <replaceable>apath</replaceable>.
        </para>
      </listitem>
      <listitem>
        <para>
        An access path of the form
        <replaceable>apath</replaceable><literal>.</literal><replaceable>cid</replaceable>
        specifies that the value of the <literal>struct</literal> member called
        <replaceable>cid</replaceable> should be accessed. 
        </para>
      </listitem>
      <listitem>
        <para>Finally, an access path of the form       
        <replaceable>apath</replaceable><literal>-></literal><replaceable>cid</replaceable>,
        as in C, specifies a combination of dereferencing and member selection.
        </para>
      </listitem>
    </itemizedlist>

    For example, we may have

<programlisting>
visualGetType              :: Visual -> IO VisualType
visualGetType (Visual vis)  = liftM cToEnum $ {#get Visual->type#} vis
</programlisting>
    </para>
  </sect2>

  <sect2>
    <title>Set Hooks</title>
    <para>
<programlisting>
{#set <replaceable>apath</replaceable>#}
</programlisting>

    Set hooks are formed in the same way as get hooks, but yield a function that
    assigns a value to a member of a C structure.  These functions expect a
    pointer to the structure as the first and the value to be assigned as the
    second argument.  For example, we may have

<programlisting>
{#set sockaddr_in.sin_family#} addr_in (cFromEnum AF_NET)
</programlisting>
    </para>
  </sect2>

  <sect2>
    <title>Pointer Hooks</title>
    <para>
<programlisting>
{#pointer [*] <replaceable>cid</replaceable> [as <replaceable>hsid</replaceable>] [foreign | stable] [newtype | -&gt;
<replaceable>hsid2</replaceable>] [nocode]#}
</programlisting>

    A pointer hook facilitates the mapping of C to Haskell pointer types.  In
    particular, it enables the use of <literal>ForeignPtr</literal> and
    <literal>StablePtr</literal> types and defines type name translations for
    pointers to non-basic types.  In general, such a hook establishes an
    association between the C type <replaceable>cid</replaceable> or
    <literal>*</literal><replaceable>cid</replaceable> and the Haskell type
    <replaceable>hsid</replaceable>, where the latter defaults to
    <replaceable>cid</replaceable> if not explicitly given.  The identifier
    <replaceable>cid</replaceable> will usually be a type name, but in the case
    of <literal>*</literal><replaceable>cid</replaceable> may also be a struct,
    union, or enum tag.  If both a type name and a tag of the same name are
    available, the type name takes precedence.  Optionally, the Haskell
    representation of the pointer can be by a <literal>ForeignPtr</literal> or
    <literal>StablePtr</literal> instead of a plain <literal>Ptr</literal>.  If
    the <literal>newtype</literal> tag is given, the Haskell type
    <replaceable>hsid</replaceable> is defined as a <literal>newtype</literal>
    rather than a transparent type synonym.  In case of a
    <literal>newtype</literal>, the type argument to the Haskell pointer type
    will be <replaceable>hsid</replaceable>, which gives a cyclic definition,
    but the type argument is here really only used as a unique type tag. 
    Without <literal>newtype</literal>, the default type argument is
    <literal>()</literal>, but another type can be specified after the symbol
    <literal>-&gt;</literal>.
    </para>

    <para>
    For example, we may have

<programlisting>
{#pointer *GtkObject as Object newtype#}
</programlisting>

    This will generate a new type <literal>Object</literal> as follows:

<programlisting>
newtype Object = Object (Ptr Object)
</programlisting>

    which enables exporting <literal>Object</literal> as an abstract type and
    facilitates type checking at call sites of imported functions using the
    encapsulated pointer.  The latter is achieved by &C2hs; as follows.  The
    tool remembers the association of the C type <literal>*GtkObject</literal>
    with the Haskell type <literal>Object</literal>, and so, it generates for
    the C function

<programlisting>
void gtk_unref_object (GtkObject *obj);
</programlisting>

    the import declaration

<programlisting>
foreign import gtk_unref_object :: Object -> IO ()
</programlisting>

    This function can obviously only be applied to pointers of the right type,
    and thus, protects against the common mistake of confusing the order of
    pointer arguments in function calls.
    </para>

    <para>
    However, as the Haskell FFI does not permit to directly pass
    <literal>ForeignPtr</literal>s to function calls or return them, the tool
    will use the type <literal>Ptr HsName</literal> in this case, where
    <literal>HsName</literal> is the Haskell name of the type.  So, if we modify
    the above declaration to be

<programlisting>
{#pointer *GtkObject as Object foreign newtype#}
</programlisting>

    the type <literal>Ptr Object</literal> will be used instead of a plain
    <literal>Object</literal> in import declarations; i.e. the previous
    <literal>import</literal> declaration will become

<programlisting>
foreign import gtk_unref_object :: Ptr Object -> IO ()
</programlisting>

    To simplify the required marshalling code for such pointers,
    the tool automatically generates a function

<programlisting>
withObject :: Object -> (Ptr Object -> IO a) -> IO a
</programlisting>

    As an example that does not represent the pointer as an abstract type,
    consider the C type declaration:

<programlisting>
typedef struct {int x, y;} *point;
</programlisting>

    We can represent it in Haskell as

<programlisting>
data Point = Point {x :: Int, y :: Int}
{#pointer point as PointPtr -> Point#}
</programlisting>

    which will translate to

<programlisting>
data Point = Point {x :: Int, y :: Int}
type PointPtr = Ptr Point
</programlisting>

    and establish a type association between <literal>point</literal> and
    <literal>PointPtr</literal>.
    </para>

    <para>
    If the keyword <literal>nocode</literal> is added to the end of a pointer
    hook, &C2hs; will not emit a type declaration.  This is useful when a &C2hs;
    module wants to make use of an existing type declaration in a binding not
    generated by &C2hs; (i.e. where there are no <literal>.chi</literal>
    files).
    </para>

    <note>
      <title>Restriction</title>
      <para>
      The name <replaceable>cid</replaceable> cannot be a basic C type (such as
      <literal>int</literal>), it must be a defined name.
      </para>
    </note>
  </sect2>

  <sect2>
    <title>Class Hooks</title>
    <para>
<programlisting>
{#class [<replaceable>hsid1</replaceable> =>] <replaceable>hsid2</replaceable> <replaceable>hsid3</replaceable>#}
</programlisting>

    Class hooks facilitate the definition of a single inheritance class hierachy
    for external pointers including up and down cast functionality.  This is
    meant to be used in cases where the objects referred to by the external
    pointers are order in such a hierachy in the external API - such structures
    are encountered in C libraries that provide an object-oriented interface. 
    Each class hook rewrites to a class declaration and one or more instance
    declarations.
    </para>

    <para>
    All classes in a hierarchy, except the root, will have a superclass
    identified by <replaceable>hsid1</replaceable>.  The new class is given by
    <replaceable>hsid2</replaceable> and the corresponding external pointer is
    identified by <replaceable>hsid3</replaceable>.  Both the superclass and the
    pointer type must already have been defined by binding hooks that precede
    the class hook.
    </para>

    <para>
    The pointers in a hierachy must either all be foreign pointers or all be
    normal pointers.  Stable pointers are not allowed.  Both pointer defined as
    <literal>newtype</literal>s and those defined by type synonyms may be used
    in class declarations and they may be mixed.  In the case of synonyms,
    Haskell's usual restrictions regarding overlapping instance declarations
    apply.
    </para>

    <para>
    The newly defined class has two members whose names are derived from the
    type name <replaceable>hsid3</replaceable>.  The name of first member is
    derived from <replaceable>hsid3</replaceable> by converting the first
    character to lower case.  This function casts from any superclass to the
    current class.  The name of the second member is derived by prefixing
    <replaceable>hsid3</replaceable> with the <literal>from</literal>.  It casts
    from the current class to any superclass.  A class hook generates an
    instance for the pointer in the newly defined class as well as in all its
    superclasses.
    </para>

    <para>
    As an example, consider

<programlisting>
{#pointer *GtkObject newtype#}
{#class GtkObjectClass GtkObject#}

{#pointer *GtkWidget newtype#}
{#class GtkObjectClass => GtkWidgetClass GtkWidget#}
</programlisting>

    The second class hook generates an instance for <literal>GtkWidget</literal>
    for both the <literal>GtkWidgetClass</literal> as well as for the
    <literal>GtkObjectClass</literal>.
    </para>
  </sect2>

  <sect2 id="cpp">
    <title>CPP Directives and Inline C Code</title>
    <para>
    A Haskell binding module may include arbitrary C pre-processor directives
    using the standard C syntax.  The directives are used in two ways: Firstly,
    they are included in the C header file generated by &C2hs; in exactly
    the same order in which they appear in the binding module.  Secondly, all
    conditional directives are honoured by &C2hs; in that all Haskell
    binding code in alternatives that are discarded by the C pre-processor are
    also discarded by &C2hs;.  This latter feature is, for example, useful
    to maintain different bindings for multiple versions of the same C API in a
    single Haskell binding module.
    </para>

    <para>
    In addition to C pre-processor directives, vanilla C code can be maintained
    in a Haskell binding module by bracketing this C code with the pseudo
    directives <literal>#c</literal> and <literal>#endc</literal>.  Such inline
    C code is emitted into the C header generated by &C2hs; at exactly the same
    position relative to CPP directives as it occurs in the binding module. 
    Pre-processor directives may encompass the <literal>#include</literal>
    directive, which can be used instead of specifying a C header file as an
    argument to <literal>c2hs</literal>.  In particular, this enables the
    simultaneous use of multiple header files without the need to provide a
    custom header file that binds them together.  If a header file
    <replaceable>lib</replaceable><literal>.h</literal> is specified as an
    argument to <literal>c2hs</literal>, the tool will emit the directive 
    <literal>#include"</literal><replaceable>lib</replaceable><literal>.h"</literal>
    into the generated C header before any other CPP directive or inline C code.
    </para>

    <para>
    As an artificial example of these features consider the following code:

<programlisting>
#define VERSION 2

#if (VERSION == 1)
foo :: CInt -> CInt
foo = {#call pure fooC#}
#else
foo :: CInt -> CInt -> CInt
foo = {#call pure fooC#}
#endif

#c
int fooC (int, int);
#endc
</programlisting>

    One of two versions of the Haskell function <literal>foo</literal> (having
    different arities) is selected in dependence on the value of the CPP macro
    <literal>VERSION</literal>, which in this example is defined in the same
    file.  In realistic code, <literal>VERSION</literal> would be defined in
    the header file supplied with the C library that is made accessible from
    Haskell by a binding module.  The above code fragment also includes one
    line of inline C code that declares a C prototype for
    <literal>fooC</literal>.
    </para>

    <note>
      <title>Current limitation of the implementation</title>
      <para>
      Inline C code can currently not contain any code blocks; i.e. only
      declarations as typically found in header files may be included.
      </para>
    </note>
  </sect2>

  <sect2>
    <title>Grammar Rules</title>
    <para>
    The following grammar rules define the syntax of binding hooks:

<programlisting>
hook     -> `{#' inner `#}'
inner    -> `import' ['qualified'] ident
          | `context' ctxt
          | `type' ident
          | `sizeof' ident
          | `enum' idalias trans [`with' prefix] [deriving]
          | `call' [`pure'] [`unsafe'] [`interruptible'] idalias
          | `fun' [`pure'] [`unsafe'] [`interruptible'] idalias parms
          | `get' apath
          | `set' apath
          | `pointer' ['*'] idalias ptrkind
          | `class' [ident `=>'] ident ident

ctxt     -> [`lib' `=' string] [prefix]
idalias  -> ident [(`as' ident | `^')]
prefix   -> `prefix' `=' string
deriving -> `deriving' `(' ident_1 `,' ... `,' ident_n `)'
parms    -> [verbhs `=>'] `{' parm_1 `,' ... `,' parm_n `}' `->' parm
parm     -> [ident_1 [`*' | `-']] verbhs [`&amp;'] [ident_2 [`*'] [`-']]
apath    -> ident
          | `*' apath
          | apath `.' ident
          | apath `->' ident
trans    -> `{' alias_1 `,' ... `,' alias_n `}'
alias    -> `underscoreToCase' | `upcaseFirstLetter' | `downcaseFirstLetter'
          | ident `as' ident
ptrkind  -> [`foreign' | `stable'] ['newtype' | '->' ident]
</programlisting>

    Identifier <literal>ident</literal> follow the lexis of Haskell.  They may
    be enclosed in single quotes to disambiguate them from C->Haskell keywords.
    </para>
  </sect2>
</sect1>

<sect1 id="bugs">
  <title>Bug Reports and Suggestions</title>
  <para>
  There is a tracker for bugs and feature requests:
  <ulink url="http://hackage.haskell.org/trac/c2hs/" />.
  Alternatively if you prefer email please send your bug reports and
  suggestions to the C->Haskell List <email>c2hs@haskell.org</email>.
  </para>

  <para>
  A good bug report contains information on the used operating system and
  Haskell compiler as well as the version of &C2hs; that you have been using. 
  You can obtain the version information by running <literal>c2hs
  --version</literal>. If possible a concise example illustrating your problem
  would be appreciated.
  </para>
</sect1>

<sect1 id="copyright">
  <title>Copyright</title>
  <para>
  &C2hs; is Copyright (C) [1999..2005] Manuel M. T. Chakravarty
  </para>

  <sect2>
    <title>&C2hs; License</title>
    <para>
    <literallayout>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    </literallayout>
    </para>
  </sect2>

  <sect2>
    <title>Documentation License</title>
    <para>
    <literallayout>
This manual is Copyright (c) [2000..2005] by Manuel M. T. Chakravarty. 
Permission is granted to copy, distribute and/or modify this document under
the terms of the GNU Free Documentation License, Version 1.1 or any later
version published by the Free Software Foundation; with no Invariant Sections,
with no Front-Cover Texts, and with the no Back-Cover Texts.  A copy of the
license is included in the section entitled "GNU Free Documentation License".
    </literallayout>
    </para>
  </sect2>

  <sect2>
    <title>Possible Licenses of Generated Code</title>
    <para>
    All code included into generated bindings is under a BSD-style
    license that does not place any restrictions on the license of the
    inteface produced with &C2hs; (i.e. closed proprietary licenses are
    possible, too).  In other words, I do not care what you use &C2hs;
    for or to whom you are giving &C2hs; or any interfaces generated with
    &C2hs;, only if you modify or improve &C2hs; itself, you have to
    contribute your changes back to the community.  Nevertheless, I will of
    course be particularly delighted if you choose to make your work freely
    available.
    </para>
  </sect2>
</sect1>

<sect1 id="gfdl">
  <title>GNU Free Documentation License</title>
  <para>
  The GNU Free Documentation License is available at
  <ulink url="http://www.fsf.org/copyleft/fdl.html" />.
  </para>
</sect1>

<sect1 id="release-notes">
  <title>Release Notes</title>
  <para>
  Important changes (especially those affecting the semantics of the tool) are
  documented in the following.
  </para>

  <sect2>
    <title>Version 0.15.1 "Rainy Days"</title>
    <itemizedlist>
      <listitem>
        <para>
        New C parser that can parse all of C99 and GNU C
        </para>
      </listitem>
      <listitem>
        <para>
        Make c2hs integrate better with Cabal (1.2 and later)
        </para>
      </listitem> 
      <listitem><para>Adapted to GHC 6.8.</para></listitem>
      <listitem><para>Now requires Cabal 1.2.</para></listitem>
      <listitem><para>Lots and lots of old code removal</para></listitem>
      <listitem>
        <para>
        Several bug fixes and improvements from Udo Stenzel:
        <itemizedlist>
          <listitem>
            <para>allowing variadic functions in structures</para>
          </listitem>
          <listitem>
            <para>allowing call and fun hooks for FunPtrs in C structs</para>
          </listitem>
          <listitem>
            <para>embedded arrays size calculated correctly</para>
          </listitem>
        </itemizedlist>
        </para>
      </listitem>
    </itemizedlist>
  </sect2>

  <sect2>
    <title>Version 0.14.5 "Travelling Lightly"</title>
    <itemizedlist>
      <listitem>
        <para>
        Added <literal>nocode</literal> directive to pointer hooks
        </para>
      </listitem>
      <listitem>
        <para>
        Can use structs properly in pointer hooks now (contributed by Jelmer
        Vernooij)
      </para>
      </listitem>
      <listitem>
        <para>
        <literal>upcaseFirstLetter</literal> and
        <literal>downcaseFirstLetter</literal>
        </para>
      </listitem>
      <listitem>
        <para>Cross-compiling with <literal>--platform</literal> flag
        </para>
      </listitem>
      <listitem>
        <para>
        Gcc's <literal>asm</literal> construct is supported (contributed by
        Duncan Coutts)
        </para>
      </listitem>
      <listitem>
        <para>
        Hierarchical modules syntax in <literal>import</literal> hooks supported
        </para>
      </listitem> 
      <listitem>
        <para>
        No separately installed marshaling library anymore; as a result binary
        &C2hs; packages and installations are now independent of the targeted
        Haskell system
        </para>
      </listitem>
      <listitem>
        <para>
        New lexer and parser generated with Alex and Happy (contributed by
        Duncan Coutts)
        </para>
      </listitem>
      <listitem><para>Cabal build system</para></listitem>
    </itemizedlist>
  </sect2>

  <sect2>
    <title>Version 0.13.6 "Pressing Forward"</title>
    <itemizedlist>
      <listitem>
        <para>Works with GHC 6.4 and Cabal packages
        </para>
      </listitem>
      <listitem>
        <para>
        Strings may contain 8-bit characters (e.g. umlauts).
        </para>
      </listitem>
      <listitem>
        <para>
        Identifier may optionally be put in single quotes.  (This is useful if
        they would otherwise collide with a &C2hs; keyword.)
        </para>
      </listitem>
      <listitem>
        <para>
        Some smaller bug fixes
        </para>
      </listitem>
      <listitem>
        <para>
        C chars are treated as integral types for marshalling purposes.
        </para>
      </listitem>
      <listitem>
        <para>
        If there is no explicit output file specified, the generated header
        file is put in the same directory as the binding file; otherwise, it
        goes in the directory where the output file is put.  Moreover, the
        <literal>--output-dir</literal> option enables the specification of
        directory where all generated files are to be put.
        </para>
      </listitem>
      <listitem>
        <para>Foreign import declarations include the name of the header file
        generated by &C2hs; (i.e. it needs neither be passed to the Haskell
        compiler at the command line nor in an OPTIONS pragma).
        </para>
      </listitem>
      <listitem>
        <para>
        We allow structs and unions with no declarations.
        </para>
      </listitem>
      <listitem>
        <para>Headers including function bodies are now parsed correctly.
        </para>
      </listitem>
      <listitem>
        <para>Duncan Coutts identified a space leak in the parser whose removal
        improved performance significantly.
        </para>
      </listitem>
    </itemizedlist>
  </sect2>

  <sect2>
    <title>Version 0.12.1 "Springtime"</title>
    <itemizedlist>
      <listitem><para>Removed support for deprecated <literal>C2HS</literal>
      interface and for old versions of the FFI libraries</para></listitem>
      <listitem><para>Improved line pragma generation</para></listitem>
      <listitem><para>Works with GHC 6.3</para></listitem>
      <listitem>
        <para>
        Builds on Mac OS X thanks to a patch by Sean Seefried
        </para>
      </listitem>
    </itemizedlist>
  </sect2>

  <sect2>
    <title>Version 0.11.5 "Powder Snow"</title>
    <itemizedlist>
      <listitem><para>Bug fixes</para></listitem>
      <listitem>
        <para>Constant expression can now contain enumerators</para>
      </listitem>
      <listitem>
        <para>
        <literal>header</literal> label removed from <literal>context</literal>
        hooks
        </para>
      </l
Download .txt
gitextract_ckd6s0y2/

├── .boring
├── .github/
│   └── workflows/
│       └── haskell-ci.yml
├── .gitignore
├── .travis.yml
├── AUTHORS
├── C2HS.hs
├── COPYING
├── ChangeLog
├── ChangeLog.CTKlight
├── ChangeLog.old
├── INSTALL
├── README
├── README.CTKlight
├── README.md
├── REGRESSION-SUITE
├── Setup.hs
├── TODO
├── TODO.CTKlight
├── appveyor.yml
├── c2hs.cabal
├── cabal.haskell-ci
├── custom-setup.hs
├── doc/
│   ├── Makefile
│   ├── c2hs.css
│   ├── c2hs.xml
│   └── man1/
│       └── c2hs.1
├── examples/
│   └── libghttpHS/
│       ├── Ghttp.chs
│       ├── Makefile
│       ├── ghttpHS.c
│       └── ghttpHS.h
├── import-handling.md
├── regression-suite-vm/
│   ├── Vagrantfile
│   ├── Vagrantfile-full
│   └── run-regression
├── src/
│   ├── C2HS/
│   │   ├── C/
│   │   │   ├── Attrs.hs
│   │   │   ├── Builtin.hs
│   │   │   ├── Info.hs
│   │   │   ├── Names.hs
│   │   │   └── Trav.hs
│   │   ├── C.hs
│   │   ├── CHS/
│   │   │   └── Lexer.hs
│   │   ├── CHS.hs
│   │   ├── Config.hs
│   │   ├── Gen/
│   │   │   ├── Bind.hs
│   │   │   ├── Header.hs
│   │   │   ├── Monad.hs
│   │   │   └── Wrapper.hs
│   │   ├── State.hs
│   │   ├── Switches.hs
│   │   ├── Version.hs
│   │   ├── config.c
│   │   └── config.h
│   ├── Control/
│   │   ├── State.hs
│   │   ├── StateBase.hs
│   │   └── StateTrans.hs
│   ├── Data/
│   │   ├── Attributes.hs
│   │   ├── Errors.hs
│   │   └── NameSpaces.hs
│   ├── Main.hs
│   ├── System/
│   │   └── CIO.hs
│   └── Text/
│       └── Lexers.hs
└── tests/
    ├── bugs/
    │   ├── call_capital/
    │   │   ├── Capital.c
    │   │   ├── Capital.chs
    │   │   └── Capital.h
    │   ├── issue-10/
    │   │   ├── Issue10.chs
    │   │   ├── issue10.c
    │   │   └── issue10.h
    │   ├── issue-102/
    │   │   └── Issue102.chs
    │   ├── issue-103/
    │   │   ├── Issue103.chs
    │   │   ├── Issue103A.chs
    │   │   ├── issue103.c
    │   │   └── issue103.h
    │   ├── issue-107/
    │   │   └── Issue107.chs
    │   ├── issue-113/
    │   │   ├── Issue113.chs
    │   │   ├── issue113.c
    │   │   └── issue113.h
    │   ├── issue-115/
    │   │   ├── Issue115.chs
    │   │   ├── issue115.c
    │   │   └── issue115.h
    │   ├── issue-116/
    │   │   ├── Issue116.chs
    │   │   ├── issue116.c
    │   │   └── issue116.h
    │   ├── issue-117/
    │   │   ├── Issue117.chs
    │   │   ├── issue117.c
    │   │   └── issue117.h
    │   ├── issue-123/
    │   │   ├── Issue123.chs
    │   │   ├── issue123.c
    │   │   └── issue123.h
    │   ├── issue-127/
    │   │   ├── Issue127.chs
    │   │   ├── issue127.c
    │   │   └── issue127.h
    │   ├── issue-128/
    │   │   ├── Issue128.chs
    │   │   ├── issue128.c
    │   │   └── issue128.h
    │   ├── issue-130/
    │   │   ├── Issue130.chs
    │   │   ├── issue130.c
    │   │   └── issue130.h
    │   ├── issue-131/
    │   │   ├── Issue131.chs
    │   │   ├── issue131.c
    │   │   └── issue131.h
    │   ├── issue-133/
    │   │   ├── Issue133.chs
    │   │   └── issue133.h
    │   ├── issue-134/
    │   │   ├── Issue134.chs
    │   │   └── issue134.h
    │   ├── issue-136/
    │   │   ├── Issue136.chs
    │   │   ├── issue136.c
    │   │   └── issue136.h
    │   ├── issue-140/
    │   │   ├── Issue140.chs
    │   │   ├── issue140.c
    │   │   └── issue140.h
    │   ├── issue-141/
    │   │   ├── Issue141A.chs
    │   │   ├── Issue141B.chs
    │   │   ├── Issue141C.chs
    │   │   └── issue141.h
    │   ├── issue-149/
    │   │   ├── Issue149.chs
    │   │   ├── issue149.c
    │   │   └── issue149.h
    │   ├── issue-15/
    │   │   ├── Issue15.chs
    │   │   ├── issue15.c
    │   │   └── issue15.h
    │   ├── issue-151/
    │   │   ├── Issue151.chs
    │   │   └── issue151.h
    │   ├── issue-152/
    │   │   ├── Issue152.chs
    │   │   └── issue152.h
    │   ├── issue-155/
    │   │   ├── Issue155.chs
    │   │   ├── Types.chs
    │   │   └── types.h
    │   ├── issue-16/
    │   │   ├── Issue16.chs
    │   │   ├── issue16.c
    │   │   └── issue16.h
    │   ├── issue-180/
    │   │   ├── Issue180.chs
    │   │   └── issue180.h
    │   ├── issue-19/
    │   │   ├── Issue19.chs
    │   │   ├── issue19.c
    │   │   └── issue19.h
    │   ├── issue-192/
    │   │   ├── Issue192.chs
    │   │   └── issue-192.h
    │   ├── issue-20/
    │   │   ├── Issue20.chs
    │   │   ├── issue20.c
    │   │   └── issue20.h
    │   ├── issue-22/
    │   │   ├── Issue22.chs
    │   │   ├── issue22.c
    │   │   └── issue22.h
    │   ├── issue-23/
    │   │   ├── Issue23.chs
    │   │   ├── issue23.c
    │   │   ├── issue23.h
    │   │   └── issue23x.h
    │   ├── issue-230/
    │   │   ├── Issue230.chs
    │   │   ├── issue230.c
    │   │   └── issue230.h
    │   ├── issue-242/
    │   │   ├── Issue242.chs
    │   │   ├── issue242.c
    │   │   └── issue242.h
    │   ├── issue-25/
    │   │   └── Issue25.chs
    │   ├── issue-257/
    │   │   ├── Issue257.chs
    │   │   ├── issue257.c
    │   │   └── issue257.h
    │   ├── issue-29/
    │   │   ├── Issue29.chs
    │   │   └── issue29.h
    │   ├── issue-30/
    │   │   ├── Issue30.chs
    │   │   ├── Issue30Aux1.chs
    │   │   ├── Issue30Aux2.chs
    │   │   ├── issue30.c
    │   │   ├── issue30.h
    │   │   ├── issue30aux1.c
    │   │   ├── issue30aux1.h
    │   │   ├── issue30aux2.c
    │   │   └── issue30aux2.h
    │   ├── issue-31/
    │   │   ├── Issue31.chs
    │   │   ├── issue31.c
    │   │   └── issue31.h
    │   ├── issue-32/
    │   │   ├── Issue32.chs
    │   │   ├── issue32.c
    │   │   └── issue32.h
    │   ├── issue-36/
    │   │   ├── Issue36.chs
    │   │   └── issue36.h
    │   ├── issue-37/
    │   │   ├── Issue37.chs
    │   │   ├── issue37.c
    │   │   └── issue37.h
    │   ├── issue-38/
    │   │   ├── Issue38.chs
    │   │   ├── issue38.c
    │   │   └── issue38.h
    │   ├── issue-43/
    │   │   ├── Issue43.chs
    │   │   ├── issue43.c
    │   │   └── issue43.h
    │   ├── issue-44/
    │   │   ├── Issue44.chs
    │   │   ├── issue44.c
    │   │   └── issue44.h
    │   ├── issue-45/
    │   │   ├── Issue45.chs
    │   │   ├── issue45.c
    │   │   └── issue45.h
    │   ├── issue-46/
    │   │   ├── Issue46.chs
    │   │   ├── issue46.c
    │   │   └── issue46.h
    │   ├── issue-47/
    │   │   ├── Issue47.chs
    │   │   ├── issue47.c
    │   │   └── issue47.h
    │   ├── issue-48/
    │   │   ├── Issue48.chs
    │   │   ├── issue48.c
    │   │   └── issue48.h
    │   ├── issue-51/
    │   │   ├── Issue51_GNU.chs
    │   │   ├── Issue51_nonGNU.chs
    │   │   ├── issue51.c
    │   │   └── issue51.h
    │   ├── issue-54/
    │   │   ├── Issue54.chs
    │   │   ├── issue54.c
    │   │   └── issue54.h
    │   ├── issue-60/
    │   │   ├── Issue60.chs
    │   │   ├── _mingw.h
    │   │   ├── issue60.c
    │   │   └── stdlib.h
    │   ├── issue-62/
    │   │   ├── Issue62.chs
    │   │   ├── issue62.c
    │   │   └── issue62.h
    │   ├── issue-65/
    │   │   ├── Issue65.chs
    │   │   ├── issue65.c
    │   │   └── issue65.h
    │   ├── issue-69/
    │   │   ├── Issue69.chs
    │   │   ├── issue69.c
    │   │   └── issue69.h
    │   ├── issue-7/
    │   │   ├── Issue7.chs
    │   │   └── issue7.h
    │   ├── issue-70/
    │   │   ├── Issue70.chs
    │   │   ├── issue70.c
    │   │   └── issue70.h
    │   ├── issue-73/
    │   │   ├── Issue73.chs
    │   │   ├── issue73.c
    │   │   └── issue73.h
    │   ├── issue-75/
    │   │   ├── Issue75.chs
    │   │   ├── issue75.c
    │   │   ├── issue75.h
    │   │   └── sndfile.h
    │   ├── issue-79/
    │   │   ├── Issue79.chs
    │   │   ├── issue79.c
    │   │   └── issue79.h
    │   ├── issue-80/
    │   │   ├── Issue80.chs
    │   │   ├── issue80.c
    │   │   └── issue80.h
    │   ├── issue-82/
    │   │   ├── Issue82.chs
    │   │   └── include/
    │   │       ├── Availability.h
    │   │       ├── AvailabilityInternal.h
    │   │       ├── TargetConditionals.h
    │   │       ├── _types.h
    │   │       ├── secure/
    │   │       │   ├── _common.h
    │   │       │   └── _string.h
    │   │       ├── string.h
    │   │       ├── strings.h
    │   │       ├── sys/
    │   │       │   └── cdefs.h
    │   │       └── xlocale/
    │   │           └── _string.h
    │   ├── issue-83/
    │   │   └── Issue83.chs
    │   ├── issue-9/
    │   │   ├── Issue9.chs
    │   │   ├── issue9.c
    │   │   └── issue9.h
    │   ├── issue-93/
    │   │   ├── Issue93.chs
    │   │   ├── issue93.c
    │   │   └── issue93.h
    │   ├── issue-95/
    │   │   ├── Issue95.chs
    │   │   ├── issue95.c
    │   │   └── issue95.h
    │   ├── issue-96/
    │   │   ├── Issue96.chs
    │   │   ├── issue96.c
    │   │   └── issue96.h
    │   ├── issue-97/
    │   │   ├── Issue97.chs
    │   │   ├── Issue97A.chs
    │   │   ├── issue97.c
    │   │   └── issue97.h
    │   └── issue-98/
    │       ├── Issue98.chs
    │       ├── issue98.c
    │       └── issue98.h
    ├── regression-suite.hs
    ├── regression-suite.yaml
    ├── system/
    │   ├── Makefile
    │   ├── calls/
    │   │   ├── Calls.chs
    │   │   └── calls.h
    │   ├── clean
    │   ├── cpp/
    │   │   └── Cpp.chs
    │   ├── enums/
    │   │   ├── Enums.chs
    │   │   ├── enums.c
    │   │   └── enums.h
    │   ├── interruptible/
    │   │   ├── Interruptible.chs
    │   │   ├── interruptible.c
    │   │   └── interruptible.h
    │   ├── marsh/
    │   │   ├── Marsh.chs
    │   │   └── marsh.h
    │   ├── pointer/
    │   │   ├── Pointer.chs
    │   │   ├── pointer.c
    │   │   └── pointer.h
    │   ├── simple/
    │   │   ├── Simple.chs
    │   │   ├── simple.c
    │   │   └── simple.h
    │   ├── sizeof/
    │   │   ├── Sizeof.chs
    │   │   ├── sizeof.c
    │   │   └── sizeof.h
    │   └── structs/
    │       ├── Structs.chs
    │       ├── structs.c
    │       └── structs.h
    ├── test-bugs.hs
    └── test-system.hs
Download .txt
SYMBOL INDEX (238 symbols across 96 files)

FILE: examples/libghttpHS/ghttpHS.c
  function ghttp_current_status (line 11) | ghttp_current_status *ghttpHS_get_status (ghttp_request *a_request)

FILE: src/C2HS/config.c
  function bitfield_direction (line 39) | int bitfield_direction ()
  function bitfield_padding (line 69) | int bitfield_padding ()
  function bitfield_int_signed (line 96) | int bitfield_int_signed ()
  type bitfield_alignment_struct (line 114) | struct bitfield_alignment_struct {
  function bitfield_alignment (line 120) | int bitfield_alignment ()

FILE: tests/bugs/call_capital/Capital.c
  function c (line 3) | void c() { printf("lower c();\n"); }
  function C (line 4) | void C() { printf("upper C();\n"); }

FILE: tests/bugs/issue-10/issue10.c
  function size_of_s1 (line 3) | size_t size_of_s1(void) { return sizeof(S1); }
  function size_of_s2 (line 4) | size_t size_of_s2(void) { return sizeof(S2); }
  function size_of_s3 (line 5) | size_t size_of_s3(void) { return sizeof(S3); }
  function size_of_s4 (line 6) | size_t size_of_s4(void) { return sizeof(S4); }
  function size_of_s5 (line 7) | size_t size_of_s5(void) { return sizeof(S5); }

FILE: tests/bugs/issue-10/issue10.h
  type S1 (line 9) | typedef struct {
  type S2 (line 17) | typedef struct {
  type S3 (line 25) | typedef struct {
  type S4 (line 29) | typedef struct {
  type S5 (line 34) | typedef struct {

FILE: tests/bugs/issue-103/issue103.c
  function test_func (line 4) | void test_func(test_enum val)

FILE: tests/bugs/issue-103/issue103.h
  type test_enum (line 1) | typedef enum {

FILE: tests/bugs/issue-113/issue113.h
  type annoying (line 1) | enum annoying { annoying_0 }

FILE: tests/bugs/issue-115/issue115.c
  function array_t (line 6) | array_t *get_struct(int n, int m, int o)

FILE: tests/bugs/issue-115/issue115.h
  type array_t (line 3) | typedef struct {

FILE: tests/bugs/issue-116/issue116.h
  type test_enum (line 1) | typedef enum {

FILE: tests/bugs/issue-117/issue117.c
  function coord_x (line 5) | int coord_x(coord_t c, int dummy)
  function coord_t (line 10) | coord_t *make_coord(int x, int y)
  function free_coord (line 19) | void free_coord(coord_t *coord)

FILE: tests/bugs/issue-117/issue117.h
  type coord_t (line 1) | typedef struct {

FILE: tests/bugs/issue-123/issue123.c
  function array_t (line 6) | array_t *get_struct(int n, int m, int o)

FILE: tests/bugs/issue-123/issue123.h
  type array_t (line 3) | typedef struct {

FILE: tests/bugs/issue-127/issue127.c
  function tst (line 3) | bool tst(int n)

FILE: tests/bugs/issue-127/issue127.h
  type TST_BOOL (line 1) | typedef unsigned char TST_BOOL;

FILE: tests/bugs/issue-128/issue128.c
  function f1 (line 4) | int f1(int n, bool incr)
  function f2 (line 12) | bool f2(int n)
  function tststruct (line 18) | tststruct *make_tststruct(int ain)
  function free_tststruct (line 26) | void free_tststruct(tststruct *s)
  function mod_tststruct (line 31) | void mod_tststruct(tststruct *s, int da, bool incr)

FILE: tests/bugs/issue-128/issue128.h
  type tststruct (line 6) | typedef struct {

FILE: tests/bugs/issue-130/issue130.c
  function my_add (line 3) | void my_add(int *a, int *b, int *result)

FILE: tests/bugs/issue-131/issue131.c
  function f1 (line 4) | int f1(int n, bool incr)
  function f2 (line 12) | bool f2(int n)

FILE: tests/bugs/issue-133/issue133.h
  type tdtst (line 2) | typedef void tdtst;

FILE: tests/bugs/issue-134/issue134.h
  type tst (line 1) | struct tst { int a; }

FILE: tests/bugs/issue-136/issue136.c
  function mutate_foo (line 3) | void mutate_foo(foo_t *foo, bar_t *bar) {

FILE: tests/bugs/issue-136/issue136.h
  type bar_t (line 1) | typedef struct {
  type foo_t (line 6) | typedef struct {

FILE: tests/bugs/issue-140/issue140.c
  function f1 (line 3) | void f1(ptr1 *p, int x) { p->a = x; }
  function f2 (line 4) | void f2(ptr2 *p, int x) { p->a = x; }
  function f3 (line 5) | void f3(ptr3 *p, int x) { p->a = x; }

FILE: tests/bugs/issue-140/issue140.h
  type ptr1 (line 1) | typedef struct _ptr1 { int a; } ptr1;
  type ptr2 (line 4) | typedef struct _ptr2 { int a; } ptr2;
  type ptr3 (line 7) | typedef struct _ptr3 { int a; } ptr3;

FILE: tests/bugs/issue-141/issue141.h
  type _p_Vec (line 1) | struct _p_Vec

FILE: tests/bugs/issue-149/issue149.c
  function test (line 3) | void test(int arg)

FILE: tests/bugs/issue-15/issue15.c
  function tst_val (line 1) | const int tst_val(void)

FILE: tests/bugs/issue-15/issue15.h
  type Tst (line 3) | enum Tst {

FILE: tests/bugs/issue-152/issue152.h
  type a (line 1) | struct a { int f; }
  type s_a (line 3) | typedef struct a s_a;

FILE: tests/bugs/issue-155/types.h
  type example_struct (line 1) | typedef struct {
  type child_struct (line 5) | typedef struct {

FILE: tests/bugs/issue-19/issue19.h
  type enums1 (line 1) | enum enums1 {
  type enums2 (line 7) | enum enums2 {

FILE: tests/bugs/issue-20/issue20.c
  function foo (line 3) | size_t foo(int n)

FILE: tests/bugs/issue-22/issue22.c
  function struct_t (line 7) | struct_t *foo(int n)

FILE: tests/bugs/issue-22/issue22.h
  type substruct_t (line 1) | typedef struct {
  type struct_t (line 5) | typedef struct {

FILE: tests/bugs/issue-23/issue23.c
  function hello_fn (line 4) | enum hello hello_fn(int n)

FILE: tests/bugs/issue-23/issue23.h
  type hello (line 1) | enum hello

FILE: tests/bugs/issue-23/issue23x.h
  type hello (line 1) | enum hello { H1, H2, H3 }

FILE: tests/bugs/issue-230/issue230.c
  type test1 (line 5) | struct test1
  type test1 (line 7) | struct test1
  type test1 (line 7) | struct test1
  type test2 (line 15) | struct test2
  type test2 (line 17) | struct test2
  type test2 (line 17) | struct test2

FILE: tests/bugs/issue-230/issue230.h
  type test1 (line 1) | struct test1 {
  type test2 (line 10) | struct test2 {
  type test1 (line 19) | struct test1
  type test2 (line 20) | struct test2

FILE: tests/bugs/issue-242/issue242.c
  function echoCULLong (line 5) | unsigned long long int echoCULLong (unsigned long long int i) {

FILE: tests/bugs/issue-257/issue257.c
  type bools (line 4) | struct bools
  type bools (line 5) | struct bools
  type bools (line 5) | struct bools

FILE: tests/bugs/issue-257/issue257.h
  type bools (line 5) | struct bools {
  type bools (line 12) | struct bools

FILE: tests/bugs/issue-30/issue30.c
  function foo (line 1) | int foo(int n) { return n + 1; }

FILE: tests/bugs/issue-30/issue30aux1.c
  function foo1 (line 1) | int foo1(int n) { return n * 2; }

FILE: tests/bugs/issue-30/issue30aux2.c
  function foo2 (line 1) | int foo2(int n) { return n * 4; }

FILE: tests/bugs/issue-31/issue31.c
  function test_enum (line 3) | test_enum enum_test(test_enum n)
  function test_struct1 (line 14) | test_struct1 *make_struct1(void)
  function access_struct1 (line 20) | int access_struct1(test_struct1 *s) { return s->a; }
  function test_struct2 (line 25) | test_struct2 *make_struct2(void)
  function access_struct2 (line 31) | int access_struct2(test_struct2 *s) { return s->b; }
  function test_struct3 (line 36) | test_struct3 *make_struct3(void)
  function access_struct3 (line 42) | int access_struct3(test_struct3 *s) { return s->c; }
  function test_struct4 (line 47) | test_struct4 *make_struct4(void)
  function access_struct4 (line 53) | int access_struct4(test_struct4 *s) { return s->d; }

FILE: tests/bugs/issue-31/issue31.h
  type test_enum (line 1) | typedef enum {
  type test_struct1 (line 9) | typedef struct { int a; } test_struct1;
  type test_struct2 (line 13) | typedef struct { int b; } test_struct2;
  type test_struct3 (line 17) | typedef struct { int c; } test_struct3;
  type test_struct4 (line 21) | typedef struct { int d; } test_struct4;

FILE: tests/bugs/issue-32/issue32.c
  function testStruct (line 5) | testStruct *makeIt(void)

FILE: tests/bugs/issue-32/issue32.h
  type testStruct (line 1) | typedef struct testStruct_ testStruct;
  type testStruct_ (line 3) | struct testStruct_ {

FILE: tests/bugs/issue-36/issue36.h
  type hit_int (line 1) | typedef struct { int a; } hit_int;
  type hit_double (line 2) | typedef struct { double a; } hit_double;

FILE: tests/bugs/issue-37/issue37.c
  function f1 (line 3) | int f1(int *np)
  function f2 (line 9) | float f2(float *np)

FILE: tests/bugs/issue-38/issue38.c
  function test_enum (line 3) | test_enum enum_test(test_enum n)

FILE: tests/bugs/issue-38/issue38.h
  type test_enum (line 1) | typedef enum {

FILE: tests/bugs/issue-43/issue43.h
  type Test1 (line 1) | enum Test1 {

FILE: tests/bugs/issue-44/issue44.h
  type foo (line 1) | typedef struct { int a; } foo;

FILE: tests/bugs/issue-45/issue45.c
  function foo (line 1) | void foo(int n) { }

FILE: tests/bugs/issue-46/issue46.c
  function func (line 3) | void func(oid *obj, int aval, float bval)
  function oid_a (line 9) | int oid_a(oid *obj)
  function oid_b (line 14) | float oid_b(oid *obj)

FILE: tests/bugs/issue-46/issue46.h
  type oid (line 1) | typedef struct {

FILE: tests/bugs/issue-47/issue47.c
  function foo (line 1) | void foo(int n) { }

FILE: tests/bugs/issue-48/issue48.c
  function foo (line 3) | int64_t foo(int64_t n)

FILE: tests/bugs/issue-51/issue51.c
  function fooGnu (line 1) | int fooGnu(int n) { return 1; }
  function fooNonGnu (line 2) | int fooNonGnu(int n) { return 0; }

FILE: tests/bugs/issue-54/issue54.c
  type foo (line 4) | struct foo
  function bar (line 6) | bar *get_bar(int n)
  type foo (line 13) | struct foo

FILE: tests/bugs/issue-54/issue54.h
  type bar (line 1) | typedef struct {
  type foo (line 6) | struct foo {
  type foo (line 12) | struct foo

FILE: tests/bugs/issue-60/stdlib.h
  function __MINGW_NOTHROW (line 336) | __cdecl __MINGW_NOTHROW	_wsearchenv(const wchar_t*, const wchar_t*, wcha...
  type ldiv_t (line 386) | typedef struct { long quot, rem; } ldiv_t;
  function __MINGW_NOTHROW (line 416) | __cdecl __MINGW_NOTHROW	_makepath (char*, const char*, const char*, cons...
  type lldiv_t (line 503) | typedef struct { long long quot, rem; } lldiv_t;
  function llabs (line 509) | __CRT_INLINE long long __cdecl __MINGW_NOTHROW llabs(long long _j)
  function __MINGW_NOTHROW (line 528) | __CRT_INLINE long long  __cdecl __MINGW_NOTHROW atoll (const char * _c)
  function __CRT_INLINE (line 530) | __CRT_INLINE char*  __cdecl __MINGW_NOTHROW lltoa (long long _n, char * ...
  function __CRT_INLINE (line 532) | __CRT_INLINE char*  __cdecl __MINGW_NOTHROW ulltoa (unsigned long long _...
  function __MINGW_NOTHROW (line 534) | __CRT_INLINE long long  __cdecl __MINGW_NOTHROW wtoll (const wchar_t * _w)
  function __CRT_INLINE (line 536) | __CRT_INLINE wchar_t*  __cdecl __MINGW_NOTHROW lltow (long long _n, wcha...
  function __CRT_INLINE (line 538) | __CRT_INLINE wchar_t*  __cdecl __MINGW_NOTHROW ulltow (unsigned long lon...

FILE: tests/bugs/issue-62/issue62.c
  function f1 (line 3) | int f1(int x, int y, int z) {
  function f2 (line 7) | int f2(int x, int* y, int* z) {

FILE: tests/bugs/issue-69/issue69.c
  function foo1 (line 1) | void foo1(int n) { }
  function foo2 (line 2) | void foo2(int n) { }

FILE: tests/bugs/issue-70/issue70.h
  type Foo (line 1) | enum Foo {

FILE: tests/bugs/issue-73/issue73.c
  function test_struct3 (line 5) | test_struct3 *make_struct3(void)
  function access_struct3 (line 13) | int access_struct3(test_struct3 *s) { return s->c; }
  function free_struct3 (line 15) | void free_struct3(test_struct3 *s) {
  function test_struct4 (line 21) | test_struct4 *make_struct4(void)
  function access_struct4 (line 29) | int access_struct4(test_struct4 *s) { return s->d; }
  function free_struct4 (line 31) | void free_struct4(test_struct4 *s) {

FILE: tests/bugs/issue-73/issue73.h
  type test_struct3 (line 1) | typedef struct { int c; } test_struct3;
  type test_struct4 (line 6) | typedef struct { int d; } test_struct4;

FILE: tests/bugs/issue-75/issue75.c
  function CHK_TST (line 5) | CHK_TST *chk_make_tst(void)

FILE: tests/bugs/issue-75/issue75.h
  type CHK_TST (line 1) | struct CHK_TST { int a; }
  type CHK_TST (line 3) | typedef struct CHK_TST CHK_TST;

FILE: tests/bugs/issue-75/sndfile.h
  type SNDFILE (line 305) | typedef	struct SNDFILE_tag	SNDFILE ;
  type __int64 (line 315) | typedef __int64		sf_count_t ;
  type sf_count_t (line 318) | typedef int64_t	sf_count_t ;
  type SF_INFO (line 328) | struct SF_INFO
  type SF_INFO (line 337) | typedef	struct SF_INFO SF_INFO ;
  type SF_FORMAT_INFO (line 350) | typedef struct
  type SF_DITHER_INFO (line 371) | typedef struct
  type SF_EMBED_FILE_INFO (line 381) | typedef struct
  type SF_INSTRUMENT (line 400) | typedef struct
  type SF_LOOP_INFO (line 418) | typedef struct
  type sf_count_t (line 462) | typedef sf_count_t		(*sf_vio_get_filelen)	(void *user_data) ;
  type sf_count_t (line 463) | typedef sf_count_t		(*sf_vio_seek)		(sf_count_t offset, int whence, void...
  type sf_count_t (line 464) | typedef sf_count_t		(*sf_vio_read)		(void *ptr, sf_count_t count, void *...
  type sf_count_t (line 465) | typedef sf_count_t		(*sf_vio_write)		(const void *ptr, sf_count_t count,...
  type sf_count_t (line 466) | typedef sf_count_t		(*sf_vio_tell)		(void *user_data) ;
  type SF_VIRTUAL_IO (line 468) | struct SF_VIRTUAL_IO
  type SF_VIRTUAL_IO (line 476) | typedef	struct SF_VIRTUAL_IO SF_VIRTUAL_IO ;

FILE: tests/bugs/issue-79/issue79.h
  type foo (line 1) | enum foo {

FILE: tests/bugs/issue-80/issue80.h
  type foo (line 1) | enum foo {

FILE: tests/bugs/issue-9/issue9.h
  type pointer_to_array (line 1) | struct pointer_to_array {
  type array_of_pointers (line 5) | struct array_of_pointers {
  type outer_t (line 11) | typedef struct {
  type ok_outer_t (line 16) | typedef struct {

FILE: tests/bugs/issue-93/issue93.c
  function mutate_foo (line 3) | void mutate_foo(foo_t *foo, bar_t *bar) {

FILE: tests/bugs/issue-93/issue93.h
  type bar_t (line 1) | typedef struct {
  type foo_t (line 6) | typedef struct {

FILE: tests/bugs/issue-95/issue95.h
  type foo (line 1) | struct foo {

FILE: tests/bugs/issue-96/issue96.c
  function simple_func (line 3) | void simple_func(foo_t *f) { }

FILE: tests/bugs/issue-96/issue96.h
  type foo_t (line 1) | typedef struct {

FILE: tests/bugs/issue-97/issue97.c
  function foo_x (line 4) | int foo_x(foo_t *f) {

FILE: tests/bugs/issue-97/issue97.h
  type foo_t (line 5) | typedef struct {

FILE: tests/bugs/issue-98/issue98.c
  function identichar (line 2) | char identichar(char c) { return c; }
  function identiuchar (line 3) | unsigned char identiuchar(unsigned char c) { return c; }
  function identischar (line 4) | signed char identischar(signed char c) { return c; }

FILE: tests/system/enums/enums.c
  function colourOfSide (line 5) | enum colour colourOfSide (side aside)

FILE: tests/system/enums/enums.h
  type colour (line 6) | enum colour {
  type weird (line 12) | enum weird {
  type side (line 20) | typedef enum {
  type side (line 27) | typedef side other_side;
  type colour (line 29) | enum colour
  type enum_net_type (line 31) | enum enum_net_type { NET_TYPE_TCPIP, NET_TYPE_SOCKET, NET_TYPE_NAMEDPIPE }
  type NET (line 33) | typedef struct st_net {
  type enums_enums (line 38) | enum enums_enums {
  type DWORD (line 49) | typedef unsigned long DWORD;

FILE: tests/system/interruptible/interruptible.c
  function run_forever (line 3) | void run_forever() {

FILE: tests/system/pointer/pointer.c
  function string (line 6) | string concat (string str1, string str2)
  function Point (line 12) | Point *make_point (int x, int y)
  function Point (line 23) | Point *trans_point (Point *pnt, int x, int y)

FILE: tests/system/pointer/pointer.h
  type _Point (line 8) | struct _Point {
  type _ColourPoint (line 12) | struct _ColourPoint {
  type Point (line 17) | typedef struct _Point Point;
  type ColourPoint (line 19) | typedef struct _ColourPoint ColourPoint;
  type _Point (line 21) | struct _Point

FILE: tests/system/simple/simple.c
  function foo (line 3) | void foo () {

FILE: tests/system/sizeof/sizeof.c
  function size_of_s1 (line 2) | size_t size_of_s1() {
  function size_of_s2 (line 5) | size_t size_of_s2() {
  function size_of_s3 (line 8) | size_t size_of_s3() {
  function size_of_s4 (line 11) | size_t size_of_s4() {
  function align_of_s1 (line 15) | size_t align_of_s1() {
  function align_of_s2 (line 18) | size_t align_of_s2() {
  function align_of_s3 (line 21) | size_t align_of_s3() {
  function align_of_s4 (line 24) | size_t align_of_s4() {

FILE: tests/system/sizeof/sizeof.h
  type S1 (line 13) | typedef struct s1 {
  type S2 (line 18) | typedef struct s2 {
  type S3 (line 25) | typedef struct s3 {
  type S4 (line 29) | typedef struct s4 {

FILE: tests/system/structs/structs.c
  function point (line 5) | point make_point (int x, int y)
  function weird (line 15) | weird make_weird (void)
  function mychar (line 28) | mychar *getSpacePtr (void)
  type bit_struct (line 35) | struct bit_struct
  type bit_struct (line 37) | struct bit_struct

FILE: tests/system/structs/structs.h
  type mychar (line 4) | typedef char bool, mychar;
  type _point (line 5) | struct _point
  type _point (line 7) | struct _point {
  type _point (line 12) | struct _point
  type ambiguousName (line 25) | typedef struct ambiguousName {
  type someOtherName (line 28) | typedef struct ambiguousName someOtherName;
  type bit_struct (line 40) | struct bit_struct {
  type bit_struct (line 47) | struct bit_struct
  type _MyStructAlign (line 53) | struct _MyStructAlign {long int x;}
  type _MyStruct (line 54) | struct _MyStruct
  type FT (line 66) | typedef struct { int type; int typ1; } FT;
  type SDL_Event (line 67) | typedef union { int type; FT typ1; } SDL_Event;
Condensed preview — 298 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (959K chars).
[
  {
    "path": ".boring",
    "chars": 843,
    "preview": "# Project specific\n\\.setup-config$\nautom4te\\.cache\nc2hs\\.spec$\nc2hs/c/CLexer\\.hs$\nc2hs/c/CParser\\.hs$\nc2hs/c2hs$\nc2hs/c2"
  },
  {
    "path": ".github/workflows/haskell-ci.yml",
    "chars": 10428,
    "preview": "# This GitHub workflow config has been generated by a script via\n#\n#   haskell-ci 'github' 'c2hs.cabal'\n#\n# To regenerat"
  },
  {
    "path": ".gitignore",
    "chars": 5474,
    "preview": "/.cabal-sandbox/*\n/cabal.sandbox.config\n*.chi\n*.chs.h\n/dist/\n/dist-newstyle/\n*.hi\n/issues/\n*.o\n/.shelly/*.txt\n/tests/bug"
  },
  {
    "path": ".travis.yml",
    "chars": 1245,
    "preview": "env:\n  global:\n    - AWS_ACCESS_KEY_ID=AKIAIKUEH2ETWTBS2CKQ\n    - secure: \"Jzawnhgk3dX2INzbZIlnHCH+aKWqy96B9T1hzBh/Fqp4w"
  },
  {
    "path": "AUTHORS",
    "chars": 1064,
    "preview": "Manuel M T Chakravarty  <chak@cse.unsw.edu.au>\nDuncan Coutts           <duncan@haskell.org>\n\nwith contributions from (al"
  },
  {
    "path": "C2HS.hs",
    "chars": 9484,
    "preview": "--  C->Haskell Compiler: Marshalling library\n--\n--  Copyright (c) [1999...2005] Manuel M T Chakravarty\n--\n--  Redistribu"
  },
  {
    "path": "COPYING",
    "chars": 18335,
    "preview": "This program is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public Licens"
  },
  {
    "path": "ChangeLog",
    "chars": 7311,
    "preview": "0.28.8.*\n - Bump upper bounds of language-c to 0.10 [#261]\n0.28.7\n - Support for InterruptibleFFI (Alex Wied)\n - Support"
  },
  {
    "path": "ChangeLog.CTKlight",
    "chars": 13062,
    "preview": "2005-05-18  Manuel M. T. Chakravarty  <chak@cse.unsw.edu.au>\n\n\t* Makefile: Evil Hack to be able create base.build.conf b"
  },
  {
    "path": "ChangeLog.old",
    "chars": 36231,
    "preview": "CHANGES ABOVE THIS POINT ARE FOR VERSIONS AFTER THE MOVE OF THE REPOSITORY\nTO GITHUB AND ARE DESCRIBED IN THE MAIN Chang"
  },
  {
    "path": "INSTALL",
    "chars": 1966,
    "preview": "                     C->Haskell Installation Instructions            -*-text-*-\n                     -------------------"
  },
  {
    "path": "README",
    "chars": 2146,
    "preview": "`c2hs` is a interfacing tool that eases Haskell access to C libraries.\nThe tool gets information about the C data type d"
  },
  {
    "path": "README.CTKlight",
    "chars": 3688,
    "preview": "\t\t       Compiler Toolkit - Light\t\t\t     -*-text-*-\n\t\t       ========================\n\nContents:\n\n  README.CTKlight -- T"
  },
  {
    "path": "README.md",
    "chars": 1497,
    "preview": "[![Build Status](https://travis-ci.org/haskell/c2hs.svg?branch=master)](https://travis-ci.org/haskell/c2hs)\n\n`c2hs` is a"
  },
  {
    "path": "REGRESSION-SUITE",
    "chars": 1944,
    "preview": "                        C2HS REGRESSION SUITE\n                        ~~~~~~~~~~~~~~~~~~~~~\n\nC2HS is flexible enough tha"
  },
  {
    "path": "Setup.hs",
    "chars": 74,
    "preview": "#!/usr/bin/env runhaskell\n\nimport Distribution.Simple\n\nmain = defaultMain\n"
  },
  {
    "path": "TODO",
    "chars": 12572,
    "preview": "\t\t\t\t\t\t\t\t     -*-text-*-\n                                C2HS TODO\n                                =========\n\nNext: - enu"
  },
  {
    "path": "TODO.CTKlight",
    "chars": 3551,
    "preview": "\t\t\t\t\t\t\t\t     -*-text-*-\n\t\t\t  Compiler Base TODO\n\t\t\t  ==================\n\nNext: \n\n\nShort Term:\n~~~~~~~~~~~\n* See general/"
  },
  {
    "path": "appveyor.yml",
    "chars": 508,
    "preview": "build: off\n\nbefore_test:\n# http://help.appveyor.com/discussions/problems/6312-curl-command-not-found\n- set PATH=C:\\Progr"
  },
  {
    "path": "c2hs.cabal",
    "chars": 9692,
    "preview": "Cabal-Version:  >= 1.10\nName:           c2hs\nVersion:        0.28.8\nLicense:        GPL-2\nLicense-File:   COPYING\nCopyri"
  },
  {
    "path": "cabal.haskell-ci",
    "chars": 51,
    "preview": "-- shelly >= 1.9 requires GHC >= 8.0\ntests: >= 8.0\n"
  },
  {
    "path": "custom-setup.hs",
    "chars": 3549,
    "preview": "--\n-- This Cabal setup script should ONLY be used in cases WHERE:\n--\n--   the bare structure wrapper capability of C2HS "
  },
  {
    "path": "doc/Makefile",
    "chars": 1650,
    "preview": "#  C->Haskell Compiler: documentation makefile\n#\n#  Author : Manuel M T Chakravarty\n#  Created: 30 October 1999\n#\n#  Ver"
  },
  {
    "path": "doc/c2hs.css",
    "chars": 826,
    "preview": "div {\n  font-family: sans-serif;\n  color: black;\n  background: white\n}\n\nh1, h2, h3, h4, h5, h6, p.title { color: #005A9C"
  },
  {
    "path": "doc/c2hs.xml",
    "chars": 57726,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF8\"?>\n<!DOCTYPE article PUBLIC \"-//OASIS//DTD DocBook XML V4.2//EN\"\n  \"http://www.oasis-"
  },
  {
    "path": "doc/man1/c2hs.1",
    "chars": 4325,
    "preview": ".\\\" Hey Emacs! This file is -*- nroff -*- source.\n.\\\"\n.\\\" Version $Revision: 1.2 $ from $Date: 2002/09/15 07:00:41 $\n.\\\""
  },
  {
    "path": "examples/libghttpHS/Ghttp.chs",
    "chars": 10008,
    "preview": "--  GhttpHS: Haskell binding to the Gnome HTTP library\t\t  -*-haskell-*-\n--\n--  Author : Manuel M. T. Chakravarty\n--  Cre"
  },
  {
    "path": "examples/libghttpHS/Makefile",
    "chars": 1365,
    "preview": "#  GnomeHaskell bindings: Gnome HTTP library\n#\n#  Author : Manuel M. T. Chakravarty\n#  Created: 8 October 1999\n#\n#  Copy"
  },
  {
    "path": "examples/libghttpHS/ghttpHS.c",
    "chars": 539,
    "preview": "/* Auxiliary C code for Ghttp.\n *\n * Copyright (c) 1999 Manuel M. T. Chakravarty\n *\n * This is required due to the inabi"
  },
  {
    "path": "examples/libghttpHS/ghttpHS.h",
    "chars": 480,
    "preview": "/* Auxiliary C code for Ghttp.\n *\n * Copyright (c) 1999 Manuel M. T. Chakravarty\n *\n * This is required due to the inabi"
  },
  {
    "path": "import-handling.md",
    "chars": 4237,
    "preview": "## Potentially breaking changes: import handling\n\n#### The problem\n\nPrevious releases of C2HS had an annoying misfeature"
  },
  {
    "path": "regression-suite-vm/Vagrantfile",
    "chars": 257,
    "preview": "Vagrant.configure(\"2\") do |config|\n  config.vm.box = \"c2hs-regression-suite.box\"\n\n  config.vm.provider :virtualbox do |v"
  },
  {
    "path": "regression-suite-vm/Vagrantfile-full",
    "chars": 2722,
    "preview": "$script = <<SCRIPT\n\nset -e\n\n# Initial APT package installation\n\nsed -i -e 's/us.archive.ubuntu.com/gb.archive.ubuntu.com"
  },
  {
    "path": "regression-suite-vm/run-regression",
    "chars": 472,
    "preview": "#!/bin/bash\n\nbranch=${1:-master}\n\nvagrant up\nvagrant ssh <<EOF\n/bin/rm -fr c2hs\nexport LD_LIBRARY_PATH=/usr/local/cuda-6"
  },
  {
    "path": "src/C2HS/C/Attrs.hs",
    "chars": 14239,
    "preview": "--  C->Haskell Compiler: C attribute definitions and manipulation routines\n--\n--  Author : Manuel M. T. Chakravarty\n--  "
  },
  {
    "path": "src/C2HS/C/Builtin.hs",
    "chars": 2217,
    "preview": "--  C->Haskell Compiler: C builtin information\n--\n--  Author : Manuel M. T. Chakravarty\n--  Created: 12 February 01\n--\n-"
  },
  {
    "path": "src/C2HS/C/Info.hs",
    "chars": 3709,
    "preview": "{-# LANGUAGE CPP #-}\n--  C->Haskell Compiler: information about the C implementation\n--\n--  Author : Manuel M T Chakrava"
  },
  {
    "path": "src/C2HS/C/Names.hs",
    "chars": 8161,
    "preview": "--  C->Haskell Compiler: C name analysis\n--\n--  Author : Manuel M. T. Chakravarty\n--  Created: 16 October 99\n--\n--  Copy"
  },
  {
    "path": "src/C2HS/C/Trav.hs",
    "chars": 37055,
    "preview": "--  C->Haskell Compiler: traversals of C structure tree\n--\n--  Author : Manuel M. T. Chakravarty\n--  Created: 16 October"
  },
  {
    "path": "src/C2HS/C.hs",
    "chars": 6822,
    "preview": "--  C->Haskell Compiler: interface to C processing routines\n--\n--  Author : Manuel M. T. Chakravarty\n--  Created: 12 Aug"
  },
  {
    "path": "src/C2HS/CHS/Lexer.hs",
    "chars": 43049,
    "preview": "--  C->Haskell Compiler: Lexer for CHS Files\n--\n--  Author : Manuel M T Chakravarty\n--  Created: 13 August 99\n--\n--  Cop"
  },
  {
    "path": "src/C2HS/CHS.hs",
    "chars": 70690,
    "preview": "{-# LANGUAGE StandaloneDeriving #-}\n--  C->Haskell Compiler: CHS file abstraction\n--\n--  Author : Manuel M T Chakravarty"
  },
  {
    "path": "src/C2HS/Config.hs",
    "chars": 5566,
    "preview": "--                                                                -*-haskell-*-\n--  ** @configure_input@ **\n--  ========"
  },
  {
    "path": "src/C2HS/Gen/Bind.hs",
    "chars": 134020,
    "preview": "{-# LANGUAGE CPP #-}\n{-# LANGUAGE BangPatterns #-}\n{-# OPTIONS_GHC -fno-warn-orphans #-}\n--  C->Haskell Compiler: bindin"
  },
  {
    "path": "src/C2HS/Gen/Header.hs",
    "chars": 14062,
    "preview": "--  C->Haskell Compiler: custom header generator\n--\n--  Author : Manuel M T Chakravarty\n--  Created: 5 February 2003\n--\n"
  },
  {
    "path": "src/C2HS/Gen/Monad.hs",
    "chars": 22329,
    "preview": "{-# OPTIONS_GHC -fno-warn-orphans #-}\n--  C->Haskell Compiler: monad for the binding generator\n--\n--  Author : Manuel M "
  },
  {
    "path": "src/C2HS/Gen/Wrapper.hs",
    "chars": 6577,
    "preview": "--  C->Haskell Compiler: custom wrapper generator\n--\n--  Author : Manuel M T Chakravarty\n--  Created: 5 February 2003\n--"
  },
  {
    "path": "src/C2HS/State.hs",
    "chars": 3163,
    "preview": "--  C -> Haskell Compiler: C2HS's state\n--\n--  Author : Manuel M. T. Chakravarty\n--  Created: 6 March 1999\n--\n--  Copyri"
  },
  {
    "path": "src/C2HS/Switches.hs",
    "chars": 4382,
    "preview": "--  C -> Haskell Compiler: management of switches\n--\n--  Author : Manuel M T Chakravarty\n--  Created: 6 March 99\n--\n--  "
  },
  {
    "path": "src/C2HS/Version.hs",
    "chars": 860,
    "preview": "module C2HS.Version (versnum, version, copyright, disclaimer)          -- -*-haskell-*-\nwhere\n\nimport qualified Paths_c2"
  },
  {
    "path": "src/C2HS/config.c",
    "chars": 3165,
    "preview": "/*  C -> Haskell Compiler: configuration query routines\n *\n *  Author : Manuel M T Chakravarty\n *  Created: 12 November "
  },
  {
    "path": "src/C2HS/config.h",
    "chars": 1338,
    "preview": "/*  C -> Haskell Compiler: configuration query header\n *\n *  Author : Manuel M T Chakravarty\n *  Created: 12 November 1\n"
  },
  {
    "path": "src/Control/State.hs",
    "chars": 10556,
    "preview": "--  Compiler Toolkit: compiler state management\n--\n--  Author : Manuel M. T. Chakravarty\n--  Created: 2 November 95\n--\n-"
  },
  {
    "path": "src/Control/StateBase.hs",
    "chars": 4783,
    "preview": "--  Compiler Toolkit: compiler state management basics\n--\n--  Author : Manuel M. T. Chakravarty\n--  Created: 7 November "
  },
  {
    "path": "src/Control/StateTrans.hs",
    "chars": 11954,
    "preview": "--  The HiPar Toolkit: state transformer routines\n--\n--  Author : Manuel M. T. Chakravarty\n--  Created: 3 March 95\n--\n--"
  },
  {
    "path": "src/Data/Attributes.hs",
    "chars": 14901,
    "preview": "--  Compiler Toolkit: general purpose attribute management\n--\n--  Author : Manuel M. T. Chakravarty\n--  Created: 14 Febr"
  },
  {
    "path": "src/Data/Errors.hs",
    "chars": 2859,
    "preview": "--  Compiler Toolkit: basic error management\n--\n--  Author : Manuel M. T. Chakravarty\n--  Created: 20 February 95\n--\n-- "
  },
  {
    "path": "src/Data/NameSpaces.hs",
    "chars": 5993,
    "preview": "--  Compiler Toolkit: name space management\n--\n--  Author : Manuel M. T. Chakravarty\n--  Created: 12 November 95\n--\n--  "
  },
  {
    "path": "src/Main.hs",
    "chars": 21708,
    "preview": "--  C->Haskell Compiler: main module\n--\n--  Copyright (c) [1999..2005] Manuel M T Chakravarty\n--\n--  This file is free s"
  },
  {
    "path": "src/System/CIO.hs",
    "chars": 5228,
    "preview": "{-# LANGUAGE CPP #-}\n--  Compiler Toolkit: Compiler I/O\n--\n--  Author : Manuel M T Chakravarty\n--  Created: 2 November 9"
  },
  {
    "path": "src/Text/Lexers.hs",
    "chars": 19184,
    "preview": "--  Compiler Toolkit: Self-optimizing lexers\n--\n--  Author : Manuel M. T. Chakravarty\n--  Created: 2 March 99\n--\n--  Cop"
  },
  {
    "path": "tests/bugs/call_capital/Capital.c",
    "chars": 114,
    "preview": "#include \"Capital.h\"\n#include <stdio.h>\nvoid c() { printf(\"lower c();\\n\"); }\nvoid C() { printf(\"upper C();\\n\"); }\n"
  },
  {
    "path": "tests/bugs/call_capital/Capital.chs",
    "chars": 113,
    "preview": "module Main where\n\n#include \"Capital.h\"\nmain = do\n  {# call C as ^ #}\n  {# call c as c' #}\n  {# call C as c'' #}\n"
  },
  {
    "path": "tests/bugs/call_capital/Capital.h",
    "chars": 20,
    "preview": "void c();\nvoid C();\n"
  },
  {
    "path": "tests/bugs/issue-10/Issue10.chs",
    "chars": 863,
    "preview": "module Main where\n\nimport Control.Monad\n\n#include \"issue10.h\"\n\ncheck :: Int -> Int -> IO ()\ncheck sz szexpect =\n  putStr"
  },
  {
    "path": "tests/bugs/issue-10/issue10.c",
    "chars": 257,
    "preview": "#include \"issue10.h\"\n\nsize_t size_of_s1(void) { return sizeof(S1); }\nsize_t size_of_s2(void) { return sizeof(S2); }\nsize"
  },
  {
    "path": "tests/bugs/issue-10/issue10.h",
    "chars": 466,
    "preview": "#include <stdlib.h>\n\nsize_t size_of_s1(void);\nsize_t size_of_s2(void);\nsize_t size_of_s3(void);\nsize_t size_of_s4(void);"
  },
  {
    "path": "tests/bugs/issue-102/Issue102.chs",
    "chars": 2031,
    "preview": "module Main where\n\n#include <stdio.h>\n#include <fcntl.h>\n\n{#pointer *FILE as File foreign finalizer fclose newtype#}\n\n{#"
  },
  {
    "path": "tests/bugs/issue-103/Issue103.chs",
    "chars": 208,
    "preview": "module Main where\n\nimport Foreign.C.Types\n\n#include \"issue103.h\"\n{#import Issue103A#}\n\n{#fun unsafe test_func as ^ { `Te"
  },
  {
    "path": "tests/bugs/issue-103/Issue103A.chs",
    "chars": 122,
    "preview": "module Issue103A where\n\nimport Foreign.C.Types\n\n#include \"issue103.h\"\n\n{#enum test_enum as TestEnum {underscoreToCase} #"
  },
  {
    "path": "tests/bugs/issue-103/issue103.c",
    "chars": 202,
    "preview": "#include \"issue103.h\"\n#include <stdio.h>\n\nvoid test_func(test_enum val)\n{\n  switch (val) {\n  case E_1: printf(\"1\\n\"); re"
  },
  {
    "path": "tests/bugs/issue-103/issue103.h",
    "chars": 80,
    "preview": "typedef enum {\n  E_1,\n  E_2,\n  E_3\n} test_enum;\n\nvoid test_func(test_enum val);\n"
  },
  {
    "path": "tests/bugs/issue-107/Issue107.chs",
    "chars": 138,
    "preview": "module Main where\n\ncheck :: Bool\n#if (C2HS_MIN_VERSION(0,19,1))\ncheck = True\n#else\ncheck = False\n#endif\n\nmain :: IO ()\nm"
  },
  {
    "path": "tests/bugs/issue-113/Issue113.chs",
    "chars": 145,
    "preview": "module Main where\n\n#include \"issue113.h\"\n\n{#enum annoying as Annoying {0 as Zero} with prefix = \"annoying\"#}\n\nmain :: IO"
  },
  {
    "path": "tests/bugs/issue-113/issue113.c",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "tests/bugs/issue-113/issue113.h",
    "chars": 30,
    "preview": "enum annoying { annoying_0 };\n"
  },
  {
    "path": "tests/bugs/issue-115/Issue115.chs",
    "chars": 416,
    "preview": "module Main where\n\nimport Foreign.Marshal.Array\n\n#include \"issue115.h\"\n\n{#pointer *array_t as MyStruct#}\n\n{#fun get_stru"
  },
  {
    "path": "tests/bugs/issue-115/issue115.c",
    "chars": 295,
    "preview": "#include \"issue115.h\"\n\narray_t myStruct;\nint other_a[3];\n\narray_t *get_struct(int n, int m, int o)\n{\n    myStruct.a[0] ="
  },
  {
    "path": "tests/bugs/issue-115/issue115.h",
    "chars": 170,
    "preview": "#pragma once\n\ntypedef struct {\n    int a[3]; /* An array of length 3. */\n    int *p;   /* A pointer to an array. */\n} ar"
  },
  {
    "path": "tests/bugs/issue-116/Issue116.chs",
    "chars": 346,
    "preview": "module Main where\n\n#include \"issue116.h\"\n\n{#enum test_enum as TestEnum {underscoreToCase} omit (TOTAL_ENUM_COUNT)\n    de"
  },
  {
    "path": "tests/bugs/issue-116/issue116.c",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "tests/bugs/issue-116/issue116.h",
    "chars": 68,
    "preview": "typedef enum {\n  E_1,\n  E_2,\n  E_3,\n  TOTAL_ENUM_COUNT\n} test_enum;\n"
  },
  {
    "path": "tests/bugs/issue-117/Issue117.chs",
    "chars": 434,
    "preview": "module Main where\n\nimport Control.Monad\nimport Foreign.Ptr\nimport Foreign.ForeignPtr\nimport Foreign.C.Types\nimport Syste"
  },
  {
    "path": "tests/bugs/issue-117/issue117.c",
    "chars": 301,
    "preview": "#include <stdlib.h>\n\n#include \"issue117.h\"\n\nint coord_x(coord_t c, int dummy)\n{\n    return c.x;\n}\n\ncoord_t *make_coord(i"
  },
  {
    "path": "tests/bugs/issue-117/issue117.h",
    "chars": 150,
    "preview": "typedef struct {\n  int x;\n  int y;\n} coord_t;\n\ncoord_t *make_coord(int x, int y);\nvoid free_coord(coord_t *coord);\nint c"
  },
  {
    "path": "tests/bugs/issue-123/Issue123.chs",
    "chars": 648,
    "preview": "module Main where\n\nimport Foreign\n\n#include \"issue123.h\"\n\n{#pointer *array_t as MyStruct#}\n\n{#fun get_struct {`Int', `In"
  },
  {
    "path": "tests/bugs/issue-123/issue123.c",
    "chars": 295,
    "preview": "#include \"issue123.h\"\n\narray_t myStruct;\nint other_a[3];\n\narray_t *get_struct(int n, int m, int o)\n{\n    myStruct.a[0] ="
  },
  {
    "path": "tests/bugs/issue-123/issue123.h",
    "chars": 170,
    "preview": "#pragma once\n\ntypedef struct {\n    int a[3]; /* An array of length 3. */\n    int *p;   /* A pointer to an array. */\n} ar"
  },
  {
    "path": "tests/bugs/issue-127/Issue127.chs",
    "chars": 141,
    "preview": "module Main where\n\n#include \"issue127.h\"\n\n{#fun tst as ^ {`Int'} -> `Bool'#}\n\nmain :: IO ()\nmain = do\n  tst 5 >>= print\n"
  },
  {
    "path": "tests/bugs/issue-127/issue127.c",
    "chars": 59,
    "preview": "#include \"issue127.h\"\n\nbool tst(int n)\n{\n  return n > 0;\n}\n"
  },
  {
    "path": "tests/bugs/issue-127/issue127.h",
    "chars": 258,
    "preview": "typedef unsigned char TST_BOOL;\n\n#if defined(__cplusplus)\n\n/* Use the C++ compiler's bool type */\n#define TST_BOOL bool\n"
  },
  {
    "path": "tests/bugs/issue-128/Issue128.chs",
    "chars": 1170,
    "preview": "module Main where\n\nimport Control.Monad\nimport Foreign.Ptr\nimport Foreign.ForeignPtr\nimport Foreign.C.Types\nimport Forei"
  },
  {
    "path": "tests/bugs/issue-128/issue128.c",
    "chars": 476,
    "preview": "#include <stdlib.h>\n#include \"issue128.h\"\n\nint f1(int n, bool incr)\n{\n  if (incr)\n    return n + 1;\n  else\n    return n "
  },
  {
    "path": "tests/bugs/issue-128/issue128.h",
    "chars": 239,
    "preview": "#include <stdbool.h>\n\nint f1(int n, bool incr);\nbool f2(int n);\n\ntypedef struct {\n  int a;\n  bool b;\n} tststruct;\n\ntstst"
  },
  {
    "path": "tests/bugs/issue-130/Issue130.chs",
    "chars": 360,
    "preview": "module Main where\n\nimport Foreign.C.Types\nimport Foreign.Marshal.Alloc\nimport Foreign.Storable\n\n#include \"issue130.h\"\n\nm"
  },
  {
    "path": "tests/bugs/issue-130/issue130.c",
    "chars": 89,
    "preview": "#include \"issue130.h\"\n\nvoid my_add(int *a, int *b, int *result)\n{\n  *result = *a + *b;\n}\n"
  },
  {
    "path": "tests/bugs/issue-130/issue130.h",
    "chars": 42,
    "preview": "void my_add(int *a, int *b, int *result);\n"
  },
  {
    "path": "tests/bugs/issue-131/Issue131.chs",
    "chars": 295,
    "preview": "module Main where\n\nimport Control.Monad\nimport Foreign.C.Types\nimport Foreign.Marshal.Utils\n\n#include \"issue131.h\"\n\n{#fu"
  },
  {
    "path": "tests/bugs/issue-131/issue131.c",
    "chars": 163,
    "preview": "#include <stdlib.h>\n#include \"issue131.h\"\n\nint f1(int n, bool incr)\n{\n  if (incr)\n    return n + 1;\n  else\n    return n "
  },
  {
    "path": "tests/bugs/issue-131/issue131.h",
    "chars": 55,
    "preview": "#include <stdbool.h>\n\nint f1(int, bool);\nbool f2(int);\n"
  },
  {
    "path": "tests/bugs/issue-133/Issue133.chs",
    "chars": 142,
    "preview": "module Main where\n\n#include \"issue133.h\"\n\n{#pointer tdptst as VoidTest1#}\n{#pointer *tdtst as VoidTest2#}\n\nmain :: IO ()"
  },
  {
    "path": "tests/bugs/issue-133/issue133.h",
    "chars": 42,
    "preview": "typedef void *tdptst;\ntypedef void tdtst;\n"
  },
  {
    "path": "tests/bugs/issue-134/Issue134.chs",
    "chars": 118,
    "preview": "module Main where\n\n#include \"issue134.h\"\n\n{# pointer *tst as ^ foreign newtype #}\n\nmain :: IO ()\nmain = putStrLn \"OK\"\n"
  },
  {
    "path": "tests/bugs/issue-134/issue134.h",
    "chars": 43,
    "preview": "struct tst { int a; };\n\nint tst(int, int);\n"
  },
  {
    "path": "tests/bugs/issue-136/Issue136.chs",
    "chars": 932,
    "preview": "{-# LANGUAGE EmptyDataDecls,\n    ForeignFunctionInterface #-}\n\n{- |\nThis will break things if you're not careful about c"
  },
  {
    "path": "tests/bugs/issue-136/issue136.c",
    "chars": 88,
    "preview": "#include \"issue136.h\"\n\nvoid mutate_foo(foo_t *foo, bar_t *bar) {\n    foo->bar = *bar;\n}\n"
  },
  {
    "path": "tests/bugs/issue-136/issue136.h",
    "chars": 143,
    "preview": "typedef struct {\n    int y;\n    int z;\n} bar_t;\n\ntypedef struct {\n    int x;\n    bar_t bar;\n} foo_t;\n\nvoid mutate_foo(fo"
  },
  {
    "path": "tests/bugs/issue-140/Issue140.chs",
    "chars": 711,
    "preview": "module Main where\n\nimport Foreign.Storable\nimport Foreign.Ptr\n\n#include \"issue140.h\"\n\n\n{#pointer *ptr1 as Ptr1 foreign n"
  },
  {
    "path": "tests/bugs/issue-140/issue140.c",
    "chars": 137,
    "preview": "#include \"issue140.h\"\n\nvoid f1(ptr1 *p, int x) { p->a = x; }\nvoid f2(ptr2 *p, int x) { p->a = x; }\nvoid f3(ptr3 *p, int "
  },
  {
    "path": "tests/bugs/issue-140/issue140.h",
    "chars": 191,
    "preview": "typedef struct _ptr1 { int a; } ptr1;\nvoid f1(ptr1 *p, int x);\n\ntypedef struct _ptr2 { int a; } ptr2;\nvoid f2(ptr2 *p, i"
  },
  {
    "path": "tests/bugs/issue-141/Issue141A.chs",
    "chars": 105,
    "preview": "module Main where\n\n#include \"issue141.h\"\n\nmain :: IO ()\nmain = do\n  print {#sizeof _p_Vec#}\n  print \"OK\"\n"
  },
  {
    "path": "tests/bugs/issue-141/Issue141B.chs",
    "chars": 106,
    "preview": "module Main where\n\n#include \"issue141.h\"\n\nmain :: IO ()\nmain = do\n  print {#alignof _p_Vec#}\n  print \"OK\"\n"
  },
  {
    "path": "tests/bugs/issue-141/Issue141C.chs",
    "chars": 115,
    "preview": "module Main where\n\n#include \"issue141.h\"\n\nmain :: IO ()\nmain = do\n  let f = {#get _p_Vec->fieldname#}\n  print \"OK\"\n"
  },
  {
    "path": "tests/bugs/issue-141/issue141.h",
    "chars": 28,
    "preview": "typedef struct _p_Vec *Vec;\n"
  },
  {
    "path": "tests/bugs/issue-149/Issue149.chs",
    "chars": 123,
    "preview": "module Main where\n\n#include \"issue149.h\"\n\n{#fun unsafe test as ^ {} -> `()'#}\n\nmain :: IO ()\nmain = do\n  test\n  print \"O"
  },
  {
    "path": "tests/bugs/issue-149/issue149.c",
    "chars": 72,
    "preview": "#include <stdio.h>\n\nvoid test(int arg)\n{\n  printf(\"test: %d\\n\", arg);\n}\n"
  },
  {
    "path": "tests/bugs/issue-149/issue149.h",
    "chars": 20,
    "preview": "void test(int arg);\n"
  },
  {
    "path": "tests/bugs/issue-15/Issue15.chs",
    "chars": 325,
    "preview": "module Main where\n\nimport Numeric\nimport Data.Char\n\n#include \"issue15.h\"\n\n{#enum Tst as ^ {underscoreToCase} deriving (E"
  },
  {
    "path": "tests/bugs/issue-15/issue15.c",
    "chars": 45,
    "preview": "const int tst_val(void)\n{\n  return 'drag';\n}\n"
  },
  {
    "path": "tests/bugs/issue-15/issue15.h",
    "chars": 195,
    "preview": "const int tst_val(void);\n\nenum Tst {\n  kClippingCreator = 'drag',\n  kClippingPictureType = 'clpp',\n  kClippingTextType ="
  },
  {
    "path": "tests/bugs/issue-151/Issue151.chs",
    "chars": 147,
    "preview": "module Issue151 where\n\n{# context lib = \"gdal\" prefix = \"CPL\" #}\n\n#include \"issue151.h\"\n\n{#pointer ErrorHandler#}\n\nmain "
  },
  {
    "path": "tests/bugs/issue-151/issue151.h",
    "chars": 51,
    "preview": "typedef void (*CPLErrorHandler)(int, const char*);\n"
  },
  {
    "path": "tests/bugs/issue-152/Issue152.chs",
    "chars": 130,
    "preview": "module Main where\n\n#include \"issue152.h\"\n\nf, g :: Int\nf = {# sizeof a #}\ng = {# sizeof s_a #}\n\nmain :: IO ()\nmain = putS"
  },
  {
    "path": "tests/bugs/issue-152/issue152.h",
    "chars": 44,
    "preview": "struct a { int f; };\n\ntypedef struct a s_a;\n"
  },
  {
    "path": "tests/bugs/issue-155/Issue155.chs",
    "chars": 74,
    "preview": "module Main where\n\n{# import Types #}\n\nmain :: IO ()\nmain = putStrLn \"OK\"\n"
  },
  {
    "path": "tests/bugs/issue-155/Types.chs",
    "chars": 376,
    "preview": "{-# LANGUAGE TypeSynonymInstances, FlexibleInstances #-}\nmodule Types where\n\n#include \"types.h\"\n\ndata ExampleStruct\n{# p"
  },
  {
    "path": "tests/bugs/issue-155/types.h",
    "chars": 87,
    "preview": "typedef struct {\n  int a;\n} example_struct;\n\ntypedef struct {\n  int b;\n} child_struct;\n"
  },
  {
    "path": "tests/bugs/issue-16/Issue16.chs",
    "chars": 54,
    "preview": "#include \"issue16.h\"\n\nmain :: IO ()\nmain = return ()\n\n"
  },
  {
    "path": "tests/bugs/issue-16/issue16.c",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "tests/bugs/issue-16/issue16.h",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "tests/bugs/issue-180/Issue180.chs",
    "chars": 171,
    "preview": "module Main where\n\n#include \"issue180.h\"\n\nmarshalIn = undefined\n\n{#fun pure test as test1\n  { 'marshalIn'* `Int'&} -> `("
  },
  {
    "path": "tests/bugs/issue-180/issue180.h",
    "chars": 20,
    "preview": "void test(int arg);\n"
  },
  {
    "path": "tests/bugs/issue-19/Issue19.chs",
    "chars": 365,
    "preview": "module Main where\n\nimport Control.Monad\n\n#include \"issue19.h\"\n\n{#context prefix=\"enums\"#}\n\n{#enum enums1 as Enums1 {unde"
  },
  {
    "path": "tests/bugs/issue-19/issue19.c",
    "chars": 21,
    "preview": "#include \"issue19.h\"\n"
  },
  {
    "path": "tests/bugs/issue-19/issue19.h",
    "chars": 144,
    "preview": "enum enums1 {\n  ENUMS_ONE   = 1,\n  ENUMS_TWO   = 2,\n  ENUMS_THREE = 3\n};\n\nenum enums2 {\n  ENUMS_FOUR = 4,\n  ENUMS_FIVE ="
  },
  {
    "path": "tests/bugs/issue-192/Issue192.chs",
    "chars": 46,
    "preview": "module Issue192 where\n\n#include \"issue-192.h\"\n"
  },
  {
    "path": "tests/bugs/issue-192/issue-192.h",
    "chars": 120,
    "preview": "extern int __fpclassifyf128 (_Float128 __value) __attribute__ ((__nothrow__ , __leaf__))\n  __attribute__ ((__const__));\n"
  },
  {
    "path": "tests/bugs/issue-20/Issue20.chs",
    "chars": 190,
    "preview": "module Main where\n\nimport Foreign.C\n\n#include \"issue20.h\"\n\n{#typedef size_t CSize#}\n{#fun foo {`Int'} -> `CSize'#}\n\nmain"
  },
  {
    "path": "tests/bugs/issue-20/issue20.c",
    "chars": 69,
    "preview": "#include <stdlib.h>\n\nsize_t foo(int n)\n{\n  return n * sizeof(int);\n}\n"
  },
  {
    "path": "tests/bugs/issue-20/issue20.h",
    "chars": 40,
    "preview": "#include <stdlib.h>\n\nsize_t foo(int n);\n"
  },
  {
    "path": "tests/bugs/issue-22/Issue22.chs",
    "chars": 769,
    "preview": "module Main where\n\nimport Foreign\nimport Foreign.C\n\n#include \"issue22.h\"\n\n{#pointer *struct_t as Struct#}\n{#pointer *sub"
  },
  {
    "path": "tests/bugs/issue-22/issue22.c",
    "chars": 217,
    "preview": "#include <string.h>\n#include \"issue22.h\"\n\nstruct_t s;\nsubstruct_t subs;\n\nstruct_t *foo(int n)\n{\n  strcpy(s.somefield, \"a"
  },
  {
    "path": "tests/bugs/issue-22/issue22.h",
    "chars": 181,
    "preview": "typedef struct {\n    int field;\n} substruct_t;\n\ntypedef struct {\n    char somefield[32];\n    substruct_t substruct;\n    "
  },
  {
    "path": "tests/bugs/issue-23/Issue23.chs",
    "chars": 226,
    "preview": "module Main where\n\n#include \"issue23.h\"\n#include \"issue23x.h\"\n\n{#enum hello as Hello {underscoreToCase} deriving (Show)#"
  },
  {
    "path": "tests/bugs/issue-23/issue23.c",
    "chars": 158,
    "preview": "#include \"issue23.h\"\n#include \"issue23x.h\"\n\nenum hello hello_fn(int n)\n{\n  switch (n) {\n  case 0: return H1;\n  case 1: r"
  },
  {
    "path": "tests/bugs/issue-23/issue23.h",
    "chars": 33,
    "preview": "extern enum hello hello_fn(int);\n"
  },
  {
    "path": "tests/bugs/issue-23/issue23x.h",
    "chars": 27,
    "preview": "enum hello { H1, H2, H3 };\n"
  },
  {
    "path": "tests/bugs/issue-230/Issue230.chs",
    "chars": 900,
    "preview": "module Main where\n\n#include \"issue230.h\"\n\nimport Control.Monad (liftM)\nimport Foreign.C\n\ncIntConv :: CInt-> Int\ncIntConv"
  },
  {
    "path": "tests/bugs/issue-230/issue230.c",
    "chars": 339,
    "preview": "#include <stdlib.h>\n\n#include \"issue230.h\"\n\nstruct test1 *make_test1(void)\n{\n  struct test1 *t = malloc(sizeof(struct te"
  },
  {
    "path": "tests/bugs/issue-230/issue230.h",
    "chars": 219,
    "preview": "struct test1 {\n  int a;\n  struct {\n    int c;\n    double d;\n  };\n  int b;\n};\n\nstruct test2 {\n  int a;\n  union {\n    int "
  },
  {
    "path": "tests/bugs/issue-242/Issue242.chs",
    "chars": 244,
    "preview": "module Main where\nimport Foreign.C.Types(CULLong)\n#include \"issue242.h\"\n\n{# fun echoCULLong as ^ {`CULLong'} -> `CULLong"
  },
  {
    "path": "tests/bugs/issue-242/issue242.c",
    "chars": 122,
    "preview": "#include <stdlib.h>\n\n#include \"issue242.h\"\n\nunsigned long long int echoCULLong (unsigned long long int i) {\n  return i;\n"
  },
  {
    "path": "tests/bugs/issue-242/issue242.h",
    "chars": 63,
    "preview": "unsigned long long int echoCULLong (unsigned long long int i);\n"
  },
  {
    "path": "tests/bugs/issue-25/Issue25.chs",
    "chars": 379,
    "preview": "module Main where\n\nimport Foreign.C\n\n#include <wchar.h>\n\n{#typedef wchar_t CWchar#}\n{#default in `String' [wchar_t *] wi"
  },
  {
    "path": "tests/bugs/issue-257/Issue257.chs",
    "chars": 407,
    "preview": "module Main where\n\n#include \"issue257.h\"\n\nimport Foreign.Ptr\n\n{#fun make_bools as make_bools {`Bool',`Bool',`Bool',`Bool"
  },
  {
    "path": "tests/bugs/issue-257/issue257.c",
    "chars": 220,
    "preview": "#include <stdlib.h>\n#include \"issue257.h\"\n\nstruct bools* make_bools(bool a, bool b, bool c, bool d) {\n  struct bools* bs"
  },
  {
    "path": "tests/bugs/issue-257/issue257.h",
    "chars": 196,
    "preview": "#ifndef _BOOLS_H\n#define _BOOLS_H\n#include <stdbool.h>\n\nstruct bools {\n  bool a;\n  bool b;\n  bool c;\n  bool d;\n};\n\nstruc"
  },
  {
    "path": "tests/bugs/issue-29/Issue29.chs",
    "chars": 72,
    "preview": "module Main where\n\n#include \"issue29.h\"\n\nmain :: IO ()\nmain = return ()\n"
  },
  {
    "path": "tests/bugs/issue-29/issue29.h",
    "chars": 131,
    "preview": "#ifndef _STDLIB_H_\n#define _STDLIB_H_\n\nint atexit(void (*)(void));\n\n#ifdef __BLOCKS__\nint atexit_b(void (^)(void));\n#end"
  },
  {
    "path": "tests/bugs/issue-30/Issue30.chs",
    "chars": 250,
    "preview": "module Main where\n\nimport Foreign\nimport Foreign.C\n\n{#import Issue30Aux1#}\n{#import Issue30Aux2#}\n\n#include \"issue30.h\"\n"
  },
  {
    "path": "tests/bugs/issue-30/Issue30Aux1.chs",
    "chars": 115,
    "preview": "module Issue30Aux1 where\n\nimport Foreign\nimport Foreign.C\n\n#include \"issue30aux1.h\"\n\n{#fun foo1 {`Int'} -> `Int'#}\n"
  },
  {
    "path": "tests/bugs/issue-30/Issue30Aux2.chs",
    "chars": 115,
    "preview": "module Issue30Aux2 where\n\nimport Foreign\nimport Foreign.C\n\n#include \"issue30aux2.h\"\n\n{#fun foo2 {`Int'} -> `Int'#}\n"
  },
  {
    "path": "tests/bugs/issue-30/issue30.c",
    "chars": 33,
    "preview": "int foo(int n) { return n + 1; }\n"
  },
  {
    "path": "tests/bugs/issue-30/issue30.h",
    "chars": 14,
    "preview": "int foo(int);\n"
  },
  {
    "path": "tests/bugs/issue-30/issue30aux1.c",
    "chars": 34,
    "preview": "int foo1(int n) { return n * 2; }\n"
  },
  {
    "path": "tests/bugs/issue-30/issue30aux1.h",
    "chars": 15,
    "preview": "int foo1(int);\n"
  },
  {
    "path": "tests/bugs/issue-30/issue30aux2.c",
    "chars": 34,
    "preview": "int foo2(int n) { return n * 4; }\n"
  },
  {
    "path": "tests/bugs/issue-30/issue30aux2.h",
    "chars": 15,
    "preview": "int foo2(int);\n"
  },
  {
    "path": "tests/bugs/issue-31/Issue31.chs",
    "chars": 2618,
    "preview": "module Main where\n\n#include \"issue31.h\"\n\n-- CASE 1:\n--\n-- fromIntegral . fromEnum and toEnum . fromIntegral from an enum"
  },
  {
    "path": "tests/bugs/issue-31/issue31.c",
    "chars": 793,
    "preview": "#include \"issue31.h\"\n\ntest_enum enum_test(test_enum n)\n{\n  switch (n) {\n  case E_1: return E_2;\n  case E_2: return E_3;\n"
  },
  {
    "path": "tests/bugs/issue-31/issue31.h",
    "chars": 527,
    "preview": "typedef enum {\n  E_1,\n  E_2,\n  E_3\n} test_enum;\n\ntest_enum enum_test(test_enum n);\n\ntypedef struct { int a; } test_struc"
  },
  {
    "path": "tests/bugs/issue-32/Issue32.chs",
    "chars": 249,
    "preview": "module Main where\n\n#include \"issue32.h\"\n\n{#pointer *testStruct as TestStructPtr #}\n\nmain :: IO ()\nmain = do\n  x <- {#cal"
  },
  {
    "path": "tests/bugs/issue-32/issue32.c",
    "chars": 190,
    "preview": "#include \"issue32.h\"\n\nstatic testStruct makeItFrom;\n\ntestStruct *makeIt(void)\n{\n  makeItFrom.a = 1234;\n  makeItFrom.b = "
  },
  {
    "path": "tests/bugs/issue-32/issue32.h",
    "chars": 163,
    "preview": "typedef struct testStruct_ testStruct;\n\nstruct testStruct_ {\n  unsigned a: 27;\n  unsigned b:  1;\n  unsigned c: 13;\n  uns"
  },
  {
    "path": "tests/bugs/issue-36/Issue36.chs",
    "chars": 317,
    "preview": "module Main where\n\n#include \"issue36.h\"\n\ndata Hit1 a = Hit1 a\ndata Hit2 a b = Hit2 a b\n\n{#pointer *hit_int as HitEg1 -> "
  },
  {
    "path": "tests/bugs/issue-36/issue36.h",
    "chars": 76,
    "preview": "typedef struct { int a; } hit_int;\ntypedef struct { double a; } hit_double;\n"
  },
  {
    "path": "tests/bugs/issue-37/Issue37.chs",
    "chars": 293,
    "preview": "module Main where\n\nimport Foreign\nimport Foreign.C\n\n#include \"issue37.h\"\n\n{#fun f1 {`Int'} -> `Int'#}\n\n{#fun f2 {`Float'"
  },
  {
    "path": "tests/bugs/issue-37/issue37.c",
    "chars": 104,
    "preview": "#include \"issue37.h\"\n\nint f1(int *np)\n{\n  return *np * 2;\n}\n\n\nfloat f2(float *np)\n{\n  return *np * 3;\n}\n"
  },
  {
    "path": "tests/bugs/issue-37/issue37.h",
    "chars": 38,
    "preview": "int f1(int *np);\nfloat f2(float *np);\n"
  },
  {
    "path": "tests/bugs/issue-38/Issue38.chs",
    "chars": 388,
    "preview": "module Main where\n\n#include \"issue38.h\"\n\n{#enum test_enum as TestEnum {underscoreToCase} deriving (Eq, Show)#}\n{#fun enu"
  },
  {
    "path": "tests/bugs/issue-38/issue38.c",
    "chars": 168,
    "preview": "#include \"issue38.h\"\n\ntest_enum enum_test(test_enum n)\n{\n  switch (n) {\n  case TEST_A: return TEST_B;\n  case TEST_B: ret"
  },
  {
    "path": "tests/bugs/issue-38/issue38.h",
    "chars": 143,
    "preview": "typedef enum {\n  TEST_A,\n  TEST_B,\n  TEST_C,\n  TEST_A_ALIAS = TEST_A,\n  TEST_C_ALIAS = TEST_C\n} test_enum;\n\ntest_enum en"
  },
  {
    "path": "tests/bugs/issue-43/Issue43.chs",
    "chars": 412,
    "preview": "module Main where\n\nimport Control.Monad (forM_)\n\n#include \"issue43.h\"\n\n{#enum Test1 {underscoreToCase} deriving (Eq, Sho"
  },
  {
    "path": "tests/bugs/issue-43/issue43.c",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "tests/bugs/issue-43/issue43.h",
    "chars": 123,
    "preview": "enum Test1 {\n  TEST1_A,\n  TEST1_B,\n  TEST1_C = 5,\n  TEST1_D\n};\n\nenum {\n  ANON_A = 8,\n  ANON_B,\n  ANON_C = 15,\n  ANON_D\n}"
  },
  {
    "path": "tests/bugs/issue-44/Issue44.chs",
    "chars": 118,
    "preview": "module Main where\n\n#include \"issue44.h\"\n\n{#pointer *foo as ^ foreign newtype#}\n\nmain :: IO ()\nmain = putStrLn \"dummy\"\n"
  },
  {
    "path": "tests/bugs/issue-44/issue44.c",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "tests/bugs/issue-44/issue44.h",
    "chars": 31,
    "preview": "typedef struct { int a; } foo;\n"
  },
  {
    "path": "tests/bugs/issue-45/Issue45.chs",
    "chars": 104,
    "preview": "module Main where\n\n#include \"issue45.h\"\n\nmain :: IO ()\nmain = foo 2\n  where {#fun foo {`Int'} -> `()'#}\n"
  },
  {
    "path": "tests/bugs/issue-45/issue45.c",
    "chars": 20,
    "preview": "void foo(int n) { }\n"
  },
  {
    "path": "tests/bugs/issue-45/issue45.h",
    "chars": 15,
    "preview": "void foo(int);\n"
  },
  {
    "path": "tests/bugs/issue-46/Issue46.chs",
    "chars": 295,
    "preview": "module Main where\n\n#include \"issue46.h\"\n\n{#pointer *oid as Oid foreign newtype#}\n\n{#fun func as ^ {+, `Int', `Float'} ->"
  },
  {
    "path": "tests/bugs/issue-46/issue46.c",
    "chars": 188,
    "preview": "#include \"issue46.h\"\n\nvoid func(oid *obj, int aval, float bval)\n{\n  obj->a = aval;\n  obj->b = bval;\n}\n\nint oid_a(oid *ob"
  },
  {
    "path": "tests/bugs/issue-46/issue46.h",
    "chars": 146,
    "preview": "typedef struct {\n  int a;\n  float b;\n  char dummy;\n} oid;\n\nvoid func(oid *obj, int aval, float bval);\nint oid_a(oid *obj"
  },
  {
    "path": "tests/bugs/issue-47/Issue47.chs",
    "chars": 97,
    "preview": "module Main where\n\n#include \"issue47.h\"\n\n{#fun foo {`Int'} -> `()'#}\n\nmain :: IO ()\nmain = foo 2\n"
  },
  {
    "path": "tests/bugs/issue-47/issue47.c",
    "chars": 20,
    "preview": "void foo(int n) { }\n"
  },
  {
    "path": "tests/bugs/issue-47/issue47.h",
    "chars": 15,
    "preview": "void foo(int);\n"
  },
  {
    "path": "tests/bugs/issue-48/Issue48.chs",
    "chars": 270,
    "preview": "module Main where\n\nimport Foreign.C.Types\n\n#include \"issue48.h\"\n\n{#typedef int64_t CLong#}\n{#default out `Int' [int64_t]"
  },
  {
    "path": "tests/bugs/issue-48/issue48.c",
    "chars": 65,
    "preview": "#include \"issue48.h\"\n\nint64_t foo(int64_t n)\n{\n  return n + 1;\n}\n"
  },
  {
    "path": "tests/bugs/issue-48/issue48.h",
    "chars": 48,
    "preview": "#include <sys/types.h>\n\nint64_t foo(int64_t n);\n"
  }
]

// ... and 98 more files (download for full content)

About this extraction

This page contains the full source code of the haskell/c2hs GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 298 files (885.7 KB), approximately 257.3k tokens, and a symbol index with 238 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!