diff options
author | Nicolas Roche <roche@adacore.com> | 2017-09-08 15:12:17 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-09-08 17:12:17 +0200 |
commit | edcc77dbd9f95301a8be1a2f2b0d774680b46a1a (patch) | |
tree | 4c2dd8030802ada53aad734af16a8b591a2a2e86 /gcc/ada/s-fileio.adb | |
parent | 9f00251a8e71aa96e243cb1e95dadbdbad8ada4f (diff) | |
download | gcc-edcc77dbd9f95301a8be1a2f2b0d774680b46a1a.zip gcc-edcc77dbd9f95301a8be1a2f2b0d774680b46a1a.tar.gz gcc-edcc77dbd9f95301a8be1a2f2b0d774680b46a1a.tar.bz2 |
Make-lang.in, [...]: Find runtime source in libgnat/
2017-09-08 Nicolas Roche <roche@adacore.com>
* gcc-interface/Make-lang.in, gcc-interface/Makefile.in: Find runtime
source in libgnat/
* a-lfztio.ads, g-timsta.ads, g-sercom-linux.adb, s-osprim-solaris.adb,
a-inteio.ads, s-stchop-rtems.adb, s-casuti.adb, s-pack39.adb,
i-vxwork-x86.ads, a-strbou.adb, a-stzmap.adb, s-assert.adb,
a-sfecin.ads, a-cohama.adb, s-casuti.ads, a-suenco.adb, s-pack39.ads,
a-stzmap.ads, a-strbou.ads, s-stalib.adb, s-trasym.adb, g-comver.adb,
s-assert.ads, s-vector.ads, g-cgi.adb, a-cohama.ads, s-wchcnv.adb,
a-titest.adb, s-pack48.adb, a-suenco.ads, a-strunb.adb, s-stalib.ads,
s-trasym.ads, a-nudira.adb, g-comver.ads, a-nuflra.adb, g-cgi.ads,
a-chacon.adb, s-wchcnv.ads, a-excach.adb, s-pack48.ads, a-titest.ads,
a-strunb.ads, s-dwalin.adb, a-nudira.ads, a-chtgbo.adb, s-resfil.adb,
a-scteio.ads, a-nuflra.ads, g-soliop-mingw.ads, s-pack57.adb,
a-chacon.ads, s-bytswa.ads, s-pooloc.adb, g-os_lib.adb, s-dwalin.ads,
a-szuzha.adb, s-resfil.ads, a-chtgbo.ads, s-spsufi.adb, s-pack57.ads,
s-pooloc.ads, g-os_lib.ads, a-stfiha.ads, a-lcteio.ads, a-wtcoau.adb,
a-szuzha.ads, s-mmosin-unix.adb, a-stmaco.ads, s-spsufi.ads,
s-stchop-limit.ads, a-wtcoau.ads, a-exctra.adb, s-mmosin-unix.ads,
s-sequio.adb, s-conca2.adb, g-table.adb, s-imglli.adb,
a-numaux-x86.adb, a-strsea.adb, s-wchstw.adb, a-clrefi.adb,
a-wwboio.adb, a-exctra.ads, s-sequio.ads, s-conca2.ads, a-wwunio.ads,
system-linux-hppa.ads, g-table.ads, s-dimkio.ads, s-imglli.ads,
a-cofove.adb, a-numaux-x86.ads, s-wchstw.ads, a-strsea.ads,
a-clrefi.ads, a-wwboio.ads, s-stratt-xdr.adb, s-crc32.adb,
s-excmac-arm.adb, g-busora.adb, a-cofove.ads, s-osprim-unix.adb,
g-io.adb, s-pack49.adb, s-crc32.ads, s-excmac-arm.ads, a-fzteio.ads,
g-busora.ads, s-stausa.adb, system-linux-mips.ads, sequenio.ads,
g-exctra.adb, g-rewdat.adb, a-cgaaso.adb, g-io.ads, s-pack49.ads,
a-wtflau.adb, a-undesu.adb, s-stausa.ads, a-ztenau.adb, g-enutst.ads,
calendar.ads, s-pack58.adb, g-rewdat.ads, g-exctra.ads, s-ststop.adb,
a-cgaaso.ads, a-strfix.adb, a-comlin.adb, a-strunb-shared.adb,
a-wtflau.ads, a-undesu.ads, a-cbhase.adb, a-ztenau.ads, s-os_lib.adb,
a-coorse.adb, a-chlat1.ads, s-pack58.ads, s-ststop.ads, a-strfix.ads,
a-comlin.ads, a-strunb-shared.ads, a-nscefu.ads, s-valboo.adb,
directio.ads, a-chtgke.adb, a-cbhase.ads, a-wtinau.adb,
system-linux-alpha.ads, s-os_lib.ads, a-coorse.ads,
system-linux-s390.ads, s-imgwiu.adb, a-chtgop.adb, s-valboo.ads,
a-chtgke.ads, a-tienio.adb, s-conca3.adb, a-wtinau.ads,
system-darwin-ppc.ads, i-c.adb, s-expllu.adb, g-expect.adb,
g-sha256.ads, s-vallld.adb, s-imgwiu.ads, a-chtgop.ads, a-strmap.adb,
a-tienio.ads, s-conca3.ads, s-imgint.adb, i-c.ads, s-expllu.ads,
s-osprim-darwin.adb, a-cogeso.adb, g-expect.ads, a-iwteio.ads,
s-vallld.ads, a-coinho-shared.adb, g-shsh64.adb, a-strmap.ads,
g-comlin.adb, a-excpol.adb, s-imgint.ads, a-ztdeau.adb, a-cogeso.ads,
a-coinho-shared.ads, g-shsh64.ads, g-comlin.ads, a-stzsup.adb,
a-rbtgbk.adb, a-wtmoau.adb, a-ztdeau.ads, s-exnlli.adb, g-tty.adb,
g-heasor.adb, g-socthi-dummy.adb, s-llflex.ads, a-zchara.ads,
a-stzsup.ads, a-ztcstr.adb, a-rbtgbk.ads, a-sfwtio.ads, a-wtmoau.ads,
a-sulcin.adb, s-exnlli.ads, system-freebsd.ads, a-stunha.adb,
a-charac.ads, g-tty.ads, g-heasor.ads, s-exctra.adb,
g-socthi-dummy.ads, a-coboho.adb, a-ztcstr.ads, a-tideio.adb,
a-sulcin.ads, a-wrstfi.adb, g-alleve.adb, s-pack59.adb, a-ngrear.adb,
a-stboha.adb, a-stunau-shared.adb, a-stunha.ads, a-lfwtio.ads,
s-fileio.adb, s-exctra.ads, a-coboho.ads, a-ioexce.ads, a-tideio.ads,
a-ngrear.ads, a-wrstfi.ads, s-pack59.ads, g-alleve.ads, a-stboha.ads,
s-poosiz.adb, g-traceb.adb, g-rannum.adb, machcode.ads, s-purexc.ads,
s-fileio.ads, a-cfinve.adb, a-crbtgk.adb, system-solaris-x86.ads,
s-poosiz.ads, g-rannum.ads, g-traceb.ads, a-except.adb, s-conca4.adb,
a-stream.adb, a-cfinve.ads, a-crbtgk.ads, s-wchwts.adb,
system-mingw.ads, a-except.ads, s-conca4.ads, a-chzla9.ads,
s-valenu.adb, s-soflin.adb, a-stream.ads, a-cgarso.adb, s-valllu.adb,
g-crc32.adb, s-wchwts.ads, s-fatflt.ads, s-imguns.adb, s-strcom.adb,
g-decstr.adb, s-valenu.ads, s-soflin.ads, a-cgarso.ads, a-cwila1.ads,
s-valllu.ads, g-crc32.ads, s-imguns.ads, g-spipat.adb, s-valwch.adb,
s-strcom.ads, g-decstr.ads, text_io.ads, g-debuti.adb, s-stchop.adb,
g-spipat.ads, s-valwch.ads, a-string.ads, s-exnint.adb, g-awk.adb,
g-tasloc.adb, s-wwdenu.adb, s-boustr.adb, a-zchuni.adb, s-stchop.ads,
g-debuti.ads, s-stopoo.adb, system-dragonfly-x86_64.ads,
system-linux-x86.ads, s-exnint.ads, g-awk.ads, a-stzhas.adb,
g-tasloc.ads, s-wwdenu.ads, g-debpoo.adb, g-except.ads,
g-sse.ads, s-boustr.ads, a-zchuni.ads, s-bitops.adb, s-wwdwch.adb,
s-stopoo.ads, a-catizo.adb, a-stzhas.ads, a-nlcefu.ads, g-debpoo.ads,
i-vxwoio.adb, s-bitops.ads, g-io-put-vxworks.adb, s-wwdwch.ads,
g-sehamd.adb, a-ssicst.adb, a-catizo.ads, s-mmap.adb, g-string.adb,
s-traceb.adb, a-swunau.adb, s-rannum.adb, a-ticoau.adb, i-vxwoio.ads,
g-sehamd.ads, a-stwiun.adb, a-ssicst.ads, s-conca5.adb, a-ssitio.ads,
s-mmap.ads, a-zttest.adb, g-string.ads, g-sercom.adb, a-cdlili.adb,
a-swunau.ads, s-traceb.ads, s-rannum.ads, a-ticoau.ads, system-aix.ads,
a-cforma.adb, a-stwiun.ads, s-conca5.ads, s-carsi8.adb, a-zttest.ads,
g-sercom.ads, a-cdlili.ads, a-cihama.adb, g-sptain.ads, a-cforma.ads,
s-maccod.ads, s-carsi8.ads, a-strsup.adb, g-sha1.adb, a-cihama.ads,
g-stseme.adb, s-traent.adb, s-valcha.adb, g-curexc.ads, a-strsup.ads,
g-sha1.ads, a-sflcin.ads, s-traent.ads, s-pack10.adb, s-valcha.ads,
a-coteio.ads, s-tasloc.adb, g-utf_32.adb, a-suteio.adb, s-except.adb,
a-direct.adb, g-stsifd-sockets.adb, a-numaux-vxworks.ads, s-winext.ads,
s-pack10.ads, a-ztexio.adb, a-tiflau.adb, system-vxworks-arm.ads,
s-tasloc.ads, a-suteio.ads, g-utf_32.ads, s-except.ads,
a-direct.ads, a-swbwha.adb, g-hesorg.adb, s-wwdcha.adb, a-wtedit.adb,
a-ztexio.ads, a-wtcoio.adb, a-tiflau.ads, a-ssizti.ads, s-casi32.adb,
a-swbwha.ads, s-veboop.adb, g-hesorg.ads, s-parame-rtems.adb,
s-wwdcha.ads, a-wtedit.ads, a-stuten.adb, a-coinve.adb, a-wtcoio.ads,
s-casi32.ads, s-string.adb, a-tiinau.adb, a-cusyqu.adb, s-conca6.adb,
s-veboop.ads, a-cgcaso.adb, a-numaux-darwin.adb, a-envvar.adb,
a-stuten.ads, s-secsta.adb, a-coinve.ads, s-string.ads, a-cusyqu.ads,
a-tiinau.ads, s-osprim-vxworks.adb, s-conca6.ads, g-spchge.adb,
s-parint.adb, a-cuprqu.adb, a-cgcaso.ads, a-numaux-darwin.ads,
a-envvar.ads, s-secsta.ads, g-spchge.ads, s-parint.ads, a-cuprqu.ads,
a-swuwti.adb, a-flteio.ads, a-sbhcin.adb, a-coprnu.adb, g-u3spch.adb,
s-atocou.adb, g-ctrl_c.adb, a-swuwti.ads, a-calend.adb, a-sbhcin.ads,
a-coprnu.ads, g-dirope.adb, g-sha512.ads, g-u3spch.ads, s-atocou.ads,
g-ctrl_c.ads, a-timoau.adb, a-witeio.adb, s-pack11.adb, a-strhas.adb,
a-wtflio.adb, g-spitbo.adb, a-calend.ads, a-ztenio.adb, g-dirope.ads,
a-slcain.adb, g-sechas.adb, a-timoau.ads, a-witeio.ads, s-pack11.ads,
s-shasto.adb, s-traceb-mastop.adb, a-ciorse.adb, s-utf_32.adb,
a-strhas.ads, a-wtflio.ads, g-spitbo.ads, a-ztenio.ads, a-slcain.ads,
g-sechas.ads, s-gearop.adb, a-siztio.ads, s-pack20.adb, s-shasto.ads,
a-ciorse.ads, s-utf_32.ads, s-crtl.ads, a-wtinio.adb, s-elaall.adb,
s-explli.adb, s-chepoo.ads, s-gearop.ads, a-einuoc.adb, s-pack20.ads,
system-linux-ia64.ads, a-swunau-shared.adb, a-wtinio.ads, g-alvety.ads,
a-liztio.ads, g-calend.adb, s-conca7.adb, s-elaall.ads, s-explli.ads,
a-einuoc.ads, s-widboo.adb, s-imgdec.adb, a-cbhama.adb, g-calend.ads,
s-conca7.ads, a-llitio.ads, i-cexten.ads, a-coorma.adb, s-widboo.ads,
s-diflio.adb, g-souinf.ads, s-imgdec.ads, g-strhas.ads, a-cbhama.ads,
g-shshco.adb, a-ztdeio.adb, s-gloloc.adb, a-coorma.ads, g-wispch.adb,
s-pack03.adb, g-eacodu.adb, s-casi16.adb, s-diflio.ads, a-colien.adb,
g-shshco.ads, a-wtmoio.adb, a-rbtgbo.adb, a-ztdeio.ads,
system-rtems.ads, s-gloloc.ads, a-csquin.ads, a-cofuse.adb,
g-wispch.ads, s-pack03.ads, s-casi16.ads, s-io.adb, a-colien.ads,
g-alveop.adb, gnat.ads, s-diinio.adb, a-cfdlli.adb, g-pehage.adb,
a-wtmoio.ads, a-stwiha.adb, a-locale.adb, a-tirsfi.adb, a-nscoty.ads,
a-rbtgbo.ads, s-pack12.adb, a-cofuse.ads, a-sfteio.ads, s-io.ads,
g-alveop.ads, a-cfdlli.ads, s-diinio.ads, a-stwiha.ads, g-pehage.ads,
a-locale.ads, a-tirsfi.ads, s-pack12.ads, s-valuti.adb, g-cppexc.adb,
system-vxworks-ppc.ads, g-memdum.adb, a-lfteio.ads, s-pack21.adb,
s-unstyp.ads, s-valuti.ads, g-cppexc.ads, system-hpux-ia64.ads,
g-memdum.ads, g-soccon.ads, g-altive.ads, a-crbtgo.adb, s-pack21.ads,
a-llizti.ads, a-numaux-libc-x86.ads, s-expint.adb, s-conca8.adb,
a-crbtgo.ads, s-pack30.adb, s-vallli.adb, s-geveop.adb, s-expint.ads,
a-direio.adb, s-conca8.ads, a-widcha.ads, s-pack30.ads, s-vallli.ads,
s-strhas.adb, s-geveop.ads, g-md5.adb, a-direio.ads, a-numaux.ads,
s-ransee.adb, a-szbzha.adb, i-cobol.adb, g-busorg.adb, s-strhas.ads,
g-md5.ads, s-widenu.adb, s-ransee.ads, s-widllu.adb, a-szbzha.ads,
a-ststio.adb, i-cobol.ads, g-busorg.ads, g-regpat.adb, s-widenu.ads,
a-secain.adb, s-widllu.ads, s-pack13.adb, g-encstr.adb, a-ztcoau.adb,
a-ststio.ads, s-widwch.adb, g-regpat.ads, s-atacco.adb, a-cborse.adb,
a-secain.ads, s-pack13.ads, g-encstr.ads, a-ztcoau.ads, s-widwch.ads,
g-io_aux.adb, s-atacco.ads, a-ncelfu.ads, interfac.ads, a-cborse.ads,
g-regexp.adb, s-pack22.adb, a-szuzti.adb, g-io_aux.ads, s-caun32.adb,
a-nselfu.ads, g-regexp.ads, s-pack22.ads, a-ticoio.adb, a-szuzti.ads,
g-diopit.adb, s-caun32.ads, s-conca9.adb, a-tags.adb, a-swmwco.ads,
a-sbecin.adb, s-pack31.adb, s-expuns.adb, a-ticoio.ads, s-valint.adb,
s-conca9.ads, g-diopit.ads, a-tags.ads, a-nllcef.ads, a-izteio.ads,
a-sbecin.ads, s-expuns.ads, s-pack31.ads, g-dyntab.adb, s-powtab.ads,
s-flocon-none.adb, s-valint.ads, a-ssiwti.ads, s-mmosin-mingw.adb,
s-pack40.adb, s-pack05.adb, a-ztflau.adb, g-dyntab.ads,
a-szuzti-shared.adb, g-alvevi.ads, a-stwise.adb, s-mmosin-mingw.ads,
s-pack40.ads, a-diocst.adb, a-ztflau.ads, s-pack05.ads, a-nlcoty.ads,
a-contai.ads, a-stwisu.adb, g-byorma.adb, a-siwtio.ads, a-stwise.ads,
s-regpat.adb, g-mbdira.adb, s-pack14.adb, a-diocst.ads, g-flocon.ads,
g-mbflra.adb, a-ztinau.adb, s-dim.ads, s-mantis.adb, a-stwisu.ads,
g-byorma.ads, s-atopri.adb, g-wistsp.ads, a-uncdea.ads, s-widcha.adb,
a-caldel.adb, s-regpat.ads, g-mbdira.ads, a-tiflio.adb, s-pack14.ads,
s-parame.adb, a-liwtio.ads, s-memory.adb, g-mbflra.ads, a-ztinau.ads,
a-wtgeau.adb, s-direio.adb, s-mantis.ads, s-atopri.ads, s-widcha.ads,
a-caldel.ads, s-pack23.adb, a-unccon.ads, a-tiflio.ads, s-parame.ads,
a-llftio.ads, s-memory.ads, s-regexp.adb, a-wtgeau.ads, a-exexda.adb,
s-direio.ads, s-pack23.ads, g-stheme.adb, a-tiinio.adb, g-sestin.ads,
s-regexp.ads, a-wtfiio.adb, a-comutr.adb, a-exexpr.adb, a-tiinio.ads,
a-ztmoau.adb, a-cohata.ads, a-wtfiio.ads, s-imgrea.adb, ada.ads,
a-szunau-shared.adb, a-comutr.ads, s-valuns.adb, a-ztmoau.ads,
system-linux-arm.ads, s-osprim-x32.adb, s-pack41.adb, s-pack06.adb,
s-imgrea.ads, s-valuns.ads, s-finroo.adb, s-caun16.adb, s-pooglo.adb,
a-zrstfi.adb, a-suenst.adb, s-pack41.ads, g-binenv.adb, s-pack06.ads,
a-calari.adb, a-nlcoar.ads, s-finroo.ads, a-timoio.adb, s-caun16.ads,
s-flocon.adb, a-suenst.ads, a-zrstfi.ads, s-pooglo.ads, s-wchcon.adb,
s-traceb-hpux.adb, s-pack50.adb, i-fortra.adb, s-pack15.adb,
a-ngcefu.adb, g-sptavs.ads, g-binenv.ads, s-wchjis.adb, a-calari.ads,
a-timoio.ads, a-decima.adb, s-flocon.ads, s-wchcon.ads, a-llfzti.ads,
i-fortra.ads, s-pack50.ads, s-pack15.ads, a-ngcefu.ads, a-cfhase.adb,
s-wchjis.ads, g-soliop.ads, a-decima.ads, a-chlat9.ads, s-pack24.adb,
a-nlelfu.ads, a-cfhase.ads, g-locfil.adb, s-atocou-builtin.adb,
s-memcop.ads, a-szunau.adb, s-pack24.ads, s-imgllb.adb, s-auxdec.adb,
g-locfil.ads, s-pack33.adb, a-szunau.ads, s-parame-vxworks.adb,
s-imgllb.ads, a-ciorma.adb, s-auxdec.ads, a-cobove.adb, s-dsaser.ads,
a-elchha.adb, s-pack33.ads, a-cofuve.adb, s-parame-vxworks.ads,
a-ciorma.ads, system-darwin-x86.ads, s-multip.adb, a-stwiun-shared.adb,
a-wichun.adb, a-cobove.ads, s-imgbiu.adb, s-tsmona-mingw.adb,
a-coormu.adb, a-siocst.adb, s-win32.ads, a-elchha.ads, s-pack42.adb,
s-pack07.adb, a-cofuve.ads, system-hpux.ads, a-teioed.adb,
a-convec.adb, g-speche.adb, s-multip.ads, a-stwiun-shared.ads,
a-wichun.ads, s-imgbiu.ads, a-numeri.ads, a-siocst.ads, a-coormu.ads,
a-lliwti.ads, s-pack42.ads, s-pack07.ads, a-teioed.ads, a-convec.ads,
g-speche.ads, g-socthi.adb, a-nucoty.ads, a-szmzco.ads, s-pack51.adb,
s-osprim-mingw.adb, s-casi64.adb, g-strspl.ads, g-socthi.ads,
g-socket-dummy.adb, s-pack51.ads, s-dimmks.ads, s-casi64.ads,
a-wtenau.adb, s-stchop-vxworks.adb, s-pack60.adb,
system-solaris-sparc.ads, s-pack25.adb, g-socket-dummy.ads,
a-exstat.adb, a-cofuma.adb, s-tsmona-linux.adb, a-wtenau.ads,
s-pack60.ads, s-pack25.ads, i-cstrea.adb, a-cofuma.ads, g-exptty.adb,
a-chzla1.ads, s-pack34.adb, i-cstrea.ads, s-excdeb.adb, a-iteint.ads,
g-exptty.ads, i-pacdec.adb, s-pack34.ads, s-rident.ads, s-sopco3.adb,
i-vxwork.ads, s-excdeb.ads, system-linux-ppc.ads, a-swuwti-shared.adb,
s-widlli.adb, s-pack43.adb, i-pacdec.ads, a-cwila9.ads, s-sopco3.ads,
a-fwteio.ads, s-widlli.ads, s-pack43.ads, a-suhcin.adb, a-wtdeau.adb,
g-allein.ads, a-suezst.adb, a-dirval-mingw.adb, g-zspche.adb,
s-bignum.adb, a-ztedit.adb, g-regist.adb, a-nllefu.ads, a-ztcoio.adb,
s-pack52.adb, a-llctio.ads, a-nucoar.ads, s-pack17.adb, a-suhcin.ads,
a-wtdeau.ads, a-suezst.ads, a-dirval.adb, g-zspche.ads, g-regist.ads,
a-ztedit.ads, s-bignum.ads, a-wtcstr.adb, system.ads, s-pack52.ads,
a-ztcoio.ads, s-pack17.ads, s-imgboo.adb, a-rbtgso.adb, a-dirval.ads,
a-cohase.adb, s-pack61.adb, a-wtcstr.ads, s-pack26.adb, s-osprim.ads,
a-tigeau.adb, s-imgboo.ads, a-nuelfu.ads, a-swfwha.ads, s-commun.adb,
g-socthi-vxworks.adb, a-rbtgso.ads, a-cohase.ads, g-zstspl.ads,
s-pack61.ads, s-pack26.ads, a-intnam-dragonfly.ads, s-imglld.adb,
a-tigeau.ads, s-commun.ads, g-socthi-vxworks.ads, a-cborma.adb,
a-stwifi.adb, g-moreex.adb, s-pack35.adb, s-imglld.ads, s-valdec.adb,
a-tifiio.adb, a-cborma.ads, g-moreex.ads, a-stwifi.ads, s-pack35.ads,
s-sopco4.adb, g-sha224.ads, g-socket.adb, a-intnam-rtems.ads,
s-finmas.adb, s-valdec.ads, s-addima.adb, a-finali.adb, a-tifiio.ads,
s-rpc.adb, a-ztflio.adb, s-pack44.adb, s-pack09.adb, a-sblcin.adb,
s-sopco4.ads, a-textio.adb, g-socket.ads, g-sptabo.ads, s-finmas.ads,
g-shsh32.adb, s-addima.ads, a-finali.ads, s-mmauni-long.ads, s-rpc.ads,
a-ztflio.ads, system-djgpp.ads, s-stache.adb, s-pack44.ads,
s-pack09.ads, a-sblcin.ads, a-textio.ads, a-cidlli.adb, g-shsh32.ads,
a-chtgbk.adb, a-tiocst.adb, s-pack53.adb, s-pack18.adb, s-stache.ads,
a-zchhan.adb, s-fatlfl.ads, a-ztinio.adb, s-strops.adb, a-siteio.ads,
a-cidlli.ads, a-chtgbk.ads, g-ssvety.ads, a-tiocst.ads, s-pack53.ads,
s-parame-hpux.ads, s-pack18.ads, a-zchhan.ads, s-strops.ads,
a-ztinio.ads, a-wichha.adb, a-stwima.adb, a-nlrear.ads, a-liteio.ads,
s-pack62.adb, s-pack27.adb, s-fore.adb, s-vercon.adb, a-wichha.ads,
a-stwima.ads, s-pack62.ads, system-linux-sparc.ads, s-pack27.ads,
g-dynhta.adb, s-fore.ads, s-vercon.ads, a-cofuba.adb, a-cimutr.adb,
i-cpoint.adb, s-imgenu.adb, a-stwibo.adb, s-pack36.adb, i-cstrin.adb,
s-imgllu.adb, a-suteio-shared.adb, g-excact.adb, s-stoele.adb,
s-addope.adb, g-dynhta.ads, a-cofuba.ads, a-ztmoio.adb, a-llfwti.ads,
a-cimutr.ads, i-cpoint.ads, s-imgenu.ads, a-stwibo.ads, a-wttest.adb,
s-pack36.ads, a-tgdico.ads, s-sopco5.adb, s-scaval.adb, i-cstrin.ads,
s-imgllu.ads, g-excact.ads, s-stoele.ads, g-deutst.ads, s-addope.ads,
s-imgwch.adb, g-sha384.ads, a-ztmoio.ads, s-pack45.adb, a-wttest.ads,
s-sopco5.ads, s-excmac-gcc.adb, s-scaval.ads, a-storio.adb,
a-coinho.adb, a-btgbso.adb, s-imgwch.ads, s-carun8.adb, memtrack.adb,
s-pack45.ads, a-sfhcin.ads, s-excmac-gcc.ads, a-storio.ads,
a-coinho.ads, a-btgbso.ads, s-stratt.adb, s-carun8.ads, a-shcain.adb,
s-pack54.adb, s-pack19.adb, a-colire.adb, a-tigeli.adb, s-caun64.adb,
s-stratt.ads, s-fatgen.adb, a-shcain.ads, a-stzunb-shared.adb,
s-pack54.ads, s-pack19.ads, a-colire.ads, a-calcon.adb, s-caun64.ads,
s-fatgen.ads, s-pack63.adb, g-arrspl.adb, a-stzunb-shared.ads,
s-pack28.adb, a-nllrar.ads, a-zzboio.adb, a-zzunio.ads, a-stunau.adb,
a-calcon.ads, g-cgideb.adb, s-objrea.adb, s-mastop.adb, a-tienau.adb,
g-altcon.adb, g-arrspl.ads, s-pack63.ads, s-restri.adb, s-pack28.ads,
a-zzboio.ads, a-stunau.ads, g-cgideb.ads, g-htable.adb, g-sothco.adb,
s-objrea.ads, g-soliop-solaris.ads, s-mastop.ads, a-tienau.ads,
system-linux-m68k.ads, g-altcon.ads, s-dmotpr.ads, s-memory-mingw.adb,
g-cgicoo.adb, s-pack37.adb, s-restri.ads, s-fatllf.ads, s-expmod.adb,
a-swuwha.adb, a-exextr.adb, a-cfhama.adb, s-gloloc-mingw.adb,
a-tiboio.adb, g-forstr.adb, g-sothco.ads, a-stzbou.adb, a-nllcty.ads,
a-suecin.adb, g-htable.ads, s-exctab.adb, a-tiunio.ads, g-cgicoo.ads,
s-osprim-posix.adb, s-pack37.ads, a-ciormu.adb, s-atocou-x86.adb,
a-swuwha.ads, s-expmod.ads, a-cfhama.ads, s-ficobl.ads, a-ngcoty.adb,
g-forstr.ads, a-tiboio.ads, a-calfor.adb, a-stzbou.ads, a-suecin.ads,
a-conhel.adb, a-crbltr.ads, s-exctab.ads, a-dhfina.ads, s-imgcha.adb,
s-pack46.adb, a-ciormu.ads, system-linux-sh4.ads, a-chahan.adb,
a-ngcoty.ads, a-stzunb.adb, a-szfzha.ads, a-calfor.ads, a-cbdlli.adb,
a-conhel.ads, s-imgcha.ads, s-pack46.ads, a-assert.adb, a-chahan.ads,
a-stzunb.ads, a-crdlli.adb, s-pack55.adb, a-cbdlli.ads, a-tideau.adb,
a-assert.ads, ioexcept.ads, s-boarop.ads, g-hesora.adb, a-crdlli.ads,
s-pack55.ads, a-tideau.ads, g-bubsor.adb, a-wtenio.adb, a-cbsyqu.adb,
g-hesora.ads, s-pack29.adb, a-nurear.ads, g-catiio.adb, s-stposu.adb,
g-bubsor.ads, a-wtenio.ads, a-cbsyqu.ads, a-suewst.adb,
system-vxworks-x86.ads, s-pack29.ads, a-cbmutr.adb, a-cbprqu.adb,
s-imenne.adb, g-sothco-dummy.adb, g-casuti.adb, g-catiio.ads,
s-stposu.ads, a-stzsea.adb, s-pack38.adb, a-suewst.ads, s-imgllw.adb,
a-cbprqu.ads, a-cbmutr.ads, s-imenne.ads, g-sothco-dummy.ads,
g-casuti.ads, s-htable.adb, s-fatsfl.ads, g-trasym.adb, unchconv.ads,
a-stzsea.ads, s-arit64.adb, s-pack38.ads, a-nllcar.ads, s-valrea.adb,
s-imgllw.ads, s-htable.ads, a-sequio.adb, g-trasym.ads, a-ngcoar.adb,
s-exnllf.adb, s-pack47.adb, s-arit64.ads, g-sercom-mingw.adb,
s-valrea.ads, g-socthi-mingw.adb, g-bytswa.adb, g-sehash.adb,
unchdeal.ads, a-sequio.ads, a-ngcoar.ads, s-exnllf.ads, a-wtdeio.adb,
s-pack47.ads, g-socthi-mingw.ads, a-excpol-abort.adb, a-ztgeau.adb,
g-bytswa.ads, g-sehash.ads, s-pack56.adb, a-wtdeio.ads, a-ngelfu.adb,
a-ztgeau.ads, a-cforse.adb, s-filatt.ads, a-stzfix.adb, a-cihase.adb,
s-pack56.ads, a-sfztio.ads, a-ngelfu.ads, s-trasym-dwarf.adb,
a-cforse.ads, a-ztfiio.adb, g-timsta.adb, a-stzfix.ads, a-cihase.ads,
a-ztfiio.ads, system-darwin-arm.ads: Move non-tasking runtime sources
to libgnat subdirectory.
From-SVN: r251902
Diffstat (limited to 'gcc/ada/s-fileio.adb')
-rw-r--r-- | gcc/ada/s-fileio.adb | 1322 |
1 files changed, 0 insertions, 1322 deletions
diff --git a/gcc/ada/s-fileio.adb b/gcc/ada/s-fileio.adb deleted file mode 100644 index c8b44bd..0000000 --- a/gcc/ada/s-fileio.adb +++ /dev/null @@ -1,1322 +0,0 @@ ------------------------------------------------------------------------------- --- -- --- GNAT RUN-TIME COMPONENTS -- --- -- --- S Y S T E M . F I L E _ I O -- --- -- --- B o d y -- --- -- --- Copyright (C) 1992-2017, Free Software Foundation, Inc. -- --- -- --- GNAT is free software; you can redistribute it and/or modify it under -- --- terms of the GNU General Public License as published by the Free Soft- -- --- ware Foundation; either version 3, or (at your option) any later ver- -- --- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- --- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- --- or FITNESS FOR A PARTICULAR PURPOSE. -- --- -- --- As a special exception under Section 7 of GPL version 3, you are granted -- --- additional permissions described in the GCC Runtime Library Exception, -- --- version 3.1, as published by the Free Software Foundation. -- --- -- --- You should have received a copy of the GNU General Public License and -- --- a copy of the GCC Runtime Library Exception along with this program; -- --- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- --- <http://www.gnu.org/licenses/>. -- --- -- --- GNAT was originally developed by the GNAT team at New York University. -- --- Extensive contributions were provided by Ada Core Technologies Inc. -- --- -- ------------------------------------------------------------------------------- - -with Ada.Finalization; use Ada.Finalization; -with Ada.IO_Exceptions; use Ada.IO_Exceptions; -with Ada.Unchecked_Deallocation; - -with Interfaces.C_Streams; use Interfaces.C_Streams; - -with System.Case_Util; use System.Case_Util; -with System.CRTL; -with System.OS_Lib; -with System.Soft_Links; - -package body System.File_IO is - - use System.File_Control_Block; - - package SSL renames System.Soft_Links; - - use type CRTL.size_t; - - ---------------------- - -- Global Variables -- - ---------------------- - - Open_Files : AFCB_Ptr; - -- This points to a list of AFCB's for all open files. This is a doubly - -- linked list, with the Prev pointer of the first entry, and the Next - -- pointer of the last entry containing null. Note that this global - -- variable must be properly protected to provide thread safety. - - type Temp_File_Record; - type Temp_File_Record_Ptr is access all Temp_File_Record; - - type Temp_File_Record is record - File : AFCB_Ptr; - Next : aliased Temp_File_Record_Ptr; - Name : String (1 .. max_path_len + 1); - end record; - -- One of these is allocated for each temporary file created - - Temp_Files : aliased Temp_File_Record_Ptr; - -- Points to list of names of temporary files. Note that this global - -- variable must be properly protected to provide thread safety. - - procedure Free is new Ada.Unchecked_Deallocation - (Temp_File_Record, Temp_File_Record_Ptr); - - type File_IO_Clean_Up_Type is new Limited_Controlled with null record; - -- The closing of all open files and deletion of temporary files is an - -- action that takes place at the end of execution of the main program. - -- This action is implemented using a library level object that gets - -- finalized at the end of program execution. Note that the type is - -- limited, in order to stop the compiler optimizing away the declaration - -- which would be allowed in the non-limited case. - - procedure Finalize (V : in out File_IO_Clean_Up_Type); - -- This is the finalize operation that is used to do the cleanup - - File_IO_Clean_Up_Object : File_IO_Clean_Up_Type; - pragma Warnings (Off, File_IO_Clean_Up_Object); - -- This is the single object of the type that triggers the finalization - -- call. Since it is at the library level, this happens just before the - -- environment task is finalized. - - text_translation_required : Boolean; - for text_translation_required'Size use Character'Size; - pragma Import - (C, text_translation_required, "__gnat_text_translation_required"); - -- If true, add appropriate suffix to control string for Open - - ----------------------- - -- Local Subprograms -- - ----------------------- - - procedure Free_String is new Ada.Unchecked_Deallocation (String, Pstring); - - subtype Fopen_String is String (1 .. 4); - -- Holds open string (longest is "w+b" & nul) - - procedure Fopen_Mode - (Namestr : String; - Mode : File_Mode; - Text : Boolean; - Creat : Boolean; - Amethod : Character; - Fopstr : out Fopen_String); - -- Determines proper open mode for a file to be opened in the given Ada - -- mode. Namestr is the NUL-terminated file name. Text is true for a text - -- file and false otherwise, and Creat is true for a create call, and False - -- for an open call. The value stored in Fopstr is a nul-terminated string - -- suitable for a call to fopen or freopen. Amethod is the character - -- designating the access method from the Access_Method field of the FCB. - - function Errno_Message - (Name : String; - Errno : Integer := OS_Lib.Errno) return String; - -- Return Errno_Message for Errno, with file name prepended - - procedure Raise_Device_Error - (File : AFCB_Ptr; - Errno : Integer := OS_Lib.Errno); - pragma No_Return (Raise_Device_Error); - -- Clear error indication on File and raise Device_Error with an exception - -- message providing errno information. - - ---------------- - -- Append_Set -- - ---------------- - - procedure Append_Set (File : AFCB_Ptr) is - begin - if File.Mode = Append_File then - if fseek (File.Stream, 0, SEEK_END) /= 0 then - Raise_Device_Error (File); - end if; - end if; - end Append_Set; - - ---------------- - -- Chain_File -- - ---------------- - - procedure Chain_File (File : AFCB_Ptr) is - begin - -- Take a task lock, to protect the global data value Open_Files - - SSL.Lock_Task.all; - - -- Do the chaining operation locked - - File.Next := Open_Files; - File.Prev := null; - Open_Files := File; - - if File.Next /= null then - File.Next.Prev := File; - end if; - - SSL.Unlock_Task.all; - - exception - when others => - SSL.Unlock_Task.all; - raise; - end Chain_File; - - --------------------- - -- Check_File_Open -- - --------------------- - - procedure Check_File_Open (File : AFCB_Ptr) is - begin - if File = null then - raise Status_Error with "file not open"; - end if; - end Check_File_Open; - - ----------------------- - -- Check_Read_Status -- - ----------------------- - - procedure Check_Read_Status (File : AFCB_Ptr) is - begin - if File = null then - raise Status_Error with "file not open"; - elsif File.Mode not in Read_File_Mode then - raise Mode_Error with "file not readable"; - end if; - end Check_Read_Status; - - ------------------------ - -- Check_Write_Status -- - ------------------------ - - procedure Check_Write_Status (File : AFCB_Ptr) is - begin - if File = null then - raise Status_Error with "file not open"; - elsif File.Mode = In_File then - raise Mode_Error with "file not writable"; - end if; - end Check_Write_Status; - - ----------- - -- Close -- - ----------- - - procedure Close (File_Ptr : access AFCB_Ptr) is - Close_Status : int := 0; - Dup_Strm : Boolean := False; - Errno : Integer := 0; - - File : AFCB_Ptr renames File_Ptr.all; - - begin - -- Take a task lock, to protect the global variables Open_Files and - -- Temp_Files, and the chains they point to. - - SSL.Lock_Task.all; - - Check_File_Open (File); - AFCB_Close (File); - - -- Sever the association between the given file and its associated - -- external file. The given file is left closed. Do not perform system - -- closes on the standard input, output and error files and also do not - -- attempt to close a stream that does not exist (signalled by a null - -- stream value -- happens in some error situations). - - if not File.Is_System_File and then File.Stream /= NULL_Stream then - - -- Do not do an fclose if this is a shared file and there is at least - -- one other instance of the stream that is open. - - if File.Shared_Status = Yes then - declare - P : AFCB_Ptr; - - begin - P := Open_Files; - while P /= null loop - if P /= File and then File.Stream = P.Stream then - Dup_Strm := True; - exit; - end if; - - P := P.Next; - end loop; - end; - end if; - - -- Do the fclose unless this was a duplicate in the shared case - - if not Dup_Strm then - Close_Status := fclose (File.Stream); - - if Close_Status /= 0 then - Errno := OS_Lib.Errno; - end if; - end if; - end if; - - -- Dechain file from list of open files and then free the storage - - if File.Prev = null then - Open_Files := File.Next; - else - File.Prev.Next := File.Next; - end if; - - if File.Next /= null then - File.Next.Prev := File.Prev; - end if; - - -- If it's a temp file, remove the corresponding record from Temp_Files, - -- and delete the file. There are unlikely to be large numbers of temp - -- files open, so a linear search is sufficiently efficient. Note that - -- we don't need to check for end of list, because the file must be - -- somewhere on the list. Note that as for Finalize, we ignore any - -- errors while attempting the unlink operation. - - if File.Is_Temporary_File then - declare - Temp : access Temp_File_Record_Ptr := Temp_Files'Access; - -- Note the double indirection here - - Discard : int; - New_Temp : Temp_File_Record_Ptr; - - begin - while Temp.all.all.File /= File loop - Temp := Temp.all.all.Next'Access; - end loop; - - Discard := unlink (Temp.all.all.Name'Address); - New_Temp := Temp.all.all.Next; - Free (Temp.all); - Temp.all := New_Temp; - end; - end if; - - -- Deallocate some parts of the file structure that were kept in heap - -- storage with the exception of system files (standard input, output - -- and error) since they had some information allocated in the stack. - - if not File.Is_System_File then - Free_String (File.Name); - Free_String (File.Form); - AFCB_Free (File); - end if; - - File := null; - - if Close_Status /= 0 then - Raise_Device_Error (null, Errno); - end if; - - SSL.Unlock_Task.all; - - exception - when others => - SSL.Unlock_Task.all; - raise; - end Close; - - ------------ - -- Delete -- - ------------ - - procedure Delete (File_Ptr : access AFCB_Ptr) is - File : AFCB_Ptr renames File_Ptr.all; - - begin - Check_File_Open (File); - - if not File.Is_Regular_File then - raise Use_Error with "cannot delete non-regular file"; - end if; - - declare - Filename : aliased constant String := File.Name.all; - Is_Temporary_File : constant Boolean := File.Is_Temporary_File; - - begin - Close (File_Ptr); - - -- Now unlink the external file. Note that we use the full name in - -- this unlink, because the working directory may have changed since - -- we did the open, and we want to unlink the right file. However, if - -- it's a temporary file, then closing it already unlinked it. - - if not Is_Temporary_File then - if unlink (Filename'Address) = -1 then - raise Use_Error with OS_Lib.Errno_Message; - end if; - end if; - end; - end Delete; - - ----------------- - -- End_Of_File -- - ----------------- - - function End_Of_File (File : AFCB_Ptr) return Boolean is - begin - Check_File_Open (File); - - if feof (File.Stream) /= 0 then - return True; - - else - Check_Read_Status (File); - - if ungetc (fgetc (File.Stream), File.Stream) = EOF then - clearerr (File.Stream); - return True; - else - return False; - end if; - end if; - end End_Of_File; - - ------------------- - -- Errno_Message -- - ------------------- - - function Errno_Message - (Name : String; - Errno : Integer := OS_Lib.Errno) return String - is - begin - return Name & ": " & OS_Lib.Errno_Message (Err => Errno); - end Errno_Message; - - -------------- - -- Finalize -- - -------------- - - procedure Finalize (V : in out File_IO_Clean_Up_Type) is - pragma Warnings (Off, V); - - Fptr1 : aliased AFCB_Ptr; - Fptr2 : AFCB_Ptr; - - Discard : int; - - begin - -- Take a lock to protect global Open_Files data structure - - SSL.Lock_Task.all; - - -- First close all open files (the slightly complex form of this loop is - -- required because Close nulls out its argument). - - Fptr1 := Open_Files; - while Fptr1 /= null loop - Fptr2 := Fptr1.Next; - Close (Fptr1'Access); - Fptr1 := Fptr2; - end loop; - - -- Now unlink all temporary files. We do not bother to free the blocks - -- because we are just about to terminate the program. We also ignore - -- any errors while attempting these unlink operations. - - while Temp_Files /= null loop - Discard := unlink (Temp_Files.Name'Address); - Temp_Files := Temp_Files.Next; - end loop; - - SSL.Unlock_Task.all; - - exception - when others => - SSL.Unlock_Task.all; - raise; - end Finalize; - - ----------- - -- Flush -- - ----------- - - procedure Flush (File : AFCB_Ptr) is - begin - Check_Write_Status (File); - - if fflush (File.Stream) /= 0 then - Raise_Device_Error (File); - end if; - end Flush; - - ---------------- - -- Fopen_Mode -- - ---------------- - - -- The fopen mode to be used is shown by the following table: - - -- OPEN CREATE - -- Append_File "r+" "w+" - -- In_File "r" "w+" - -- Out_File (Direct_IO, Stream_IO) "r+" [*] "w" - -- Out_File (others) "w" "w" - -- Inout_File "r+" "w+" - - -- [*] Except that for Out_File, if the file exists and is a fifo (i.e. a - -- named pipe), we use "w" instead of "r+". This is necessary to make a - -- write to the fifo block until a reader is ready. - - -- Note: we do not use "a" or "a+" for Append_File, since this would not - -- work in the case of stream files, where even if in append file mode, - -- you can reset to earlier points in the file. The caller must use the - -- Append_Set routine to deal with the necessary positioning. - - -- Note: in several cases, the fopen mode used allows reading and writing, - -- but the setting of the Ada mode is more restrictive. For instance, - -- Create in In_File mode uses "w+" which allows writing, but the Ada mode - -- In_File will cause any write operations to be rejected with Mode_Error - -- in any case. - - -- Note: for the Out_File/Open cases for other than the Direct_IO case, an - -- initial call will be made by the caller to first open the file in "r" - -- mode to be sure that it exists. The real open, in "w" mode, will then - -- destroy this file. This is peculiar, but that's what Ada semantics - -- require and the ACATS tests insist on. - - -- If text file translation is required, then either "b" or "t" is appended - -- to the mode, depending on the setting of Text. - - procedure Fopen_Mode - (Namestr : String; - Mode : File_Mode; - Text : Boolean; - Creat : Boolean; - Amethod : Character; - Fopstr : out Fopen_String) - is - Fptr : Positive; - - function is_fifo (Path : Address) return Integer; - pragma Import (C, is_fifo, "__gnat_is_fifo"); - - begin - case Mode is - when In_File => - if Creat then - Fopstr (1) := 'w'; - Fopstr (2) := '+'; - Fptr := 3; - else - Fopstr (1) := 'r'; - Fptr := 2; - end if; - - when Out_File => - if Amethod in 'D' | 'S' - and then not Creat - and then is_fifo (Namestr'Address) = 0 - then - Fopstr (1) := 'r'; - Fopstr (2) := '+'; - Fptr := 3; - else - Fopstr (1) := 'w'; - Fptr := 2; - end if; - - when Append_File - | Inout_File - => - Fopstr (1) := (if Creat then 'w' else 'r'); - Fopstr (2) := '+'; - Fptr := 3; - end case; - - -- If text_translation_required is true then we need to append either a - -- "t" or "b" to the string to get the right mode. - - if text_translation_required then - Fopstr (Fptr) := (if Text then 't' else 'b'); - Fptr := Fptr + 1; - end if; - - Fopstr (Fptr) := ASCII.NUL; - end Fopen_Mode; - - ---------- - -- Form -- - ---------- - - function Form (File : AFCB_Ptr) return String is - begin - if File = null then - raise Status_Error with "Form: file not open"; - else - return File.Form.all (1 .. File.Form'Length - 1); - end if; - end Form; - - ------------------ - -- Form_Boolean -- - ------------------ - - function Form_Boolean - (Form : String; - Keyword : String; - Default : Boolean) return Boolean - is - V1, V2 : Natural; - pragma Unreferenced (V2); - - begin - Form_Parameter (Form, Keyword, V1, V2); - - if V1 = 0 then - return Default; - elsif Form (V1) = 'y' then - return True; - elsif Form (V1) = 'n' then - return False; - else - raise Use_Error with "invalid Form"; - end if; - end Form_Boolean; - - ------------------ - -- Form_Integer -- - ------------------ - - function Form_Integer - (Form : String; - Keyword : String; - Default : Integer) return Integer - is - V1, V2 : Natural; - V : Integer; - - begin - Form_Parameter (Form, Keyword, V1, V2); - - if V1 = 0 then - return Default; - - else - V := 0; - - for J in V1 .. V2 loop - if Form (J) not in '0' .. '9' then - raise Use_Error with "invalid Form"; - else - V := V * 10 + Character'Pos (Form (J)) - Character'Pos ('0'); - end if; - - if V > 999_999 then - raise Use_Error with "invalid Form"; - end if; - end loop; - - return V; - end if; - end Form_Integer; - - -------------------- - -- Form_Parameter -- - -------------------- - - procedure Form_Parameter - (Form : String; - Keyword : String; - Start : out Natural; - Stop : out Natural) - is - Klen : constant Integer := Keyword'Length; - - begin - for J in Form'First + Klen .. Form'Last - 1 loop - if Form (J) = '=' - and then Form (J - Klen .. J - 1) = Keyword - then - Start := J + 1; - Stop := Start - 1; - while Form (Stop + 1) /= ASCII.NUL - and then Form (Stop + 1) /= ',' - loop - Stop := Stop + 1; - end loop; - - return; - end if; - end loop; - - Start := 0; - Stop := 0; - end Form_Parameter; - - ------------- - -- Is_Open -- - ------------- - - function Is_Open (File : AFCB_Ptr) return Boolean is - begin - -- We return True if the file is open, and the underlying file stream is - -- usable. In particular on Windows an application linked with -mwindows - -- option set does not have a console attached. In this case standard - -- files (Current_Output, Current_Error, Current_Input) are not created. - -- We want Is_Open (Current_Output) to return False in this case. - - return File /= null and then fileno (File.Stream) /= -1; - end Is_Open; - - ------------------- - -- Make_Buffered -- - ------------------- - - procedure Make_Buffered - (File : AFCB_Ptr; - Buf_Siz : Interfaces.C_Streams.size_t) - is - status : Integer; - pragma Unreferenced (status); - - begin - status := setvbuf (File.Stream, Null_Address, IOFBF, Buf_Siz); - end Make_Buffered; - - ------------------------ - -- Make_Line_Buffered -- - ------------------------ - - procedure Make_Line_Buffered - (File : AFCB_Ptr; - Line_Siz : Interfaces.C_Streams.size_t) - is - status : Integer; - pragma Unreferenced (status); - - begin - status := setvbuf (File.Stream, Null_Address, IOLBF, Line_Siz); - -- No error checking??? - end Make_Line_Buffered; - - --------------------- - -- Make_Unbuffered -- - --------------------- - - procedure Make_Unbuffered (File : AFCB_Ptr) is - status : Integer; - pragma Unreferenced (status); - - begin - status := setvbuf (File.Stream, Null_Address, IONBF, 0); - -- No error checking??? - end Make_Unbuffered; - - ---------- - -- Mode -- - ---------- - - function Mode (File : AFCB_Ptr) return File_Mode is - begin - if File = null then - raise Status_Error with "Mode: file not open"; - else - return File.Mode; - end if; - end Mode; - - ---------- - -- Name -- - ---------- - - function Name (File : AFCB_Ptr) return String is - begin - if File = null then - raise Status_Error with "Name: file not open"; - else - return File.Name.all (1 .. File.Name'Length - 1); - end if; - end Name; - - ---------- - -- Open -- - ---------- - - procedure Open - (File_Ptr : in out AFCB_Ptr; - Dummy_FCB : AFCB'Class; - Mode : File_Mode; - Name : String; - Form : String; - Amethod : Character; - Creat : Boolean; - Text : Boolean; - C_Stream : FILEs := NULL_Stream) - is - pragma Warnings (Off, Dummy_FCB); - -- Yes we know this is never assigned a value. That's intended, since - -- all we ever use of this value is the tag for dispatching purposes. - - procedure Tmp_Name (Buffer : Address); - pragma Import (C, Tmp_Name, "__gnat_tmp_name"); - -- Set buffer (a String address) with a temporary filename - - function Get_Case_Sensitive return Integer; - pragma Import (C, Get_Case_Sensitive, - "__gnat_get_file_names_case_sensitive"); - - procedure Record_AFCB; - -- Create and record new AFCB into the runtime, note that the - -- implementation uses the variables below which corresponds to the - -- status of the opened file. - - File_Names_Case_Sensitive : constant Boolean := Get_Case_Sensitive /= 0; - -- Set to indicate whether the operating system convention is for file - -- names to be case sensitive (e.g., in Unix, set True), or not case - -- sensitive (e.g., in Windows, set False). Declared locally to avoid - -- breaking the Preelaborate rule that disallows function calls at the - -- library level. - - Stream : FILEs := C_Stream; - -- Stream which we open in response to this request - - Shared : Shared_Status_Type; - -- Setting of Shared_Status field for file - - Fopstr : aliased Fopen_String; - -- Mode string used in fopen call - - Formstr : aliased String (1 .. Form'Length + 1); - -- Form string with ASCII.NUL appended, folded to lower case - - Text_Encoding : Content_Encoding; - - Tempfile : constant Boolean := Name = ""; - -- Indicates temporary file case, which is indicated by an empty file - -- name. - - Namelen : constant Integer := max_path_len; - -- Length required for file name, not including final ASCII.NUL. - -- Note that we used to reference L_tmpnam here, which is not reliable - -- since __gnat_tmp_name does not always use tmpnam. - - Namestr : aliased String (1 .. Namelen + 1); - -- Name as given or temporary file name with ASCII.NUL appended - - Fullname : aliased String (1 .. max_path_len + 1); - -- Full name (as required for Name function, and as stored in the - -- control block in the Name field) with ASCII.NUL appended. - - Full_Name_Len : Integer; - -- Length of name actually stored in Fullname - - Encoding : CRTL.Filename_Encoding; - -- Filename encoding specified into the form parameter - - ----------------- - -- Record_AFCB -- - ----------------- - - procedure Record_AFCB is - begin - File_Ptr := AFCB_Allocate (Dummy_FCB); - - -- Note that we cannot use an aggregate here as File_Ptr is a - -- class-wide access to a limited type (Root_Stream_Type). - - File_Ptr.Is_Regular_File := is_regular_file (fileno (Stream)) /= 0; - File_Ptr.Is_System_File := False; - File_Ptr.Text_Encoding := Text_Encoding; - File_Ptr.Shared_Status := Shared; - File_Ptr.Access_Method := Amethod; - File_Ptr.Stream := Stream; - File_Ptr.Form := new String'(Formstr); - File_Ptr.Name := new String'(Fullname - (1 .. Full_Name_Len)); - File_Ptr.Mode := Mode; - File_Ptr.Is_Temporary_File := Tempfile; - File_Ptr.Encoding := Encoding; - - Chain_File (File_Ptr); - Append_Set (File_Ptr); - end Record_AFCB; - - -- Start of processing for Open - - begin - if File_Ptr /= null then - raise Status_Error with "file already open"; - end if; - - -- Acquire form string, setting required NUL terminator - - Formstr (1 .. Form'Length) := Form; - Formstr (Formstr'Last) := ASCII.NUL; - - -- Convert form string to lower case - - for J in Formstr'Range loop - if Formstr (J) in 'A' .. 'Z' then - Formstr (J) := Character'Val (Character'Pos (Formstr (J)) + 32); - end if; - end loop; - - -- Acquire setting of shared parameter - - declare - V1, V2 : Natural; - - begin - Form_Parameter (Formstr, "shared", V1, V2); - - if V1 = 0 then - Shared := None; - elsif Formstr (V1 .. V2) = "yes" then - Shared := Yes; - elsif Formstr (V1 .. V2) = "no" then - Shared := No; - else - raise Use_Error with "invalid Form"; - end if; - end; - - -- Acquire setting of encoding parameter - - declare - V1, V2 : Natural; - - begin - Form_Parameter (Formstr, "encoding", V1, V2); - - if V1 = 0 then - Encoding := CRTL.Unspecified; - elsif Formstr (V1 .. V2) = "utf8" then - Encoding := CRTL.UTF8; - elsif Formstr (V1 .. V2) = "8bits" then - Encoding := CRTL.ASCII_8bits; - else - raise Use_Error with "invalid Form"; - end if; - end; - - -- Acquire setting of text_translation parameter. Only needed if this is - -- a [Wide_[Wide_]]Text_IO file, in which case we default to True, but - -- if the Form says Text_Translation=No, we use binary mode, so new-line - -- will be just LF, even on Windows. - - if Text then - Text_Encoding := Default_Text; - else - Text_Encoding := None; - end if; - - if Text_Encoding in Text_Content_Encoding then - declare - V1, V2 : Natural; - - begin - Form_Parameter (Formstr, "text_translation", V1, V2); - - if V1 = 0 then - null; - elsif Formstr (V1 .. V2) = "no" then - Text_Encoding := None; - elsif Formstr (V1 .. V2) = "text" - or else Formstr (V1 .. V2) = "yes" - then - Text_Encoding := Interfaces.C_Streams.Text; - elsif Formstr (V1 .. V2) = "wtext" then - Text_Encoding := Wtext; - elsif Formstr (V1 .. V2) = "u8text" then - Text_Encoding := U8text; - elsif Formstr (V1 .. V2) = "u16text" then - Text_Encoding := U16text; - else - raise Use_Error with "invalid Form"; - end if; - end; - end if; - - -- If we were given a stream (call from xxx.C_Streams.Open), then set - -- the full name to the given one, and skip to end of processing. - - if Stream /= NULL_Stream then - Full_Name_Len := Name'Length + 1; - Fullname (1 .. Full_Name_Len - 1) := Name; - Fullname (Full_Name_Len) := ASCII.NUL; - - -- Normal case of Open or Create - - else - -- If temporary file case, get temporary file name and add to the - -- list of temporary files to be deleted on exit. - - if Tempfile then - if not Creat then - raise Name_Error with "opening temp file without creating it"; - end if; - - Tmp_Name (Namestr'Address); - - if Namestr (1) = ASCII.NUL then - raise Use_Error with "invalid temp file name"; - end if; - - -- Normal case of non-empty name given (i.e. not a temp file) - - else - if Name'Length > Namelen then - raise Name_Error with "file name too long"; - end if; - - Namestr (1 .. Name'Length) := Name; - Namestr (Name'Length + 1) := ASCII.NUL; - end if; - - -- Get full name in accordance with the advice of RM A.8.2(22) - - full_name (Namestr'Address, Fullname'Address); - - if Fullname (1) = ASCII.NUL then - raise Use_Error with Errno_Message (Name); - end if; - - Full_Name_Len := 1; - while Full_Name_Len < Fullname'Last - and then Fullname (Full_Name_Len) /= ASCII.NUL - loop - Full_Name_Len := Full_Name_Len + 1; - end loop; - - -- Fullname is generated by calling system's full_name. The problem - -- is, full_name does nothing about the casing, so a file name - -- comparison may generally speaking not be valid on non-case- - -- sensitive systems, and in particular we get unexpected failures - -- on Windows/Vista because of this. So we use s-casuti to force - -- the name to lower case. - - if not File_Names_Case_Sensitive then - To_Lower (Fullname (1 .. Full_Name_Len)); - end if; - - -- If Shared=None or Shared=Yes, then check for the existence of - -- another file with exactly the same full name. - - if Shared /= No then - declare - P : AFCB_Ptr; - - begin - -- Take a task lock to protect Open_Files - - SSL.Lock_Task.all; - - -- Search list of open files - - P := Open_Files; - while P /= null loop - if Fullname (1 .. Full_Name_Len) = P.Name.all then - - -- If we get a match, and either file has Shared=None, - -- then raise Use_Error, since we don't allow two files - -- of the same name to be opened unless they specify the - -- required sharing mode. - - if Shared = None - or else P.Shared_Status = None - then - raise Use_Error with "reopening shared file"; - - -- If both files have Shared=Yes, then we acquire the - -- stream from the located file to use as our stream. - - elsif Shared = Yes - and then P.Shared_Status = Yes - then - Stream := P.Stream; - - Record_AFCB; - pragma Assert (not Tempfile); - - exit; - - -- Otherwise one of the files has Shared=Yes and one has - -- Shared=No. If the current file has Shared=No then all - -- is well but we don't want to share any other file's - -- stream. If the current file has Shared=Yes, we would - -- like to share a stream, but not from a file that has - -- Shared=No, so either way, we just continue the search. - - else - null; - end if; - end if; - - P := P.Next; - end loop; - - SSL.Unlock_Task.all; - - exception - when others => - SSL.Unlock_Task.all; - raise; - end; - end if; - - -- Open specified file if we did not find an existing stream, - -- otherwise we just return as there is nothing more to be done. - - if Stream /= NULL_Stream then - return; - - else - Fopen_Mode - (Namestr => Namestr, - Mode => Mode, - Text => Text_Encoding in Text_Content_Encoding, - Creat => Creat, - Amethod => Amethod, - Fopstr => Fopstr); - - -- A special case, if we are opening (OPEN case) a file and the - -- mode returned by Fopen_Mode is not "r" or "r+", then we first - -- make sure that the file exists as required by Ada semantics. - - if not Creat and then Fopstr (1) /= 'r' then - if file_exists (Namestr'Address) = 0 then - raise Name_Error with Errno_Message (Name); - end if; - end if; - - -- Now open the file. Note that we use the name as given in the - -- original Open call for this purpose, since that seems the - -- clearest implementation of the intent. It would presumably - -- work to use the full name here, but if there is any difference, - -- then we should use the name used in the call. - - -- Note: for a corresponding delete, we will use the full name, - -- since by the time of the delete, the current working directory - -- may have changed and we do not want to delete a different file. - - Stream := - fopen (Namestr'Address, Fopstr'Address, Encoding); - - if Stream = NULL_Stream then - - -- Raise Name_Error if trying to open a non-existent file. - -- Otherwise raise Use_Error. - - -- Should we raise Device_Error for ENOSPC??? - - declare - function Is_File_Not_Found_Error - (Errno_Value : Integer) return Integer; - pragma Import - (C, Is_File_Not_Found_Error, - "__gnat_is_file_not_found_error"); - -- Non-zero when the given errno value indicates a non- - -- existing file. - - Errno : constant Integer := OS_Lib.Errno; - Message : constant String := Errno_Message (Name, Errno); - - begin - if Is_File_Not_Found_Error (Errno) /= 0 then - raise Name_Error with Message; - else - raise Use_Error with Message; - end if; - end; - end if; - end if; - end if; - - -- Stream has been successfully located or opened, so now we are - -- committed to completing the opening of the file. Allocate block on - -- heap and fill in its fields. - - Record_AFCB; - - if Tempfile then - -- Chain to temp file list, ensuring thread safety with a lock - - begin - SSL.Lock_Task.all; - Temp_Files := - new Temp_File_Record' - (File => File_Ptr, Name => Namestr, Next => Temp_Files); - SSL.Unlock_Task.all; - - exception - when others => - SSL.Unlock_Task.all; - raise; - end; - end if; - end Open; - - ------------------------ - -- Raise_Device_Error -- - ------------------------ - - procedure Raise_Device_Error - (File : AFCB_Ptr; - Errno : Integer := OS_Lib.Errno) - is - begin - -- Clear error status so that the same error is not reported twice - - if File /= null then - clearerr (File.Stream); - end if; - - raise Device_Error with OS_Lib.Errno_Message (Err => Errno); - end Raise_Device_Error; - - -------------- - -- Read_Buf -- - -------------- - - procedure Read_Buf (File : AFCB_Ptr; Buf : Address; Siz : size_t) is - Nread : size_t; - - begin - Nread := fread (Buf, 1, Siz, File.Stream); - - if Nread = Siz then - return; - - elsif ferror (File.Stream) /= 0 then - Raise_Device_Error (File); - - elsif Nread = 0 then - raise End_Error; - - else -- 0 < Nread < Siz - raise Data_Error with "not enough data read"; - end if; - end Read_Buf; - - procedure Read_Buf - (File : AFCB_Ptr; - Buf : Address; - Siz : Interfaces.C_Streams.size_t; - Count : out Interfaces.C_Streams.size_t) - is - begin - Count := fread (Buf, 1, Siz, File.Stream); - - if Count = 0 and then ferror (File.Stream) /= 0 then - Raise_Device_Error (File); - end if; - end Read_Buf; - - ----------- - -- Reset -- - ----------- - - -- The reset which does not change the mode simply does a rewind - - procedure Reset (File_Ptr : access AFCB_Ptr) is - File : AFCB_Ptr renames File_Ptr.all; - begin - Check_File_Open (File); - Reset (File_Ptr, File.Mode); - end Reset; - - -- The reset with a change in mode is done using freopen, and is not - -- permitted except for regular files (since otherwise there is no name for - -- the freopen, and in any case it seems meaningless). - - procedure Reset (File_Ptr : access AFCB_Ptr; Mode : File_Mode) is - File : AFCB_Ptr renames File_Ptr.all; - Fopstr : aliased Fopen_String; - - begin - Check_File_Open (File); - - -- Change of mode not allowed for shared file or file with no name or - -- file that is not a regular file, or for a system file. Note that we - -- allow the "change" of mode if it is not in fact doing a change. - - if Mode /= File.Mode then - if File.Shared_Status = Yes then - raise Use_Error with "cannot change mode of shared file"; - elsif File.Name'Length <= 1 then - raise Use_Error with "cannot change mode of temp file"; - elsif File.Is_System_File then - raise Use_Error with "cannot change mode of system file"; - elsif not File.Is_Regular_File then - raise Use_Error with "cannot change mode of non-regular file"; - end if; - end if; - - -- For In_File or Inout_File for a regular file, we can just do a rewind - -- if the mode is unchanged, which is more efficient than doing a full - -- reopen. - - if Mode = File.Mode - and then Mode in Read_File_Mode - then - rewind (File.Stream); - - -- Here the change of mode is permitted, we do it by reopening the file - -- in the new mode and replacing the stream with a new stream. - - else - Fopen_Mode - (Namestr => File.Name.all, - Mode => Mode, - Text => File.Text_Encoding in Text_Content_Encoding, - Creat => False, - Amethod => File.Access_Method, - Fopstr => Fopstr); - - File.Stream := freopen - (File.Name.all'Address, Fopstr'Address, File.Stream, - File.Encoding); - - if File.Stream = NULL_Stream then - Close (File_Ptr); - raise Use_Error; - else - File.Mode := Mode; - Append_Set (File); - end if; - end if; - end Reset; - - --------------- - -- Write_Buf -- - --------------- - - procedure Write_Buf (File : AFCB_Ptr; Buf : Address; Siz : size_t) is - begin - -- Note: for most purposes, the Siz and 1 parameters in the fwrite call - -- could be reversed, but we have encountered systems where this is a - -- better choice, since for some file formats, reversing the parameters - -- results in records of one byte each. - - SSL.Abort_Defer.all; - - if fwrite (Buf, Siz, 1, File.Stream) /= 1 then - if Siz /= 0 then - SSL.Abort_Undefer.all; - Raise_Device_Error (File); - end if; - end if; - - SSL.Abort_Undefer.all; - end Write_Buf; - -end System.File_IO; |