c2hs 0.28.2 → 0.28.3
raw patch · 40 files changed
+3384/−4 lines, 40 filesdep ~basedep ~language-cnew-uploader
Dependency ranges changed: base, language-c
Files
- .boring +59/−0
- .gitignore +170/−0
- .travis.yml +30/−0
- ChangeLog +2/−0
- ChangeLog.CTKlight +465/−0
- README.CTKlight +80/−0
- README.md +35/−0
- REGRESSION-SUITE +50/−0
- TODO +289/−0
- TODO.CTKlight +81/−0
- c2hs.cabal +2/−2
- custom-setup.hs +92/−0
- examples/libghttpHS/Ghttp.chs +326/−0
- examples/libghttpHS/Makefile +46/−0
- examples/libghttpHS/ghttpHS.c +22/−0
- examples/libghttpHS/ghttpHS.h +21/−0
- import-handling.md +104/−0
- regression-suite-vm/Vagrantfile +9/−0
- regression-suite-vm/Vagrantfile-full +84/−0
- regression-suite-vm/run-regression +20/−0
- src/C2HS/CHS/Lexer.hs +4/−1
- src/C2HS/Version.hs +1/−1
- tests/bugs/issue-192/Issue192.chs +3/−0
- tests/bugs/issue-192/issue-192.h +2/−0
- tests/bugs/issue-37/Issue37.chs +17/−0
- tests/bugs/issue-37/issue37.c +12/−0
- tests/bugs/issue-37/issue37.h +2/−0
- tests/bugs/issue-82/include/Availability.h +145/−0
- tests/bugs/issue-82/include/AvailabilityInternal.h +273/−0
- tests/bugs/issue-82/include/TargetConditionals.h +108/−0
- tests/bugs/issue-82/include/_types.h +68/−0
- tests/bugs/issue-82/include/secure/_common.h +41/−0
- tests/bugs/issue-82/include/secure/_string.h +144/−0
- tests/bugs/issue-82/include/string.h +197/−0
- tests/bugs/issue-82/include/strings.h +96/−0
- tests/bugs/issue-82/include/sys/cdefs.h +126/−0
- tests/bugs/issue-82/include/xlocale/_string.h +35/−0
- tests/regression-suite.yaml +112/−0
- tests/system/clean +7/−0
- tests/test-bugs.hs +4/−0
+ .boring view
@@ -0,0 +1,59 @@+# 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$
+ .gitignore view
@@ -0,0 +1,170 @@+/.cabal-sandbox/*+/cabal.sandbox.config+*.chi+*.chs.h+/dist/*+*.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_c.o+/tests/bugs/call_capital/Capital.hi+/tests/bugs/call_capital/Capital.hs+/tests/bugs/call_capital/Capital.o+/tests/bugs/issue-09/Issue09.hs+/tests/bugs/issue-102/Issue102+/tests/bugs/issue-102/Issue102.hs+/tests/bugs/issue-103/Issue103A.hs+/tests/bugs/issue-103/Issue103.hs+/tests/bugs/issue-107/Issue107+/tests/bugs/issue-107/Issue107.hs+/tests/bugs/issue-10/Issue10+/tests/bugs/issue-10/Issue10.hs+/tests/bugs/issue-10/Issue10.i+/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-15/Issue15+/tests/bugs/issue-15/Issue15.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-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-29/Issue29.hs+/tests/bugs/issue-29/Issue29.i+/tests/bugs/issue-30/Issue30+/tests/bugs/issue-30/Issue30Aux1.hs+/tests/bugs/issue-30/Issue30Aux2.hs+/tests/bugs/issue-30/Issue30.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-51/Issue51+/tests/bugs/issue-51/Issue51_GNU+/tests/bugs/issue-51/Issue51_GNU.hs+/tests/bugs/issue-51/Issue51.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-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-7/Issue7.hs+/tests/bugs/issue-7/Issue7.i+/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-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/Issue97A.hs+/tests/bugs/issue-97/Issue97.hs+/tests/bugs/issue-98/Issue98+/tests/bugs/issue-98/Issue98.hs+/tests/bugs/issue-9/Issue9+/tests/bugs/issue-9/Issue9.hs+/tests/system/calls/Calls.hs+/tests/system/cpp/Cpp.hs+/tests/system/enums/enums+/tests/system/enums/Enums.hs+/tests/system/marsh/marsh+/tests/system/marsh/Marsh.hs+/tests/system/pointer/pointer+/tests/system/pointer/Pointer.hs+/tests/system/simple/simple+/tests/system/simple/Simple.hs+/tests/system/sizeof/sizeof+/tests/system/sizeof/Sizeof.hs+/tests/system/structs/structs+/tests/system/structs/Structs.hs+/tests/bugs/issue-20/Issue20+/tests/bugs/issue-20/Issue20.hs+/tests/bugs/issue-25/Issue25+/tests/bugs/issue-25/Issue25.hs+/tests/bugs/issue-48/Issue48+/tests/bugs/issue-48/Issue48.hs+/tests/bugs/issue-123/Issue123+/tests/bugs/issue-123/Issue123.hs+/tests/bugs/issue-102/issue-102.txt+/tests/bugs/issue-117/Issue117+/tests/bugs/issue-117/Issue117.hs+/tests/bugs/issue-117/Issue117.chs.c+/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-131/Issue131.chs.c+/tests/bugs/issue-131/Issue131.hs+/tests/bugs/issue-131/Issue131+/tests/bugs/issue-130/Issue130+/tests/bugs/issue-130/Issue130.hs+/tests/bugs/issue-133/Issue133+/tests/bugs/issue-133/Issue133.hs+/tests/bugs/issue-136/Issue136.hs+/tests/bugs/issue-136/Issue136+/tests/bugs/issue-134/Issue134+/tests/bugs/issue-134/Issue134.hs+/tests/bugs/issue-151/Issue151.hs+/tests/bugs/issue-149/Issue149+/tests/bugs/issue-149/Issue149.hs+/tests/bugs/issue-141/Issue141A.hs+/tests/bugs/issue-141/Issue141B.hs+/tests/bugs/issue-152/Issue152+/tests/bugs/issue-140/Issue140+/tests/bugs/issue-140/Issue140.hs+/tests/bugs/issue-152/Issue152.hs+/tests/bugs/issue-155/Issue155+/tests/bugs/issue-155/Issue155.hs+/tests/bugs/issue-152/Issue152.hs+/tests/bugs/issue-155/Types.hs
+ .travis.yml view
@@ -0,0 +1,30 @@+env:+ global:+ - AWS_ACCESS_KEY_ID=AKIAIKUEH2ETWTBS2CKQ+ - secure: "Jzawnhgk3dX2INzbZIlnHCH+aKWqy96B9T1hzBh/Fqp4whglaZDO0mTLHQnhypqAt1rXO2o3yBNcKgGOcgfUuE71uBCzzaXieB0p8BhYn7cwYeANbuKNOGrsP6oDutS5F57FNWwgRp+2oanpgJNOs/6wvfElA7W6ibN8tZiLQrw="+ matrix:+ - GHCVER=7.10.3++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-1.24 ghc-$GHCVER-prof ghc-$GHCVER-dyn happy+ - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/1.24/bin:$PATH++install:+ - sudo apt-get update -qq+ - sudo pip install awscli+ - cabal update+ - |+ if [ $GHCVER = "head" ] || [ ${GHCVER%.*} = "7.8" ] || [ ${GHCVER%.*} = "7.10" ]; 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
ChangeLog view
@@ -1,3 +1,5 @@+0.28.3+ - Switch to language-c 0.7.1 [#192] 0.28.2 - Switch to language-c 0.6 [#176] 0.28.1
+ ChangeLog.CTKlight view
@@ -0,0 +1,465 @@+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 Norbäck+ <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.
+ README.CTKlight view
@@ -0,0 +1,80 @@+ 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.
+ README.md view
@@ -0,0 +1,35 @@+[](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 — called the binding file —+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`.
+ REGRESSION-SUITE view
@@ -0,0 +1,50 @@+ 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.
+ TODO view
@@ -0,0 +1,289 @@+ -*-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, eg, `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 müßte es doch möglich sein, automatisch Instanzen von+ Storable für Strukturen zu erstellen. Falls man mal einen generische+ Pointer hat, kann man ja mit der ... as ... Methode eigene+ Marshalling Funktionen zur Verfügung stellen. Oder habe ich da etwas+ grundsätzliches ü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
+ TODO.CTKlight view
@@ -0,0 +1,81 @@+ -*-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 occurences.++* 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+ (eg, 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.
c2hs.cabal view
@@ -1,5 +1,5 @@ Name: c2hs-Version: 0.28.2+Version: 0.28.3 License: GPL-2 License-File: COPYING Copyright: Copyright (c) 1999-2007 Manuel M T Chakravarty@@ -112,7 +112,7 @@ Executable c2hs Build-Depends: base >= 2 && < 5, bytestring,- language-c >= 0.6 && < 0.7,+ language-c >= 0.7.1 && < 0.8, filepath, dlist
+ custom-setup.hs view
@@ -0,0 +1,92 @@+--+-- 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
+ examples/libghttpHS/Ghttp.chs view
@@ -0,0 +1,326 @@+-- GhttpHS: Haskell binding to the Gnome HTTP library -*-haskell-*-+--+-- Author : Manuel M. T. Chakravarty+-- Created: 5 August 99+--+-- Copyright (c) [1999..2000] Manuel M. T. Chakravarty+--+-- 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.+--+--- DESCRIPTION ---------------------------------------------------------------+--+-- The C library `libghttp' provides a set of common http functions needed at +-- the client and the server end of an http connection. The Haskell binding+-- is generated with the help of the C->Haskell tool - always modify the+-- original .chs file, _not_ the generated .hs file.+--+-- This library is fully compliant with HTTP 1.1 as defined in the draft 5+-- update of RFC 2068. +--+--- DOCU ----------------------------------------------------------------------+--+-- language: Haskell 98 & C->HS binding hooks (v0.7.5)+--+-- ** Stylistic warning: In the definition of `CurrentStatus', the field+-- labels do not contain the name of the data type to which they belong.+-- This is _not_ good practice in larger interfaces, because in Haskell+-- such field labels pollute the global name space.+--+--- TODO ----------------------------------------------------------------------+--+-- * When and by whom is the memory area passed to `ghttp_set_body' be freed; +-- how about the string returned from `ghttp_get_body'?+--+-- * Conversion of `time_t' misses for `parseDate'.+--++module Ghttp (Request, URI, Type(..), SyncMode(..), Status(..), Proc(..),+ CurrentStatus(..),+ requestNew, requestDestroy, uriValidate, setURI, setProxy,+ setType, setBody, setSync, prepare, setChunksize, setHeader,+ process, getStatus, getHeader, close, clean, getSocket, getBody, + getError, {-parseDate,-} setAuthinfo, setProxyAuthinfo)+where++-- C->HS marshalling library+--+import C2HS++import Monad (liftM, when)+import IOExts (unsafePerformIO)+++{#context lib="libghttp" prefix="ghttp"#}+++-- data structures+-- ---------------++-- abstract handle for a http request object (EXPORTED ABSTRACTLY)+--+newtype Request = Request Addr++-- Uniform Resource Indicators (EXPORTED)+--+type URI = String++-- body type (EXPORTED)+--+{#enum ghttp_type as Type {underscoreToCase}#}++-- synchronous/asynchronous mode (EXPORTED)+--+{#enum sync_mode as SyncMode {underscoreToCase}#}++-- request status (EXPORTED)+--+{#enum status as Status {underscoreToCase}#}++-- describes the activity of a request (EXPORTED)+--+{#enum proc as Proc {underscoreToCase}#}++-- status descriptor (EXPORTED)+--+data CurrentStatus = CurrentStatus {+ proc :: Proc, -- What's it doing?+ bytesRead :: Int, -- How many bytes have been read?+ bytesTotal :: Int -- How many bytes total?+ }++-- error types+--+invalidURI, illegalRequest :: String+invalidURI = "Ghttp: The Uniform Resource Indicator is invalid."+illegalRequest = "Ghttp: The request is illegal or unsupported."+++-- functions+-- ---------++-- create a new request object (EXPORTED)+--+requestNew :: IO Request+requestNew = liftM Request {#call unsafe request_new#}++-- delete a current request object (EXPORTED)+--+requestDestroy :: Request -> IO ()+requestDestroy (Request reqa) = {#call unsafe request_destroy#} reqa++-- validate a uri (EXPORTED)+--+uriValidate :: URI -> Bool+uriValidate uri = + let res = unsafePerformIO $+ {#call unsafe uri_validate#} `marsh1_` (stdAddr uri :> free)+ in+ res == -1++-- set a uri in a request (EXPORTED)+--+-- * raise an exception if the URI is not valid+--+setURI :: Request -> URI -> IO ()+setURI (Request reqa) uri = + {#call unsafe set_uri#} reqa `marsh1_` (stdAddr uri :> free)+ `ifNegRaise_` invalidURI++-- set a proxy for a request (EXPORTED)+--+-- * raise an exception if the request is not valid+--+setProxy :: Request -> URI -> IO ()+setProxy (Request reqa) uri = + {#call unsafe set_proxy#} reqa `marsh1_` (stdAddr uri :> free)+ `ifNegRaise_` illegalRequest++-- set a request type (EXPORTED)+--+-- * raise an exception if the request is not valid+--+setType :: Request -> Type -> IO ()+setType (Request reqa) rtype = + {#call unsafe set_type#} reqa (cFromEnum rtype)+ `ifNegRaise_` illegalRequest++-- set the body (EXPORTED)+--+-- * raise an exception if the request is not valid+--+setBody :: Request -> String -> IO ()+setBody (Request reqa) body =+ do+ (box, len) <- listToAddrWithLen body+ {#call unsafe set_body#} reqa box (cFromInt len)+ `ifNegRaise_` illegalRequest++-- set whether or not you want to use sync or async mode (EXPORTED)+--+-- * raise an exception if the request is not valid+--+setSync :: Request -> SyncMode -> IO ()+setSync (Request reqa) smode =+ {#call unsafe set_sync#} reqa (cFromEnum smode)+ `ifNegRaise_` illegalRequest++-- Prepare a request; call this before trying to process a request or if you+-- change the uri (EXPORTED)+--+-- * raise an exception if the request is not valid+--+prepare :: Request -> IO ()+prepare (Request reqa) =+ {#call unsafe prepare#} reqa+ `ifNegRaise_` illegalRequest++-- set the chunk size; you might want to do this to optimize for different+-- connection speeds (EXPORTED)+--+setChunksize :: Request -> Int -> IO ()+setChunksize (Request reqa) size =+ {#call unsafe set_chunksize#} reqa (cFromInt size)++-- set a random request header (EXPORTED)+--+setHeader :: Request -> String -> String -> IO ()+setHeader (Request reqa) hdr val =+ {#call unsafe set_header#} reqa+ `marsh2_` (stdAddr hdr :> free)+ $ (stdAddr val :> free)++-- process a request (EXPORTED)+--+process :: Request -> IO Status+process (Request reqa) = liftM cToEnum $ {#call unsafe process#} reqa++-- get the status of a request (EXPORTED)+--+getStatus :: Request -> IO CurrentStatus+getStatus (Request reqa) =+ {#call unsafe ghttpHS_get_status #} reqa >>= cFromCurrentStatus++-- get the value of a random response header (EXPORTED)+--+getHeader :: Request -> String -> IO String+getHeader (Request reqa) hdr =+ {#call unsafe get_header#} reqa `marsh1_` (stdAddr hdr :> free)+ >>= addrStd++-- abort a currently running request (EXPORTED)+--+-- * raise an exception if the request is not valid+--+close :: Request -> IO ()+close (Request reqa) = {#call unsafe close#} reqa+ `ifNegRaise_` illegalRequest++-- clean a request (EXPORTED)+--+clean :: Request -> IO ()+clean (Request reqa) = {#call unsafe clean#} reqa++-- get the socket associated with a particular connection (EXPORTED)+--+-- * raise an exception if the request is not valid+--+getSocket :: Request -> IO Int+getSocket (Request reqa) = {#call unsafe get_socket#} reqa+ `ifNegRaise` illegalRequest++-- get the return entity body (EXPORTED)+--+-- * this includes getting the length with `ghttp_get_body_len', as the string +-- is not necessarily \0 terminated+--+getBody :: Request -> IO String+getBody (Request reqa) = + do+ bodyAddr <- {#call unsafe get_body#} reqa+ `ifNullRaise` illegalRequest+ bodyLen <- {#call unsafe get_body_len#} reqa+ addrWithLenToList bodyAddr (cToInt bodyLen)++-- get an error message for a request that has failed (EXPORTED)+--+getError :: Request -> IO String+getError (Request reqa) = + {#call unsafe get_error#} reqa >>= addrStd++-- parse a date string that is one of the standard date formats (EXPORTED)+--+{-parseDate :: String -> CalendarTime+parseDate str = + do+ time_t <- {#call unsafe parse_date#} `fromString` str+ time <- toCalendarTime+ -}++-- return the status code (EXPORTED)+--+statusCode :: Request -> IO Int+statusCode (Request reqa) = + liftM cToInt $ {#call unsafe status_code#} reqa++-- return the reason phrase (EXPORTED)+--+-- * raise an exception if the request is not valid+--+reasonPhrase :: Request -> IO String+reasonPhrase (Request reqa) = + ({#call unsafe reason_phrase#} reqa+ `ifNullRaise` illegalRequest+ ) >>= addrStd++-- set your username/password pair (EXPORTED)+--+-- * raise an exception if the request is not valid+--+setAuthinfo :: Request -> String -> String -> IO ()+setAuthinfo (Request reqa) user pass =+ ({#call unsafe set_authinfo#} reqa + `marsh2_` (stdAddr user :> free)+ $ (stdAddr pass :> free)+ )+ `ifNegRaise_` illegalRequest++-- set your username/password pair for proxy (EXPORTED)+--+-- * raise an exception if the request is not valid+--+setProxyAuthinfo :: Request -> String -> String -> IO ()+setProxyAuthinfo (Request reqa) user pass =+ ({#call unsafe set_proxy_authinfo#} reqa + `marsh2_` (stdAddr user :> free)+ $ (stdAddr pass :> free)+ )+ `ifNegRaise_` illegalRequest+++-- auxilliary marshalling function+-- -------------------------------++-- marshal the elements of a `ghttp_current_status' struct to Haskell land+--+-- * frees the C struct+--+cFromCurrentStatus :: Addr -> IO CurrentStatus+cFromCurrentStatus csPtr = + do+ proc <- liftM cToEnum$ {#get current_status.proc#} csPtr+ read <- liftM cToInt $ {#get current_status.bytes_read#} csPtr+ total<- liftM cToInt $ {#get current_status.bytes_total#} csPtr+ free csPtr+ return $ CurrentStatus {+ proc = proc,+ bytesRead = read,+ bytesTotal = total+ }
+ examples/libghttpHS/Makefile view
@@ -0,0 +1,46 @@+# GnomeHaskell bindings: Gnome HTTP library+#+# Author : Manuel M. T. Chakravarty+# Created: 8 October 1999+#+# Copyright (c) 1999 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 =====================================================================+#+# = TODO =====================================================================+#+# * Let configure do the dirty work; how about automake++# the commented out variants are to be used if the directory is moved out of +# the C->HS source tree+#+GHC=ghc+#C2HS=c2hs+C2HS=../../c2hs+GHTTP_HEADER=ghttpHS.h+#HCFLAGS=`c2hs-config --cflags`+HCFLAGS=-i../../lib -fglasgow-exts++OBJS=Ghttp.o ghttpHS.o++Ghttp.hs: Ghttp.chs ghttpHS.h+ $(C2HS) $(GHTTP_HEADER) Ghttp.chs++Ghttp.o: Ghttp.hs ghttpHS.h+ $(GHC) '-#include"ghttpHS.h"' $(HCFLAGS) -c $<++ghttpHS.o: ghttpHS.h ghttpHS.c++libghttpHS.a: $(OBJS)+ -$(RM) $@+ $(AR) -crs $@ $(OBJS)
+ examples/libghttpHS/ghttpHS.c view
@@ -0,0 +1,22 @@+/* Auxiliary C code for Ghttp.+ *+ * Copyright (c) 1999 Manuel M. T. Chakravarty+ *+ * This is required due to the inability of GHC's FFI to pass structures from C+ * to Haskell.+ */++#include "ghttpHS.h"++ghttp_current_status *ghttpHS_get_status (ghttp_request *a_request)+{+ ghttp_current_status *status;++ status = (ghttp_current_status *) malloc (sizeof (ghttp_current_status));+ if (!status) {+ printf ("Ghttp: ghttpHS_get_status: Out of memory!");+ exit (1);+ }+ *status = ghttp_get_status (a_request);+ return status;+}
+ examples/libghttpHS/ghttpHS.h view
@@ -0,0 +1,21 @@+/* Auxiliary C code for Ghttp.+ *+ * Copyright (c) 1999 Manuel M. T. Chakravarty+ *+ * This is required due to the inability of GHC's FFI to pass structures from C+ * to Haskell.+ */++#ifndef __GHTTPHS_H__+#define __GHTTPHS_H__+++#include <ghttp.h>++/* returns a reference to a newly allocated memory area holding the result of + * the corresponding vanilla `libghttp' function+ */+ghttp_current_status *ghttpHS_get_status (ghttp_request *a_request);+++#endif /* __GHTTPHS_H__ */
+ import-handling.md view
@@ -0,0 +1,104 @@+## Potentially breaking changes: import handling++#### The problem++Previous releases of C2HS had an annoying misfeature -- you had to+manage the imports of Haskell library functions in C2HS-generated code+yourself. Suppose you had the following code in a `.chs` file:++``` haskell+#include "issue44.h"++{#pointer *foo as ^ foreign newtype#}+```++where the contents of the `issue44.h` header are:++``` c+typedef struct { int a; } foo;+```++Running C2HS would then generate the following Haskell code:++``` haskell+newtype Foo = Foo (ForeignPtr (Foo))+withFoo :: Foo -> (Ptr Foo -> IO b) -> IO b+withFoo (Foo fptr) = withForeignPtr fptr+```++Note the use of the names `ForeignPtr`, `Ptr` and `withForeignPtr`.+These come from the Haskell library modules `Foreign.Ptr` and+`Foreign.ForeignPtr`, but C2HS didn't generate any `import`+declarations to make these modules accessible. This meant that there+would normally be a bit of back and forth when writing C2HS code:+write your bindings, run C2HS, try compiling with GHC, have the+compile fail because of missing imports, add the imports to your+`.chs` file and repeat. Kind of annoying.++As well as being annoying, the lack of import declaration generation+meant that it was sometimes impossible to make internal changes to the+way that C2HS binds to C functions without breaking existing user+code. The example that finally drove me to try to fix this was issue+130 (https://github.com/haskell/c2hs/issues/130) that required a+change that would lead to most C2HS code now needing to import+`unsafePerformIO`. It didn't seem like a good idea to push a change+like that (that would break more or less all C2HS code out there!)+without fixing the import problem (so that the change for issue #130+could happen transparently to all existing working C2HS code).+++#### The solution++The solution I ended up with is pretty simple, but I think it's+robust. For the example above, C2HS now generates the following+Haskell code:++``` haskell+import qualified Foreign.ForeignPtr as C2HSImp+import qualified Foreign.Ptr as C2HSImp++newtype Foo = Foo (C2HSImp.ForeignPtr (Foo))+withFoo :: Foo -> (C2HSImp.Ptr Foo -> IO b) -> IO b+withFoo (Foo fptr) = C2HSImp.withForeignPtr fptr+```++All library symbols needed to generate Haskell binding code are now+qualified under the name `C2HSImp` and the relevant library modules+are imported qualified as `C2HSImp`.++The end result of this is that you still need to import modules only+for names that you explicitly use (so if you use `alloca` in an input+marshaller, you need to import `Foreign.Marshal.Alloc`). All external+names that C2HS uses in code that it generates should be imported+automatically.+++#### Potential complaints++1. Modules compiled with `-Werror` may now fail because of unused+ import warnings. This was something I had to deal with for most of+ the C2HS test cases (since they all imported the required library+ modules and they're mostly compiled with `-Werror`), but since the+ community consensus seems to be that `-Werror` shouldn't be used in+ released code, I think it's reasonable to allow the possibility of+ this kind of breakage.++2. It's possible that the code I wrote for deciding where to put the+ extra import declarations isn't quite perfect. I tried a couple of+ different solutions, but ended up with a hand-made "find the first+ safe place to add imports" function that relies quite heavily on+ the details of C2HS's CHS file parser. I did try a solution based+ on `haskell-src-exts`, but this didn't work very well, because+ `haskell-src-exts` doesn't support all available GHC extensions and+ I would have needed some mechanism to propagate extension+ information from Cabal files to C2HS to make the parsing work.++These changes have been tested reasonably extensively -- all of the+core C2HS tests pass, and the following packages are known to work+(they're all in the regression suite): abcBridge, alsa-mixer, cuda,+cufft, gnome-keyring, gnuidn, haskell-mpi, hnetcdf, hpuz, hsndfile,+hsshellscript, igraph, libssh2.++I'll be adding more packages to the regression suite, but if there's a+package you're particularly concerned about that's not on this list,+let me know.
+ regression-suite-vm/Vagrantfile view
@@ -0,0 +1,9 @@+Vagrant.configure("2") do |config|+ config.vm.box = "c2hs-regression-suite.box"++ config.vm.provider :virtualbox do |vb|+ vb.gui = false+ vb.customize ["modifyvm", :id, "--memory", "2048"]+ vb.customize ["modifyvm", :id, "--cpus", "2"]+ end+end
+ regression-suite-vm/Vagrantfile-full view
@@ -0,0 +1,84 @@+$script = <<SCRIPT++set -e++# Initial APT package installation++sed -i -e 's/us.archive.ubuntu.com/gb.archive.ubuntu.com/g' /etc/apt/sources.list+sed -i -e '/trusty multiverse/s/^# //' -e '/trusty-updates multiverse/s/^# //' /etc/apt/sources.list++apt-get update+apt-get install -y python-pip+pip install awscli++mkdir cuda-packages+aws s3 sync s3://cuda-packages ./cuda-packages+dpkg -i ./cuda-packages/cuda-repo-ubuntu1204_6.5-14_amd64.deb+/bin/rm ./cuda-packages/cuda-repo-ubuntu1204_6.5-14_amd64.deb+mv ./cuda-packages/*.deb /var/cache/apt/archives+/bin/rm -fr ./cuda-packages++apt-add-repository -y ppa:igraph/ppa+apt-get update++PACKAGES="alex build-essential git happy libatlas-base-dev libgmp-dev+ liblapack-dev libnetcdf-dev unzip zlib1g-dev libopencv-dev+ libcv-dev libhighgui-dev libgnome-keyring-dev libgsl0-dev+ libsndfile1-dev libqtscript4-core libqt4-declarative+ libigraph0-dev acpid consolekit dkms lib32gcc1 libc-bin+ libc-dev-bin libc6 libc6-dev libc6-i386 libck-connector0+ libpam-ck-connector libpolkit-agent-1-0+ libpolkit-backend-1-0 libpolkit-gobject-1-0 libvdpau1+ libxmu-dev libxmu-headers policykit-1 policykit-1-gnome+ python-xkit screen-resolution-extra cuda libasound2-dev+ libidn11-dev libopenmpi-dev libssh2-1-dev"++apt-get install -y $PACKAGES++cd /usr/lib/x86_64-linux-gnu+ln -s libgmp.so.10 libgmp.so.3+cd /root+++# GHC and Cabal installation+wget https://www.haskell.org/ghc/dist/7.8.3/ghc-7.8.3-x86_64-unknown-linux-deb7.tar.xz+tar xJf ghc-7.8.3-x86_64-unknown-linux-deb7.tar.xz+cd ghc-7.8.3+./configure+make install+cd ..+/bin/rm -fr ghc-7.8.3*++wget https://www.haskell.org/cabal/release/cabal-install-1.20.0.3/cabal-install-1.20.0.3.tar.gz+tar xzf cabal-install-1.20.0.3.tar.gz+cd cabal-install-1.20.0.3+./bootstrap.sh+cd ..+/bin/rm -fr cabal-install-1.20.0.3*++if [ ! -f /usr/bin/cabal-1.20 ]; then+ cp /root/.cabal/bin/cabal /usr/bin/cabal-1.20+ (cd /usr/bin/ && rm -rf cabal && ln -s cabal-1.20 cabal)+fi++echo "export PATH=\$HOME/.cabal/bin:\$PATH" >> /etc/bash.bashrc+echo "export PATH=/usr/local/cuda-6.5/bin:\$PATH" >> /etc/bash.bashrc++su vagrant -c 'cabal update'++SCRIPT++Vagrant.configure("2") do |config|+ config.vm.box = "trusty-server-cloudimg-amd64-vagrant-disk1.box"+ config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"++ config.vm.synced_folder "..", "/home/vagrant/c2hs"++ config.vm.provider :virtualbox do |vb|+ vb.gui = false+ vb.customize ["modifyvm", :id, "--memory", "2048"]+ vb.customize ["modifyvm", :id, "--cpus", "2"]+ end++ config.vm.provision "shell", inline: $script+end
+ regression-suite-vm/run-regression view
@@ -0,0 +1,20 @@+#!/bin/bash++branch=${1:-master}++vagrant up+vagrant ssh <<EOF+/bin/rm -fr c2hs+export LD_LIBRARY_PATH=/usr/local/cuda-6.5/lib64:$LD_LIBRARY_PATH+git clone https://github.com/haskell/c2hs.git+cd c2hs+git checkout $branch+cabal update+cabal install --only-dep --enable-tests -fregression+cabal install+cabal configure --enable-tests -fregression+cabal build && cabal test+export C2HS_REGRESSION_SUITE=1+./dist/build/regression-suite/regression-suite+EOF+vagrant destroy -f
src/C2HS/CHS/Lexer.hs view
@@ -712,7 +712,10 @@ s, Nothing) adjustPosByCLinePragma :: String -> Position -> Position-adjustPosByCLinePragma str pos = adjustPos fname' row' pos+adjustPosByCLinePragma str pos =+ if isSourcePos pos+ then position (posOffset pos) fname' row' 1 (posParent pos)+ else pos where fname = posFile pos str' = dropWhite str
src/C2HS/Version.hs view
@@ -10,7 +10,7 @@ name = "C->Haskell Compiler" versnum = Paths_c2hs.version versnick = "Switcheroo"-date = "1 April 2016"+date = "25 November 2017" version = name ++ ", version " ++ showVersion versnum ++ " " ++ versnick ++ ", " ++ date copyright = "Copyright (c) 1999-2007 Manuel M T Chakravarty\n" ++ " 2005-2008 Duncan Coutts\n"
+ tests/bugs/issue-192/Issue192.chs view
@@ -0,0 +1,3 @@+module Issue192 where++#include "issue-192.h"
+ tests/bugs/issue-192/issue-192.h view
@@ -0,0 +1,2 @@+extern int __fpclassifyf128 (_Float128 __value) __attribute__ ((__nothrow__ , __leaf__))+ __attribute__ ((__const__));
+ tests/bugs/issue-37/Issue37.chs view
@@ -0,0 +1,17 @@+module Main where++import Foreign+import Foreign.C++#include "issue37.h"++{#fun f1 {`Int'} -> `Int'#}++{#fun f2 {`Float'} -> `Float'#}++main :: IO ()+main = do+ tst1 <- f1 7+ tst2 <- f2 23+ putStrLn $ if tst1 == 14 then "SAME" else "DIFF"+ putStrLn $ if tst2 == 69 then "SAME" else "DIFF"
+ tests/bugs/issue-37/issue37.c view
@@ -0,0 +1,12 @@+#include "issue37.h"++int f1(int *np)+{+ return *np * 2;+}+++float f2(float *np)+{+ return *np * 3;+}
+ tests/bugs/issue-37/issue37.h view
@@ -0,0 +1,2 @@+int f1(int *np);+float f2(float *np);
+ tests/bugs/issue-82/include/Availability.h view
@@ -0,0 +1,145 @@+/*+ * Copyright (c) 2007-2009 by Apple Inc.. All rights reserved.+ *+ * @APPLE_LICENSE_HEADER_START@+ * + * This file contains Original Code and/or Modifications of Original Code+ * as defined in and that are subject to the Apple Public Source License+ * Version 2.0 (the 'License'). You may not use this file except in+ * compliance with the License. Please obtain a copy of the License at+ * http://www.opensource.apple.com/apsl/ and read it before using this+ * file.+ * + * The Original Code and all software distributed under the License are+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.+ * Please see the License for the specific language governing rights and+ * limitations under the License.+ * + * @APPLE_LICENSE_HEADER_END@+ */+ +#ifndef __AVAILABILITY__+#define __AVAILABILITY__+ /* + These macros are for use in OS header files. They enable function prototypes+ and Objective-C methods to be tagged with the OS version in which they+ were first available; and, if applicable, the OS version in which they + became deprecated. + + The desktop Mac OS X and the iPhone OS X each have different version numbers.+ The __OSX_AVAILABLE_STARTING() macro allows you to specify both the desktop+ and phone OS version numbers. For instance:+ __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_2_0)+ means the function/method was first available on Mac OS X 10.2 on the desktop+ and first available in OS X 2.0 on the iPhone.+ + If a function is available on one platform, but not the other a _NA (not+ applicable) parameter is used. For instance:+ __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA)+ means that the function/method was first available on Mac OS X 10.3, and it+ currently not implemented on the iPhone.++ At some point, a function/method may be deprecated. That means Apple+ recommends applications stop using the function, either because there is a + better replacement or the functionality is being phased out. Deprecated+ functions/methods can be tagged with a __OSX_AVAILABLE_BUT_DEPRECATED()+ macro which specifies the OS version where the function became available+ as well as the OS version in which it became deprecated. For instance:+ __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0,__MAC_10_5,__IPHONE_NA,__IPHONE_NA)+ means that the function/method was introduced in Mac OS X 10.0, then+ became deprecated beginning in Mac OS X 10.5. On the iPhone the function + has never been availlable. + + For these macros to function properly, a program must specify the OS version range + it is targeting. The min OS version is specified as an option to the compiler:+ -mmacosx-version-min=10.x when building for Mac OS X, and -miphone-version-min=1.x.x+ when building for the iPhone. The upper bound for the OS version is rarely needed,+ but it can be set on the command line via: -D__MAC_OS_X_VERSION_MAX_ALLOWED=10xx for+ Mac OS X and __IPHONE_OS_VERSION_MAX_ALLOWED = 1xxx for iPhone. + + Examples:++ A function available in Mac OS X 10.5 and later, but not on the phone:+ + extern void mymacfunc() __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);+++ An Objective-C method in Mac OS X 10.5 and later, but not on the phone:+ + @interface MyClass : NSObject+ -(void) mymacmethod __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);+ @end++ + An enum available on the phone in 2.1 and later, but not available on Mac OS X:+ + #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 20100+ enum { myEnum = 1 };+ #endif+ Note: this works when targeting the Mac OS X platform because + __IPHONE_OS_VERSION_MIN_REQUIRED is undefined which evaluates to zero, + so test becomes #if 0 >= 20100 which is false. Also, we use+ 20100 instead of __IPHONE_2_1 to be safe. The __IPHONE_2_1 macro did not+ exist in <Availability.h> prior to the 2.1 SDK. So, if somehow this + conditional was used with an earilier SDK, it would evaluate incorrectly.+++ It is also possible to use the *_VERSION_MIN_REQUIRED in source code to make one+ source base that can be compiled to target a range of OS versions. It is best+ to not use the _MAC_* and __IPHONE_* macros for comparisons, but rather their values.+ That is because you might get compiled on an old OS that does not define a later+ OS version macro, and in the C preprocessor undefined values evaluate to zero+ in expresssions, which could cause the #if expression to evaluate in an unexpected+ way.+ + #ifdef __MAC_OS_X_VERSION_MIN_REQUIRED+ // code only compiled when targeting Mac OS X and not iPhone+ // note use of 1050 instead of __MAC_10_5+ #if __MAC_OS_X_VERSION_MIN_REQUIRED < 1050+ // code in here might run on pre-Leopard OS+ #else+ // code here can assume Leopard or later+ #endif+ #endif+++*/++#define __MAC_10_0 1000+#define __MAC_10_1 1010+#define __MAC_10_2 1020+#define __MAC_10_3 1030+#define __MAC_10_4 1040+#define __MAC_10_5 1050+#define __MAC_10_6 1060+#define __MAC_NA 9999 /* not available */++#define __IPHONE_2_0 20000 +#define __IPHONE_2_1 20100 +#define __IPHONE_2_2 20200 +#define __IPHONE_3_0 30000 +#define __IPHONE_NA 99999 /* not available */++#include <AvailabilityInternal.h>+++#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED+ #define __OSX_AVAILABLE_STARTING(_mac, _iphone) __AVAILABILITY_INTERNAL##_iphone+ #define __OSX_AVAILABLE_BUT_DEPRECATED(_macIntro, _macDep, _iphoneIntro, _iphoneDep) \+ __AVAILABILITY_INTERNAL##_iphoneIntro##_DEP##_iphoneDep++#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED)+ #define __OSX_AVAILABLE_STARTING(_mac, _iphone) __AVAILABILITY_INTERNAL##_mac+ #define __OSX_AVAILABLE_BUT_DEPRECATED(_macIntro, _macDep, _iphoneIntro, _iphoneDep) \+ __AVAILABILITY_INTERNAL##_macIntro##_DEP##_macDep++#else+ #define __OSX_AVAILABLE_STARTING(_mac, _iphone)+ #define __OSX_AVAILABLE_BUT_DEPRECATED(_macIntro, _macDep, _iphoneIntro, _iphoneDep) +#endif+++#endif /* __AVAILABILITY__ */
+ tests/bugs/issue-82/include/AvailabilityInternal.h view
@@ -0,0 +1,273 @@+/*+ * Copyright (c) 2007-2009 by Apple Inc.. All rights reserved.+ *+ * @APPLE_LICENSE_HEADER_START@+ * + * This file contains Original Code and/or Modifications of Original Code+ * as defined in and that are subject to the Apple Public Source License+ * Version 2.0 (the 'License'). You may not use this file except in+ * compliance with the License. Please obtain a copy of the License at+ * http://www.opensource.apple.com/apsl/ and read it before using this+ * file.+ * + * The Original Code and all software distributed under the License are+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.+ * Please see the License for the specific language governing rights and+ * limitations under the License.+ * + * @APPLE_LICENSE_HEADER_END@+ */++/*+ File: AvailabilityInternal.h+ + Contains: implementation details of __OSX_AVAILABLE_* macros from <Availability.h>++*/+#ifndef __AVAILABILITY_INTERNAL__+#define __AVAILABILITY_INTERNAL__+++/* if we want to support some compiler that does not support these+ attributes, we can test for the compiler version before defining these */+#define __AVAILABILITY_INTERNAL_DEPRECATED __attribute__((deprecated,visibility("default")))+#define __AVAILABILITY_INTERNAL_UNAVAILABLE __attribute__((unavailable,visibility("default")))+#define __AVAILABILITY_INTERNAL_WEAK_IMPORT __attribute__((weak_import,visibility("default")))+#define __AVAILABILITY_INTERNAL_REGULAR __attribute__((visibility("default")))+++#ifndef __IPHONE_OS_VERSION_MIN_REQUIRED+ #ifdef __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__+ /* compiler sets __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ when -miphoneos-version-min is used */+ #define __IPHONE_OS_VERSION_MIN_REQUIRED __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__+ #endif+#endif+++#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED+ /* make sure a default max version is set */+ #ifndef __IPHONE_OS_VERSION_MAX_ALLOWED+ #define __IPHONE_OS_VERSION_MAX_ALLOWED __IPHONE_3_0+ #endif+ /* make sure a valid min is set */+ #if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_2_0+ #undef __IPHONE_OS_VERSION_MIN_REQUIRED+ #define __IPHONE_OS_VERSION_MIN_REQUIRED __IPHONE_2_0 + #endif+ + /* set up internal macros (up to 2.0) */+ #if __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_2_0+ #define __AVAILABILITY_INTERNAL__IPHONE_2_0 __AVAILABILITY_INTERNAL_UNAVAILABLE+ #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_2_0+ #define __AVAILABILITY_INTERNAL__IPHONE_2_0 __AVAILABILITY_INTERNAL_WEAK_IMPORT+ #else+ #define __AVAILABILITY_INTERNAL__IPHONE_2_0 __AVAILABILITY_INTERNAL_REGULAR+ #endif+ #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_NA __AVAILABILITY_INTERNAL__IPHONE_2_0+ #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_2_0 __AVAILABILITY_INTERNAL_DEPRECATED+ /* set up internal macros (up to 2.1) */+ #if __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_2_1+ #define __AVAILABILITY_INTERNAL__IPHONE_2_1 __AVAILABILITY_INTERNAL_UNAVAILABLE+ #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_2_1+ #define __AVAILABILITY_INTERNAL__IPHONE_2_1 __AVAILABILITY_INTERNAL_WEAK_IMPORT+ #else+ #define __AVAILABILITY_INTERNAL__IPHONE_2_1 __AVAILABILITY_INTERNAL_REGULAR+ #endif+ #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_NA __AVAILABILITY_INTERNAL__IPHONE_2_1+ #if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_2_1+ #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_2_1 __AVAILABILITY_INTERNAL_REGULAR + #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_2_1 __AVAILABILITY_INTERNAL_WEAK_IMPORT+ #else+ #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_2_1 __AVAILABILITY_INTERNAL_DEPRECATED+ #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_2_1 __AVAILABILITY_INTERNAL_DEPRECATED+ #endif+ /* set up internal macros (up to 2.2) */+ #if __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_2_2+ #define __AVAILABILITY_INTERNAL__IPHONE_2_2 __AVAILABILITY_INTERNAL_UNAVAILABLE+ #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_2_2+ #define __AVAILABILITY_INTERNAL__IPHONE_2_2 __AVAILABILITY_INTERNAL_WEAK_IMPORT+ #else+ #define __AVAILABILITY_INTERNAL__IPHONE_2_2 __AVAILABILITY_INTERNAL_REGULAR+ #endif+ #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_NA __AVAILABILITY_INTERNAL__IPHONE_2_2+ #if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_2_1+ #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_2_2 __AVAILABILITY_INTERNAL_REGULAR + #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_2_2 __AVAILABILITY_INTERNAL_WEAK_IMPORT+ #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_2_2 __AVAILABILITY_INTERNAL_WEAK_IMPORT+ #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_2_2+ #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_2_2 __AVAILABILITY_INTERNAL_REGULAR + #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_2_2 __AVAILABILITY_INTERNAL_REGULAR + #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_2_2 __AVAILABILITY_INTERNAL_WEAK_IMPORT+ #else+ #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_2_2 __AVAILABILITY_INTERNAL_DEPRECATED+ #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_2_2 __AVAILABILITY_INTERNAL_DEPRECATED+ #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_2_2 __AVAILABILITY_INTERNAL_DEPRECATED+ #endif+ /* set up internal macros (up to 3.0) */+ #if __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_3_0+ #define __AVAILABILITY_INTERNAL__IPHONE_3_0 __AVAILABILITY_INTERNAL_UNAVAILABLE+ #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_0+ #define __AVAILABILITY_INTERNAL__IPHONE_3_0 __AVAILABILITY_INTERNAL_WEAK_IMPORT+ #else+ #define __AVAILABILITY_INTERNAL__IPHONE_3_0 __AVAILABILITY_INTERNAL_REGULAR+ #endif+ #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_NA __AVAILABILITY_INTERNAL__IPHONE_3_0+ #if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_2_1+ #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_3_0 __AVAILABILITY_INTERNAL_REGULAR + #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_3_0 __AVAILABILITY_INTERNAL_WEAK_IMPORT+ #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_3_0 __AVAILABILITY_INTERNAL_WEAK_IMPORT+ #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_3_0 __AVAILABILITY_INTERNAL_WEAK_IMPORT+ #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_2_2+ #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_3_0 __AVAILABILITY_INTERNAL_REGULAR + #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_3_0 __AVAILABILITY_INTERNAL_REGULAR + #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_3_0 __AVAILABILITY_INTERNAL_WEAK_IMPORT+ #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_3_0 __AVAILABILITY_INTERNAL_WEAK_IMPORT+ #elif __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_3_0+ #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_3_0 __AVAILABILITY_INTERNAL_REGULAR + #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_3_0 __AVAILABILITY_INTERNAL_REGULAR + #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_3_0 __AVAILABILITY_INTERNAL_REGULAR + #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_3_0 __AVAILABILITY_INTERNAL_WEAK_IMPORT+ #else+ #define __AVAILABILITY_INTERNAL__IPHONE_2_0_DEP__IPHONE_3_0 __AVAILABILITY_INTERNAL_DEPRECATED+ #define __AVAILABILITY_INTERNAL__IPHONE_2_1_DEP__IPHONE_3_0 __AVAILABILITY_INTERNAL_DEPRECATED+ #define __AVAILABILITY_INTERNAL__IPHONE_2_2_DEP__IPHONE_3_0 __AVAILABILITY_INTERNAL_DEPRECATED+ #define __AVAILABILITY_INTERNAL__IPHONE_3_0_DEP__IPHONE_3_0 __AVAILABILITY_INTERNAL_DEPRECATED+ #endif+ /* set up internal macros (n/a) */+ #define __AVAILABILITY_INTERNAL__IPHONE_NA __AVAILABILITY_INTERNAL_UNAVAILABLE + #define __AVAILABILITY_INTERNAL__IPHONE_NA_DEP__IPHONE_NA __AVAILABILITY_INTERNAL_UNAVAILABLE+ +#elif defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)+ /* compiler for Mac OS X sets __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ */+ #define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__+ /* make sure a default max version is set */+ #ifndef __MAC_OS_X_VERSION_MAX_ALLOWED+ #define __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_10_6+ #endif++ /* set up internal macros */+ #if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_6+ #define __AVAILABILITY_INTERNAL__MAC_10_6 __AVAILABILITY_INTERNAL_UNAVAILABLE+ #elif __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6+ #define __AVAILABILITY_INTERNAL__MAC_10_6 __AVAILABILITY_INTERNAL_WEAK_IMPORT+ #else + #define __AVAILABILITY_INTERNAL__MAC_10_6 __AVAILABILITY_INTERNAL_REGULAR+ #endif+ #if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_5+ #define __AVAILABILITY_INTERNAL__MAC_10_5 __AVAILABILITY_INTERNAL_UNAVAILABLE+ #elif __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_5+ #define __AVAILABILITY_INTERNAL__MAC_10_5 __AVAILABILITY_INTERNAL_WEAK_IMPORT+ #else+ #define __AVAILABILITY_INTERNAL__MAC_10_5 __AVAILABILITY_INTERNAL_REGULAR+ #endif+ #if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_4+ #define __AVAILABILITY_INTERNAL__MAC_10_4 __AVAILABILITY_INTERNAL_UNAVAILABLE+ #elif __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_4+ #define __AVAILABILITY_INTERNAL__MAC_10_4 __AVAILABILITY_INTERNAL_WEAK_IMPORT+ #else+ #define __AVAILABILITY_INTERNAL__MAC_10_4 __AVAILABILITY_INTERNAL_REGULAR+ #endif+ #if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_3+ #define __AVAILABILITY_INTERNAL__MAC_10_3 __AVAILABILITY_INTERNAL_UNAVAILABLE+ #elif __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_3+ #define __AVAILABILITY_INTERNAL__MAC_10_3 __AVAILABILITY_INTERNAL_WEAK_IMPORT+ #else+ #define __AVAILABILITY_INTERNAL__MAC_10_3 __AVAILABILITY_INTERNAL_REGULAR+ #endif+ #if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_2+ #define __AVAILABILITY_INTERNAL__MAC_10_2 __AVAILABILITY_INTERNAL_UNAVAILABLE+ #elif __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_2+ #define __AVAILABILITY_INTERNAL__MAC_10_2 __AVAILABILITY_INTERNAL_WEAK_IMPORT+ #else + #define __AVAILABILITY_INTERNAL__MAC_10_2 __AVAILABILITY_INTERNAL_REGULAR+ #endif+ #if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_1+ #define __AVAILABILITY_INTERNAL__MAC_10_1 __AVAILABILITY_INTERNAL_UNAVAILABLE+ #elif __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_1+ #define __AVAILABILITY_INTERNAL__MAC_10_1 __AVAILABILITY_INTERNAL_WEAK_IMPORT+ #else+ #define __AVAILABILITY_INTERNAL__MAC_10_1 __AVAILABILITY_INTERNAL_REGULAR+ #endif+ #if __MAC_OS_X_VERSION_MAX_ALLOWED < __MAC_10_0+ #define __AVAILABILITY_INTERNAL__MAC_10_0 __AVAILABILITY_INTERNAL_UNAVAILABLE+ #elif __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_0+ #define __AVAILABILITY_INTERNAL__MAC_10_0 __AVAILABILITY_INTERNAL_WEAK_IMPORT+ #else+ #define __AVAILABILITY_INTERNAL__MAC_10_0 __AVAILABILITY_INTERNAL_REGULAR+ #endif+ #define __AVAILABILITY_INTERNAL__MAC_NA __AVAILABILITY_INTERNAL_UNAVAILABLE+ #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_1+ #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_1 __AVAILABILITY_INTERNAL_DEPRECATED+ #else+ #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_1 __AVAILABILITY_INTERNAL__MAC_10_0+ #endif+ #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_2+ #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_2 __AVAILABILITY_INTERNAL_DEPRECATED+ #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_2 __AVAILABILITY_INTERNAL_DEPRECATED+ #else+ #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_2 __AVAILABILITY_INTERNAL__MAC_10_0+ #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_2 __AVAILABILITY_INTERNAL__MAC_10_1+ #endif+ #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_3+ #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_3 __AVAILABILITY_INTERNAL_DEPRECATED+ #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_3 __AVAILABILITY_INTERNAL_DEPRECATED+ #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_3 __AVAILABILITY_INTERNAL_DEPRECATED+ #else+ #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_3 __AVAILABILITY_INTERNAL__MAC_10_0+ #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_3 __AVAILABILITY_INTERNAL__MAC_10_1+ #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_3 __AVAILABILITY_INTERNAL__MAC_10_2+ #endif+ #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_4+ #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_4 __AVAILABILITY_INTERNAL_DEPRECATED+ #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_4 __AVAILABILITY_INTERNAL_DEPRECATED+ #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_4 __AVAILABILITY_INTERNAL_DEPRECATED+ #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_4 __AVAILABILITY_INTERNAL_DEPRECATED+ #else+ #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_4 __AVAILABILITY_INTERNAL__MAC_10_0+ #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_4 __AVAILABILITY_INTERNAL__MAC_10_1+ #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_4 __AVAILABILITY_INTERNAL__MAC_10_2+ #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_4 __AVAILABILITY_INTERNAL__MAC_10_3+ #endif+ #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_5+ #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_5 __AVAILABILITY_INTERNAL_DEPRECATED+ #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_5 __AVAILABILITY_INTERNAL_DEPRECATED+ #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_5 __AVAILABILITY_INTERNAL_DEPRECATED+ #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_5 __AVAILABILITY_INTERNAL_DEPRECATED+ #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_5 __AVAILABILITY_INTERNAL_DEPRECATED+ #else+ #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_5 __AVAILABILITY_INTERNAL__MAC_10_0+ #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_5 __AVAILABILITY_INTERNAL__MAC_10_1+ #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_5 __AVAILABILITY_INTERNAL__MAC_10_2+ #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_5 __AVAILABILITY_INTERNAL__MAC_10_3+ #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_5 __AVAILABILITY_INTERNAL__MAC_10_4+ #endif+ #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_6+ #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_6 __AVAILABILITY_INTERNAL_DEPRECATED+ #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_6 __AVAILABILITY_INTERNAL_DEPRECATED+ #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_6 __AVAILABILITY_INTERNAL_DEPRECATED+ #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_6 __AVAILABILITY_INTERNAL_DEPRECATED+ #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_6 __AVAILABILITY_INTERNAL_DEPRECATED+ #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_6 __AVAILABILITY_INTERNAL_DEPRECATED+ #else+ #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_6 __AVAILABILITY_INTERNAL__MAC_10_0+ #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_10_6 __AVAILABILITY_INTERNAL__MAC_10_1+ #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_6 __AVAILABILITY_INTERNAL__MAC_10_2+ #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_10_6 __AVAILABILITY_INTERNAL__MAC_10_3+ #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_10_6 __AVAILABILITY_INTERNAL__MAC_10_4+ #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_10_6 __AVAILABILITY_INTERNAL__MAC_10_5+ #endif+ #define __AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_NA __AVAILABILITY_INTERNAL__MAC_10_0+ #define __AVAILABILITY_INTERNAL__MAC_10_1_DEP__MAC_NA __AVAILABILITY_INTERNAL__MAC_10_1+ #define __AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_NA __AVAILABILITY_INTERNAL__MAC_10_2+ #define __AVAILABILITY_INTERNAL__MAC_10_3_DEP__MAC_NA __AVAILABILITY_INTERNAL__MAC_10_3+ #define __AVAILABILITY_INTERNAL__MAC_10_4_DEP__MAC_NA __AVAILABILITY_INTERNAL__MAC_10_4+ #define __AVAILABILITY_INTERNAL__MAC_10_5_DEP__MAC_NA __AVAILABILITY_INTERNAL__MAC_10_5+ #define __AVAILABILITY_INTERNAL__MAC_10_6_DEP__MAC_NA __AVAILABILITY_INTERNAL__MAC_10_6+ #define __AVAILABILITY_INTERNAL__MAC_NA_DEP__MAC_NA __AVAILABILITY_INTERNAL_UNAVAILABLE++#endif++#endif /* __AVAILABILITY_INTERNAL__ */
+ tests/bugs/issue-82/include/TargetConditionals.h view
@@ -0,0 +1,108 @@+/*+ * Copyright (c) 2000-2008 by Apple Inc.. All rights reserved.+ *+ * @APPLE_LICENSE_HEADER_START@+ * + * This file contains Original Code and/or Modifications of Original Code+ * as defined in and that are subject to the Apple Public Source License+ * Version 2.0 (the 'License'). You may not use this file except in+ * compliance with the License. Please obtain a copy of the License at+ * http://www.opensource.apple.com/apsl/ and read it before using this+ * file.+ * + * The Original Code and all software distributed under the License are+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.+ * Please see the License for the specific language governing rights and+ * limitations under the License.+ * + * @APPLE_LICENSE_HEADER_END@+ */+ +/*+ File: TargetConditionals.h+ + Contains: Autoconfiguration of TARGET_ conditionals for Mac OS X and iPhone+ + Note: TargetConditionals.h in 3.4 Universal Interfaces works+ with all compilers. This header only recognizes compilers+ known to run on Mac OS X.+ +*/++#ifndef __TARGETCONDITIONALS__+#define __TARGETCONDITIONALS__+/****************************************************************************************************++ TARGET_CPU_* + These conditionals specify which microprocessor instruction set is being+ generated. At most one of these is true, the rest are false.++ TARGET_CPU_PPC - Compiler is generating PowerPC instructions for 32-bit mode+ TARGET_CPU_PPC64 - Compiler is generating PowerPC instructions for 64-bit mode+ TARGET_CPU_68K - Compiler is generating 680x0 instructions+ TARGET_CPU_X86 - Compiler is generating x86 instructions+ TARGET_CPU_ARM - Compiler is generating ARM instructions+ TARGET_CPU_MIPS - Compiler is generating MIPS instructions+ TARGET_CPU_SPARC - Compiler is generating Sparc instructions+ TARGET_CPU_ALPHA - Compiler is generating Dec Alpha instructions+++ TARGET_OS_* + These conditionals specify in which Operating System the generated code will+ run. The MAC/WIN32/UNIX conditionals are mutually exclusive. The EMBEDDED/IPHONE + conditionals are variants of TARGET_OS_MAC. ++ TARGET_OS_MAC - Generate code will run under Mac OS+ TARGET_OS_WIN32 - Generate code will run under 32-bit Windows+ TARGET_OS_UNIX - Generate code will run under some non Mac OS X unix + TARGET_OS_EMBEDDED - Generate code will run under an embedded OS variant+ of TARGET_OS_MAC+ TARGET_OS_IPHONE - Generate code will run under iPhone OS which + is a variant of TARGET_OS_MAC.++ TARGET_RT_* + These conditionals specify in which runtime the generated code will+ run. This is needed when the OS and CPU support more than one runtime+ (e.g. Mac OS X supports CFM and mach-o).++ TARGET_RT_LITTLE_ENDIAN - Generated code uses little endian format for integers+ TARGET_RT_BIG_ENDIAN - Generated code uses big endian format for integers + TARGET_RT_64_BIT - Generated code uses 64-bit pointers + TARGET_RT_MAC_CFM - TARGET_OS_MAC is true and CFM68K or PowerPC CFM (TVectors) are used+ TARGET_RT_MAC_MACHO - TARGET_OS_MAC is true and Mach-O/dlyd runtime is used+++ TARGET_IPHONE_SIMULATOR - Generate code for running under iPhone Simulator+ ++****************************************************************************************************/+++/*+ * gcc based compiler used on Mac OS X+ */+#define TARGET_OS_MAC 1+#define TARGET_OS_WIN32 0+#define TARGET_OS_UNIX 0+#define TARGET_OS_EMBEDDED 0+#define TARGET_OS_IPHONE 0+#define TARGET_IPHONE_SIMULATOR 0+#define TARGET_CPU_PPC 0+#define TARGET_CPU_PPC64 0+#define TARGET_CPU_68K 0+#define TARGET_CPU_X86 0+#define TARGET_CPU_X86_64 1+#define TARGET_CPU_ARM 0+#define TARGET_CPU_MIPS 0+#define TARGET_CPU_SPARC 0+#define TARGET_CPU_ALPHA 0+#define TARGET_RT_MAC_CFM 0+#define TARGET_RT_MAC_MACHO 1+#define TARGET_RT_LITTLE_ENDIAN 1+#define TARGET_RT_BIG_ENDIAN 0+#define TARGET_RT_64_BIT 1++#endif /* __TARGETCONDITIONALS__ */
+ tests/bugs/issue-82/include/_types.h view
@@ -0,0 +1,68 @@+/*+ * Copyright (c) 2004, 2008, 2009 Apple Inc. All rights reserved.+ *+ * @APPLE_LICENSE_HEADER_START@+ * + * This file contains Original Code and/or Modifications of Original Code+ * as defined in and that are subject to the Apple Public Source License+ * Version 2.0 (the 'License'). You may not use this file except in+ * compliance with the License. Please obtain a copy of the License at+ * http://www.opensource.apple.com/apsl/ and read it before using this+ * file.+ * + * The Original Code and all software distributed under the License are+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.+ * Please see the License for the specific language governing rights and+ * limitations under the License.+ * + * @APPLE_LICENSE_HEADER_END@+ */++#ifndef __TYPES_H_+#define __TYPES_H_++/*#include <sys/_types.h>*/++#if __GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 7+#define __strfmonlike(fmtarg, firstvararg) \+ __attribute__((__format__ (__strfmon__, fmtarg, firstvararg)))+#define __strftimelike(fmtarg) \+ __attribute__((__format__ (__strftime__, fmtarg, 0)))+#else+#define __strfmonlike(fmtarg, firstvararg)+#define __strftimelike(fmtarg)+#endif++/*typedef int __darwin_nl_item;*/+/*typedef int __darwin_wctrans_t;*/+#ifdef __LP64__+/*typedef __uint32_t __darwin_wctype_t;*/+#else /* !__LP64__ */+/*typedef unsigned long __darwin_wctype_t;*/+#endif /* __LP64__ */++#ifdef __WCHAR_MAX__+#define __DARWIN_WCHAR_MAX __WCHAR_MAX__+#else /* ! __WCHAR_MAX__ */+#define __DARWIN_WCHAR_MAX 0x7fffffff+#endif /* __WCHAR_MAX__ */++#if __DARWIN_WCHAR_MAX > 0xffffU+#define __DARWIN_WCHAR_MIN (-0x7fffffff - 1)+#else+#define __DARWIN_WCHAR_MIN 0+#endif+#define __DARWIN_WEOF ((__darwin_wint_t)-1)++#ifndef _FORTIFY_SOURCE+# if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && ((__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0) < 1050)+# define _FORTIFY_SOURCE 0+# else+# define _FORTIFY_SOURCE 2 /* on by default */+# endif+#endif++#endif /* __TYPES_H_ */
+ tests/bugs/issue-82/include/secure/_common.h view
@@ -0,0 +1,41 @@+/*+ * Copyright (c) 2007, 2008 Apple Inc. All rights reserved.+ *+ * @APPLE_LICENSE_HEADER_START@+ *+ * This file contains Original Code and/or Modifications of Original Code+ * as defined in and that are subject to the Apple Public Source License+ * Version 2.0 (the 'License'). You may not use this file except in+ * compliance with the License. Please obtain a copy of the License at+ * http://www.opensource.apple.com/apsl/ and read it before using this+ * file.+ *+ * The Original Code and all software distributed under the License are+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.+ * Please see the License for the specific language governing rights and+ * limitations under the License.+ *+ * @APPLE_LICENSE_HEADER_END@+ */++#ifndef _SECURE__COMMON_H_+#define _SECURE__COMMON_H_++#undef _USE_FORTIFY_LEVEL+#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0+# if _FORTIFY_SOURCE > 1+# define _USE_FORTIFY_LEVEL 2+# else+# define _USE_FORTIFY_LEVEL 1+# endif+#else+# define _USE_FORTIFY_LEVEL 0+#endif++#define __darwin_obsz0(object) __builtin_object_size (object, 0)+#define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIFY_LEVEL > 1 ? 1 : 0)++#endif
+ tests/bugs/issue-82/include/secure/_string.h view
@@ -0,0 +1,144 @@+/*+ * Copyright (c) 2007 Apple Inc. All rights reserved.+ *+ * @APPLE_LICENSE_HEADER_START@+ *+ * This file contains Original Code and/or Modifications of Original Code+ * as defined in and that are subject to the Apple Public Source License+ * Version 2.0 (the 'License'). You may not use this file except in+ * compliance with the License. Please obtain a copy of the License at+ * http://www.opensource.apple.com/apsl/ and read it before using this+ * file.+ *+ * The Original Code and all software distributed under the License are+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.+ * Please see the License for the specific language governing rights and+ * limitations under the License.+ *+ * @APPLE_LICENSE_HEADER_END@+ */++#ifndef _STRING_H_+# error "Never use <secure/_string.h> directly; include <string.h> instead."+#endif++#ifndef _SECURE__STRING_H_+#define _SECURE__STRING_H_++#include <Availability.h>+#include <sys/cdefs.h>+#include <secure/_common.h>++#if _USE_FORTIFY_LEVEL > 0++#ifndef __has_builtin+#define _undef__has_builtin+#define __has_builtin(x) 0+#endif++/* <rdar://problem/12622659> */+#if defined(__clang__) && \+ ((defined(__apple_build_version__) && __apple_build_version__ >= 4260006) || \+ (!defined(__apple_build_version__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 3))))+#define __HAS_FIXED_CHK_PROTOTYPES 1+#else+#define __HAS_FIXED_CHK_PROTOTYPES 0+#endif++/* memccpy, memcpy, mempcpy, memmove, memset, strcpy, strlcpy, stpcpy,+ strncpy, stpncpy, strcat, strlcat, and strncat */++#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090+#if __has_builtin(__builtin___memccpy_chk) && __HAS_FIXED_CHK_PROTOTYPES+#undef memccpy+#define memccpy(dest, src, c, len) \+ __builtin___memccpy_chk (dest, src, c, len, __darwin_obsz0 (dest))+#endif+#endif++#if __has_builtin(__builtin___memcpy_chk) || defined(__GNUC__)+#undef memcpy+#define memcpy(dest, src, len) \+ __builtin___memcpy_chk (dest, src, len, __darwin_obsz0 (dest))+#endif++#if __has_builtin(__builtin___memmove_chk) || defined(__GNUC__)+#undef memmove+#define memmove(dest, src, len) \+ __builtin___memmove_chk (dest, src, len, __darwin_obsz0 (dest))+#endif++#if __has_builtin(__builtin___memset_chk) || defined(__GNUC__)+#undef memset+#define memset(dest, val, len) \+ __builtin___memset_chk (dest, val, len, __darwin_obsz0 (dest))+#endif++#if __has_builtin(__builtin___strcpy_chk) || defined(__GNUC__)+#undef strcpy+#define strcpy(dest, src) \+ __builtin___strcpy_chk (dest, src, __darwin_obsz (dest))+#endif++#if __DARWIN_C_LEVEL >= 200809L+#if __has_builtin(__builtin___stpcpy_chk) || defined(__GNUC__)+#undef stpcpy+#define stpcpy(dest, src) \+ __builtin___stpcpy_chk (dest, src, __darwin_obsz (dest))+#endif++#if __has_builtin(__builtin___stpncpy_chk) || __APPLE_CC__ >= 5666 || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)+#undef stpncpy+#define stpncpy(dest, src, len) \+ __builtin___stpncpy_chk (dest, src, len, __darwin_obsz (dest))+#endif+#endif /* _DARWIN_C_LEVEL >= 200809L */++#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090+#if __has_builtin(__builtin___strlcpy_chk) && __HAS_FIXED_CHK_PROTOTYPES+#undef strlcpy+#define strlcpy(dest, src, len) \+ __builtin___strlcpy_chk (dest, src, len, __darwin_obsz (dest))+#endif++#if __has_builtin(__builtin___strlcat_chk) && __HAS_FIXED_CHK_PROTOTYPES+#undef strlcat+#define strlcat(dest, src, len) \+ __builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))+#endif+#endif /* __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 */+#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */++#if __has_builtin(__builtin___strncpy_chk) || defined(__GNUC__)+#undef strncpy+#define strncpy(dest, src, len) \+ __builtin___strncpy_chk (dest, src, len, __darwin_obsz (dest))+#endif++#if __has_builtin(__builtin___strcat_chk) || defined(__GNUC__)+#undef strcat+#define strcat(dest, src) \+ __builtin___strcat_chk (dest, src, __darwin_obsz (dest))+#endif++#if ! (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 32000)+#if __has_builtin(__builtin___strncat_chk) || defined(__GNUC__)+#undef strncat+#define strncat(dest, src, len) \+ __builtin___strncat_chk (dest, src, len, __darwin_obsz (dest))+#endif+#endif++#ifdef _undef__has_builtin+#undef _undef__has_builtin+#undef __has_builtin+#endif++#undef __HAS_FIXED_CHK_PROTOTYPES++#endif /* _USE_FORTIFY_LEVEL > 0 */+#endif /* _SECURE__STRING_H_ */
+ tests/bugs/issue-82/include/string.h view
@@ -0,0 +1,197 @@+/*+ * Copyright (c) 2000, 2007, 2010 Apple Inc. All rights reserved.+ *+ * @APPLE_LICENSE_HEADER_START@+ *+ * This file contains Original Code and/or Modifications of Original Code+ * as defined in and that are subject to the Apple Public Source License+ * Version 2.0 (the 'License'). You may not use this file except in+ * compliance with the License. Please obtain a copy of the License at+ * http://www.opensource.apple.com/apsl/ and read it before using this+ * file.+ *+ * The Original Code and all software distributed under the License are+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.+ * Please see the License for the specific language governing rights and+ * limitations under the License.+ *+ * @APPLE_LICENSE_HEADER_END@+ */+/*-+ * Copyright (c) 1990, 1993+ * The Regents of the University of California. All rights reserved.+ *+ * 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. All advertising materials mentioning features or use of this software+ * must display the following acknowledgement:+ * This product includes software developed by the University of+ * California, Berkeley and its contributors.+ * 4. Neither the name of the University nor the names of its contributors+ * may be used to endorse or promote products derived from this software+ * without specific prior written permission.+ *+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.+ *+ * @(#)string.h 8.1 (Berkeley) 6/2/93+ */++#ifndef _STRING_H_+#define _STRING_H_++#include <_types.h>+#include <sys/cdefs.h>+#include <Availability.h>+/*#include <sys/_types/_size_t.h>*/+/*#include <sys/_types/_null.h>*/++/* ANSI-C */++__BEGIN_DECLS+void *memchr(const void *, int, int);+int memcmp(const void *, const void *, int);+void *memcpy(void *, const void *, int);+void *memmove(void *, const void *, int);+void *memset(void *, int, int);+char *strcat(char *, const char *);+char *strchr(const char *, int);+int strcmp(const char *, const char *);+int strcoll(const char *, const char *);+char *strcpy(char *, const char *);+int strcspn(const char *, const char *);+//Begin-Libc+#ifndef LIBC_ALIAS_STRERROR+//End-Libc+char *strerror(int) /*__DARWIN_ALIAS(strerror)*/;+//Begin-Libc+#else /* LIBC_ALIAS_STRERROR */+char *strerror(int) LIBC_ALIAS(strerror);+#endif /* !LIBC_ALIAS_STRERROR */+//End-Libc+int strlen(const char *);+char *strncat(char *, const char *, int);+int strncmp(const char *, const char *, int);+char *strncpy(char *, const char *, int);+char *strpbrk(const char *, const char *);+char *strrchr(const char *, int);+int strspn(const char *, const char *);+char *strstr(const char *, const char *);+char *strtok(char *, const char *);+int strxfrm(char *, const char *, int);+__END_DECLS++++/* Additional functionality provided by:+ * POSIX.1c-1995,+ * POSIX.1i-1995,+ * and the omnibus ISO/IEC 9945-1: 1996+ */++#if __DARWIN_C_LEVEL >= 199506L+__BEGIN_DECLS+char *strtok_r(char *, const char *, char **);+__END_DECLS+#endif /* __DARWIN_C_LEVEL >= 199506L */++++/* Additional functionality provided by:+ * POSIX.1-2001+ */++#if __DARWIN_C_LEVEL >= 200112L+__BEGIN_DECLS+int strerror_r(int, char *, int);+char *strdup(const char *);+void *memccpy(void *, const void *, int, int);+__END_DECLS+#endif /* __DARWIN_C_LEVEL >= 200112L */++++/* Additional functionality provided by:+ * POSIX.1-2008+ */++#if __DARWIN_C_LEVEL >= 200809L+__BEGIN_DECLS+char *stpcpy(char *, const char *);+char *stpncpy(char *, const char *, int) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);+char *strndup(const char *, int) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);+int strnlen(const char *, int) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);+char *strsignal(int sig);+__END_DECLS+#endif /* __DARWIN_C_LEVEL >= 200809L */++/* C11 Annex K */++#if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1+#include <sys/_types/_rsize_t.h>+#include <sys/_types/_errno_t.h>++__BEGIN_DECLS+errno_t memset_s(void *, rsize_t, int, rsize_t) __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);+__END_DECLS+#endif++/* Darwin extensions */++#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL+/*#include <sys/_types/_ssize_t.h>*/++__BEGIN_DECLS+void *memmem(const void *, int, const void *, int) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);+void memset_pattern4(void *, const void *, int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_0);+void memset_pattern8(void *, const void *, int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_0);+void memset_pattern16(void *, const void *, int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_3_0);++char *strcasestr(const char *, const char *);+char *strnstr(const char *, const char *, int);+int strlcat(char *, const char *, int);+int strlcpy(char *, const char *, int);+void strmode(int, char *);+char *strsep(char **, const char *);++/* SUS places swab() in unistd.h. It is listed here for source compatibility */+void swab(const void * __restrict, void * __restrict, int);+__END_DECLS++/* Some functions historically defined in string.h were placed in strings.h+ * by SUS. We are using "strings.h" instead of <strings.h> to avoid an issue+ * where /Developer/Headers/FlatCarbon/Strings.h could be included instead on+ * case-insensitive file systems.+ */+#include "strings.h"+#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */+++#ifdef _USE_EXTENDED_LOCALES_+#include <xlocale/_string.h>+#endif /* _USE_EXTENDED_LOCALES_ */++#if defined (__GNUC__) && _FORTIFY_SOURCE > 0 && !defined (__cplusplus)+/* Security checking functions. */+#include <secure/_string.h>+#endif++#endif /* _STRING_H_ */
+ tests/bugs/issue-82/include/strings.h view
@@ -0,0 +1,96 @@+/*+ * Copyright (c) 2000, 2007, 2010 Apple Inc. All rights reserved.+ *+ * @APPLE_LICENSE_HEADER_START@+ * + * This file contains Original Code and/or Modifications of Original Code+ * as defined in and that are subject to the Apple Public Source License+ * Version 2.0 (the 'License'). You may not use this file except in+ * compliance with the License. Please obtain a copy of the License at+ * http://www.opensource.apple.com/apsl/ and read it before using this+ * file.+ * + * The Original Code and all software distributed under the License are+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.+ * Please see the License for the specific language governing rights and+ * limitations under the License.+ * + * @APPLE_LICENSE_HEADER_END@+ */+/*-+ * Copyright (c) 1990, 1993+ * The Regents of the University of California. All rights reserved.+ *+ * 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. All advertising materials mentioning features or use of this software+ * must display the following acknowledgement:+ * This product includes software developed by the University of+ * California, Berkeley and its contributors.+ * 4. Neither the name of the University nor the names of its contributors+ * may be used to endorse or promote products derived from this software+ * without specific prior written permission.+ *+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.+ *+ * @(#)strings.h 8.1 (Berkeley) 6/2/93+ */++#ifndef _STRINGS_H_+#define _STRINGS_H_++#include <_types.h>++#include <sys/cdefs.h>+#include <Availability.h>+/*#include <sys/_types/_size_t.h>*/++__BEGIN_DECLS+/* Removed in Issue 7 */+#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200809L+int bcmp(const void *, const void *, size_t) __POSIX_C_DEPRECATED(200112L);+void bcopy(const void *, void *, size_t) __POSIX_C_DEPRECATED(200112L);+void bzero(void *, size_t) __POSIX_C_DEPRECATED(200112L);+char *index(const char *, int) __POSIX_C_DEPRECATED(200112L);+char *rindex(const char *, int) __POSIX_C_DEPRECATED(200112L);+#endif++int ffs(int);+int strcasecmp(const char *, const char *);+int strncasecmp(const char *, const char *, int);+__END_DECLS++/* Darwin extensions */+#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL+__BEGIN_DECLS+int ffsl(long) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);+int ffsll(long long) __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);+int fls(int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);+int flsl(long) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);+int flsll(long long) __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);+__END_DECLS++#include <string.h>+#endif++#endif /* _STRINGS_H_ */+
+ tests/bugs/issue-82/include/sys/cdefs.h view
@@ -0,0 +1,126 @@+/*+ * Copyright (c) 2006 - 2008 Apple Inc. All rights reserved.+ *+ * @APPLE_LICENSE_HEADER_START@+ * + * This file contains Original Code and/or Modifications of Original Code+ * as defined in and that are subject to the Apple Public Source License+ * Version 2.0 (the 'License'). You may not use this file except in+ * compliance with the License. Please obtain a copy of the License at+ * http://www.opensource.apple.com/apsl/ and read it before using this+ * file.+ * + * The Original Code and all software distributed under the License are+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.+ * Please see the License for the specific language governing rights and+ * limitations under the License.+ * + * @APPLE_LICENSE_HEADER_END@+ */++/***********************************************************************+ * Not to be installed in /usr/include+ ***********************************************************************/++#ifndef _LIBC_SYS_CDEFS_H_+#define _LIBC_SYS_CDEFS_H_++/*+ * Now include the real sys/cdefs.h. The checks in libc-features.h will assure+ * that those macros are consistent with the current build environment.+ */+#include_next <sys/cdefs.h>+#ifndef _LIBC_NO_FEATURE_VERIFICATION+#if defined(__arm__) || defined(__i386__) || defined(__x86_64__)+/*# include "libc-features.h"*/+#else+# error "Unknown architecture."+#endif+#endif /* _LIBC_NO_FEATURE_VERIFICATION */++/*+ * symbol suffixes used for symbol versioning+ */+#if defined(VARIANT_LEGACY)+# define LIBC_SUF_UNIX03 /* nothing */+# define LIBC_SUF_64_BIT_INO_T /* nothing */+# define LIBC_SUF_NON_CANCELABLE /* nothing */+# define LIBC_SUF_1050 /* nothing */+#else /* !VARIANT_LEGACY */+# if __DARWIN_ONLY_UNIX_CONFORMANCE+# define LIBC_SUF_UNIX03 /* nothing */+# else /* !__DARWIN_ONLY_UNIX_CONFORMANCE */+# define LIBC_SUF_UNIX03 "$UNIX2003"+# endif /* __DARWIN_ONLY_UNIX_CONFORMANCE */++# if defined(VARIANT_INODE32)+# define LIBC_SUF_64_BIT_INO_T /* nothing */+# else /* !VARIANT_INODE32 */+# if __DARWIN_ONLY_64_BIT_INO_T+# define LIBC_SUF_64_BIT_INO_T /* nothing */+# else /* !__DARWIN_ONLY_64_BIT_INO_T */+# define LIBC_SUF_64_BIT_INO_T "$INODE64"+# endif /* __DARWIN_ONLY_64_BIT_INO_T */+# endif /* VARIANT_INODE32 */++# if defined(VARIANT_CANCELABLE)+# define LIBC_SUF_NON_CANCELABLE /* nothing */+# else /* !LIBC_NON_CANCELABLE */+# define LIBC_SUF_NON_CANCELABLE "$NOCANCEL"+# endif /* LIBC_NON_CANCELABLE */++# if defined(VARIANT_PRE1050)+# define LIBC_SUF_1050 /* nothing */+# else /* !VARIANT_PRE1050 */+# if __DARWIN_ONLY_VERS_1050+# define LIBC_SUF_1050 /* nothing */+# else /* !__DARWIN_ONLY_VERS_1050 */+# define LIBC_SUF_1050 "$1050"+# endif /* __DARWIN_ONLY_VERS_1050 */+# endif /* VARIANT_PRE1050 */++#endif /* LIBC_UNIX03 */++#define LIBC_SUF_EXTSN "$DARWIN_EXTSN"++/*+ * symbol versioning macros+ */+#define LIBC_ALIAS(sym) __asm("_" __STRING(sym) LIBC_SUF_UNIX03)+#define LIBC_ALIAS_C(sym) __asm("_" __STRING(sym) LIBC_SUF_NON_CANCELABLE LIBC_SUF_UNIX03)+#define LIBC_ALIAS_I(sym) __asm("_" __STRING(sym) LIBC_SUF_64_BIT_INO_T LIBC_SUF_UNIX03)+#define LIBC_INODE64(sym) __asm("_" __STRING(sym) LIBC_SUF_64_BIT_INO_T)++#define LIBC_1050(sym) __asm("_" __STRING(sym) LIBC_SUF_1050)+#define LIBC_1050ALIAS(sym) __asm("_" __STRING(sym) LIBC_SUF_1050 LIBC_SUF_UNIX03)+#define LIBC_1050ALIAS_C(sym) __asm("_" __STRING(sym) LIBC_SUF_1050 LIBC_SUF_NON_CANCELABLE LIBC_SUF_UNIX03)+#define LIBC_1050ALIAS_I(sym) __asm("_" __STRING(sym) LIBC_SUF_1050 LIBC_SUF_64_BIT_INO_T LIBC_SUF_UNIX03)+#define LIBC_1050INODE64(sym) __asm("_" __STRING(sym) LIBC_SUF_1050 LIBC_SUF_64_BIT_INO_T)++#define LIBC_EXTSN(sym) __asm("_" __STRING(sym) LIBC_SUF_EXTSN)+#define LIBC_EXTSN_C(sym) __asm("_" __STRING(sym) LIBC_SUF_EXTSN LIBC_SUF_NON_CANCELABLE)++extern int pthread_key_init_np(int, void (*)(void *));++#include <TargetConditionals.h>+#if TARGET_IPHONE_SIMULATOR+/* Simulator keys are offset by 200 */+#define __LIBC_PTHREAD_KEY(x) (210 + (x))+#else+#define __LIBC_PTHREAD_KEY(x) (10 + (x))+#endif++/*+ * Libc pthread key assignments+ */+#define __LIBC_PTHREAD_KEY_XLOCALE __LIBC_PTHREAD_KEY(0)+#define __LIBC_PTHREAD_KEY_TTYNAME __LIBC_PTHREAD_KEY(1)+#define __LIBC_PTHREAD_KEY_LOCALTIME __LIBC_PTHREAD_KEY(2)+#define __LIBC_PTHREAD_KEY_GMTIME __LIBC_PTHREAD_KEY(3)+#define __LIBC_PTHREAD_KEY_GDTOA_BIGINT __LIBC_PTHREAD_KEY(4)+#define __LIBC_PTHREAD_KEY_PARSEFLOAT __LIBC_PTHREAD_KEY(5)++#endif /* _LIBC_SYS_CDEFS_H_ */
+ tests/bugs/issue-82/include/xlocale/_string.h view
@@ -0,0 +1,35 @@+/*+ * Copyright (c) 2005 Apple Computer, Inc. All rights reserved.+ *+ * @APPLE_LICENSE_HEADER_START@+ * + * This file contains Original Code and/or Modifications of Original Code+ * as defined in and that are subject to the Apple Public Source License+ * Version 2.0 (the 'License'). You may not use this file except in+ * compliance with the License. Please obtain a copy of the License at+ * http://www.opensource.apple.com/apsl/ and read it before using this+ * file.+ * + * The Original Code and all software distributed under the License are+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.+ * Please see the License for the specific language governing rights and+ * limitations under the License.+ * + * @APPLE_LICENSE_HEADER_END@+ */++#ifndef _XLOCALE__STRING_H_+#define _XLOCALE__STRING_H_++__BEGIN_DECLS+int strcoll_l(const char *, const char *, locale_t);+size_t strxfrm_l(char *, const char *, size_t, locale_t);+int strcasecmp_l(const char *, const char *, locale_t);+char *strcasestr_l(const char *, const char *, locale_t);+int strncasecmp_l(const char *, const char *, size_t, locale_t);+__END_DECLS++#endif /* _XLOCALE__STRING_H_ */
+ tests/regression-suite.yaml view
@@ -0,0 +1,112 @@+-+ name: abcBridge+ on-travis: false++# COMMENTED FOR THE MOMENT BECAUSE OF BOUNDS ON C2HS DEPENDENCY+# -+# name: al+# apt-packages: [libopenal-dev]++-+ name: alsa-mixer+ apt-packages: [libasound2-dev]++# DEPENDENCY ONLY AVAILABLE IN UBUNTU 14.04+: TRAVIS IS AT 12.04+#-+# name: bullet+# apt-packages: [libbullet-dev]++-+ name: cuda-shared-setup+ cabal: false+ on-travis: false+ special-setup:+ - mkdir cuda-packages+ - aws s3 sync s3://cuda-packages ./cuda-packages+ - sudo dpkg -i ./cuda-packages/cuda-repo-ubuntu1204_6.5-14_amd64.deb+ - /bin/rm ./cuda-packages/cuda-repo-ubuntu1204_6.5-14_amd64.deb+ - sudo apt-get update+ - "sudo bash -c 'mv ./cuda-packages/*.deb /var/cache/apt/archives'"+ - sudo apt-get install -y cuda+ apt-packages: [acpid, consolekit, dkms, lib32gcc1, libc-bin,+ libc-dev-bin, libc6, libc6-dev, libc6-i386,+ libck-connector0, libpam-ck-connector,+ libpolkit-agent-1-0, libpolkit-backend-1-0,+ libpolkit-gobject-1-0, libvdpau1, libxmu-dev,+ libxmu-headers, policykit-1, policykit-1-gnome,+ python-xkit, screen-resolution-extra]+ extra-path: [/usr/local/cuda-6.5/bin]+ extra-so-path: [/usr/local/cuda-6.5/lib]++-+ name: cuda+ on-travis: false+ extra-include-dirs: [/usr/local/cuda-6.5/include]+ extra-lib-dirs: [/usr/local/cuda-6.5/lib64]++-+ name: cufft+ on-travis: false+ extra-include-dirs: [/usr/local/cuda-6.5/include]+ extra-lib-dirs: [/usr/local/cuda-6.5/lib64]++# BROKEN+#-+# name: CV+# apt-packages: [libopencv-dev, libcv-dev, libhighgui-dev]++-+ name: gnome-keyring+ apt-packages: [libgnome-keyring-dev]++-+ name: gnuidn+ apt-packages: [libidn11-dev]+ on-travis: false++-+ name: haskell-mpi+ apt-packages: [libopenmpi-dev]+ extra-include-dirs: [/usr/include/openmpi]+ on-travis: false++-+ name: hnetcdf+ apt-packages: [libnetcdf-dev, libgsl0-dev, liblapack-dev]+ run-tests: true++-+ name: hpuz++-+ name: hsndfile+ apt-packages: [libsndfile1-dev]++-+ name: hsshellscript++# DEPENDENCIES ONLY AVAILABLE IN UBUNTU 14.04+: TRAVIS IS AT 12.04+# -+# name: hsqml+# apt-packages: [???]+# on-travis: false++-+ name: igraph+ apt-ppa: [igraph/ppa]+ apt-packages: [libigraph0-dev]+ on-travis: false++-+ name: libssh2+ apt-packages: [libssh2-1-dev]++# BUILD PROBLEMS WITH CURRENT C2HS+#-+# name: ncurses+# apt-packages: [ncurses-dev]++# NEED TO RETEST+# -+# name: OpenCL+# on-travis: false
+ tests/system/clean view
@@ -0,0 +1,7 @@+#!/bin/bash+find . -name \*.o | xargs /bin/rm 2> /dev/null+find . -name \*.hs | xargs /bin/rm 2> /dev/null+find . -name \*.chi | xargs /bin/rm 2> /dev/null+find . -name \*.chs.h | xargs /bin/rm 2> /dev/null+find . -name \*.hi | xargs /bin/rm 2> /dev/null+find . -mindepth 2 -type f -a -executable | xargs /bin/rm 2> /dev/null
tests/test-bugs.hs view
@@ -93,6 +93,7 @@ , testCase "Issue #152" issue152 , testCase "Issue #155" issue155 , testCase "Issue #180" issue180+ , testCase "Issue #192" issue192 ] ++ -- Some tests that won't work on Windows. if os /= "cygwin32" && os /= "mingw32"@@ -112,6 +113,9 @@ res <- absPath "./Capital" >>= cmd let expected = ["upper C();", "lower c();", "upper C();"] liftIO $ assertBool "" (T.lines res == expected)++issue192 :: Assertion+issue192 = hs_only_build_issue 192 issue180 :: Assertion issue180 = c2hsShelly $ chdir "tests/bugs/issue-180" $ do