aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/prj-env.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@act-europe.fr>2003-10-21 15:42:24 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2003-10-21 15:42:24 +0200
commitfbf5a39b3e101719c6bf03cf2cd013b4a312e275 (patch)
treebdfc70477b60f1220cb05dd233a4570dd9c6bb5c /gcc/ada/prj-env.adb
parent75a5a481c2048242ed62c7355381160aa1369616 (diff)
downloadgcc-fbf5a39b3e101719c6bf03cf2cd013b4a312e275.zip
gcc-fbf5a39b3e101719c6bf03cf2cd013b4a312e275.tar.gz
gcc-fbf5a39b3e101719c6bf03cf2cd013b4a312e275.tar.bz2
3psoccon.ads, [...]: Files added.
2003-10-21 Arnaud Charlet <charlet@act-europe.fr> * 3psoccon.ads, 3veacodu.adb, 3vexpect.adb, 3vsoccon.ads, 3vsocthi.adb, 3vsocthi.ads, 3vtrasym.adb, 3zsoccon.ads, 3zsocthi.adb, 3zsocthi.ads, 50system.ads, 51system.ads, 55system.ads, 56osinte.adb, 56osinte.ads, 56taprop.adb, 56taspri.ads, 56tpopsp.adb, 57system.ads, 58system.ads, 59system.ads, 5aml-tgt.adb, 5bml-tgt.adb, 5csystem.ads, 5dsystem.ads, 5fosinte.adb, 5gml-tgt.adb, 5hml-tgt.adb, 5isystem.ads, 5lparame.adb, 5msystem.ads, 5psystem.ads, 5sml-tgt.adb, 5sosprim.adb, 5stpopsp.adb, 5tsystem.ads, 5usystem.ads, 5vml-tgt.adb, 5vsymbol.adb, 5vtraent.adb, 5vtraent.ads, 5wml-tgt.adb, 5xparame.ads, 5xsystem.ads, 5xvxwork.ads, 5yparame.ads, 5ytiitho.adb, 5zinit.adb, 5zml-tgt.adb, 5zparame.ads, 5ztaspri.ads, 5ztfsetr.adb, 5zthrini.adb, 5ztiitho.adb, 5ztpopsp.adb, 7stfsetr.adb, 7straces.adb, 7strafor.adb, 7strafor.ads, 7stratas.adb, a-excach.adb, a-exexda.adb, a-exexpr.adb, a-exextr.adb, a-exstat.adb, a-strsup.adb, a-strsup.ads, a-stwisu.adb, a-stwisu.ads, bld.adb, bld.ads, bld-io.adb, bld-io.ads, clean.adb, clean.ads, ctrl_c.c, erroutc.adb, erroutc.ads, errutil.adb, errutil.ads, err_vars.ads, final.c, g-arrspl.adb, g-arrspl.ads, g-boubuf.adb, g-boubuf.ads, g-boumai.ads, g-bubsor.adb, g-bubsor.ads, g-comver.adb, g-comver.ads, g-ctrl_c.ads, g-dynhta.adb, g-dynhta.ads, g-eacodu.adb, g-excact.adb, g-excact.ads, g-heasor.adb, g-heasor.ads, g-memdum.adb, g-memdum.ads, gnatclean.adb, gnatsym.adb, g-pehage.adb, g-pehage.ads, g-perhas.ads, gpr2make.adb, gpr2make.ads, gprcmd.adb, gprep.adb, gprep.ads, g-semaph.adb, g-semaph.ads, g-string.adb, g-string.ads, g-strspl.ads, g-wistsp.ads, i-vthrea.adb, i-vthrea.ads, i-vxwoio.adb, i-vxwoio.ads, Makefile.generic, Makefile.prolog, Makefile.rtl, prep.adb, prep.ads, prepcomp.adb, prepcomp.ads, prj-err.adb, prj-err.ads, s-boarop.ads, s-carsi8.adb, s-carsi8.ads, s-carun8.adb, s-carun8.ads, s-casi16.adb, s-casi16.ads, s-casi32.adb, s-casi32.ads, s-casi64.adb, s-casi64.ads, s-casuti.adb, s-casuti.ads, s-caun16.adb, s-caun16.ads, s-caun32.adb, s-caun32.ads, s-caun64.adb, s-caun64.ads, scng.adb, scng.ads, s-exnint.adb, s-exnllf.adb, s-exnlli.adb, s-expint.adb, s-explli.adb, s-geveop.adb, s-geveop.ads, s-hibaen.ads, s-htable.adb, s-htable.ads, sinput-c.adb, sinput-c.ads, s-memcop.ads, socket.c, s-purexc.ads, s-scaval.adb, s-stopoo.adb, s-strcom.adb, s-strcom.ads, s-strxdr.adb, s-rident.ads, s-thread.adb, s-thread.ads, s-tpae65.adb, s-tpae65.ads, s-tporft.adb, s-traent.adb, s-traent.ads, styleg.adb, styleg.ads, styleg-c.adb, styleg-c.ads, s-veboop.adb, s-veboop.ads, s-vector.ads, symbols.adb, symbols.ads, tb-alvms.c, tb-alvxw.c, tempdir.adb, tempdir.ads, vms_conv.ads, vms_conv.adb, vms_data.ads, vxaddr2line.adb: Files added. Merge with ACT tree. * 4dintnam.ads, 4mintnam.ads, 4uintnam.ads, 52system.ads, 5dosinte.ads, 5etpopse.adb, 5mosinte.ads, 5qosinte.adb, 5qosinte.ads, 5qstache.adb, 5qtaprop.adb, 5qtaspri.ads, 5stpopse.adb, 5uintman.adb, 5uosinte.ads, adafinal.c, g-enblsp.adb, io-aux.c, scn-nlit.adb, scn-slit.adb, s-exnflt.ads, s-exngen.adb, s-exngen.ads, s-exnlfl.ads, s-exnlin.ads, s-exnsfl.ads, s-exnsin.ads, s-exnssi.ads, s-expflt.ads, s-expgen.adb, s-expgen.ads, s-explfl.ads, s-explin.ads, s-expllf.ads, s-expsfl.ads, s-expsin.ads, s-expssi.ads, style.adb: Files removed. Merge with ACT tree. * 1ic.ads, 31soccon.ads, 31soliop.ads, 3asoccon.ads, 3bsoccon.ads, 3gsoccon.ads, 3hsoccon.ads, 3ssoccon.ads, 3ssoliop.ads, 3wsoccon.ads, 3wsocthi.adb, 3wsocthi.ads, 3wsoliop.ads, 41intnam.ads, 42intnam.ads, 4aintnam.ads, 4cintnam.ads, 4gintnam.ads, 4hexcpol.adb, 4hintnam.ads, 4lintnam.ads, 4nintnam.ads, 4ointnam.ads, 4onumaux.ads, 4pintnam.ads, 4sintnam.ads, 4vcaldel.adb, 4vcalend.adb, 4vintnam.ads, 4wexcpol.adb, 4wintnam.ads, 4zintnam.ads, 51osinte.adb, 51osinte.ads, 52osinte.adb, 52osinte.ads, 53osinte.ads, 54osinte.ads, 5aosinte.adb, 5aosinte.ads, 5asystem.ads, 5ataprop.adb, 5atasinf.ads, 5ataspri.ads, 5atpopsp.adb, 5avxwork.ads, 5bosinte.adb, 5bosinte.ads, 5bsystem.ads, 5cosinte.ads, 5esystem.ads, 5fintman.adb, 5fosinte.ads, 5fsystem.ads, 5ftaprop.adb, 5ftasinf.ads, 5ginterr.adb, 5gintman.adb, 5gmastop.adb, 5gosinte.ads, 5gproinf.ads, 5gsystem.ads, 5gtaprop.adb, 5gtasinf.ads, 5gtpgetc.adb, 5hosinte.adb, 5hosinte.ads, 5hsystem.ads, 5htaprop.adb, 5htaspri.ads, 5htraceb.adb, 5iosinte.adb, 5itaprop.adb, 5itaspri.ads, 5ksystem.ads, 5kvxwork.ads, 5lintman.adb, 5lml-tgt.adb, 5losinte.ads, 5lsystem.ads, 5mvxwork.ads, 5ninmaop.adb, 5nintman.adb, 5nosinte.ads, 5ntaprop.adb, 5ntaspri.ads, 5ointerr.adb, 5omastop.adb, 5oosinte.adb, 5oosinte.ads, 5oosprim.adb, 5oparame.adb, 5osystem.ads, 5otaprop.adb, 5otaspri.ads, 5posinte.ads, 5posprim.adb, 5pvxwork.ads, 5sintman.adb, 5sosinte.adb, 5sosinte.ads, 5ssystem.ads, 5staprop.adb, 5stasinf.ads, 5staspri.ads, 5svxwork.ads, 5tosinte.ads, 5vasthan.adb, 5vinmaop.adb, 5vinterr.adb, 5vintman.adb, 5vintman.ads, 5vmastop.adb, 5vosinte.adb, 5vosinte.ads, 5vosprim.adb, 5vsystem.ads, 5vtaprop.adb, 5vtaspri.ads, 5vtpopde.adb, 5vtpopde.ads, 5wgloloc.adb, 5wintman.adb, 5wmemory.adb, 5wosprim.adb, 5wsystem.ads, 5wtaprop.adb, 5wtaspri.ads, 5ysystem.ads, 5zinterr.adb, 5zintman.adb, 5zosinte.adb, 5zosinte.ads, 5zosprim.adb, 5zsystem.ads, 5ztaprop.adb, 6vcpp.adb, 6vcstrea.adb, 6vinterf.ads, 7sinmaop.adb, 7sintman.adb, 7sosinte.adb, 7sosprim.adb, 7staprop.adb, 7staspri.ads, 7stpopsp.adb, 7straceb.adb, 9drpc.adb, a-caldel.adb, a-caldel.ads, a-charac.ads, a-colien.ads, a-comlin.adb, adaint.c, adaint.h, ada-tree.def, a-diocst.adb, a-diocst.ads, a-direio.adb, a-except.adb, a-except.ads, a-excpol.adb, a-exctra.adb, a-exctra.ads, a-filico.adb, a-interr.adb, a-intsig.adb, a-intsig.ads, ali.adb, ali.ads, ali-util.adb, ali-util.ads, a-ngcefu.adb, a-ngcoty.adb, a-ngelfu.adb, a-nudira.adb, a-nudira.ads, a-nuflra.adb, a-nuflra.ads, a-reatim.adb, a-reatim.ads, a-retide.ads, a-sequio.adb, a-siocst.adb, a-siocst.ads, a-ssicst.adb, a-ssicst.ads, a-strbou.adb, a-strbou.ads, a-strfix.adb, a-strmap.adb, a-strsea.ads, a-strunb.adb, a-strunb.ads, a-ststio.adb, a-stunau.adb, a-stunau.ads, a-stwibo.adb, a-stwibo.ads, a-stwifi.adb, a-stwima.adb, a-stwiun.adb, a-stwiun.ads, a-tags.adb, a-tags.ads, a-tasatt.adb, a-taside.adb, a-teioed.adb, a-textio.adb, a-textio.ads, a-tienau.adb, a-tifiio.adb, a-tiflau.adb, a-tiflio.adb, a-tigeau.adb, a-tigeau.ads, a-tiinau.adb, a-timoau.adb, a-tiocst.adb, a-tiocst.ads, atree.adb, atree.ads, a-witeio.adb, a-witeio.ads, a-wtcstr.adb, a-wtcstr.ads, a-wtdeio.adb, a-wtedit.adb, a-wtenau.adb, a-wtflau.adb, a-wtinau.adb, a-wtmoau.adb, bcheck.adb, binde.adb, bindgen.adb, bindusg.adb, checks.adb, checks.ads, cio.c, comperr.adb, comperr.ads, csets.adb, cstand.adb, cstreams.c, debug_a.adb, debug_a.ads, debug.adb, decl.c, einfo.adb, einfo.ads, errout.adb, errout.ads, eval_fat.adb, eval_fat.ads, exp_aggr.adb, expander.adb, expander.ads, exp_attr.adb, exp_ch11.adb, exp_ch13.adb, exp_ch2.adb, exp_ch3.adb, exp_ch3.ads, exp_ch4.adb, exp_ch5.adb, exp_ch6.adb, exp_ch7.adb, exp_ch7.ads, exp_ch8.adb, exp_ch9.adb, exp_code.adb, exp_dbug.adb, exp_dbug.ads, exp_disp.adb, exp_dist.adb, expect.c, exp_fixd.adb, exp_imgv.adb, exp_intr.adb, exp_pakd.adb, exp_prag.adb, exp_strm.adb, exp_strm.ads, exp_tss.adb, exp_tss.ads, exp_util.adb, exp_util.ads, exp_vfpt.adb, fe.h, fmap.adb, fmap.ads, fname.adb, fname.ads, fname-uf.adb, fname-uf.ads, freeze.adb, freeze.ads, frontend.adb, g-awk.adb, g-awk.ads, g-busora.adb, g-busora.ads, g-busorg.adb, g-busorg.ads, g-casuti.adb, g-casuti.ads, g-catiio.adb, g-catiio.ads, g-cgi.adb, g-cgi.ads, g-cgicoo.adb, g-cgicoo.ads, g-cgideb.adb, g-cgideb.ads, g-comlin.adb, g-comlin.ads, g-crc32.adb, g-crc32.ads, g-debpoo.adb, g-debpoo.ads, g-debuti.adb, g-debuti.ads, g-diopit.adb, g-diopit.ads, g-dirope.adb, g-dirope.ads, g-dyntab.adb, g-dyntab.ads, g-except.ads, g-exctra.adb, g-exctra.ads, g-expect.adb, g-expect.ads, g-hesora.adb, g-hesora.ads, g-hesorg.adb, g-hesorg.ads, g-htable.adb, g-htable.ads, gigi.h, g-io.adb, g-io.ads, g-io_aux.adb, g-io_aux.ads, g-locfil.adb, g-locfil.ads, g-md5.adb, g-md5.ads, gmem.c, gnat1drv.adb, gnatbind.adb, gnatchop.adb, gnatcmd.adb, gnatfind.adb, gnatkr.adb, gnatlbr.adb, gnatlink.adb, gnatls.adb, gnatmake.adb, gnatmem.adb, gnatname.adb, gnatprep.adb, gnatprep.ads, gnatpsta.adb, gnatxref.adb, g-os_lib.adb, g-os_lib.ads, g-regexp.adb, g-regexp.ads, g-regist.adb, g-regist.ads, g-regpat.adb, g-regpat.ads, g-soccon.ads, g-socket.adb, g-socket.ads, g-socthi.adb, g-socthi.ads, g-soliop.ads, g-souinf.ads, g-speche.adb, g-speche.ads, g-spipat.adb, g-spipat.ads, g-spitbo.adb, g-spitbo.ads, g-sptabo.ads, g-sptain.ads, g-sptavs.ads, g-table.adb, g-table.ads, g-tasloc.adb, g-tasloc.ads, g-thread.adb, g-thread.ads, g-traceb.adb, g-traceb.ads, g-trasym.adb, g-trasym.ads, hostparm.ads, i-c.ads, i-cobol.adb, i-cpp.adb, i-cstrea.ads, i-cstrin.adb, i-cstrin.ads, impunit.adb, init.c, inline.adb, interfac.ads, i-pacdec.ads, itypes.adb, itypes.ads, i-vxwork.ads, lang.opt, lang-specs.h, layout.adb, lib.adb, lib.ads, lib-list.adb, lib-load.adb, lib-load.ads, lib-sort.adb, lib-util.adb, lib-writ.adb, lib-writ.ads, lib-xref.adb, lib-xref.ads, link.c, live.adb, make.adb, make.ads, Makefile.adalib, Makefile.in, Make-lang.in, makeusg.adb, mdll.adb, mdll-fil.adb, mdll-fil.ads, mdll-utl.adb, mdll-utl.ads, memroot.adb, memroot.ads, memtrack.adb, misc.c, mkdir.c, mlib.adb, mlib.ads, mlib-fil.adb, mlib-fil.ads, mlib-prj.adb, mlib-prj.ads, mlib-tgt.adb, mlib-tgt.ads, mlib-utl.adb, mlib-utl.ads, namet.adb, namet.ads, namet.h, nlists.ads, nlists.h, nmake.adt, opt.adb, opt.ads, osint.adb, osint.ads, osint-b.adb, osint-c.adb, par.adb, par-ch10.adb, par-ch11.adb, par-ch2.adb, par-ch3.adb, par-ch4.adb, par-ch5.adb, par-ch6.adb, par-ch9.adb, par-endh.adb, par-labl.adb, par-load.adb, par-prag.adb, par-sync.adb, par-tchk.adb, par-util.adb, prj.adb, prj.ads, prj-attr.adb, prj-attr.ads, prj-com.adb, prj-com.ads, prj-dect.adb, prj-dect.ads, prj-env.adb, prj-env.ads, prj-ext.adb, prj-ext.ads, prj-makr.adb, prj-makr.ads, prj-nmsc.adb, prj-nmsc.ads, prj-pars.adb, prj-pars.ads, prj-part.adb, prj-part.ads, prj-pp.adb, prj-pp.ads, prj-proc.adb, prj-proc.ads, prj-strt.adb, prj-strt.ads, prj-tree.adb, prj-tree.ads, prj-util.adb, prj-util.ads, raise.c, raise.h, repinfo.adb, repinfo.h, restrict.adb, restrict.ads, rident.ads, rtsfind.adb, rtsfind.ads, s-addima.ads, s-arit64.adb, s-assert.adb, s-assert.ads, s-atacco.adb, s-atacco.ads, s-auxdec.adb, s-auxdec.ads, s-bitops.adb, scans.ads, scn.adb, scn.ads, s-crc32.adb, s-crc32.ads, s-direio.adb, sem.adb, sem.ads, sem_aggr.adb, sem_attr.adb, sem_attr.ads, sem_case.adb, sem_case.ads, sem_cat.adb, sem_cat.ads, sem_ch10.adb, sem_ch11.adb, sem_ch12.adb, sem_ch12.ads, sem_ch13.adb, sem_ch13.ads, sem_ch3.adb, sem_ch3.ads, sem_ch4.adb, sem_ch5.adb, sem_ch5.ads, sem_ch6.adb, sem_ch6.ads, sem_ch7.adb, sem_ch7.ads, sem_ch8.adb, sem_ch8.ads, sem_ch9.adb, sem_disp.adb, sem_disp.ads, sem_dist.adb, sem_elab.adb, sem_eval.adb, sem_eval.ads, sem_intr.adb, sem_maps.adb, sem_mech.adb, sem_prag.adb, sem_prag.ads, sem_res.adb, sem_res.ads, sem_type.adb, sem_type.ads, sem_util.adb, sem_util.ads, sem_warn.adb, s-errrep.adb, s-errrep.ads, s-exctab.adb, s-exctab.ads, s-exnint.ads, s-exnllf.ads, s-exnlli.ads, s-expint.ads, s-explli.ads, s-expuns.ads, s-fatflt.ads, s-fatgen.adb, s-fatgen.ads, s-fatlfl.ads, s-fatllf.ads, s-fatsfl.ads, s-fileio.adb, s-fileio.ads, s-finimp.adb, s-finimp.ads, s-finroo.adb, s-finroo.ads, sfn_scan.adb, s-gloloc.adb, s-gloloc.ads, s-imgdec.adb, s-imgenu.adb, s-imgrea.adb, s-imgwch.adb, sinfo.adb, sinfo.ads, s-inmaop.ads, sinput.adb, sinput.ads, sinput-d.adb, sinput-l.adb, sinput-l.ads, sinput-p.adb, sinput-p.ads, s-interr.adb, s-interr.ads, s-intman.ads, s-maccod.ads, s-mastop.adb, s-mastop.ads, s-memory.adb, s-memory.ads, snames.adb, snames.ads, snames.h, s-osprim.ads, s-parame.ads, s-parint.ads, s-pooloc.adb, s-pooloc.ads, s-poosiz.adb, sprint.adb, s-proinf.ads, s-scaval.ads, s-secsta.adb, s-secsta.ads, s-sequio.adb, s-shasto.adb, s-shasto.ads, s-soflin.ads, s-stache.adb, s-stache.ads, s-stalib.adb, s-stalib.ads, s-stoele.ads, s-stopoo.ads, s-stratt.adb, s-stratt.ads, s-strops.adb, s-strops.ads, s-taasde.adb, s-taasde.ads, s-tadeca.adb, s-tadeca.ads, s-tadert.adb, s-tadert.ads, s-taenca.adb, s-taenca.ads, s-taprob.adb, s-taprob.ads, s-taprop.ads, s-tarest.adb, s-tarest.ads, s-tasdeb.adb, s-tasdeb.ads, s-tasinf.adb, s-tasinf.ads, s-tasini.adb, s-tasini.ads, s-taskin.adb, s-taskin.ads, s-tasque.adb, s-tasque.ads, s-tasren.adb, s-tasren.ads, s-tasres.ads, s-tassta.adb, s-tassta.ads, s-tasuti.adb, s-tasuti.ads, s-tataat.adb, s-tataat.ads, s-tpinop.adb, s-tpinop.ads, s-tpoben.adb, s-tpoben.ads, s-tpobop.adb, s-tpobop.ads, s-tposen.adb, s-tposen.ads, s-traceb.adb, s-traceb.ads, stringt.adb, stringt.ads, stringt.h, style.ads, stylesw.adb, stylesw.ads, s-unstyp.ads, s-vaflop.ads, s-valrea.adb, s-valuti.adb, s-vercon.adb, s-vmexta.adb, s-wchcnv.ads, s-wchcon.ads, s-widcha.adb, switch.adb, switch.ads, switch-b.adb, switch-c.adb, switch-m.adb, s-wwdcha.adb, s-wwdwch.adb, sysdep.c, system.ads, table.adb, table.ads, targparm.adb, targparm.ads, targtyps.c, tbuild.adb, tbuild.ads, tracebak.c, trans.c, tree_io.adb, treepr.adb, treeprs.adt, ttypes.ads, types.ads, types.h, uintp.adb, uintp.ads, uintp.h, uname.adb, urealp.adb, urealp.ads, urealp.h, usage.adb, utils2.c, utils.c, validsw.adb, validsw.ads, widechar.adb, xeinfo.adb, xnmake.adb, xref_lib.adb, xref_lib.ads, xr_tabls.adb, xr_tabls.ads, xtreeprs.adb, xsnames.adb, einfo.h, sinfo.h, treeprs.ads, nmake.ads, nmake.adb, gnatvsn.ads: Merge with ACT tree. * gnatvsn.adb: Rewritten in a simpler and more efficient way. From-SVN: r72751
Diffstat (limited to 'gcc/ada/prj-env.adb')
-rw-r--r--gcc/ada/prj-env.adb1061
1 files changed, 724 insertions, 337 deletions
diff --git a/gcc/ada/prj-env.adb b/gcc/ada/prj-env.adb
index 3faf081..9df20fa 100644
--- a/gcc/ada/prj-env.adb
+++ b/gcc/ada/prj-env.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2002 Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2003 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- --
@@ -24,28 +24,43 @@
-- --
------------------------------------------------------------------------------
-with GNAT.OS_Lib; use GNAT.OS_Lib;
-with Namet; use Namet;
+with Namet; use Namet;
with Opt;
-with Osint; use Osint;
-with Output; use Output;
-with Prj.Com; use Prj.Com;
-with Prj.Util;
-with Snames; use Snames;
-with Stringt; use Stringt;
+with Osint; use Osint;
+with Output; use Output;
+with Prj.Com; use Prj.Com;
with Table;
+with Tempdir;
+
+with GNAT.OS_Lib; use GNAT.OS_Lib;
package body Prj.Env is
type Naming_Id is new Nat;
- Ada_Path_Buffer : String_Access := new String (1 .. 1_000);
+ Current_Source_Path_File : Name_Id := No_Name;
+ -- Current value of project source path file env var.
+ -- Used to avoid setting the env var to the same value.
+
+ Current_Object_Path_File : Name_Id := No_Name;
+ -- Current value of project object path file env var.
+ -- Used to avoid setting the env var to the same value.
+
+ Ada_Path_Buffer : String_Access := new String (1 .. 1024);
-- A buffer where values for ADA_INCLUDE_PATH
-- and ADA_OBJECTS_PATH are stored.
Ada_Path_Length : Natural := 0;
-- Index of the last valid character in Ada_Path_Buffer.
+ Ada_Prj_Include_File_Set : Boolean := False;
+ Ada_Prj_Objects_File_Set : Boolean := False;
+ -- These flags are set to True when the corresponding environment variables
+ -- are set and are used to give these environment variables an empty string
+ -- value at the end of the program. This has no practical effect on most
+ -- platforms, except on VMS where the logical names are deassigned, thus
+ -- avoiding the pollution of the environment of the caller.
+
package Namings is new Table.Table (
Table_Component_Type => Naming_Data,
Table_Index_Type => Naming_Id,
@@ -56,11 +71,22 @@ package body Prj.Env is
Default_Naming : constant Naming_Id := Namings.First;
- Global_Configuration_Pragmas : Name_Id;
- Local_Configuration_Pragmas : Name_Id;
-
Fill_Mapping_File : Boolean := True;
+ package Path_Files is new Table.Table (
+ Table_Component_Type => Name_Id,
+ Table_Index_Type => Natural,
+ Table_Low_Bound => 1,
+ Table_Initial => 50,
+ Table_Increment => 50,
+ Table_Name => "Prj.Env.Path_Files");
+ -- Table storing all the temp path file names.
+ -- Used by Delete_All_Path_Files.
+
+ type Project_Flags is array (Project_Id range <>) of Boolean;
+ -- A Boolean array type used in Create_Mapping_File to select the projects
+ -- in the closure of a specific project.
+
-----------------------
-- Local Subprograms --
-----------------------
@@ -77,9 +103,36 @@ package body Prj.Env is
-- Add to Ada_Path_Buffer all the source directories in string list
-- Source_Dirs, if any. Increment Ada_Path_Length.
- procedure Add_To_Path (Path : String);
- -- Add Path to global variable Ada_Path_Buffer
- -- Increment Ada_Path_Length
+ procedure Add_To_Path (Dir : String);
+ -- If Dir is not already in the global variable Ada_Path_Buffer, add it.
+ -- Increment Ada_Path_Length.
+ -- If Ada_Path_Length /= 0, prepend a Path_Separator character to
+ -- Path.
+
+ procedure Add_To_Path_File
+ (Source_Dirs : String_List_Id;
+ Path_File : File_Descriptor);
+ -- Add to Ada_Path_Buffer all the source directories in string list
+ -- Source_Dirs, if any. Increment Ada_Path_Length.
+
+ procedure Add_To_Path_File
+ (Path : String;
+ Path_File : File_Descriptor);
+ -- Add Path to path file
+
+ procedure Create_New_Path_File
+ (Path_FD : out File_Descriptor;
+ Path_Name : out Name_Id);
+ -- Create a new temporary path file. Get the file name in Path_Name.
+ -- The name is normally obtained by increasing the number in
+ -- Temp_Path_File_Name by 1.
+
+ procedure Set_Path_File_Var (Name : String; Value : String);
+ -- Call Setenv, after calling To_Host_File_Spec
+
+ function Ultimate_Extension_Of (Project : in Project_Id) return Project_Id;
+ -- Return a project that is either Project or an extended ancestor of
+ -- Project that itself is not extended.
----------------------
-- Ada_Include_Path --
@@ -90,7 +143,7 @@ package body Prj.Env is
procedure Add (Project : Project_Id);
-- Add all the source directories of a project to the path only if
-- this project has not been visited. Calls itself recursively for
- -- projects being modified, and imported projects. Adds the project
+ -- projects being extended, and imported projects. Adds the project
-- to the list Seen if this is the call to Add for this project.
---------
@@ -105,7 +158,7 @@ package body Prj.Env is
Projects.Table (Project).Seen := True;
declare
- Data : Project_Data := Projects.Table (Project);
+ Data : constant Project_Data := Projects.Table (Project);
List : Project_List := Data.Imported_Projects;
begin
@@ -113,10 +166,10 @@ package body Prj.Env is
Add_To_Path (Data.Source_Dirs);
- -- Call Add to the project being modified, if any
+ -- Call Add to the project being extended, if any
- if Data.Modifies /= No_Project then
- Add (Data.Modifies);
+ if Data.Extends /= No_Project then
+ Add (Data.Extends);
end if;
-- Call Add for each imported project, if any
@@ -135,7 +188,7 @@ package body Prj.Env is
-- If it is the first time we call this function for
-- this project, compute the source path
- if Projects.Table (Project).Include_Path = null then
+ if Projects.Table (Project).Ada_Include_Path = null then
Ada_Path_Length := 0;
for Index in 1 .. Projects.Last loop
@@ -143,11 +196,11 @@ package body Prj.Env is
end loop;
Add (Project);
- Projects.Table (Project).Include_Path :=
+ Projects.Table (Project).Ada_Include_Path :=
new String'(Ada_Path_Buffer (1 .. Ada_Path_Length));
end if;
- return Projects.Table (Project).Include_Path;
+ return Projects.Table (Project).Ada_Include_Path;
end Ada_Include_Path;
function Ada_Include_Path
@@ -177,7 +230,7 @@ package body Prj.Env is
procedure Add (Project : Project_Id);
-- Add all the object directories of a project to the path only if
-- this project has not been visited. Calls itself recursively for
- -- projects being modified, and imported projects. Adds the project
+ -- projects being extended, and imported projects. Adds the project
-- to the list Seen if this is the first call to Add for this project.
---------
@@ -192,7 +245,7 @@ package body Prj.Env is
Projects.Table (Project).Seen := True;
declare
- Data : Project_Data := Projects.Table (Project);
+ Data : constant Project_Data := Projects.Table (Project);
List : Project_List := Data.Imported_Projects;
begin
@@ -206,35 +259,22 @@ package body Prj.Env is
and then
(not Including_Libraries or else not Data.Library))
then
- if Ada_Path_Length > 0 then
- Add_To_Path (Path => (1 => Path_Separator));
- end if;
-
- -- For a library project, att the library directory
+ -- For a library project, add the library directory
if Data.Library then
- declare
- New_Path : constant String :=
- Get_Name_String (Data.Library_Dir);
- begin
- Add_To_Path (New_Path);
- end;
- else
+ Add_To_Path (Get_Name_String (Data.Library_Dir));
+ else
-- For a non library project, add the object directory
- declare
- New_Path : constant String :=
- Get_Name_String (Data.Object_Directory);
- begin
- Add_To_Path (New_Path);
- end;
+
+ Add_To_Path (Get_Name_String (Data.Object_Directory));
end if;
end if;
- -- Call Add to the project being modified, if any
+ -- Call Add to the project being extended, if any
- if Data.Modifies /= No_Project then
- Add (Data.Modifies);
+ if Data.Extends /= No_Project then
+ Add (Data.Extends);
end if;
-- Call Add for each imported project, if any
@@ -254,7 +294,7 @@ package body Prj.Env is
-- If it is the first time we call this function for
-- this project, compute the objects path
- if Projects.Table (Project).Objects_Path = null then
+ if Projects.Table (Project).Ada_Objects_Path = null then
Ada_Path_Length := 0;
for Index in 1 .. Projects.Last loop
@@ -262,11 +302,11 @@ package body Prj.Env is
end loop;
Add (Project);
- Projects.Table (Project).Objects_Path :=
+ Projects.Table (Project).Ada_Objects_Path :=
new String'(Ada_Path_Buffer (1 .. Ada_Path_Length));
end if;
- return Projects.Table (Project).Objects_Path;
+ return Projects.Table (Project).Ada_Objects_Path;
end Ada_Objects_Path;
-----------------
@@ -279,47 +319,123 @@ package body Prj.Env is
begin
while Current /= Nil_String loop
- if Ada_Path_Length > 0 then
- Add_To_Path (Path => (1 => Path_Separator));
- end if;
-
Source_Dir := String_Elements.Table (Current);
- String_To_Name_Buffer (Source_Dir.Value);
-
- declare
- New_Path : constant String :=
- Name_Buffer (1 .. Name_Len);
- begin
- Add_To_Path (New_Path);
- end;
-
+ Add_To_Path (Get_Name_String (Source_Dir.Value));
Current := Source_Dir.Next;
end loop;
end Add_To_Path;
- procedure Add_To_Path (Path : String) is
+ procedure Add_To_Path (Dir : String) is
+ Len : Natural;
+ New_Buffer : String_Access;
+ Min_Len : Natural;
+
+ function Is_Present (Path : String; Dir : String) return Boolean;
+ -- Return True if Dir is part of Path
+
+ ----------------
+ -- Is_Present --
+ ----------------
+
+ function Is_Present (Path : String; Dir : String) return Boolean is
+ Last : constant Integer := Path'Last - Dir'Length + 1;
+ begin
+ for J in Path'First .. Last loop
+ -- Note: the order of the conditions below is important, since
+ -- it ensures a minimal number of string comparisons.
+
+ if (J = Path'First
+ or else Path (J - 1) = Path_Separator)
+ and then
+ (J + Dir'Length > Path'Last
+ or else Path (J + Dir'Length) = Path_Separator)
+ and then Dir = Path (J .. J + Dir'Length - 1)
+ then
+ return True;
+ end if;
+ end loop;
+
+ return False;
+ end Is_Present;
+
begin
- -- If Ada_Path_Buffer is too small, double it
+ if Is_Present (Ada_Path_Buffer (1 .. Ada_Path_Length), Dir) then
+ -- Dir is already in the path, nothing to do
- if Ada_Path_Length + Path'Length > Ada_Path_Buffer'Last then
- declare
- New_Ada_Path_Buffer : constant String_Access :=
- new String
- (1 .. Ada_Path_Buffer'Last +
- Ada_Path_Buffer'Last);
+ return;
+ end if;
- begin
- New_Ada_Path_Buffer (1 .. Ada_Path_Length) :=
- Ada_Path_Buffer (1 .. Ada_Path_Length);
- Ada_Path_Buffer := New_Ada_Path_Buffer;
- end;
+ Min_Len := Ada_Path_Length + Dir'Length;
+
+ if Ada_Path_Length > 0 then
+ -- Add 1 for the Path_Separator character
+
+ Min_Len := Min_Len + 1;
+ end if;
+
+ -- If Ada_Path_Buffer is too small, increase it
+
+ Len := Ada_Path_Buffer'Last;
+
+ if Len < Min_Len then
+ loop
+ Len := Len * 2;
+ exit when Len >= Min_Len;
+ end loop;
+
+ New_Buffer := new String (1 .. Len);
+ New_Buffer (1 .. Ada_Path_Length) :=
+ Ada_Path_Buffer (1 .. Ada_Path_Length);
+ Free (Ada_Path_Buffer);
+ Ada_Path_Buffer := New_Buffer;
+ end if;
+
+ if Ada_Path_Length > 0 then
+ Ada_Path_Length := Ada_Path_Length + 1;
+ Ada_Path_Buffer (Ada_Path_Length) := Path_Separator;
end if;
Ada_Path_Buffer
- (Ada_Path_Length + 1 .. Ada_Path_Length + Path'Length) := Path;
- Ada_Path_Length := Ada_Path_Length + Path'Length;
+ (Ada_Path_Length + 1 .. Ada_Path_Length + Dir'Length) := Dir;
+ Ada_Path_Length := Ada_Path_Length + Dir'Length;
end Add_To_Path;
+ ----------------------
+ -- Add_To_Path_File --
+ ----------------------
+
+ procedure Add_To_Path_File
+ (Source_Dirs : String_List_Id;
+ Path_File : File_Descriptor)
+ is
+ Current : String_List_Id := Source_Dirs;
+ Source_Dir : String_Element;
+
+ begin
+ while Current /= Nil_String loop
+ Source_Dir := String_Elements.Table (Current);
+ Add_To_Path_File (Get_Name_String (Source_Dir.Value), Path_File);
+ Current := Source_Dir.Next;
+ end loop;
+ end Add_To_Path_File;
+
+ procedure Add_To_Path_File
+ (Path : String;
+ Path_File : File_Descriptor)
+ is
+ Line : String (1 .. Path'Length + 1);
+ Len : Natural;
+
+ begin
+ Line (1 .. Path'Length) := Path;
+ Line (Line'Last) := ASCII.LF;
+ Len := Write (Path_File, Line (1)'Address, Line'Length);
+
+ if Len /= Line'Length then
+ Prj.Com.Fail ("disk full");
+ end if;
+ end Add_To_Path_File;
+
-----------------------
-- Body_Path_Name_Of --
-----------------------
@@ -346,13 +462,12 @@ package body Prj.Env is
-- For each source directory
while Current_Source /= Nil_String loop
- String_To_Name_Buffer
- (String_Elements.Table (Current_Source).Value);
Path :=
Locate_Regular_File
- (Namet.Get_Name_String
- (Data.File_Names (Body_Part).Name),
- Name_Buffer (1 .. Name_Len));
+ (Namet.Get_Name_String
+ (Data.File_Names (Body_Part).Name),
+ Namet.Get_Name_String
+ (String_Elements.Table (Current_Source).Value));
-- If the file is in this directory,
-- then we store the path, and we are done.
@@ -383,15 +498,15 @@ package body Prj.Env is
--------------------------------
procedure Create_Config_Pragmas_File
- (For_Project : Project_Id;
- Main_Project : Project_Id)
+ (For_Project : Project_Id;
+ Main_Project : Project_Id;
+ Include_Config_Files : Boolean := True)
is
- File_Name : Temp_File_Name;
- File : File_Descriptor := Invalid_FD;
+ pragma Unreferenced (Main_Project);
+ pragma Unreferenced (Include_Config_Files);
- The_Packages : Package_Id;
- Gnatmake : Prj.Package_Id;
- Compiler : Prj.Package_Id;
+ File_Name : Name_Id := No_Name;
+ File : File_Descriptor := Invalid_FD;
Current_Unit : Unit_Id := Units.First;
@@ -400,11 +515,8 @@ package body Prj.Env is
Current_Project : Project_List;
Current_Naming : Naming_Id;
- Global_Attribute : Variable_Value := Nil_Variable_Value;
- Local_Attribute : Variable_Value := Nil_Variable_Value;
-
- Global_Attribute_Present : Boolean := False;
- Local_Attribute_Present : Boolean := False;
+ Status : Boolean;
+ -- For call to Close
procedure Check (Project : Project_Id);
@@ -413,9 +525,6 @@ package body Prj.Env is
-- If not, create one, and put its name in the project data,
-- with the indication that it is a temporary file.
- procedure Copy_File (Name : String_Id);
- -- Copy a configuration pragmas file into the temp file.
-
procedure Put
(Unit_Name : Name_Id;
File_Name : Name_Id;
@@ -483,7 +592,7 @@ package body Prj.Env is
-- Spec
Put_Line
- (File, "pragma Source_File_Name");
+ (File, "pragma Source_File_Name_Project");
Put_Line
(File, " (Spec_File_Name => ""*" &
Namet.Get_Name_String (Data.Naming.Current_Spec_Suffix) &
@@ -499,10 +608,10 @@ package body Prj.Env is
-- and body
Put_Line
- (File, "pragma Source_File_Name");
+ (File, "pragma Source_File_Name_Project");
Put_Line
(File, " (Body_File_Name => ""*" &
- Namet.Get_Name_String (Data.Naming.Current_Impl_Suffix) &
+ Namet.Get_Name_String (Data.Naming.Current_Body_Suffix) &
""",");
Put_Line
(File, " Casing => " &
@@ -515,10 +624,10 @@ package body Prj.Env is
-- and maybe separate
if
- Data.Naming.Current_Impl_Suffix /= Data.Naming.Separate_Suffix
+ Data.Naming.Current_Body_Suffix /= Data.Naming.Separate_Suffix
then
Put_Line
- (File, "pragma Source_File_Name");
+ (File, "pragma Source_File_Name_Project");
Put_Line
(File, " (Subunit_File_Name => ""*" &
Namet.Get_Name_String (Data.Naming.Separate_Suffix) &
@@ -534,8 +643,8 @@ package body Prj.Env is
end if;
end if;
- if Data.Modifies /= No_Project then
- Check (Data.Modifies);
+ if Data.Extends /= No_Project then
+ Check (Data.Extends);
end if;
declare
@@ -557,66 +666,19 @@ package body Prj.Env is
procedure Check_Temp_File is
begin
if File = Invalid_FD then
- GNAT.OS_Lib.Create_Temp_File (File, Name => File_Name);
+ Tempdir.Create_Temp_File (File, Name => File_Name);
+
if File = Invalid_FD then
- Osint.Fail
+ Prj.Com.Fail
("unable to create temporary configuration pragmas file");
elsif Opt.Verbose_Mode then
Write_Str ("Creating temp file """);
- Write_Str (File_Name);
+ Write_Str (Get_Name_String (File_Name));
Write_Line ("""");
end if;
end if;
end Check_Temp_File;
- ---------------
- -- Copy_File --
- ---------------
-
- procedure Copy_File (Name : in String_Id) is
- Input : File_Descriptor;
- Buffer : String (1 .. 1_000);
- Input_Length : Integer;
- Output_Length : Integer;
-
- begin
- Check_Temp_File;
- String_To_Name_Buffer (Name);
-
- if Opt.Verbose_Mode then
- Write_Str ("Copying config pragmas file """);
- Write_Str (Name_Buffer (1 .. Name_Len));
- Write_Line (""" into temp file");
- end if;
-
- declare
- Name : constant String :=
- Name_Buffer (1 .. Name_Len) & ASCII.NUL;
- begin
- Input := Open_Read (Name'Address, Binary);
- end;
-
- if Input = Invalid_FD then
- Osint.Fail
- ("cannot open configuration pragmas file " &
- Name_Buffer (1 .. Name_Len));
- end if;
-
- loop
- Input_Length := Read (Input, Buffer'Address, Buffer'Length);
- Output_Length := Write (File, Buffer'Address, Input_Length);
-
- if Output_Length /= Input_Length then
- Osint.Fail ("disk full");
- end if;
-
- exit when Input_Length < Buffer'Length;
- end loop;
-
- Close (Input);
-
- end Copy_File;
-
---------
-- Put --
---------
@@ -633,7 +695,7 @@ package body Prj.Env is
-- Put the pragma SFN for the unit kind (spec or body)
- Put (File, "pragma Source_File_Name (");
+ Put (File, "pragma Source_File_Name_Project (");
Put (File, Namet.Get_Name_String (Unit_Name));
if Unit_Kind = Specification then
@@ -653,7 +715,7 @@ package body Prj.Env is
Last := Write (File, S (S'First)'Address, S'Length);
if Last /= S'Length then
- Osint.Fail ("Disk full");
+ Prj.Com.Fail ("Disk full");
end if;
if Current_Verbosity = High then
@@ -681,7 +743,7 @@ package body Prj.Env is
Last := Write (File, S0'Address, S0'Length);
if Last /= S'Length + 1 then
- Osint.Fail ("Disk full");
+ Prj.Com.Fail ("Disk full");
end if;
if Current_Verbosity = High then
@@ -726,73 +788,41 @@ package body Prj.Env is
end;
end loop;
- The_Packages := Projects.Table (Main_Project).Decl.Packages;
- Gnatmake :=
- Prj.Util.Value_Of
- (Name => Name_Builder,
- In_Packages => The_Packages);
-
- if Gnatmake /= No_Package then
- Global_Attribute := Prj.Util.Value_Of
- (Variable_Name => Global_Configuration_Pragmas,
- In_Variables => Packages.Table (Gnatmake).Decl.Attributes);
- Global_Attribute_Present :=
- Global_Attribute /= Nil_Variable_Value
- and then String_Length (Global_Attribute.Value) > 0;
- end if;
+ -- If there are no non standard naming scheme, issue the GNAT
+ -- standard naming scheme. This will tell the compiler that
+ -- a project file is used and will forbid any pragma SFN.
- The_Packages := Projects.Table (For_Project).Decl.Packages;
- Compiler :=
- Prj.Util.Value_Of
- (Name => Name_Compiler,
- In_Packages => The_Packages);
-
- if Compiler /= No_Package then
- Local_Attribute := Prj.Util.Value_Of
- (Variable_Name => Local_Configuration_Pragmas,
- In_Variables => Packages.Table (Compiler).Decl.Attributes);
- Local_Attribute_Present :=
- Local_Attribute /= Nil_Variable_Value
- and then String_Length (Local_Attribute.Value) > 0;
- end if;
+ if File = Invalid_FD then
+ Check_Temp_File;
- if Global_Attribute_Present then
- if File /= Invalid_FD
- or else Local_Attribute_Present
- then
- Copy_File (Global_Attribute.Value);
+ Put_Line (File, "pragma Source_File_Name_Project");
+ Put_Line (File, " (Spec_File_Name => ""*.ads"",");
+ Put_Line (File, " Dot_Replacement => ""-"",");
+ Put_Line (File, " Casing => lowercase);");
- else
- String_To_Name_Buffer (Global_Attribute.Value);
- Projects.Table (For_Project).Config_File_Name := Name_Find;
- end if;
+ Put_Line (File, "pragma Source_File_Name_Project");
+ Put_Line (File, " (Body_File_Name => ""*.adb"",");
+ Put_Line (File, " Dot_Replacement => ""-"",");
+ Put_Line (File, " Casing => lowercase);");
end if;
- if Local_Attribute_Present then
- if File /= Invalid_FD then
- Copy_File (Local_Attribute.Value);
+ -- Close the temporary file
- else
- String_To_Name_Buffer (Local_Attribute.Value);
- Projects.Table (For_Project).Config_File_Name := Name_Find;
- end if;
- end if;
-
- if File /= Invalid_FD then
- GNAT.OS_Lib.Close (File);
+ GNAT.OS_Lib.Close (File, Status);
- if Opt.Verbose_Mode then
- Write_Str ("Closing configuration file """);
- Write_Str (File_Name);
- Write_Line ("""");
- end if;
+ if not Status then
+ Prj.Com.Fail ("disk full");
+ end if;
- Name_Len := File_Name'Length;
- Name_Buffer (1 .. Name_Len) := File_Name;
- Projects.Table (For_Project).Config_File_Name := Name_Find;
- Projects.Table (For_Project).Config_File_Temp := True;
+ if Opt.Verbose_Mode then
+ Write_Str ("Closing configuration file """);
+ Write_Str (Get_Name_String (File_Name));
+ Write_Line ("""");
end if;
+ Projects.Table (For_Project).Config_File_Name := File_Name;
+ Projects.Table (For_Project).Config_File_Temp := True;
+
Projects.Table (For_Project).Config_Checked := True;
end if;
end Create_Config_Pragmas_File;
@@ -801,11 +831,22 @@ package body Prj.Env is
-- Create_Mapping_File --
-------------------------
- procedure Create_Mapping_File (Name : in out Temp_File_Name) is
+ procedure Create_Mapping_File
+ (Project : Project_Id;
+ Name : out Name_Id)
+ is
File : File_Descriptor := Invalid_FD;
The_Unit_Data : Unit_Data;
Data : File_Name_Data;
+ Status : Boolean;
+ -- For call to Close
+
+ Present : Project_Flags (No_Project .. Projects.Last) :=
+ (others => False);
+ -- For each project in the closure of Project, the corresponding flag
+ -- will be set to True;
+
procedure Put_Name_Buffer;
-- Put the line contained in the Name_Buffer in the mapping file
@@ -813,6 +854,10 @@ package body Prj.Env is
-- Put the mapping of the spec or body contained in Data in the file
-- (3 lines).
+ procedure Recursive_Flag (Prj : Project_Id);
+ -- Set the flags corresponding to Prj, the projects it imports
+ -- (directly or indirectly) or extends to True. Call itself recursively.
+
---------
-- Put --
---------
@@ -826,7 +871,7 @@ package body Prj.Env is
Last := Write (File, Name_Buffer (1)'Address, Name_Len);
if Last /= Name_Len then
- Osint.Fail ("Disk full");
+ Prj.Com.Fail ("Disk full");
end if;
end Put_Name_Buffer;
@@ -851,7 +896,7 @@ package body Prj.Env is
Put_Name_Buffer;
- -- Line with the file nale
+ -- Line with the file name
Get_Name_String (Data.Name);
Put_Name_Buffer;
@@ -863,18 +908,57 @@ package body Prj.Env is
end Put_Data;
+ --------------------
+ -- Recursive_Flag --
+ --------------------
+
+ procedure Recursive_Flag (Prj : Project_Id) is
+ Imported : Project_List;
+ Proj : Project_Id;
+
+ begin
+ -- Nothing to do for non existent project or project that has
+ -- already been flagged.
+
+ if Prj = No_Project or else Present (Prj) then
+ return;
+ end if;
+
+ -- Flag the current project
+
+ Present (Prj) := True;
+ Imported := Projects.Table (Prj).Imported_Projects;
+
+ -- Call itself for each project directly imported
+
+ while Imported /= Empty_Project_List loop
+ Proj := Project_Lists.Table (Imported).Project;
+ Imported := Project_Lists.Table (Imported).Next;
+ Recursive_Flag (Proj);
+ end loop;
+
+ -- Call itself for an eventual project being extended
+
+ Recursive_Flag (Projects.Table (Prj).Extends);
+ end Recursive_Flag;
+
-- Start of processing for Create_Mapping_File
begin
- GNAT.OS_Lib.Create_Temp_File (File, Name => Name);
+ -- Flag the necessary projects
+
+ Recursive_Flag (Project);
+
+ -- Create the temporary file
+
+ Tempdir.Create_Temp_File (File, Name => Name);
if File = Invalid_FD then
- Osint.Fail
- ("unable to create temporary mapping file");
+ Prj.Com.Fail ("unable to create temporary mapping file");
elsif Opt.Verbose_Mode then
Write_Str ("Creating temp mapping file """);
- Write_Str (Name);
+ Write_Str (Get_Name_String (Name));
Write_Line ("""");
end if;
@@ -889,17 +973,19 @@ package body Prj.Env is
if The_Unit_Data.Name /= No_Name then
Data := The_Unit_Data.File_Names (Specification);
- -- If there is a spec, put it mapping in the file
+ -- If there is a spec, put it mapping in the file if it is
+ -- from a project in the closure of Project.
- if Data.Name /= No_Name then
+ if Data.Name /= No_Name and then Present (Data.Project) then
Put_Data (Spec => True);
end if;
Data := The_Unit_Data.File_Names (Body_Part);
-- If there is a body (or subunit) put its mapping in the file
+ -- if it is from a project in the closure of Project.
- if Data.Name /= No_Name then
+ if Data.Name /= No_Name and then Present (Data.Project) then
Put_Data (Spec => False);
end if;
@@ -907,20 +993,78 @@ package body Prj.Env is
end loop;
end if;
- GNAT.OS_Lib.Close (File);
+ GNAT.OS_Lib.Close (File, Status);
+
+ if not Status then
+ Prj.Com.Fail ("disk full");
+ end if;
end Create_Mapping_File;
+ --------------------------
+ -- Create_New_Path_File --
+ --------------------------
+
+ procedure Create_New_Path_File
+ (Path_FD : out File_Descriptor;
+ Path_Name : out Name_Id)
+ is
+ begin
+ Tempdir.Create_Temp_File (Path_FD, Path_Name);
+
+ if Path_Name /= No_Name then
+
+ -- Record the name, so that the temp path file will be deleted
+ -- at the end of the program.
+
+ Path_Files.Increment_Last;
+ Path_Files.Table (Path_Files.Last) := Path_Name;
+ end if;
+ end Create_New_Path_File;
+
+ ---------------------------
+ -- Delete_All_Path_Files --
+ ---------------------------
+
+ procedure Delete_All_Path_Files is
+ Disregard : Boolean := True;
+
+ begin
+ for Index in 1 .. Path_Files.Last loop
+ if Path_Files.Table (Index) /= No_Name then
+ Delete_File
+ (Get_Name_String (Path_Files.Table (Index)), Disregard);
+ end if;
+ end loop;
+
+ -- If any of the environment variables ADA_PRJ_INCLUDE_FILE or
+ -- ADA_PRJ_OBJECTS_FILE has been set, then reset their value to
+ -- the empty string. On VMS, this has the effect of deassigning
+ -- the logical names.
+
+ if Ada_Prj_Include_File_Set then
+ Setenv (Project_Include_Path_File, "");
+ Ada_Prj_Include_File_Set := False;
+ end if;
+
+ if Ada_Prj_Objects_File_Set then
+ Setenv (Project_Objects_Path_File, "");
+ Ada_Prj_Objects_File_Set := False;
+ end if;
+ end Delete_All_Path_Files;
+
------------------------------------
-- File_Name_Of_Library_Unit_Body --
------------------------------------
function File_Name_Of_Library_Unit_Body
- (Name : String;
- Project : Project_Id)
- return String
+ (Name : String;
+ Project : Project_Id;
+ Main_Project_Only : Boolean := True)
+ return String
is
- Data : constant Project_Data := Projects.Table (Project);
+ The_Project : Project_Id := Project;
+ Data : Project_Data := Projects.Table (Project);
Original_Name : String := Name;
Extended_Spec_Name : String :=
@@ -928,7 +1072,7 @@ package body Prj.Env is
(Data.Naming.Current_Spec_Suffix);
Extended_Body_Name : String :=
Name & Namet.Get_Name_String
- (Data.Naming.Current_Impl_Suffix);
+ (Data.Naming.Current_Body_Suffix);
Unit : Unit_Data;
@@ -967,109 +1111,127 @@ package body Prj.Env is
Write_Eol;
end if;
- -- For every unit
-
- for Current in reverse Units.First .. Units.Last loop
- Unit := Units.Table (Current);
+ -- For extending project, search in the extended project
+ -- if the source is not found. For non extending projects,
+ -- this loop will be run only once.
- -- Case of unit of the same project
+ loop
+ -- For every unit
- if Unit.File_Names (Body_Part).Project = Project then
- declare
- Current_Name : constant Name_Id :=
- Unit.File_Names (Body_Part).Name;
+ for Current in reverse Units.First .. Units.Last loop
+ Unit := Units.Table (Current);
- begin
- -- Case of a body present
+ -- Check for body
- if Current_Name /= No_Name then
- if Current_Verbosity = High then
- Write_Str (" Comparing with """);
- Write_Str (Get_Name_String (Current_Name));
- Write_Char ('"');
- Write_Eol;
- end if;
+ if not Main_Project_Only
+ or else Unit.File_Names (Body_Part).Project = The_Project
+ then
+ declare
+ Current_Name : constant Name_Id :=
+ Unit.File_Names (Body_Part).Name;
- -- If it has the name of the original name,
- -- return the original name
+ begin
+ -- Case of a body present
- if Unit.Name = The_Original_Name
- or else Current_Name = The_Original_Name
- then
+ if Current_Name /= No_Name then
if Current_Verbosity = High then
- Write_Line (" OK");
+ Write_Str (" Comparing with """);
+ Write_Str (Get_Name_String (Current_Name));
+ Write_Char ('"');
+ Write_Eol;
end if;
- return Get_Name_String (Current_Name);
+ -- If it has the name of the original name,
+ -- return the original name
- -- If it has the name of the extended body name,
- -- return the extended body name
+ if Unit.Name = The_Original_Name
+ or else Current_Name = The_Original_Name
+ then
+ if Current_Verbosity = High then
+ Write_Line (" OK");
+ end if;
- elsif Current_Name = The_Body_Name then
- if Current_Verbosity = High then
- Write_Line (" OK");
- end if;
+ return Get_Name_String (Current_Name);
- return Extended_Body_Name;
+ -- If it has the name of the extended body name,
+ -- return the extended body name
- else
- if Current_Verbosity = High then
- Write_Line (" not good");
- end if;
- end if;
- end if;
- end;
- end if;
+ elsif Current_Name = The_Body_Name then
+ if Current_Verbosity = High then
+ Write_Line (" OK");
+ end if;
- -- Case of a unit of the same project
+ return Extended_Body_Name;
- if Units.Table (Current).File_Names (Specification).Project =
- Project
- then
- declare
- Current_Name : constant Name_Id :=
- Unit.File_Names (Specification).Name;
+ else
+ if Current_Verbosity = High then
+ Write_Line (" not good");
+ end if;
+ end if;
+ end if;
+ end;
+ end if;
- begin
- -- Case of spec present
+ -- Check for spec
- if Current_Name /= No_Name then
- if Current_Verbosity = High then
- Write_Str (" Comparing with """);
- Write_Str (Get_Name_String (Current_Name));
- Write_Char ('"');
- Write_Eol;
- end if;
+ if not Main_Project_Only
+ or else Unit.File_Names (Specification).Project = The_Project
+ then
+ declare
+ Current_Name : constant Name_Id :=
+ Unit.File_Names (Specification).Name;
- -- If name same as the original name, return original name
+ begin
+ -- Case of spec present
- if Unit.Name = The_Original_Name
- or else Current_Name = The_Original_Name
- then
+ if Current_Name /= No_Name then
if Current_Verbosity = High then
- Write_Line (" OK");
+ Write_Str (" Comparing with """);
+ Write_Str (Get_Name_String (Current_Name));
+ Write_Char ('"');
+ Write_Eol;
end if;
- return Get_Name_String (Current_Name);
+ -- If name same as the original name, return original
+ -- name.
- -- If it has the same name as the extended spec name,
- -- return the extended spec name.
+ if Unit.Name = The_Original_Name
+ or else Current_Name = The_Original_Name
+ then
+ if Current_Verbosity = High then
+ Write_Line (" OK");
+ end if;
- elsif Current_Name = The_Spec_Name then
- if Current_Verbosity = High then
- Write_Line (" OK");
- end if;
+ return Get_Name_String (Current_Name);
- return Extended_Spec_Name;
+ -- If it has the same name as the extended spec name,
+ -- return the extended spec name.
- else
- if Current_Verbosity = High then
- Write_Line (" not good");
+ elsif Current_Name = The_Spec_Name then
+ if Current_Verbosity = High then
+ Write_Line (" OK");
+ end if;
+
+ return Extended_Spec_Name;
+
+ else
+ if Current_Verbosity = High then
+ Write_Line (" not good");
+ end if;
end if;
end if;
- end if;
- end;
- end if;
+ end;
+ end if;
+ end loop;
+
+ -- If we are not in an extending project, give up
+
+ exit when (not Main_Project_Only) or else Data.Extends = No_Project;
+
+ -- Otherwise, look in the project we are extending
+
+ The_Project := Data.Extends;
+ Data := Projects.Table (The_Project);
end loop;
-- We don't know this file name, return an empty string
@@ -1087,7 +1249,7 @@ package body Prj.Env is
procedure Add (Project : Project_Id);
-- Process a project. Remember the processes visited to avoid
-- processing a project twice. Recursively process an eventual
- -- modified project, and all imported projects.
+ -- extended project, and all imported projects.
---------
-- Add --
@@ -1146,8 +1308,8 @@ package body Prj.Env is
-- If we are extending a project, visit it
- if Data.Modifies /= No_Project then
- Add (Data.Modifies);
+ if Data.Extends /= No_Project then
+ Add (Data.Extends);
end if;
-- And visit all imported projects
@@ -1177,7 +1339,7 @@ package body Prj.Env is
procedure Add (Project : Project_Id);
-- Process a project. Remember the processes visited to avoid
-- processing a project twice. Recursively process an eventual
- -- modified project, and all imported projects.
+ -- extended project, and all imported projects.
---------
-- Add --
@@ -1235,16 +1397,15 @@ package body Prj.Env is
while Current /= Nil_String loop
The_String := String_Elements.Table (Current);
- String_To_Name_Buffer (The_String.Value);
- Action (Name_Buffer (1 .. Name_Len));
+ Action (Get_Name_String (The_String.Value));
Current := The_String.Next;
end loop;
end;
-- If we are extending a project, visit it
- if Data.Modifies /= No_Project then
- Add (Data.Modifies);
+ if Data.Extends /= No_Project then
+ Add (Data.Extends);
end if;
-- And visit all imported projects
@@ -1299,8 +1460,9 @@ package body Prj.Env is
(Unit.File_Names (Specification).Path) =
Original_Name)
then
- Project := Unit.File_Names (Specification).Project;
- Path := Unit.File_Names (Specification).Path;
+ Project := Ultimate_Extension_Of
+ (Unit.File_Names (Specification).Project);
+ Path := Unit.File_Names (Specification).Display_Path;
if Current_Verbosity > Default then
Write_Str ("Done: Specification.");
@@ -1318,8 +1480,9 @@ package body Prj.Env is
(Unit.File_Names (Body_Part).Path) =
Original_Name)
then
- Project := Unit.File_Names (Body_Part).Project;
- Path := Unit.File_Names (Body_Part).Path;
+ Project := Ultimate_Extension_Of
+ (Unit.File_Names (Body_Part).Project);
+ Path := Unit.File_Names (Body_Part).Display_Path;
if Current_Verbosity > Default then
Write_Str ("Done: Body.");
@@ -1346,20 +1509,10 @@ package body Prj.Env is
----------------
procedure Initialize is
- Global : constant String := "global_configuration_pragmas";
- Local : constant String := "local_configuration_pragmas";
-
begin
- -- Put the standard GNAT naming scheme in the Namings table
-
- Namings.Increment_Last;
- Namings.Table (Namings.Last) := Standard_Naming_Data;
- Name_Len := Global'Length;
- Name_Buffer (1 .. Name_Len) := Global;
- Global_Configuration_Pragmas := Name_Find;
- Name_Len := Local'Length;
- Name_Buffer (1 .. Name_Len) := Local;
- Local_Configuration_Pragmas := Name_Find;
+ -- There is nothing to do anymore
+
+ null;
end Initialize;
------------------------------------
@@ -1379,7 +1532,7 @@ package body Prj.Env is
(Data.Naming.Current_Spec_Suffix);
Extended_Body_Name : String :=
Name & Namet.Get_Name_String
- (Data.Naming.Current_Impl_Suffix);
+ (Data.Naming.Current_Body_Suffix);
First : Unit_Id := Units.First;
Current : Unit_Id;
@@ -1388,7 +1541,7 @@ package body Prj.Env is
begin
Canonical_Case_File_Name (Original_Name);
Canonical_Case_File_Name (Extended_Spec_Name);
- Canonical_Case_File_Name (Extended_Spec_Name);
+ Canonical_Case_File_Name (Extended_Body_Name);
if Current_Verbosity = High then
Write_Str ("Looking for path name of """);
@@ -1548,6 +1701,206 @@ package body Prj.Env is
Write_Line ("end of List of Sources.");
end Print_Sources;
+ -------------------
+ -- Set_Ada_Paths --
+ -------------------
+
+ procedure Set_Ada_Paths
+ (Project : Project_Id;
+ Including_Libraries : Boolean)
+ is
+ Source_FD : File_Descriptor := Invalid_FD;
+ Object_FD : File_Descriptor := Invalid_FD;
+
+ Process_Source_Dirs : Boolean := False;
+ Process_Object_Dirs : Boolean := False;
+
+ Status : Boolean;
+ -- For calls to Close
+
+ procedure Add (Project : Project_Id);
+ -- Add all the source/object directories of a project to the path only
+ -- if this project has not been visited. Calls itself recursively for
+ -- projects being extended, and imported projects.
+
+ ---------
+ -- Add --
+ ---------
+
+ procedure Add (Project : Project_Id) is
+ begin
+ -- If Seen is False, then the project has not yet been visited
+
+ if not Projects.Table (Project).Seen then
+ Projects.Table (Project).Seen := True;
+
+ declare
+ Data : constant Project_Data := Projects.Table (Project);
+ List : Project_List := Data.Imported_Projects;
+
+ begin
+ if Process_Source_Dirs then
+
+ -- Add to path all source directories of this project
+
+ Add_To_Path_File (Data.Source_Dirs, Source_FD);
+ end if;
+
+ if Process_Object_Dirs then
+
+ -- Add to path the object directory of this project
+ -- except if we don't include library project and
+ -- this is a library project.
+
+ if (Data.Library and then Including_Libraries)
+ or else
+ (Data.Object_Directory /= No_Name
+ and then
+ (not Including_Libraries or else not Data.Library))
+ then
+ -- For a library project, add the library directory
+
+ if Data.Library then
+ declare
+ New_Path : constant String :=
+ Get_Name_String (Data.Library_Dir);
+
+ begin
+ Add_To_Path_File (New_Path, Object_FD);
+ end;
+
+ else
+ -- For a non library project, add the object directory
+
+ declare
+ New_Path : constant String :=
+ Get_Name_String (Data.Object_Directory);
+ begin
+ Add_To_Path_File (New_Path, Object_FD);
+ end;
+ end if;
+ end if;
+ end if;
+
+ -- Call Add to the project being extended, if any
+
+ if Data.Extends /= No_Project then
+ Add (Data.Extends);
+ end if;
+
+ -- Call Add for each imported project, if any
+
+ while List /= Empty_Project_List loop
+ Add (Project_Lists.Table (List).Project);
+ List := Project_Lists.Table (List).Next;
+ end loop;
+ end;
+ end if;
+ end Add;
+
+ -- Start of processing for Set_Ada_Paths
+
+ begin
+ -- If it is the first time we call this procedure for
+ -- this project, compute the source path and/or the object path.
+
+ if Projects.Table (Project).Include_Path_File = No_Name then
+ Process_Source_Dirs := True;
+ Create_New_Path_File
+ (Source_FD, Projects.Table (Project).Include_Path_File);
+ end if;
+
+ -- For the object path, we make a distinction depending on
+ -- Including_Libraries.
+
+ if Including_Libraries then
+ if Projects.Table (Project).Objects_Path_File_With_Libs = No_Name then
+ Process_Object_Dirs := True;
+ Create_New_Path_File
+ (Object_FD, Projects.Table (Project).
+ Objects_Path_File_With_Libs);
+ end if;
+
+ else
+ if
+ Projects.Table (Project).Objects_Path_File_Without_Libs = No_Name
+ then
+ Process_Object_Dirs := True;
+ Create_New_Path_File
+ (Object_FD, Projects.Table (Project).
+ Objects_Path_File_Without_Libs);
+ end if;
+ end if;
+
+ -- If there is something to do, set Seen to False for all projects,
+ -- then call the recursive procedure Add for Project.
+
+ if Process_Source_Dirs or Process_Object_Dirs then
+ for Index in 1 .. Projects.Last loop
+ Projects.Table (Index).Seen := False;
+ end loop;
+
+ Add (Project);
+ end if;
+
+ -- Close any file that has been created.
+
+ if Source_FD /= Invalid_FD then
+ Close (Source_FD, Status);
+
+ if not Status then
+ Prj.Com.Fail ("disk full");
+ end if;
+ end if;
+
+ if Object_FD /= Invalid_FD then
+ Close (Object_FD, Status);
+
+ if not Status then
+ Prj.Com.Fail ("disk full");
+ end if;
+ end if;
+
+ -- Set the env vars, if they need to be changed, and set the
+ -- corresponding flags.
+
+ if
+ Current_Source_Path_File /= Projects.Table (Project).Include_Path_File
+ then
+ Current_Source_Path_File :=
+ Projects.Table (Project).Include_Path_File;
+ Set_Path_File_Var
+ (Project_Include_Path_File,
+ Get_Name_String (Current_Source_Path_File));
+ Ada_Prj_Include_File_Set := True;
+ end if;
+
+ if Including_Libraries then
+ if Current_Object_Path_File
+ /= Projects.Table (Project).Objects_Path_File_With_Libs
+ then
+ Current_Object_Path_File :=
+ Projects.Table (Project).Objects_Path_File_With_Libs;
+ Set_Path_File_Var
+ (Project_Objects_Path_File,
+ Get_Name_String (Current_Object_Path_File));
+ Ada_Prj_Objects_File_Set := True;
+ end if;
+
+ else
+ if Current_Object_Path_File
+ /= Projects.Table (Project).Objects_Path_File_Without_Libs
+ then
+ Current_Object_Path_File :=
+ Projects.Table (Project).Objects_Path_File_Without_Libs;
+ Set_Path_File_Var
+ (Project_Objects_Path_File,
+ Get_Name_String (Current_Object_Path_File));
+ Ada_Prj_Objects_File_Set := True;
+ end if;
+ end if;
+ end Set_Ada_Paths;
+
---------------------------------------------
-- Set_Mapping_File_Initial_State_To_Empty --
---------------------------------------------
@@ -1558,6 +1911,23 @@ package body Prj.Env is
end Set_Mapping_File_Initial_State_To_Empty;
-----------------------
+ -- Set_Path_File_Var --
+ -----------------------
+
+ procedure Set_Path_File_Var (Name : String; Value : String) is
+ Host_Spec : String_Access := To_Host_File_Spec (Value);
+
+ begin
+ if Host_Spec = null then
+ Prj.Com.Fail
+ ("could not convert file name """, Value, """ to host spec");
+ else
+ Setenv (Name, Host_Spec.all);
+ Free (Host_Spec);
+ end if;
+ end Set_Path_File_Var;
+
+ -----------------------
-- Spec_Path_Name_Of --
-----------------------
@@ -1576,12 +1946,11 @@ package body Prj.Env is
Data.File_Names (Specification).Name;
while Current_Source /= Nil_String loop
- String_To_Name_Buffer
- (String_Elements.Table (Current_Source).Value);
Path := Locate_Regular_File
(Namet.Get_Name_String
(Data.File_Names (Specification).Name),
- Name_Buffer (1 .. Name_Len));
+ Namet.Get_Name_String
+ (String_Elements.Table (Current_Source).Value));
if Path /= null then
Name_Len := Path'Length;
@@ -1601,4 +1970,22 @@ package body Prj.Env is
return Namet.Get_Name_String (Data.File_Names (Specification).Path);
end Spec_Path_Name_Of;
+ ---------------------------
+ -- Ultimate_Extension_Of --
+ ---------------------------
+
+ function Ultimate_Extension_Of (Project : in Project_Id) return Project_Id
+ is
+ Result : Project_Id := Project;
+
+ begin
+ while Projects.Table (Result).Extended_By /= No_Project loop
+ Result := Projects.Table (Result).Extended_By;
+ end loop;
+
+ return Result;
+ end Ultimate_Extension_Of;
+
+begin
+ Path_Files.Set_Last (0);
end Prj.Env;