The unified diff between revisions [946683f2..] and [e2585a44..] is displayed below. It can also be downloaded as a raw diff.

#
#
# delete "docs/explorer.jpg"
#
# delete "docs/main-window.jpg"
#
# delete "docs/process.jpg"
#
# add_file "code_analysis/src/code_coverage-gcov.adb"
#  content [424afe7301e95ea0ca052be270cda0aae96a7843]
#
# add_file "code_analysis/src/code_coverage-gcov.ads"
#  content [680dc4b4394cb1f197988aa13d72d87b76d15b6f]
#
# add_file "code_analysis/src/code_coverage-xcov.adb"
#  content [569c99ed9ebb3d4d351e57ae309486e54b2679ab]
#
# add_file "code_analysis/src/code_coverage-xcov.ads"
#  content [e08b1fa3d57cc3fabc4a9ae7f21a8fb75074c516]
#
# add_file "docs/target-configuration-dialog.jpg"
#  content [827d9cc18ba145a7624f561c9f8b39415b499767]
#
# add_file "share/plug-ins/csharp.xml"
#  content [f0a34502b93c24929cce515596106c09dd57841c]
#
# patch "ada_module/src/ada_semantic_tree-units.adb"
#  from [8cd6f5abf152522078999fc9aa4f791833606e20]
#    to [c959c35ae91c434a51f6fce572b92610a29044fa]
#
# patch "aunit/src/aunit_filters.adb"
#  from [0f8fddeafb6750266e9b1f7742d7eafd5aa573c8]
#    to [aa70b1b5a0d7b71d22b66d06ed14b5fa9acbcf60]
#
# patch "browsers/src/browsers-canvas.adb"
#  from [0dc370c1eb78dc50d302685785f1e2ea88e9ac6c]
#    to [f0a35ec9e87e6f726c705c469d51d18d80993a4d]
#
# patch "browsers/src/browsers-projects.adb"
#  from [4ee5c62955ccca6de761ab9cde6e3ab653bbb571]
#    to [673e9988d62730f9f0ada94b1216bc9fd5c66324]
#
# patch "builder/src/build_command_manager.adb"
#  from [248380553d0f104c5ed81822219a17f6162bb036]
#    to [8284db952775fe536af92b269b4fc1893516d429]
#
# patch "builder/src/build_command_manager.ads"
#  from [75d08fc7b2de7ec12ea8b4d047c6e1b501cf09c4]
#    to [75afeb0fd27ce725193d4179865706916afd5f89]
#
# patch "builder/src/builder_facility_module-scripts.adb"
#  from [035c85f61fedb415bbcda628efbc233c3ba30f2c]
#    to [cbf21aae426102e2abfbb6f0b47e8398e1615bec]
#
# patch "builder/src/builder_facility_module.adb"
#  from [8143384a8bdad497509889492d68e90dedf0ee3d]
#    to [6cd476838df33ecaaa231a5cd521e46ed1a9bbaf]
#
# patch "builder/src/builder_facility_module.ads"
#  from [cef6755512c957168a01e8c190e7e97df2bcc175]
#    to [c3f99e6fb9a08a5120fa1bdbc2e3dcf0deb2ab09]
#
# patch "builder/src/builder_module.adb"
#  from [4a26e9ab61b4a0a355cec4740db117dffc760d9b]
#    to [28dff7e565400acc916afde0cd3f1961d770784a]
#
# patch "builder/src/commands-builder.adb"
#  from [0566308f898745c50889925defac13e942200c97]
#    to [92443278cd0e02d4504ee7bb5c959abefd931aa7]
#
# patch "code_analysis/src/code_analysis.adb"
#  from [93829282a986c7a754aa8f5deea4cb59520f9ab6]
#    to [4c74db222b91bce2c7a42af3916213c013cedb9b]
#
# patch "code_analysis/src/code_analysis.ads"
#  from [230e8825dbd08c1bd250a411d88ebd39df15a469]
#    to [c0ee8e0e20dfe833a122c446835701eb7beab2ae]
#
# patch "code_analysis/src/code_analysis_module.adb"
#  from [9862bffa2270f27fa42d149e776110de0ed4f237]
#    to [50afeb20706593d439c725257d8c28abb12fe36e]
#
# patch "code_analysis/src/code_analysis_test.adb"
#  from [9dcc9cefadd3279ccd828e48f8df4ec7a4e1caba]
#    to [427b842632977c85d7207d5ee1dc25e7852ea2cd]
#
# patch "code_analysis/src/code_analysis_tree_model.adb"
#  from [a25db384aa081a2df99b39c1bf244b2d222c07c4]
#    to [35ca458952551b0bf953cf2a997752e49042c864]
#
# patch "code_analysis/src/code_coverage.adb"
#  from [ecb54712f181034d19fde81b5261baa444a6a2e8]
#    to [dea30900103cdafc90005e509f5f557c5e7560eb]
#
# patch "code_analysis/src/code_coverage.ads"
#  from [c309beec06460e2e95f5a0615a2dce466b22c1a4]
#    to [f12392dabe8aaf757419e092f1fa8e93a482d296]
#
# patch "code_analysis/src/coverage_gui.adb"
#  from [c70e6310ba697d5ebb3a0d8d52dfe0dec9a34458]
#    to [90875772831135c14642eda457c79025eddb03b2]
#
# patch "code_analysis/src/coverage_gui.ads"
#  from [798a2eb90301a2c542ce1327df8c19eedfd644f6]
#    to [189e184a8f7f94b1f5a29661999b6a9e5704a025]
#
# patch "common/src/basic_mapper.adb"
#  from [9421e82683128e309810cdd9e0c4bf21b83b40f6]
#    to [ec5563dfdf295e2b78811f1f34456726cc39add4]
#
# patch "common/src/config.ads.in"
#  from [715c49740d989e4747d70cdb531e7d3b4984e608]
#    to [1f0e843b7141ab09a68194f70ff2b8543c3a7932]
#
# patch "common/src/filesystems.adb"
#  from [3e8552a2f5dc08e0c148086dd79ef48ef4e601e5]
#    to [c8ce53cb47c6a7f6bc1a7cc9cd8303abfc237f39]
#
# patch "common/src/filesystems.ads"
#  from [77f8d14869bfbe42749ae6b1764e869e6589bdee]
#    to [441ee4139c3d477fb32e355c74038e6e2bc74451]
#
# patch "common/src/gui_utils.adb"
#  from [0e7b29da864656161cc541232329ca1ac4336124]
#    to [aa2c4530bdbb2c9a6b343a0546c6f64effbd99c4]
#
# patch "common/src/gui_utils.ads"
#  from [f089a4cd875e74ef646b0f3d3eb37a302c43b661]
#    to [b45839f44172bb515afc2b23599cf35b4ddf29d5]
#
# patch "common/src/histories.adb"
#  from [d6cf0471fe48f335d5d52629f61053e455613eea]
#    to [167179ad1f1bd573a788856ab9bb9e00f5b45e07]
#
# patch "common/src/interactive_consoles.adb"
#  from [71fc4a12e7189fbaf3dca0b66ce43d619017324f]
#    to [032b6ca5095c0c16af1a981f766e5320732dab97]
#
# patch "common/src/remote-path-translator.adb"
#  from [698969b0f5a15ad491a40c8cd0b86fce3efa41a7]
#    to [3356103e497991ccd30490bd8e3ab1baba0c8074]
#
# patch "common/src/string_list_utils.adb"
#  from [68370f0ce127f79f603657a5c77cdc680654495b]
#    to [13f811e99b1322cdcfc28d2374c0caf4ecb5d115]
#
# patch "common/src/string_list_utils.ads"
#  from [9c8d5ddf67c500bdfd733d125154c31fd3341969]
#    to [7936fd46b93afa12379e71aa33cfbd914603fc3a]
#
# patch "common/src/string_utils.ads"
#  from [63e0f1a0f71d63dbfc89387ea7856fd56852cf4c]
#    to [95c04b650c4852f43b9cd90c139a4340cb9358d3]
#
# patch "common/src/utf8_utils.adb"
#  from [59d91e0fc93c1419a35068a3cd80a7a9acb7650a]
#    to [88ddee2b95ef27280f0b8879643eaecedb144814]
#
# patch "configure"
#  from [1c8a8113472662099ee29ea21126ed5d1961e79e]
#    to [2b4fb8ae2c30399cca97cec33c58eb76e8fa4513]
#
# patch "configure.in"
#  from [3edcf408dd66fbd53191fe7266482e790f48668d]
#    to [5190661de942f1f9e3a17081ead7a36e23064411]
#
# patch "custom/src/custom_module.adb"
#  from [80aceda3399d136bdd08caf34eb2f11cc9042e12]
#    to [e7773a654d6ae452ea3183d0dd9ec626482037d3]
#
# patch "distrib/.gps_wrapper"
#  from [07f0c88210fe331760589c4e6dd82119e94323c9]
#    to [6de489133800c2f03d20eecea997fcbfc0f31362]
#
# patch "distrib/doinstall"
#  from [f989c237fa30112254a37ca6977f931e9f23461d]
#    to [2d9b20419959ce0250b0a56971a9d3c18fb0df20]
#
# patch "distrib/features"
#  from [b6e28b9b55f076568cbe6395fa855e2f00526fec]
#    to [955c2600ffb1adf38f2d1d50a1030210e110eab4]
#
# patch "distrib/known-problems"
#  from [752991e08fcca67bbaf06853e33f07ec4feb7309]
#    to [7ba5937d702b36c642620b7bdcc8e50822ff3c12]
#
# patch "docs/Makefile.in"
#  from [6373ff752d508ea748d5ab7a82292a9908b9eae3]
#    to [bda5d5e013301bb9b8fce8b089a82765a09e99c7]
#
# patch "docs/about.jpg"
#  from [603bcc8ac6da7fbeede0a7996536c17167a801ac]
#    to [49fafdfc64e0a71f050c6a773e40e1dd043191d9]
#
# patch "docs/aliases.jpg"
#  from [86e17b8c2682e6611c0ccd61fbae966a9c0ddab3]
#    to [acabe38683db9d40b9cd9ca968f8d9cea4462f1b]
#
# patch "docs/gps-welcome-public.html"
#  from [69ff2512020254c2b56b95beb4dc3a0bb5def4ea]
#    to [4e263646afb55fa217dec197acb405895caa3e4c]
#
# patch "docs/gps-welcome.html"
#  from [12e425fe250d5ff1ebc470bcc592878764f43ca0]
#    to [a58e772f7518d2053e43ec57d46eb31b74e56a45]
#
# patch "docs/gps.texi"
#  from [e7178b148b6cba4a16fe76e89be1dc1fe6834086]
#    to [26da3e6ae8c6041bc584d4d861f322b26e45e402]
#
# patch "docs/main-gps.jpg"
#  from [d18917c60742e0bd74f831c01c28658eda545ddf]
#    to [c66fe8995488a667faf12a6da24f09404d6d4f2c]
#
# patch "docs/messages.jpg"
#  from [7e11bf48615b04046e4f7bd2b12798670e343e23]
#    to [4bf1e77e2046ea98230c6d6b1447360ff5473299]
#
# patch "docs/toolchains-config.jpg"
#  from [0ab6f7cc38095dfa69bda0e9085d4190d729c392]
#    to [2aac23cefa13775d6aee843a6ab62f8bc8cd4ae1]
#
# patch "docs/tutorial.texi"
#  from [5e30ceaf1cccb779854a6faa78ba45c29a0128a8]
#    to [580d3a931773f297e81bfd78f0b29dfbdd7b42a9]
#
# patch "docs/welcome.jpg"
#  from [7e0184584fb858b7e0bb8d44e36bb334088a1bdd]
#    to [cefd70ada70f5a651be8afa706e6acd211cd17e1]
#
# patch "gnatlib/Makefile.conf.in"
#  from [0c64275b323860d0df365ca3480e4c88c30982a7]
#    to [184925bff1cce1ffc44621adf6e036a7894edee9]
#
# patch "gnatlib/aclocal.m4"
#  from [f1f77d5cf57d44c3489816f2a8ab100892f4803e]
#    to [b6e617700678d224a6b06ef3703b2cc09d452e0c]
#
# patch "gnatlib/configure"
#  from [3e1e88ef5118a27a04b9888e5e0703ad196b4672]
#    to [dac8c5731f6966303847c3339bd66cb73032eca3]
#
# patch "gnatlib/configure.in"
#  from [5c3af66a46ccd36b3212e47e1f6b04d60b7abcf8]
#    to [7db1db42473e84c6c4d85748a30e7a97647e3d18]
#
# patch "gnatlib/src/gnatcoll-filesystem-unix-remote.adb"
#  from [0856b41d83c956412fe3737a70d7e5e2d656e0ab]
#    to [a5e52d2ba799b9a1363fd2b280345bfd43d21798]
#
# patch "gnatlib/src/gnatcoll-filesystem.adb"
#  from [1eb7e242da4881b462875b4aed5933ec818b347b]
#    to [bb459f22f09330beba8528c5a953463e0e0ae215]
#
# patch "gnatlib/src/gnatcoll-filesystem.ads"
#  from [2728926b836e9502ad5e3e642b3d2554730da8d2]
#    to [e2b0258cd89436015a75866a23d2bb268903c422]
#
# patch "gnatlib/src/gnatcoll-mmap__win32.adb"
#  from [3a74855254cd415eb78415cb6d00e4c5bca5e85b]
#    to [bf8c9a98e72d439bff06464f1cd84cd2d7bcfa67]
#
# patch "gnatlib/src/gnatcoll-scripts-impl.adb"
#  from [057c95387f2dc691e90f9399b7559792520efb7c]
#    to [5da1991bc1de8321d2eee377cd214e7e2658a8b5]
#
# patch "gnatlib/src/gnatcoll-sql.adb"
#  from [18f1fdb9f83344e991964a7d3cfc9ecba3b85d74]
#    to [df15c50675965259357b549e26fdc9d051cc6c75]
#
# patch "gnatlib/src/gnatcoll-sql.ads"
#  from [51eebc66d3f2b83d090a2c8a2be314b2d7bc283b]
#    to [0ccbb7725e55e9ba254145c7fe321b6a1a093b9a]
#
# patch "gnatlib/src/gnatcoll-vfs.adb"
#  from [006f5f7a26828ab62762c716bad997901edd1ad3]
#    to [68f3f6136e156d316ead5495a786b218d0616a50]
#
# patch "gnatlib/src/gnatcoll-vfs.ads"
#  from [7b3f0c3901e6d1353293428d9609ae81ec44ea0c]
#    to [1e0514efe2d049e4a268822c63ca0ab58fba5325]
#
# patch "gps/src/gps-callbacks.adb"
#  from [b45c969d7f17f159353ab2031da9ed13b65dc011]
#    to [3b02331665e4a5c51aad9998da58c02b744a774a]
#
# patch "gps/src/gps-main.adb"
#  from [f427eccd467c5fed86ebc31c5e687654f2f8209d]
#    to [b3b788653e6ad03ae412f361374978eba6b5b0cb]
#
# patch "gps/src/gps-menu.adb"
#  from [3f59d11f03d442f68271913c2d762e628315511a]
#    to [4643f7917d9ab126cfbe77f8ebf648d9a1097577]
#
# patch "gvd/gvd/advanced_breakpoint_pkg.adb"
#  from [789e6662646370d030bf7ff5e39a4f4f1249ab2b]
#    to [e8f3f52d2ec1909938b6efe0b20a70235f3634d6]
#
# patch "gvd/gvd/breakpoints_pkg.adb"
#  from [3af52a5e470400c0e2dbe4d6184c84e403149fd9]
#    to [e4eeb4730d048e8f42911a9de4404ab55bf47fd2]
#
# patch "gvd/gvd/debugger-gdb.adb"
#  from [557206c5a1f2636da48a4f7b305c51d462a3ff45]
#    to [8615ab3009abb14c430452d28fd44088ab68907c]
#
# patch "gvd/gvd/debugger.adb"
#  from [4f41c19ea8266920e15c8e2c0b02588747d99704]
#    to [a1eefa876eba9d00bc3567cda1d63d752e456584]
#
# patch "gvd/gvd/gvd-consoles.adb"
#  from [4e959cc7df997d1324015d5bbe333e35aa7502cc]
#    to [a95c215f613f48967337308cadd4522aad0d57ff]
#
# patch "gvd/gvd/gvd-generic_view.adb"
#  from [ade6eba9887487ee012458a20d207c3d7a576e6d]
#    to [e0fb0265a68efeea3a2418ae3bca36e3a6d3ebf7]
#
# patch "gvd/gvd/gvd-process.adb"
#  from [e54fd21d368b1b0b42c1e1c2da8a37ec60110d1a]
#    to [054d31ca82ce38fd7ab6f6ded94c6212df2abe5c]
#
# patch "gvd/gvd/memory_view_pkg.adb"
#  from [45ff643cbfb2c17ebef3dccb91f837920aaaedaa]
#    to [b9f57e7269d2756561a7e4ac24ce0bd7bfb50747]
#
# patch "help/src/help_module.adb"
#  from [98596a60fec355c9a7dabc676b48608173514f9f]
#    to [d3cb8a8a4cf8842b888b1135555930e7affb5f5f]
#
# patch "kernel/src/default_preferences.adb"
#  from [b2b02ba3f0149ab4f33eb4d7d7b370120db5b86a]
#    to [d81d3dcef5533d22627bed436aaf12b3e5b512f7]
#
# patch "kernel/src/gps-kernel-hooks.adb"
#  from [f58a519dfcc5d0d528d6a9eee1e6e4400887df25]
#    to [97af39a00cff36245fd38c71211afb7888831283]
#
# patch "kernel/src/gps-kernel-macros.adb"
#  from [aecdc2c5ebfadf6cb98a84c0a4aebacf8e55c797]
#    to [52a0dfbc088b88faf61276878b9bab0db5115e62]
#
# patch "kernel/src/gps-kernel-mdi.adb"
#  from [b99052c9de7e485d2cd8f8bf9a573627415aed05]
#    to [26d9ffc4e4f1a8c4b48bed8409584d15a7370a09]
#
# patch "kernel/src/gps-kernel-preferences.adb"
#  from [d5bf08104489f31c25cd8a51e74f4bbe60376ef0]
#    to [23b524646f7b750e48a949a4e5b25a4764581914]
#
# patch "kernel/src/gps-kernel-preferences.ads"
#  from [ba267cb7bf5bfc19caec2a398c0f44a9135efedf]
#    to [42cf8fb3c97e2ebf683b76a53366058b40d5cfc2]
#
# patch "kernel/src/gps-kernel-project.adb"
#  from [60b0edfa96dcc75ccb2c1d84c15fa6a08cb76d4c]
#    to [bb8e9cb6975adfb1e062280637cd85bbd4e93c92]
#
# patch "kernel/src/gps-kernel-remote.adb"
#  from [de7dc707a2c45d9a5fadb92cfc618e984d18c5e6]
#    to [aecccf075179014d9e73c0756b9c08d4e2a31dd9]
#
# patch "kernel/src/gps-kernel-standard_hooks.adb"
#  from [0e76dda6b83c4fb2e5e8873dffa9d2497d061423]
#    to [98899a9d1dc9b02e9b14aec95b48b3825046be92]
#
# patch "kernel/src/gps-kernel-standard_hooks.ads"
#  from [69b6b4860bc4de8e138d236eb403e88391019b8b]
#    to [218082c84512cb9bafde8f33e269f2adeb020dec]
#
# patch "kernel/src/gps-kernel-timeout.adb"
#  from [307a6c2042ec1c9fb2e62309b846f03112c1e75d]
#    to [45d5d11a160ca4223a84ce65b277b46af8699710]
#
# patch "kernel/src/gps-kernel.adb"
#  from [5a992e70e78324a12fb38cb677dfd482ca5d0dda]
#    to [65d3376d6ac7515763d16014f5103b43d0e15a81]
#
# patch "kernel/src/gps-kernel.ads"
#  from [a74998e6e7d33a3d1adfd1888ad1d3463644950a]
#    to [a4d8d88d79ea6f9a60dd9b2358909b2ba1de09b5]
#
# patch "kernel/src_info/ali_parser.adb"
#  from [d83a4e48b8f56f63721fe440d1319a2d5be2f9ef]
#    to [7099fb7294937b811d5c05acac93c0bf77ab3b7b]
#
# patch "kernel/src_info/projects-registry.adb"
#  from [6984348e9231d0a829281326b8672f254ffba83e]
#    to [155b5cc8da77f57240a438962f98feb5551ce994]
#
# patch "kernel/src_info/projects.adb"
#  from [51b2e995fb3b412d5efe92afbe9c98bef1ee6261]
#    to [4cb6582f670546c79d338fb3d9f831c1a8547ab4]
#
# patch "kernel/src_info/projects.ads"
#  from [47cb814c94cbcae37ab83c5670207b564f080cd6]
#    to [ed15a6e88aea46d9db70011dcb041af04e33fa90]
#
# patch "keymanager/src/keymanager_module-macros.adb"
#  from [49718c1a1320e4cb1c7485f57a147707171dff2c]
#    to [e4a0dd37feecbd836bbaef18ef57436559187247]
#
# patch "navigation/src/navigation_module.adb"
#  from [347994dfd17021585628aea69673b238d09d69d0]
#    to [3aa4cad20ed56a59fa90ad8b43fd654fef63efbf]
#
# patch "prj_editor/src/creation_wizard-extending.adb"
#  from [b6ee6d02ec94acbf1015157a417f762f0b4c6f42]
#    to [c9756a03f5553a58b77e26004327680049f755b6]
#
# patch "prj_editor/src/project_explorers.adb"
#  from [0b9bb404849c68f4a4c7c70a6269b2961f863cec]
#    to [8aba2e0e8ec8c02de4fc0d8ae72ae2bc09ca0de1]
#
# patch "prj_editor/src/project_explorers_common.adb"
#  from [fc2d4bf44738a6902ea7ec160ad76b567bb51839]
#    to [fe767165ed71cf46908e3a6ea439161375fc477f]
#
# patch "prj_editor/src/project_explorers_files.adb"
#  from [99f881ed4df6e28c554e4d4620df459090d1c99b]
#    to [2dec7217b3b8481fa22d1597e8354bf39cfc7f71]
#
# patch "prj_editor/src/project_properties.adb"
#  from [1a9ccbd6343c1eb797fc7f2d20ed3be63caa9bd8]
#    to [ff6c16218de874e8937284eb5b26772d7ccd050f]
#
# patch "prj_editor/src/project_viewers.adb"
#  from [416f5845011f19f6c752d88b1a8891a9a3ee16f8]
#    to [bdc2e70a6b326b828420d1b6e9fcf15b991237ac]
#
# patch "prj_editor/src/scenario_views.adb"
#  from [e36d060e258ead82f7cd2432686b86eb9b68dd16]
#    to [91e8b880a6bfafcee8af07fe6e10ce3704bc2c2e]
#
# patch "share/library/debugger.py"
#  from [02152d9aa7d794eab3f7a81966f33c155bed2e6c]
#    to [78c5c5c112aab6ca62274d69986760cd0c38ce93]
#
# patch "share/library/dispatching.py"
#  from [38925dc9e4dda41dded5d120f1626fe9864d1cf9]
#    to [ab956954cb95ed6339f701803b9aabc0c1068ee0]
#
# patch "share/library/gnatr.xml"
#  from [213d158ee72bdf1f009196d95fbb0e1dab5d6839]
#    to [8bd5f51679cb7a9ab00b945f8856fac7e075ea40]
#
# patch "share/library/occurrences.py"
#  from [3bc98a3482d12234b042f479a03e11eadab5cfe1]
#    to [457f3d0e0623a6e1ff0b72696cd1806303718ffc]
#
# patch "share/library/rectangles.py"
#  from [a30685b0a1fceb465afd8c2c926ecb85e9f446c7]
#    to [c409f93da0f6fd3c8a512ab2b70a359e24edbdda]
#
# patch "share/library/unicode.py"
#  from [c665fd3e8c241d8153d78b4476ce8188b08a2d44]
#    to [83ef55f5464f29affc4495c74ca205c274e0142e]
#
# patch "share/plug-ins/Makefile.py"
#  from [59619cdeb9af34757a29b5a2fd1b0bea97128971]
#    to [748dc399697d76ddfc3209b4996ad6ea7f937ff2]
#
# patch "share/plug-ins/align.py"
#  from [10a12b230e2ddb78db909a243347ec9a339289cf]
#    to [0b300cc7c2cb18b72263ea3f56bb7b92a945b964]
#
# patch "share/plug-ins/build_modes.xml"
#  from [3d53e48f4d8df1ac31d2b2497acce41e661c7ea1]
#    to [53d41e07f841cc0579cc67a9e6bd1fd51c3b0b83]
#
# patch "share/plug-ins/build_targets.xml"
#  from [8ef796c782f4dfbd53f24f5e10831e8fd747e26c]
#    to [d887b02496455b27cc18bcda4977a75b42ab6983]
#
# patch "share/plug-ins/cvs.xml"
#  from [effe4f12850687d26d43c4c0bf5e58866f60a5d2]
#    to [0c68daaaaca1998674ea97a2f87533383ae1ad15]
#
# patch "share/plug-ins/expanded_code.py"
#  from [0499b3e66cc016c95a602daeafc0d0d51e22a4db]
#    to [3d24f7366d1ee13490256c765ff96ba89e3aa92e]
#
# patch "share/plug-ins/gcov.py"
#  from [bef8d4a8d3f242b66c77dbe46e77d79fecf2dd08]
#    to [47773ba0227701d8729246f0fd5c796a3aef183b]
#
# patch "share/plug-ins/git.xml"
#  from [872be652ea69f206af584001ba0c19b00474a9e6]
#    to [3bde14c1181dcc556961b81ca1b32cac6a007212]
#
# patch "share/plug-ins/gnatpsta.py"
#  from [3879387a48184ec118b8eb0672b68512e639d530]
#    to [04f8333908787a18a835f14bb711b39a3171fd35]
#
# patch "share/plug-ins/gps_utils/__init__.py"
#  from [4e2c5844663f47a90f3cbb67b90e5b77c30a738d]
#    to [a8747ff4b888b09f6f10584a05ad3868f38cb658]
#
# patch "share/plug-ins/gps_utils/highlighter.py"
#  from [f385b0a94adad0d1834385cb868c1a8bb75cb95d]
#    to [eea658a6c74965c7003d666cd817b7b65f17521d]
#
# patch "share/plug-ins/navigation_utils.py"
#  from [b26cd16b6af486a454505cd83d520758a2631a96]
#    to [0e9e00ea7ef9ed573ddea857667e787d929fdcfa]
#
# patch "share/plug-ins/pipe.py"
#  from [c79de9cfb140a174dfa40c6475275ac4d4dbded0]
#    to [3a1bb503e1f1550689e592c178818a38888a8727]
#
# patch "share/plug-ins/python_support.py"
#  from [533078ea708a731a4cf8ae36c2c20fab33ce81d6]
#    to [d142bafaf183055dedd9dcb4376b60562d265700]
#
# patch "share/plug-ins/reset_gps_registry.py"
#  from [230a63bb7b5538c991b4fa0148341862adb4b9b4]
#    to [62cea0ae321df8e3103d15d22fbfe54cf3a256ef]
#
# patch "share/plug-ins/sort_selection.py"
#  from [e5d93b91cdf4e78cad8486360d1aa06bf10a0b2c]
#    to [84011622366729e178984c0880ba5b579ba6ac20]
#
# patch "share/plug-ins/subversion.xml"
#  from [9211f5d88047ab4edeafb6aaa57a32c327ce79cb]
#    to [f8891859f72de3f9cffbc1bbbfda69ccb485e977]
#
# patch "share/plug-ins/text_utils.py"
#  from [f711112e67af5178ffaf3f954d0ef5f06c992a44]
#    to [3dc081dae39c009eb7352ab93f301af4be3ead3c]
#
# patch "share/plug-ins/xml_support.py"
#  from [eb2dc0d9ea2f10607b69f16d0a6a895946f9a9aa]
#    to [924b12663603a76b93408b57b1d2aaf9d056db94]
#
# patch "share/shell_commands.xml"
#  from [77c6e287e3be0114137524d9fc3022112feab130]
#    to [4308d628a11619d0df704f5010d7ea81eb2685a6]
#
# patch "shared.gpr"
#  from [daa769bbdc10f5dedb068c278effbd4ef9978021]
#    to [f71cdc25f394003ff720737ace673235161c4576]
#
# patch "src_editor/src/files_extra_info_pkg-callbacks.adb"
#  from [ec94d090ca68b80b90a8a2f419f5f2bbbf79c2f2]
#    to [a07669b34fbe39d8452d9c72569cc95ee136bee4]
#
# patch "src_editor/src/src_editor_box.adb"
#  from [cc1211f87147412033a001bfdf164aa2c5ac98f2]
#    to [cdf97d7de171f4d6265762602f53656623d742cc]
#
# patch "src_editor/src/src_editor_box.ads"
#  from [0d3cad1d67abbd709690c37a7f2a6544663f427c]
#    to [62197011cf19e0ebba4e69296bbf3ec9ae7dc92c]
#
# patch "src_editor/src/src_editor_buffer-line_information.adb"
#  from [a9dcbc5fc88f0c2a42d0efcbeead0971e975c515]
#    to [20121c407692e27067d4703cbaf375e0dd2f1295]
#
# patch "src_editor/src/src_editor_buffer.adb"
#  from [7bea92bf527a015245c9669d155381a26acea5f8]
#    to [8102557244df0bd4b8fd37471e8dfc54b7bdcea1]
#
# patch "src_editor/src/src_editor_module-shell.adb"
#  from [9a947979903d02226518c4542b4c690cacf56aa1]
#    to [b7d821bd0fea8e67fc4cc12936f43bfe845a3096]
#
# patch "src_editor/src/src_editor_module.adb"
#  from [25f2783309d5fb4ef4659c691a0f02b66e7b820c]
#    to [d625f84ca7a37f6dfd9c54562e2d40602a63aa4d]
#
# patch "src_editor/src/src_editor_view.adb"
#  from [67545e123dd2594ec01bfa920c9265096c946d60]
#    to [18e70a6118bb1e1d42b797ca4f52383dce16510f]
#
# patch "toolchains/src/toolchains_module.adb"
#  from [59166512e4805ebcc50888b698c27eaef900de85]
#    to [4421d90461026b8a187ae768e1c5a391f0ff2499]
#
# patch "vcs/src/vcs-clearcase.adb"
#  from [0fa380c10acb847d748080a32d488d00c85dcadd]
#    to [b683c1235e437778162781d58ca58b8013206722]
#
# patch "vcs/src/vcs-clearcase.ads"
#  from [1432e6801b807649c1051d404244ab12ec0bfcb9]
#    to [65740b2b8820bd9563884dc4ef161a68b63ffacd]
#
# patch "vcs/src/vcs-generic_vcs.adb"
#  from [0d45f15ac723fa3c271e5a33760e9c08f5e9cfc5]
#    to [3433d7d20a84b51ba125cbf25263d6b811b54733]
#
# patch "vcs/src/vcs-generic_vcs.ads"
#  from [bcd8a857a9cc1d33be2adb368f07232441456d84]
#    to [d41f4e21464a07e678a40d41ad7c1c7494193e7c]
#
# patch "vcs/src/vcs-unknown_vcs.adb"
#  from [d91c2c251d9157a1dc9345af7137c2ab7e765929]
#    to [bd2299de74a0e241fe6b243d6bf7a4790e7a5970]
#
# patch "vcs/src/vcs.adb"
#  from [94f5848436fa84744afa96164a0f64a33e0a4913]
#    to [68a2b7197c1537b30e1eb48ab16a9ac9cf6897ec]
#
# patch "vcs/src/vcs.ads"
#  from [15fb1667e25ca6c1eb4d931a86ff8eb9057e5a7e]
#    to [a10f2333617d890c3e63df51c71c1435035dda41]
#
# patch "vcs/src/vcs_activities.adb"
#  from [c75b38f89d8500be743e0fca3ee6bc0c29a02d51]
#    to [0f1ef7cee23fcf407f7d1605d0881fef1a1c709f]
#
# patch "vcs/src/vcs_activities_view_api.adb"
#  from [bb5d89e67dca53a3eb53acdea99fd5dd65f674ec]
#    to [15d5ed0407857fb79dc1d5f5a8d52a823d9ff4e8]
#
# patch "vcs/src/vcs_module.adb"
#  from [a6e4eee1c3b035bfaa47df070ff40f740c91e991]
#    to [7ebbbeec0656f2a5cfb4cdc0181baf95904cfcd0]
#
# patch "vcs/src/vcs_module.ads"
#  from [4bff9ae7573988297c1ac2842eb4a20a2734ff11]
#    to [a4dad200df71084a919b2e775dda7089e80bb174]
#
# patch "vcs/src/vcs_status.adb"
#  from [c59e7aca6a6790e776ab7a0bf504ff83f52ffdbb]
#    to [752d2b349b13646c7b953de2150bf9c77f5544fd]
#
# patch "vcs/src/vcs_utils.adb"
#  from [2d1da6290f6eb68b1a6341f01e472a5be392cc64]
#    to [1f43800a95ee8be57967b7358b14db61dd7b227f]
#
# patch "vcs/src/vcs_view-explorer.adb"
#  from [c41b28ebc2c1eb8b92128a086431e0bb3469b0e7]
#    to [5f456aad025567696dc29bf5415e5ba54f05c21d]
#
# patch "vcs/src/vcs_view-explorer.ads"
#  from [d98643015fbea9de2ab1df5775ab90755201e716]
#    to [0a3a1021cbe870778f615d6fb75c0ddfec98f446]
#
# patch "vcs/src/vcs_view_api.adb"
#  from [50849bcb2a655ea2f198659ddd7db4e5c90b68d7]
#    to [d9e13b17867337c8ed94cadec59d0b38cb66c6bf]
#
# patch "vcs/src/vcs_view_api.ads"
#  from [511f730d24b2b82fec778e5751ddbd2e8a0e9cda]
#    to [6454c97a96386dad0fb108a58fc49d4be7b71d70]
#
# patch "vfs/src/vfs_module.adb"
#  from [9dbfd461d599bd920c4003c21d8cdf4f345c6e0e]
#    to [e76eab6ca0d48ce05aa8ede3bc46bb9b5657283d]
#
# patch "vsearch/src/entities-tooltips.adb"
#  from [b9dc234f60a897cb3c570d81918d14f3aa755453]
#    to [f122eed4c997c05f62397ef54e372841a41b5023]
#
# patch "widgets/src/build_configurations-gtkada-dialogs.adb"
#  from [576ee154f8155a41ef31dd3a484240c5a7ec90ba]
#    to [c5ad86b9ffb695539790680566e9ac06164158bf]
#
# patch "widgets/src/build_configurations-gtkada.adb"
#  from [4d7caec2f4ab4ee1755e433a14f0989dc70136b6]
#    to [5dd3da75ea99ab724a4d17ec962fabd3fc77ec6e]
#
# patch "widgets/src/build_configurations-gtkada.ads"
#  from [4f96a1542e9cc4a4b7e88afcf31b4969fc26c0cb]
#    to [2c7c0db5306e3a1b4ff3e6ef93c94c009f779ef4]
#
# patch "widgets/src/build_configurations.adb"
#  from [3e6daee005150243f2e0396f919741af55a0e80b]
#    to [2bdb4f5e6448cebdfe943184ffe224b684885224]
#
# patch "widgets/src/build_configurations.ads"
#  from [b2238340818a754353ed5052b85fe5d585844a1f]
#    to [26449a4ff15405d0251b89b4a4c15d1f7a835177]
#
# patch "widgets/src/directory_tree.adb"
#  from [6248aacc61bace3f8b22b914f1848eaa36b79528]
#    to [4aa0aee8f6d0fdafb9fc99942030c152adbb571c]
#
# patch "widgets/src/gtkada-file_selector.adb"
#  from [4170d46ca4678f7221a261f3e062378066c0c6a9]
#    to [0e7ded67948abbc404bdf418d1b19ef878b570a5]
#
# patch "widgets/src/render.c"
#  from [deb2a0f9ce0ba30f8fd955175d6d5816384413c5]
#    to [9c6d705d475299fedf164dbf9d5dba3fac440db3]
#
# patch "widgets/src/switches_chooser-gtkada.adb"
#  from [d3e187a12dea2c9d292f293b98ff85042ce7e178]
#    to [a9fb026c5c3789d8fc44f9012b8c98a0ffeba233]
#
# patch "widgets/src/switches_chooser.adb"
#  from [23bf8a65a92dc45872704cf72926edb55ac5f3cf]
#    to [ef232cdbed81c21569aadf978f47650fd25414f9]
#
# patch "widgets/src/switches_chooser.ads"
#  from [77216ce29303ecfaff67f0be3c07bc8aa5b5da6e]
#    to [799499ec5ff8b4a701c6d9369415401d0a257056]
#
#   set "docs/target-configuration-dialog.jpg"
#  attr "mtn:manual_merge"
# value "true"
#
============================================================
--- code_analysis/src/code_coverage-gcov.adb	424afe7301e95ea0ca052be270cda0aae96a7843
+++ code_analysis/src/code_coverage-gcov.adb	424afe7301e95ea0ca052be270cda0aae96a7843
@@ -0,0 +1,253 @@
+-----------------------------------------------------------------------
+--                               G P S                               --
+--                                                                   --
+--                   Copyright (C) 2008, AdaCore                     --
+--                                                                   --
+-- GPS is Free  software;  you can redistribute it and/or modify  it --
+-- under the terms of the GNU General Public License as published by --
+-- the Free Software Foundation; either version 2 of the License, or --
+-- (at your option) any later version.                               --
+--                                                                   --
+-- This program is  distributed in the hope that it will be  useful, --
+-- but  WITHOUT ANY WARRANTY;  without even the  implied warranty of --
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU --
+-- General Public License for more details. You should have received --
+-- a copy of the GNU General Public License along with this program; --
+-- if not,  write to the  Free Software Foundation, Inc.,  59 Temple --
+-- Place - Suite 330, Boston, MA 02111-1307, USA.                    --
+-----------------------------------------------------------------------
+
+with Ada.Strings;       use Ada.Strings;
+with Ada.Strings.Fixed; use Ada.Strings.Fixed;
+with GNAT.Regpat;       use GNAT.Regpat;
+with GPS.Intl;          use GPS.Intl;
+with GPS.Kernel.Styles;
+with GPS.Location_View;
+with Code_Analysis_GUI;
+--  ??? Why not replace by Code_Coverage_Gui?
+with Coverage_GUI;
+with String_Utils;       use String_Utils;
+
+package body Code_Coverage.Gcov is
+
+   -------------------
+   -- Add_File_Info --
+   -------------------
+
+   procedure Add_File_Info
+     (File_Node     : Code_Analysis.File_Access;
+      File_Contents : String_Access)
+   is
+      Current           : Natural;
+      Line_Regexp       : constant Pattern_Matcher := Compile
+        ("^ +(\d+|#####): *(\d+):(.*$)", Multiple_Lines);
+      Line_Matches      : Match_Array (0 .. 3);
+      Last_Line_Regexp  : constant Pattern_Matcher := Compile
+        ("^ +(\d+|#####|-): *(\d+):", Multiple_Lines);
+      Last_Line_Matches : Match_Array (0 .. 2);
+      Line_Num          : Natural;
+      Lines_Count       : Natural := 0;
+      Not_Cov_Count     : Natural := 0;
+   begin
+      if File_Node.Analysis_Data.Coverage_Data = null then
+         File_Node.Analysis_Data.Coverage_Data := new File_Coverage;
+      end if;
+
+      --  Determination of the line number
+
+      Current := File_Contents'Last;
+      Current := Index (File_Contents.all, (1 => ASCII.LF), Current, Backward);
+
+      if Current = File_Contents'Last then
+         if Current > 0 then
+            Current := Index
+              (File_Contents.all, (1 => ASCII.LF), Current - 1, Backward);
+
+            if Current = 0 then
+               Set_Error (File_Node, File_Corrupted);
+               --  The .gcov file is not a valid Gcov file.
+               --  No last source code line found.
+               return;
+            end if;
+         else
+            Set_Error (File_Node, File_Empty);
+            --  the .gcov file is not a valid Gcov file.
+            return;
+         end if;
+      end if;
+
+      loop
+         Match
+           (Last_Line_Regexp, File_Contents.all, Last_Line_Matches, Current);
+
+         exit when Last_Line_Matches (0) /= No_Match;
+
+         if Current > 0 then
+            Current := Index
+              (File_Contents.all, (1 => ASCII.LF), Current - 1, Backward);
+
+            if Current = 0 then
+               Set_Error (File_Node, File_Corrupted);
+               --  The .gcov file is not a valid Gcov file.
+               --  No last source code line found.
+               return;
+            end if;
+         else
+            Set_Error (File_Node, File_Corrupted);
+            --  the .gcov file is not a valid Gcov file.
+            return;
+         end if;
+      end loop;
+
+      --  Parsing of the line coverage information
+
+      File_Node.Lines := new Line_Array (1 .. Natural'Value (File_Contents
+        (Last_Line_Matches (2).First .. Last_Line_Matches (2).Last)));
+      --  Create a Line_Array with exactly the number of elements corresponding
+      --  to the number of code lines in the original source code file.
+
+      File_Node.Lines.all := (others => Null_Line);
+      Current := File_Contents'First;
+      loop
+         Match (Line_Regexp, File_Contents.all, Line_Matches, Current);
+
+         exit when Line_Matches (0) = No_Match;
+
+         Lines_Count := Lines_Count + 1;
+         Line_Num := Natural'Value
+           (File_Contents (Line_Matches (2).First .. Line_Matches (2).Last));
+         File_Node.Lines (Line_Num).Number := Line_Num;
+         File_Node.Lines (Line_Num).Analysis_Data.Coverage_Data :=
+           new Gcov_Line_Coverage;
+         Gcov_Line_Coverage
+           (File_Node.Lines (Line_Num).Analysis_Data.Coverage_Data.all).Status
+           := No_Code;
+
+         case File_Contents (Line_Matches (1).First) is
+            when '#' =>
+               Gcov_Line_Coverage
+                 (File_Node.Lines
+                    (Line_Num).Analysis_Data.Coverage_Data.all).Status
+                 := Not_Covered;
+               File_Node.Lines (Line_Num).Analysis_Data.Coverage_Data.Coverage
+                 := 0;
+               File_Node.Lines (Line_Num).Contents := new String'
+                 (File_Contents
+                    (Line_Matches (3).First .. Line_Matches (3).Last));
+               Not_Cov_Count := Not_Cov_Count + 1;
+            when others =>
+               Gcov_Line_Coverage
+                 (File_Node.Lines
+                    (Line_Num).Analysis_Data.Coverage_Data.all).Status
+                 := Covered;
+               File_Node.Lines (Line_Num).Analysis_Data.Coverage_Data.Coverage
+                 := Natural'Value
+                   (File_Contents
+                        (Line_Matches (1).First .. Line_Matches (1).Last));
+         end case;
+
+         Current := Line_Matches (0).Last + 1;
+      end loop;
+
+      Node_Coverage (File_Node.Analysis_Data.Coverage_Data.all).Children :=
+        Lines_Count;
+      File_Node.Analysis_Data.Coverage_Data.Coverage := Not_Cov_Count;
+      File_Coverage (File_Node.Analysis_Data.Coverage_Data.all).Status :=
+        Valid;
+   end Add_File_Info;
+
+   -------------------------------
+   -- Add_Location_If_Uncovered --
+   -------------------------------
+
+   overriding procedure Add_Location_If_Uncovered
+     (Coverage    : Gcov_Line_Coverage;
+      Kernel      : GPS.Kernel.Kernel_Handle;
+      File        : GNATCOLL.VFS.Virtual_File;
+      Line_Number : Positive;
+      Line_Text   : String_Access;
+      Added       : in out Boolean)
+   is
+   begin
+      if Coverage.Coverage = 0 then
+         Added := True;
+         GPS.Location_View.Insert_Location
+           (Kernel             => Kernel,
+            Category           => Coverage_GUI.Uncovered_Category,
+            File               => File,
+            Text               => Line_Text.all,
+            Line               => Line_Number,
+            Column             => 1,
+            Highlight          => True,
+            Highlight_Category => GPS.Kernel.Styles.Builder_Warnings_Style);
+      end if;
+   end Add_Location_If_Uncovered;
+
+   ------------------------
+   -- Line_Coverage_Info --
+   ------------------------
+
+   overriding function Line_Coverage_Info
+     (Coverage : Gcov_Line_Coverage;
+      Bin_Mode : Boolean := False)
+      return GPS.Kernel.Standard_Hooks.Line_Information_Record
+   is
+      Pango_Markup_To_Open_1 : constant String := "<span foreground=""";
+      Pango_Markup_To_Open_2 : constant String := """>";
+      Pango_Markup_To_Close  : constant String := "</span>";
+
+      Result : GPS.Kernel.Standard_Hooks.Line_Information_Record;
+
+   begin
+      if Bin_Mode then
+         case Coverage.Coverage is
+         when 0 =>
+            Result.Image := Code_Analysis_GUI.Uncovered_Line_Pixbuf;
+            Result.Tooltip_Text := new String'
+              (-"The code for this line has not been executed.");
+         when others =>
+            Result.Image := Code_Analysis_GUI.Covered_Line_Pixbuf;
+            Result.Tooltip_Text := new String'
+              (-"The code for this line has been executed.");
+         end case;
+      else
+         case Coverage.Coverage is
+         when 0 =>
+            Result.Text := new
+              String'(Pango_Markup_To_Open_1
+                      & "red"
+                      & Pango_Markup_To_Open_2
+                      & "#"
+                      & Pango_Markup_To_Close);
+         when 1 =>
+            Result.Text := new
+              String'(Pango_Markup_To_Open_1
+                      & "black"
+                      & Pango_Markup_To_Open_2
+                      & (-" 1 time ")
+                       & Pango_Markup_To_Close);
+         when others =>
+            Result.Text := new
+              String'
+                (Pango_Markup_To_Open_1
+                 & "black"
+                 & Pango_Markup_To_Open_2
+                 & Image (Coverage.Coverage)
+                 & " times"
+                 & Pango_Markup_To_Close);
+         end case;
+      end if;
+
+      return Result;
+   end Line_Coverage_Info;
+
+   --------------
+   -- Is_Valid --
+   --------------
+
+   overriding function Is_Valid (Self : Gcov_Line_Coverage) return Boolean is
+   begin
+      return Self.Status /= Undetermined;
+   end Is_Valid;
+
+end Code_Coverage.Gcov;
============================================================
--- code_analysis/src/code_coverage-gcov.ads	680dc4b4394cb1f197988aa13d72d87b76d15b6f
+++ code_analysis/src/code_coverage-gcov.ads	680dc4b4394cb1f197988aa13d72d87b76d15b6f
@@ -0,0 +1,58 @@
+-----------------------------------------------------------------------
+--                               G P S                               --
+--                                                                   --
+--                   Copyright (C) 2008, AdaCore                     --
+--                                                                   --
+-- GPS is Free  software;  you can redistribute it and/or modify  it --
+-- under the terms of the GNU General Public License as published by --
+-- the Free Software Foundation; either version 2 of the License, or --
+-- (at your option) any later version.                               --
+--                                                                   --
+-- This program is  distributed in the hope that it will be  useful, --
+-- but  WITHOUT ANY WARRANTY;  without even the  implied warranty of --
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU --
+-- General Public License for more details. You should have received --
+-- a copy of the GNU General Public License along with this program; --
+-- if not,  write to the  Free Software Foundation, Inc.,  59 Temple --
+-- Place - Suite 330, Boston, MA 02111-1307, USA.                    --
+-----------------------------------------------------------------------
+
+with GNATCOLL.VFS;
+with GPS.Kernel.Standard_Hooks;
+
+package Code_Coverage.Gcov is
+
+   type Gcov_Line_Coverage_Status is
+     (No_Code,
+      Not_Covered,
+      Covered,
+      Undetermined);
+
+   type Gcov_Line_Coverage is new Code_Analysis.Line_Coverage with record
+      Status : Gcov_Line_Coverage_Status := Undetermined;
+   end record;
+
+   overriding function Is_Valid (Self : Gcov_Line_Coverage) return Boolean;
+
+   overriding function Line_Coverage_Info
+     (Coverage : Gcov_Line_Coverage;
+      Bin_Mode : Boolean := False)
+      return GPS.Kernel.Standard_Hooks.Line_Information_Record;
+
+   overriding procedure Add_Location_If_Uncovered
+     (Coverage    : Gcov_Line_Coverage;
+      Kernel      : GPS.Kernel.Kernel_Handle;
+      File        : GNATCOLL.VFS.Virtual_File;
+      Line_Number : Positive;
+      Line_Text   : String_Access;
+      Added       : in out Boolean);
+   --  Adds location of the uncovered line to the location window. Set Added to
+   --  True if line has been added; otherwise preserve Added value.
+
+   procedure Add_File_Info
+     (File_Node     : Code_Analysis.File_Access;
+      File_Contents : String_Access);
+   --  Parse the File_Contents and fill the File_Node with gcov info
+   --  And set Line_Count and Covered_Lines
+
+end Code_Coverage.Gcov;
============================================================
--- code_analysis/src/code_coverage-xcov.adb	569c99ed9ebb3d4d351e57ae309486e54b2679ab
+++ code_analysis/src/code_coverage-xcov.adb	569c99ed9ebb3d4d351e57ae309486e54b2679ab
@@ -0,0 +1,333 @@
+-----------------------------------------------------------------------
+--                               G P S                               --
+--                                                                   --
+--                   Copyright (C) 2008, AdaCore                     --
+--                                                                   --
+-- GPS is Free  software;  you can redistribute it and/or modify  it --
+-- under the terms of the GNU General Public License as published by --
+-- the Free Software Foundation; either version 2 of the License, or --
+-- (at your option) any later version.                               --
+--                                                                   --
+-- This program is  distributed in the hope that it will be  useful, --
+-- but  WITHOUT ANY WARRANTY;  without even the  implied warranty of --
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU --
+-- General Public License for more details. You should have received --
+-- a copy of the GNU General Public License along with this program; --
+-- if not,  write to the  Free Software Foundation, Inc.,  59 Temple --
+-- Place - Suite 330, Boston, MA 02111-1307, USA.                    --
+-----------------------------------------------------------------------
+
+with Ada.Strings;       use Ada.Strings;
+with Ada.Strings.Fixed; use Ada.Strings.Fixed;
+with GNAT.Regpat;       use GNAT.Regpat;
+with GNATCOLL.Traces;
+with GPS.Intl;          use GPS.Intl;
+with GPS.Kernel.Styles;
+with GPS.Location_View;
+with Traces;
+with Coverage_GUI;
+
+package body Code_Coverage.Xcov is
+
+   Xcov_Code_Coverage_Module_Trace : constant Traces.Debug_Handle
+     := GNATCOLL.Traces.Create
+       ("XCOV_CODE_COVERAGE_MODULE", GNATCOLL.Traces.On);
+
+   -------------------
+   -- Add_File_Info --
+   -------------------
+
+   procedure Add_File_Info
+     (File_Node     : Code_Analysis.File_Access;
+      File_Contents : String_Access)
+   is
+      Current           : Natural;
+      Line_Regexp       : constant Pattern_Matcher := Compile
+        ("^ +(\d+) ([-!?+>v*]):(.*$)", Multiple_Lines);
+      Line_Matches      : Match_Array (0 .. 3);
+      Last_Line_Regexp  : constant Pattern_Matcher := Compile
+        ("^ +(\d+) (.):", Multiple_Lines);
+      Last_Line_Matches : Match_Array (0 .. 2);
+      Line_Num          : Natural;
+      Lines_Count       : Natural := 0;
+      Not_Cov_Count     : Natural := 0;
+      Line_Coverage     : Xcov_Line_Coverage_Access;
+   begin
+      if File_Node.Analysis_Data.Coverage_Data = null then
+         File_Node.Analysis_Data.Coverage_Data := new File_Coverage;
+      end if;
+
+      --  Determination of the line number
+
+      Current := File_Contents'Last;
+      Current := Index (File_Contents.all, (1 => ASCII.LF), Current, Backward);
+
+      if Current = File_Contents'Last then
+         if Current > 0 then
+            Current := Index
+              (File_Contents.all, (1 => ASCII.LF), Current - 1, Backward);
+
+            if Current = 0 then
+               Set_Error (File_Node, File_Corrupted);
+               --  The .xcov file is not a valid Xcov file.
+               --  No last source code line found.
+               return;
+            end if;
+         else
+            Set_Error (File_Node, File_Empty);
+            --  the .xcov file is not a valid Xcov file.
+            return;
+         end if;
+      end if;
+
+      loop
+         Match
+           (Last_Line_Regexp, File_Contents.all, Last_Line_Matches, Current);
+
+         exit when Last_Line_Matches (0) /= No_Match;
+
+         if Current > 0 then
+            Current := Index
+              (File_Contents.all, (1 => ASCII.LF), Current - 1, Backward);
+
+            if Current = 0 then
+               Set_Error (File_Node, File_Corrupted);
+               --  The .xcov file is not a valid Xcov file.
+               --  No last source code line found.
+               return;
+            end if;
+         else
+            Set_Error (File_Node, File_Corrupted);
+            --  the .xcov file is not a valid Xcov file.
+            return;
+         end if;
+      end loop;
+
+      --  Parsing of the line coverage information
+
+      File_Node.Lines := new Line_Array (1 .. Natural'Value (File_Contents
+        (Last_Line_Matches (1).First .. Last_Line_Matches (1).Last)));
+      --  Create a Line_Array with exactly the number of elements corresponding
+      --  to the number of code lines in the original source code file.
+
+      File_Node.Lines.all := (others => Null_Line);
+      Current := File_Contents'First;
+
+      --  Skip first two lines: file name and coverage statistic information
+
+      Current := Index (File_Contents.all, (1 => ASCII.LF), Current + 1);
+      Current := Index (File_Contents.all, (1 => ASCII.LF), Current + 1);
+      Current := Current + 1;
+
+      loop
+         Match (Line_Regexp, File_Contents.all, Line_Matches, Current);
+
+         exit when Line_Matches (0) = No_Match;
+
+         Lines_Count := Lines_Count + 1;
+         Line_Num := Natural'Value
+           (File_Contents (Line_Matches (1).First .. Line_Matches (1).Last));
+         File_Node.Lines (Line_Num).Number := Line_Num;
+         Line_Coverage := new Xcov_Line_Coverage;
+         File_Node.Lines (Line_Num).Analysis_Data.Coverage_Data :=
+           Coverage_Access (Line_Coverage);
+         Line_Coverage.Status := No_Code;
+         Line_Coverage.Coverage := 0;
+
+         case File_Contents (Line_Matches (2).First) is
+            when '-' =>
+               Line_Coverage.Status   := Not_Covered;
+               Not_Cov_Count := Not_Cov_Count + 1;
+
+            when '!' =>
+               Line_Coverage.Status := Partially_Covered;
+
+            when '?' =>
+               Line_Coverage.Status := Branch_Partially_Covered;
+
+            when '+' =>
+               Line_Coverage.Status := Covered_No_Branch;
+
+            when '>' =>
+               Line_Coverage.Status := Branch_Taken;
+
+            when 'v' =>
+               Line_Coverage.Status := Branch_Fallthrough;
+
+            when '*' =>
+               Line_Coverage.Status := Branch_Covered;
+
+            when others =>
+               GNATCOLL.Traces.Trace
+                 (Xcov_Code_Coverage_Module_Trace,
+                  "unexpected character: "
+                  & File_Contents (Line_Matches (2).First));
+               pragma Assert (False);
+         end case;
+
+         --  Set Coverage to 1 for partially and fully covered lines
+
+         if Line_Coverage.Status in Xcov_Partially_Covered
+           or else Line_Coverage.Status in Xcov_Fully_Covered
+         then
+            Line_Coverage.Coverage := 1;
+         end if;
+
+         --  For uncovered and partially covered lines also store text
+         --  of the corresponding line.
+
+         if Line_Coverage.Status = Not_Covered
+           or else Line_Coverage.Status in Xcov_Partially_Covered
+         then
+            File_Node.Lines (Line_Num).Contents := new String'
+              (File_Contents
+                 (Line_Matches (3).First .. Line_Matches (3).Last));
+         end if;
+
+         Current := Line_Matches (0).Last + 1;
+      end loop;
+
+      Node_Coverage (File_Node.Analysis_Data.Coverage_Data.all).Children :=
+        Lines_Count;
+      File_Node.Analysis_Data.Coverage_Data.Coverage := Not_Cov_Count;
+      File_Coverage (File_Node.Analysis_Data.Coverage_Data.all).Status :=
+        Valid;
+   end Add_File_Info;
+
+   -------------------------------
+   -- Add_Location_If_Uncovered --
+   -------------------------------
+
+   overriding procedure Add_Location_If_Uncovered
+     (Coverage    : Xcov_Line_Coverage;
+      Kernel      : GPS.Kernel.Kernel_Handle;
+      File        : GNATCOLL.VFS.Virtual_File;
+      Line_Number : Positive;
+      Line_Text   : String_Access;
+      Added       : in out Boolean)
+   is
+   begin
+      if Coverage.Status = Not_Covered then
+         Added := True;
+
+         GPS.Location_View.Insert_Location
+           (Kernel             => Kernel,
+            Category           => Coverage_GUI.Uncovered_Category,
+            File               => File,
+            Text               => Line_Text.all,
+            Line               => Line_Number,
+            Column             => 1,
+            Highlight          => True,
+            Highlight_Category => GPS.Kernel.Styles.Builder_Warnings_Style);
+
+      elsif Coverage.Status in Xcov_Partially_Covered then
+         Added := True;
+
+         GPS.Location_View.Insert_Location
+           (Kernel             => Kernel,
+            Category           => Coverage_GUI.Partially_Covered_Category,
+            File               => File,
+            Text               => Line_Text.all,
+            Line               => Line_Number,
+            Column             => 1,
+            Highlight          => True,
+            Highlight_Category => GPS.Kernel.Styles.Builder_Warnings_Style);
+      end if;
+   end Add_Location_If_Uncovered;
+
+   ------------------------
+   -- Line_Coverage_Info --
+   ------------------------
+
+   overriding function Line_Coverage_Info
+     (Coverage : Xcov_Line_Coverage;
+      Bin_Mode : Boolean := False)
+      return GPS.Kernel.Standard_Hooks.Line_Information_Record
+   is
+      pragma Unreferenced (Bin_Mode);
+      --  It is used by the gcov plugin.
+
+      Pango_Markup_To_Open_1 : constant String := "<span background=""";
+      Pango_Markup_To_Open_2 : constant String := """>";
+      Pango_Markup_To_Close  : constant String := "</span>";
+
+      Not_Covered_Color       : constant String := "red";
+      Partially_Covered_Color : constant String := "orange";
+      Fully_Covered_Color     : constant String := "green";
+
+      Result : GPS.Kernel.Standard_Hooks.Line_Information_Record;
+
+   begin
+      case Coverage.Status is
+         when No_Code =>
+            null;
+
+         when Not_Covered =>
+            Result.Text := new String'
+              (Pango_Markup_To_Open_1 & Not_Covered_Color
+               & Pango_Markup_To_Open_2 & "-" & Pango_Markup_To_Close);
+            Result.Tooltip_Text := new String'
+              (-"The code for this line has not been executed.");
+
+         when Partially_Covered =>
+            Result.Text := new String'
+              (Pango_Markup_To_Open_1 & Partially_Covered_Color
+               & Pango_Markup_To_Open_2 & "!" & Pango_Markup_To_Close);
+            Result.Tooltip_Text := new String'
+              (-"The code for this line has been partially executed.");
+
+         when Branch_Partially_Covered =>
+            Result.Text := new String'
+              (Pango_Markup_To_Open_1 & Partially_Covered_Color
+               & Pango_Markup_To_Open_2 & "?" & Pango_Markup_To_Close);
+            Result.Tooltip_Text := new String'
+              (-("The code for this line has been executed,"
+               & " but not all decisions taken"));
+
+         when Covered_No_Branch =>
+            Result.Text := new String'
+              (Pango_Markup_To_Open_1 & Fully_Covered_Color
+               & Pango_Markup_To_Open_2 & "+" & Pango_Markup_To_Close);
+            Result.Tooltip_Text := new String'
+              (-"The code for this line has been executed, no branches");
+
+         when Branch_Taken =>
+            Result.Text := new String'
+              (Pango_Markup_To_Open_1 & Partially_Covered_Color
+               & Pango_Markup_To_Open_2 & ">" & Pango_Markup_To_Close);
+            Result.Tooltip_Text := new String'
+              (-("The code for this line has been executed,"
+               & " branch taken"));
+
+         when Branch_Fallthrough =>
+            Result.Text := new String'
+              (Pango_Markup_To_Open_1 & Partially_Covered_Color
+               & Pango_Markup_To_Open_2 & "v" & Pango_Markup_To_Close);
+            Result.Tooltip_Text := new String'
+              (-("The code for this line has been executed,"
+               & " branch fallthrough"));
+
+         when Branch_Covered =>
+            Result.Text := new String'
+              (Pango_Markup_To_Open_1 & Fully_Covered_Color
+               & Pango_Markup_To_Open_2 & "*" & Pango_Markup_To_Close);
+            Result.Tooltip_Text := new String'
+              (-"The code for this line has been executed, branch covered");
+
+         when Undetermined =>
+            Result.Text := new String'(-"Undetermined");
+      end case;
+
+      return Result;
+   end Line_Coverage_Info;
+
+   --------------
+   -- Is_Valid --
+   --------------
+
+   overriding function Is_Valid (Self : Xcov_Line_Coverage) return Boolean is
+   begin
+      return Self.Status /= Undetermined;
+   end Is_Valid;
+
+end Code_Coverage.Xcov;
============================================================
--- code_analysis/src/code_coverage-xcov.ads	e08b1fa3d57cc3fabc4a9ae7f21a8fb75074c516
+++ code_analysis/src/code_coverage-xcov.ads	e08b1fa3d57cc3fabc4a9ae7f21a8fb75074c516
@@ -0,0 +1,71 @@
+-----------------------------------------------------------------------
+--                               G P S                               --
+--                                                                   --
+--                   Copyright (C) 2008, AdaCore                     --
+--                                                                   --
+-- GPS is Free  software;  you can redistribute it and/or modify  it --
+-- under the terms of the GNU General Public License as published by --
+-- the Free Software Foundation; either version 2 of the License, or --
+-- (at your option) any later version.                               --
+--                                                                   --
+-- This program is  distributed in the hope that it will be  useful, --
+-- but  WITHOUT ANY WARRANTY;  without even the  implied warranty of --
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU --
+-- General Public License for more details. You should have received --
+-- a copy of the GNU General Public License along with this program; --
+-- if not,  write to the  Free Software Foundation, Inc.,  59 Temple --
+-- Place - Suite 330, Boston, MA 02111-1307, USA.                    --
+-----------------------------------------------------------------------
+
+with GNATCOLL.VFS;
+with GPS.Kernel.Standard_Hooks;
+
+package Code_Coverage.Xcov is
+
+   type Xcov_Line_Coverage_Status is
+     (Undetermined,
+      No_Code,
+      Not_Covered,
+      Partially_Covered,
+      Branch_Partially_Covered,
+      Branch_Taken,
+      Branch_Fallthrough,
+      Branch_Covered,
+      Covered_No_Branch);
+
+   subtype Xcov_Partially_Covered is
+     Xcov_Line_Coverage_Status range Partially_Covered .. Branch_Fallthrough;
+
+   subtype Xcov_Fully_Covered is
+     Xcov_Line_Coverage_Status range Branch_Covered .. Covered_No_Branch;
+
+   type Xcov_Line_Coverage is new Code_Analysis.Line_Coverage with record
+      Status : Xcov_Line_Coverage_Status := Undetermined;
+   end record;
+
+   type Xcov_Line_Coverage_Access is access all Xcov_Line_Coverage'Class;
+
+   overriding function Is_Valid (Self : Xcov_Line_Coverage) return Boolean;
+
+   overriding function Line_Coverage_Info
+     (Coverage : Xcov_Line_Coverage;
+      Bin_Mode : Boolean := False)
+      return GPS.Kernel.Standard_Hooks.Line_Information_Record;
+
+   overriding procedure Add_Location_If_Uncovered
+     (Coverage    : Xcov_Line_Coverage;
+      Kernel      : GPS.Kernel.Kernel_Handle;
+      File        : GNATCOLL.VFS.Virtual_File;
+      Line_Number : Positive;
+      Line_Text   : String_Access;
+      Added       : in out Boolean);
+   --  Adds location of the uncovered line to the location window. Set Added to
+   --  True if line has been added; otherwise preserve Added value.
+
+   procedure Add_File_Info
+     (File_Node     : Code_Analysis.File_Access;
+      File_Contents : String_Access);
+   --  Parse the File_Contents and fill the File_Node with gcov info
+   --  And set Line_Count and Covered_Lines
+
+end Code_Coverage.Xcov;
============================================================
# docs/target-configuration-dialog.jpg is binary
============================================================
--- share/plug-ins/csharp.xml	f0a34502b93c24929cce515596106c09dd57841c
+++ share/plug-ins/csharp.xml	f0a34502b93c24929cce515596106c09dd57841c
@@ -0,0 +1,41 @@
+<?xml version='1.0'?>
+<root>
+  <Language>
+    <Name>C#</Name>
+    <Spec_Suffix>.cs</Spec_Suffix>
+    <Keywords>(a(bstract|s)|b(ase|ool|reak|yte)|c(a(se|tch)|h(ar|ecked)|lass|on(st|tinue))|e(lse|num|vent|xplicit|xtern)|f(alse|inally|ixed|or|oreach)|goto|i(mplicit|nt|nterface|nternal|[fns])|lo(ck|ng)|n(amespace|ew|ull)|o(bject|perator|ut|verride)|p(arams|rivate|rotected|ublic)|r(eadonly|e(f|turn))|s(byte|ealed|hort|izeof|tackalloc|tatic|tring|truct|witch)|t(his|hrow|rue|ry|ypeof)|u(int|long|nchecked|nsafe|short|sing)|virtual|volatile|void|while)\b</Keywords>
+    <Parent>c</Parent>
+    <Context>
+      <New_Line_Comment_Start>//</New_Line_Comment_Start>
+      <String_Delimiter>&quot;</String_Delimiter>
+      <Can_Indent>True</Can_Indent>
+      <Syntax_Highlighting>True</Syntax_Highlighting>
+      <Case_Sensitive>True</Case_Sensitive>
+      <Quote_Character>\</Quote_Character>
+      <Constant_Character>&apos;</Constant_Character>
+    </Context>
+
+    <Categories>
+      <Category>
+        <Name>use</Name>
+        <Pattern>^\s*using\s+([^;]*);$</Pattern>
+        <Index>1</Index>
+      </Category>
+      <Category>
+        <Name>namespace</Name>
+        <Pattern>^\s*namespace\s+([\w][\w\d_.]+)</Pattern>
+        <Index>1</Index>
+      </Category>
+      <Category>
+        <Name>function</Name>
+        <Pattern>^\s*((abstract|public|private|protected|static)\s+)*[\w\d_*]+\s+([\w\d_]+)\s*\([^\)]*\)</Pattern>
+        <Index>3</Index>
+      </Category>
+      <Category>
+        <Name>class</Name>
+        <Pattern>^\s*((abstract|public|private|static)\s+)*class\s+(\w[\w\d_]+)\s*(\:\s*\w*)?</Pattern>
+        <Index>3</Index>
+      </Category>
+    </Categories>
+  </Language>
+</root>
\ No newline at end of file
============================================================
--- ada_module/src/ada_semantic_tree-units.adb	8cd6f5abf152522078999fc9aa4f791833606e20
+++ ada_module/src/ada_semantic_tree-units.adb	c959c35ae91c434a51f6fce572b92610a29044fa
@@ -424,7 +424,10 @@ package body Ada_Semantic_Tree.Units is
          while It /= Null_Construct_Tree_Iterator loop
             Construct := Get_Construct (It);

-            if Is_Compilation_Unit (It) then
+            if Is_Compilation_Unit (It)
+              and then Construct /= null
+              and then Construct.Name /= null
+            then
                Info := Get_Unit_Info
                  (Assistant.Unit_Key, To_Entity_Access (File, It));

@@ -531,6 +534,10 @@ package body Ada_Semantic_Tree.Units is
          Child_Unit   : Unit_Access;
          Parent_Found : Boolean := False;
       begin
+         if Unit = null then
+            return;
+         end if;
+
          Unit_Entity := To_Entity_Access (Unit.Entity);
          Unit_Construct := Get_Construct (Unit_Entity);

============================================================
--- aunit/src/aunit_filters.adb	0f8fddeafb6750266e9b1f7742d7eafd5aa573c8
+++ aunit/src/aunit_filters.adb	aa70b1b5a0d7b71d22b66d06ed14b5fa9acbcf60
@@ -1,7 +1,7 @@
 -----------------------------------------------------------------------
 --                               G P S                               --
 --                                                                   --
---                        Copyright (C) 2001-2008, AdaCore           --
+--                 Copyright (C) 2001-2008, AdaCore                  --
 --                                                                   --
 -- GPS is free  software;  you can redistribute it and/or modify  it --
 -- under the terms of the GNU General Public License as published by --
@@ -17,10 +17,14 @@
 -- Place - Suite 330, Boston, MA 02111-1307, USA.                    --
 -----------------------------------------------------------------------

+with Ada.Characters.Handling; use Ada.Characters.Handling;
+
 with GNAT.OS_Lib;
 with GNATCOLL.Mmap;
-with Ada.Characters.Handling; use Ada.Characters.Handling;
+
 with Glib.Convert;            use Glib.Convert;
+
+with Filesystems;             use Filesystems;
 with GPS.Kernel.Project;      use GPS.Kernel.Project;
 with Language;                use Language;
 with Language.Ada;            use Language.Ada;
@@ -70,13 +74,13 @@ package body Aunit_Filters is
       end if;

       File_Buffer := GNATCOLL.Mmap.Read_Whole_File
-        (Locale_From_UTF8 (File_Name),
+        (Filesystems.Filename_From_UTF8 (File_Name),
          Empty_If_Not_Found => True);
       Parse_Constructs
         (Ada_Lang, Locale_To_UTF8 (File_Buffer.all), Constructs);
       Current_Construct := Constructs.First;

-      --  Find the name of the suite or test case.
+      --  Find the name of the suite or test case

       while not Found
         and then Current_Construct /= null
@@ -131,7 +135,7 @@ package body Aunit_Filters is
          Current_Construct := Current_Construct.Next;
       end loop;

-      --  Find the name of the main unit.
+      --  Find the name of the main unit

       if Found then
          Package_Name := new String'(Constructs.Last.Name.all);
============================================================
--- browsers/src/browsers-canvas.adb	0dc370c1eb78dc50d302685785f1e2ea88e9ac6c
+++ browsers/src/browsers-canvas.adb	f0a35ec9e87e6f726c705c469d51d18d80993a4d
@@ -1,7 +1,7 @@
 -----------------------------------------------------------------------
 --                               G P S                               --
 --                                                                   --
---                      Copyright (C) 2001-2008, AdaCore             --
+--                 Copyright (C) 2001-2008, AdaCore                  --
 --                                                                   --
 -- GPS is free  software;  you can redistribute it and/or modify  it --
 -- under the terms of the GNU General Public License as published by --
@@ -19,8 +19,10 @@ with Ada.Strings.Fixed;

 with Ada.Numerics.Elementary_Functions; use Ada.Numerics.Elementary_Functions;
 with Ada.Strings.Fixed;                 use Ada.Strings.Fixed;
+
 with GNAT.OS_Lib;
 with GNAT.Strings;                      use GNAT.Strings;
+with GNATCOLL.VFS;                      use GNATCOLL.VFS;

 with Gdk.Color;                         use Gdk.Color;
 with Gdk.GC;                            use Gdk.GC;
@@ -33,7 +35,6 @@ with Glib;
 with Gdk.Window;                        use Gdk.Window;

 with Glib;                              use Glib;
-with Glib.Convert;                      use Glib.Convert;
 with Glib.Error;                        use Glib.Error;
 with Glib.Graphs;                       use Glib.Graphs;
 with Glib.Object;                       use Glib.Object;
@@ -67,6 +68,7 @@ with Commands.Interactive;

 with Commands;                          use Commands;
 with Commands.Interactive;              use Commands.Interactive;
+with Filesystems;                       use Filesystems;
 with GPS.Intl;                          use GPS.Intl;
 with GPS.Kernel;                        use GPS.Kernel;
 with GPS.Kernel.Actions;                use GPS.Kernel.Actions;
@@ -78,19 +80,18 @@ with Traces;
 with OS_Utils;                          use OS_Utils;
 with String_Utils;
 with Traces;                            use Traces;
-with GNATCOLL.VFS;                               use GNATCOLL.VFS;

 package body Browsers.Canvas is

    Zoom_Levels : constant array (Positive range <>) of Guint :=
-     (25, 50, 75, 100, 150, 200, 300, 400);
+                   (25, 50, 75, 100, 150, 200, 300, 400);
    --  All the possible zoom levels. We have to use such an array, instead
    --  of doing the computation directly, so as to avoid rounding errors that
    --  would appear in the computation and make zoom_in not the reverse of
    --  zoom_out.

    Zoom_Steps : constant := 3;
-   --  Number of steps while zooming in or out.
+   --  Number of steps while zooming in or out

    package Check_Canvas_Handler is new Gtk.Handlers.User_Callback
      (Gtk_Check_Menu_Item_Record, General_Browser);
@@ -119,7 +120,7 @@ package body Browsers.Canvas is
    --  Zoom directly to a specific level (Data.Zoom)

    procedure Realized (Browser : access Gtk_Widget_Record'Class);
-   --  Callback for the "realized" signal.
+   --  Callback for the "realized" signal

    function Key_Press
      (Browser : access Gtk_Widget_Record'Class; Event : Gdk_Event)
@@ -127,10 +128,10 @@ package body Browsers.Canvas is
    --  Callback for the key press event

    procedure On_Export (Browser : access Gtk_Widget_Record'Class);
-   --  Export the contents of the browser as an image.
+   --  Export the contents of the browser as an image

    procedure On_Export_To_SVG (Browser : access Gtk_Widget_Record'Class);
-   --  Export the contents of the browser to SVG.
+   --  Export the contents of the browser to SVG

    procedure On_Refresh (Browser : access Gtk_Widget_Record'Class);
    --  Recompute the layout of the canvas
@@ -138,10 +139,10 @@ package body Browsers.Canvas is
    procedure Change_Align_On_Grid
      (Item    : access Gtk_Check_Menu_Item_Record'Class;
       Browser : General_Browser);
-   --  Callback for the "align on grid" contextual menu item.
+   --  Callback for the "align on grid" contextual menu item

    procedure On_Select_All (Browser : access Gtk_Widget_Record'Class);
-   --  Select all the items in the canvas.
+   --  Select all the items in the canvas

    procedure On_Data_Clear (Browser : access Gtk_Widget_Record'Class);
    --  "Clear" contextual menu
@@ -156,19 +157,19 @@ package body Browsers.Canvas is
    --  Toggle the display of links for the item

    procedure Toggle_Orthogonal (Browser : access Gtk_Widget_Record'Class);
-   --  Toggle the layout of links.
+   --  Toggle the layout of links

    procedure Set_Root
      (Mitem : access Gtk_Widget_Record'Class; Data : Cb_Data);
-   --  Remove all items except the one described in Data from the canvas.
+   --  Remove all items except the one described in Data from the canvas

    procedure Close_Item
      (Event : Gdk.Event.Gdk_Event; User  : access Browser_Item_Record'Class);
-   --  Close an item when the user presses on the title bar button.
+   --  Close an item when the user presses on the title bar button

    procedure Dump
      (Me : Debug_Handle; Tree : Active_Area_Tree; Indent : Natural := 0);
-   --  For debugging purposes, dump the tree to Me.
+   --  For debugging purposes, dump the tree to Me

    procedure Destroyed (Browser : access Gtk_Widget_Record'Class);
    --  Called when the browser is destroyed
@@ -213,7 +214,7 @@ package body Browsers.Canvas is
    procedure Browser_To_SVG
      (Browser     : access General_Browser_Record'Class;
       SVG_File_FD : GNAT.OS_Lib.File_Descriptor);
-   --  Output an SVG representation of a browser in a file.
+   --  Output an SVG representation of a browser in a file

    function Arrow_Head_To_SVG
      (Canvas : access Interactive_Canvas_Record'Class;
@@ -916,13 +917,13 @@ package body Browsers.Canvas is
    begin
       declare
          Name   : constant Virtual_File :=
-           Select_File
-             (Title             => -"Export Browser As PNG Image",
-              Parent            => Get_Main_Window (Kernel),
-              Default_Name      => "noname.png",
-              Use_Native_Dialog => Use_Native_Dialogs.Get_Pref,
-              Kind              => Save_File,
-              History           => Get_History (Kernel));
+                    Select_File
+                      (Title             => -"Export Browser As PNG Image",
+                       Parent            => Get_Main_Window (Kernel),
+                       Default_Name      => "noname.png",
+                       Use_Native_Dialog => Use_Native_Dialogs.Get_Pref,
+                       Kind              => Save_File,
+                       History           => Get_History (Kernel));
          Pixbuf : Gdk_Pixbuf;
          Error  : GError;

@@ -935,7 +936,7 @@ package body Browsers.Canvas is
             if Pixbuf /= null then
                Save
                  (Pixbuf,
-                  Locale_From_UTF8 (Full_Name (Name).all),
+                  Filesystems.Filename_From_UTF8 (Full_Name (Name).all),
                   PNG,
                   Error);
                Unref (Pixbuf);
@@ -1234,7 +1235,7 @@ package body Browsers.Canvas is
       function Reset_Item
         (Canvas : access Interactive_Canvas_Record'Class;
          Link   : access Canvas_Link_Record'Class) return Boolean;
-      --  Reset the items linked to User.
+      --  Reset the items linked to User

       ----------------
       -- Reset_Item --
@@ -1677,7 +1678,7 @@ package body Browsers.Canvas is
       begin
          Inserted := False;

-         --  If Area is a child of the new Tmp area.
+         --  If Area is a child of the new Tmp area
          if Rectangle_In (Rectangle, Area.Rectangle) then
             Tmp.Children := new Active_Area_Tree_Array'(1 => Area);
             Area := Tmp;
@@ -2275,7 +2276,7 @@ package body Browsers.Canvas is
       Text        : String_Access;

       procedure Display (Text : String; Line : Xref_Line);
-      --  Display Text on Item.
+      --  Display Text on Item

       procedure Display (Text : String; Line : Xref_Line) is
       begin
============================================================
--- browsers/src/browsers-projects.adb	4ee5c62955ccca6de761ab9cde6e3ab653bbb571
+++ browsers/src/browsers-projects.adb	673e9988d62730f9f0ada94b1216bc9fd5c66324
@@ -172,7 +172,7 @@ package body Browsers.Projects is
    procedure Examine_Ancestor_Project_Hierarchy
      (Browser : access Project_Browser_Record'Class;
       Project : Project_Type);
-   --  Add to the browser all the projects that with Project.
+   --  Add to the browser all the projects that with Project

    procedure On_Examine_Prj_Hierarchy
      (Item : access Arrow_Item_Record'Class);
@@ -255,7 +255,7 @@ package body Browsers.Projects is
          P1 := Project_Of (Src);
          P2 := Project_Of (Dest);

-         if Parent_Project (P1) = P2 then
+         if Extended_Project (P1) = P2 then
             Add_Link
               (Get_Canvas (Browser), L, Src, Dest, Descr => -"extending");
          else
============================================================
--- builder/src/build_command_manager.adb	248380553d0f104c5ed81822219a17f6162bb036
+++ builder/src/build_command_manager.adb	8284db952775fe536af92b269b4fc1893516d429
@@ -18,34 +18,32 @@ with Ada.Unchecked_Deallocation;
 -----------------------------------------------------------------------

 with Ada.Unchecked_Deallocation;
+with Ada.Strings.Fixed;

-with GNAT.Directory_Operations; use GNAT.Directory_Operations;
+with GNAT.Directory_Operations;   use GNAT.Directory_Operations;

-with GNATCOLL.Templates; use GNATCOLL.Templates;
-with GPS.Kernel;             use GPS.Kernel;
-with GPS.Kernel.Console;     use GPS.Kernel.Console;
-with GPS.Kernel.Contexts;    use GPS.Kernel.Contexts;
-with GPS.Kernel.Macros;      use GPS.Kernel.Macros;
-with GPS.Kernel.Preferences; use GPS.Kernel.Preferences;
-with GPS.Kernel.Project;     use GPS.Kernel.Project;
-with GPS.Intl;               use GPS.Intl;
+with GNATCOLL.Templates;          use GNATCOLL.Templates;

-with GPS.Location_View;      use GPS.Location_View;
-
-with Projects.Registry;      use Projects.Registry;
-
-with Commands.Builder; use Commands.Builder;
-
+with Builder_Facility_Module;     use Builder_Facility_Module;
 with Build_Configurations.Gtkada; use Build_Configurations.Gtkada;
+with Commands.Builder;            use Commands.Builder;
+with GPS.Kernel;                  use GPS.Kernel;
+with GPS.Kernel.Console;          use GPS.Kernel.Console;
+with GPS.Kernel.Contexts;         use GPS.Kernel.Contexts;
+with GPS.Kernel.Macros;           use GPS.Kernel.Macros;
+with GPS.Kernel.Preferences;      use GPS.Kernel.Preferences;
+with GPS.Kernel.Project;          use GPS.Kernel.Project;
+with GPS.Kernel.Hooks;            use GPS.Kernel.Hooks;
+with GPS.Kernel.Standard_Hooks;   use GPS.Kernel.Standard_Hooks;
+with GPS.Intl;                    use GPS.Intl;
+with GPS.Location_View;           use GPS.Location_View;
+with OS_Utils;                    use OS_Utils;
+with Projects.Registry;           use Projects.Registry;
+with Projects;                    use Projects;
+with Remote;                      use Remote;
+with String_Utils;                use String_Utils;
+with Traces;                      use Traces;

-with OS_Utils;           use OS_Utils;
-with Projects;           use Projects;
-with Remote;             use Remote;
-with String_Utils;       use String_Utils;
-with Traces;             use Traces;
-
-with Builder_Facility_Module; use Builder_Facility_Module;
-
 package body Build_Command_Manager is

    Me : constant Debug_Handle := Create ("Build_Command_Manager");
@@ -54,7 +52,7 @@ package body Build_Command_Manager is
      (Argument_List, Argument_List_Access);

    Invalid_Argument : exception;
-   --  Raised by Expand_Arg below.
+   --  Raised by Expand_Arg below

    function Expand_Command_Line
      (Kernel     : GPS.Kernel.Kernel_Handle;
@@ -86,7 +84,7 @@ package body Build_Command_Manager is
    --  expansion will be done.

    procedure Free (Ar : in out Argument_List);
-   --  Free memory associated to Ar.
+   --  Free memory associated to Ar

    ----------
    -- Free --
@@ -124,10 +122,11 @@ package body Build_Command_Manager is
       function Substitution
         (Param : String; Quoted : Boolean) return String
       is
-         Done   : aliased Boolean := False;
+         Done : aliased Boolean := False;
       begin
          if Param = "subdir" then
             return Subdir;
+
          else
             declare
                Result : constant String := GPS.Kernel.Macros.Substitute
@@ -139,6 +138,7 @@ package body Build_Command_Manager is
                   else
                      raise Invalid_Argument;
                   end if;
+
                else
                   return Result;
                end if;
@@ -194,12 +194,56 @@ package body Build_Command_Manager is
             return (1 => new String'("-eL"));
          end if;

-      --  ??? Ditto for %builder and %gprclean
+      --  ??? Ditto for %attr
+      elsif Arg'Length > 7
+        and then Arg (Arg'First .. Arg'First + 5) = "%attr("
+        and then Arg (Arg'Last) = ')'
+      then
+         declare
+            function Get_Index (A, B : Natural) return Natural;
+            --  Return A if A /= 0, B otherwise
+
+            ---------------
+            -- Get_Index --
+            ---------------
+
+            function Get_Index (A, B : Natural) return Natural is
+            begin
+               if A = 0 then
+                  return B;
+               else
+                  return A;
+               end if;
+            end Get_Index;
+
+            J    : constant Natural :=
+              Get_Index (Ada.Strings.Fixed.Index (Arg, "'"), Arg'First + 5);
+            K    : constant Natural :=
+              Get_Index (Ada.Strings.Fixed.Index (Arg (J .. Arg'Last), ","),
+                         Arg'Last);
+            Pkg  : constant String := Arg (Arg'First + 6 .. J - 1);
+            Attr : constant String := Arg (J + 1 .. K - 1);
+            Prj  : constant Project_Type :=
+              Get_Project (Get_Kernel (Context));
+            Val  : Argument_List_Access :=
+              Argument_String_To_List
+                (Get_Attribute_Value
+                   (Prj, Build (Pkg, Attr),
+                    Default => Arg (K + 1 .. Arg'Last - 1)));
+            Res  : constant Argument_List := Val.all;
+
+         begin
+            Unchecked_Free (Val);
+            return Res;
+         end;
+
+      --  ??? Ditto for %builder, %gprbuild and %gprclean
       elsif Arg = "%builder"
+        or else Arg = "%gprbuild"
         or else Arg = "%gprclean"
       then
          declare
-            Builder  : constant Boolean := Arg = "%builder";
+            Builder  : constant Boolean := Arg /= "%gprclean";
             Prj      : constant Project_Type :=
                          Get_Project (Get_Kernel (Context));
             Gnatmake : constant String :=
@@ -208,9 +252,24 @@ package body Build_Command_Manager is
                             Default => "gnatmake",
                             Index   => "Ada");
             First    : Natural := Gnatmake'First;
+            Langs    : Argument_List := Get_Languages (Prj, Recursive => True);

+            Multi_Language_Build : Boolean := True;
+
          begin
-            if Multi_Language_Build.Get_Pref
+            if Arg /= "%gprbuild"
+              and then Langs'Length = 1
+              and then Langs (Langs'First).all = "ada"
+            then
+               --  Determine if the project has only Ada set, if so, set
+               --  Multi_Language_Build to False.
+
+               Multi_Language_Build := False;
+            end if;
+
+            Free (Langs);
+
+            if Multi_Language_Build
               and then Multi_Language_Builder.Get_Pref = Gprbuild
             then
                if Gnatmake'Length > 9
@@ -239,7 +298,7 @@ package body Build_Command_Manager is
                end if;

             elsif Builder then
-               if Multi_Language_Build.Get_Pref then
+               if Multi_Language_Build then
                   return (1 => new String'("gprmake"));
                else
                   return (1 => new String'(Gnatmake));
@@ -267,16 +326,19 @@ package body Build_Command_Manager is
             if File = No_File then
                if Simulate then
                   return (1 => new String'("<current-file>"));
+
                else
                   Console.Insert
                     (Kernel, -"No file selected", Mode => Console.Error);
                   raise Invalid_Argument;
                end if;
+
             elsif Get_Project_From_File
               (Get_Registry (Kernel).all, File, False) = No_Project
             then
                if Simulate then
                   return (1 => new String'("<current-file>"));
+
                else
                   Console.Insert
                     (Kernel, -"Could not determine the project for file: "
@@ -284,6 +346,7 @@ package body Build_Command_Manager is
                      Mode => Console.Error);
                   raise Invalid_Argument;
                end if;
+
             else
                --  We are launching a compile command involving File:
                --  remove reference to File from the Locations View.
@@ -294,12 +357,12 @@ package body Build_Command_Manager is
             end if;
          end;

-      elsif Arg = "%M" then
+      elsif Arg = "%T" then
          if Main /= "" then
             return (1 => new String'(Main));
          else
             Console.Insert
-              (Kernel, -"Could not determine the main to build.",
+              (Kernel, -"Could not determine the target to build.",
                Mode => Console.Error);
             raise Invalid_Argument;
          end if;
@@ -307,7 +370,7 @@ package body Build_Command_Manager is
       else
          return (1 => new String'
                    (GNATCOLL.Templates.Substitute
-                    (Str => Arg,
+                    (Str       => Arg,
                      Delimiter => GPS.Kernel.Macros.Special_Character,
                      Callback  => Substitution'Unrestricted_Access)));
       end if;
@@ -326,9 +389,9 @@ package body Build_Command_Manager is
       Subdir     : String;
       Simulate   : Boolean := False) return Argument_List_Access
    is
-      Result : Argument_List_Access := new Argument_List (1 .. CL'Length * 2);
-      Index  : Natural := 1;
-      --  Index of the next free element in Result.
+      Result  : Argument_List_Access := new Argument_List (1 .. CL'Length * 2);
+      Index   : Natural := 1;
+      --  Index of the next free element in Result

       Context : constant Selection_Context := Get_Current_Context (Kernel);

@@ -393,29 +456,29 @@ package body Build_Command_Manager is
    -------------------

    procedure Launch_Target
-     (Kernel       : GPS.Kernel.Kernel_Handle;
-      Registry     : Build_Config_Registry_Access;
-      Target_Name  : String;
-      Mode_Name    : String;
-      Force_File   : Virtual_File;
-      Extra_Args   : Argument_List_Access;
-      Quiet        : Boolean;
-      Synchronous  : Boolean;
-      Dialog       : Dialog_Mode;
-      Main         : String)
+     (Kernel      : GPS.Kernel.Kernel_Handle;
+      Registry    : Build_Config_Registry_Access;
+      Target_Name : String;
+      Mode_Name   : String;
+      Force_File  : Virtual_File;
+      Extra_Args  : Argument_List_Access;
+      Quiet       : Boolean;
+      Synchronous : Boolean;
+      Dialog      : Dialog_Mode;
+      Main        : String)
    is
-      Prj          : constant Project_Type := Get_Project (Kernel);
-      Old_Dir      : constant Dir_Name_Str := Get_Current_Dir;
-      T            : Target_Access;
-      Full         : Argument_List_Access;
-      Command_Line : Argument_List_Access;
+      Prj            : constant Project_Type := Get_Project (Kernel);
+      Old_Dir        : constant Dir_Name_Str := Get_Current_Dir;
+      T              : Target_Access;
+      Full           : Argument_List_Access;
+      Command_Line   : Argument_List_Access;
       All_Extra_Args : Argument_List_Access;

       procedure Launch_For_Mode
         (Mode   : String;
          Quiet  : Boolean;
          Shadow : Boolean);
-      --  Compute and launch the command, for the given mode.
+      --  Compute and launch the command, for the given mode

       ---------------------
       -- Launch_For_Mode --
@@ -424,7 +487,8 @@ package body Build_Command_Manager is
       procedure Launch_For_Mode
         (Mode   : String;
          Quiet  : Boolean;
-         Shadow : Boolean) is
+         Shadow : Boolean)
+      is

          Subdir : constant String := Get_Mode_Subdir (Mode);
          Server : Server_Type;
@@ -432,21 +496,36 @@ package body Build_Command_Manager is
          function Expand_Cmd_Line (CL : String) return String;
          --  Callback for Single_Target_Dialog

+         ---------------------
+         -- Expand_Cmd_Line --
+         ---------------------
+
          function Expand_Cmd_Line (CL : String) return String is
-            CL_Args : Argument_List_Access := Argument_String_To_List (CL);
+            CL_Args   : Argument_List_Access := Argument_String_To_List (CL);
             Mode_Args : Argument_List_Access :=
                           Apply_Mode_Args (Get_Model (T), Mode, CL_Args.all);
-            Args    : Argument_List_Access :=
-              Expand_Command_Line
-                (Kernel, Mode_Args.all & All_Extra_Args.all, Server,
-                 Force_File, Main, Subdir, Simulate => True);
-            Res     : constant String := Argument_List_To_String (Args.all);
+            Args      : Argument_List_Access :=
+                          Expand_Command_Line
+                            (Kernel, Mode_Args.all & All_Extra_Args.all,
+                             Server,
+                             Force_File, Main, Subdir, Simulate => True);

          begin
-            Free (CL_Args);
-            Free (Mode_Args);
-            Free (Args);
-            return Res;
+            if Args = null then
+               Free (CL_Args);
+               Free (Mode_Args);
+               return "";
+
+            else
+               declare
+                  Res : constant String := Argument_List_To_String (Args.all);
+               begin
+                  Free (CL_Args);
+                  Free (Mode_Args);
+                  Free (Args);
+                  return Res;
+               end;
+            end if;
          end Expand_Cmd_Line;

       begin
@@ -500,8 +579,8 @@ package body Build_Command_Manager is
             --  Get the unexpanded command line from the target

             declare
-               CL : constant Argument_List :=
-                      Get_Command_Line_Unexpanded (Registry, T);
+               CL      : constant Argument_List :=
+                           Get_Command_Line_Unexpanded (Registry, T);
                CL_Mode : Argument_List_Access :=
                            Apply_Mode_Args (Get_Model (T), Mode, CL);
             begin
@@ -570,11 +649,8 @@ package body Build_Command_Manager is
             Modes : Argument_List := Get_List_Of_Modes (Get_Model (T));
          begin
             for J in Modes'Range loop
-               --  All modes after Modes'First are Ninja modes
-               Launch_For_Mode
-                 (Modes (J).all,
-                  Quiet,
-                  J > Modes'First);
+               --  All modes after Modes'First are Shadow modes
+               Launch_For_Mode (Modes (J).all, Quiet, J > Modes'First);
             end loop;

             Free (Modes);
@@ -591,22 +667,22 @@ package body Build_Command_Manager is
    overriding
    function Execute
      (Command : access Build_Command;
-      Context : Interactive_Command_Context)
-      return Command_Return_Type
+      Context : Interactive_Command_Context) return Command_Return_Type
    is
       --  ??? We should use the command context
       pragma Unreferenced (Context);
    begin
-      Launch_Target (Kernel       => Command.Kernel,
-                     Registry     => Command.Registry,
-                     Target_Name  => To_String (Command.Target_Name),
-                     Mode_Name    => "",
-                     Force_File   => No_File,
-                     Extra_Args   => null,
-                     Quiet        => Command.Quiet,
-                     Dialog       => Command.Dialog,
-                     Synchronous  => False,
-                     Main         => To_String (Command.Main));
+      Launch_Target
+        (Kernel       => Command.Kernel,
+         Registry     => Command.Registry,
+         Target_Name  => To_String (Command.Target_Name),
+         Mode_Name    => "",
+         Force_File   => No_File,
+         Extra_Args   => null,
+         Quiet        => Command.Quiet,
+         Dialog       => Command.Dialog,
+         Synchronous  => False,
+         Main         => To_String (Command.Main));
       return Success;
    end Execute;

@@ -615,13 +691,13 @@ package body Build_Command_Manager is
    ------------

    procedure Create
-     (Item         : out Build_Command_Access;
-      Kernel       : GPS.Kernel.Kernel_Handle;
-      Registry     : Build_Config_Registry_Access;
-      Target_Name  : String;
-      Main         : String;
-      Quiet        : Boolean;
-      Dialog       : Dialog_Mode) is
+     (Item        : out Build_Command_Access;
+      Kernel      : GPS.Kernel.Kernel_Handle;
+      Registry    : Build_Config_Registry_Access;
+      Target_Name : String;
+      Main        : String;
+      Quiet       : Boolean;
+      Dialog      : Dialog_Mode) is
    begin
       Item := new Build_Command;
       Item.Kernel := Kernel;
@@ -642,28 +718,39 @@ package body Build_Command_Manager is
       Context : Interactive_Command_Context) return Command_Return_Type
    is
       pragma Unreferenced (Context);
-      Mains  : Argument_List := Get_Mains (Command.Kernel);

+      Target_Type : constant String := To_String (Command.Target_Type);
+      Data        : aliased String_Hooks_Args :=
+                      (Hooks_Data with
+                       Length => Target_Type'Length,
+                       Value  => Target_Type);
+      Mains       : Argument_List_Access :=
+                      Argument_String_To_List
+                        (Run_Hook_Until_Not_Empty
+                           (Command.Kernel,
+                            Compute_Build_Targets_Hook,
+                            Data'Unchecked_Access));
+
    begin
       if Command.Main not in 1 .. Mains'Length then
          Insert (Command.Kernel,
                  (-"This project does not contain") & Command.Main'Img
-                 & (-" main files"), Mode => Error);
+                 & " " & Target_Type & (-" targets"), Mode => Error);
+         Free (Mains);
          return Failure;
       end if;

       Launch_Target
-        (Kernel       => Command.Kernel,
-         Registry     => Command.Registry,
-         Target_Name  => To_String (Command.Target_Name),
-         Mode_Name    => "",
-         Force_File   => No_File,
-         Extra_Args   => null,
-         Quiet        => Command.Quiet,
-         Dialog       => Command.Dialog,
-         Synchronous  => False,
-         Main         => Mains (Mains'First - 1 + Command.Main).all);
-
+        (Kernel      => Command.Kernel,
+         Registry    => Command.Registry,
+         Target_Name => To_String (Command.Target_Name),
+         Mode_Name   => "",
+         Force_File  => No_File,
+         Extra_Args  => null,
+         Quiet       => Command.Quiet,
+         Dialog      => Command.Dialog,
+         Synchronous => False,
+         Main        => Mains (Mains'First - 1 + Command.Main).all);
       Free (Mains);

       return Success;
@@ -674,19 +761,21 @@ package body Build_Command_Manager is
    ------------

    procedure Create
-     (Item         : out Build_Main_Command_Access;
-      Kernel       : GPS.Kernel.Kernel_Handle;
-      Registry     : Build_Config_Registry_Access;
-      Target_Name  : String;
-      Main         : Natural;
-      Quiet        : Boolean;
-      Dialog       : Dialog_Mode)
+     (Item        : out Build_Main_Command_Access;
+      Kernel      : GPS.Kernel.Kernel_Handle;
+      Registry    : Build_Config_Registry_Access;
+      Target_Name : String;
+      Target_Type : String;
+      Main        : Natural;
+      Quiet       : Boolean;
+      Dialog      : Dialog_Mode)
    is
    begin
       Item := new Build_Main_Command;
       Item.Kernel := Kernel;
       Item.Registry := Registry;
-      Item.Target_Name := To_Unbounded_String (Target_Name);
+      Set_Unbounded_String (Item.Target_Name, Target_Name);
+      Set_Unbounded_String (Item.Target_Type, Target_Type);
       Item.Main := Main;
       Item.Dialog := Dialog;
       Item.Quiet := Quiet;
============================================================
--- builder/src/build_command_manager.ads	75d08fc7b2de7ec12ea8b4d047c6e1b501cf09c4
+++ builder/src/build_command_manager.ads	75afeb0fd27ce725193d4179865706916afd5f89
@@ -23,16 +23,17 @@
 --
 --  See spec of Builder_Facility_Module for an overview of the build system.

+with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
+
 with GNAT.OS_Lib;           use GNAT.OS_Lib;
-with GPS.Kernel;

+with GNATCOLL.VFS;          use GNATCOLL.VFS;
+
+with GPS.Kernel;
 with Build_Configurations;  use Build_Configurations;
-with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
 with Commands;              use Commands;
 with Commands.Interactive;  use Commands.Interactive;

-with GNATCOLL.VFS;          use GNATCOLL.VFS;
-
 package Build_Command_Manager is

    type Dialog_Mode is
@@ -46,16 +47,16 @@ package Build_Command_Manager is
    --  Default means that the target default should be enforced

    procedure Launch_Target
-     (Kernel       : GPS.Kernel.Kernel_Handle;
-      Registry     : Build_Config_Registry_Access;
-      Target_Name  : String;
-      Mode_Name    : String;
-      Force_File   : Virtual_File;
-      Extra_Args   : Argument_List_Access;
-      Quiet        : Boolean;
-      Synchronous  : Boolean;
-      Dialog       : Dialog_Mode;
-      Main         : String);
+     (Kernel      : GPS.Kernel.Kernel_Handle;
+      Registry    : Build_Config_Registry_Access;
+      Target_Name : String;
+      Mode_Name   : String;
+      Force_File  : Virtual_File;
+      Extra_Args  : Argument_List_Access;
+      Quiet       : Boolean;
+      Synchronous : Boolean;
+      Dialog      : Dialog_Mode;
+      Main        : String);
    --  Launch a build of target named Target_Name
    --  If Mode_Name is not the empty string, then the Mode Mode_Name will be
    --  used.
@@ -90,18 +91,17 @@ package Build_Command_Manager is
    overriding
    function Execute
      (Command : access Build_Command;
-      Context : Interactive_Command_Context)
-      return Command_Return_Type;
+      Context : Interactive_Command_Context) return Command_Return_Type;
    --  See inherited documentation

    procedure Create
-     (Item         : out Build_Command_Access;
-      Kernel       : GPS.Kernel.Kernel_Handle;
-      Registry     : Build_Config_Registry_Access;
-      Target_Name  : String;
-      Main         : String;
-      Quiet        : Boolean;
-      Dialog       : Dialog_Mode);
+     (Item        : out Build_Command_Access;
+      Kernel      : GPS.Kernel.Kernel_Handle;
+      Registry    : Build_Config_Registry_Access;
+      Target_Name : String;
+      Main        : String;
+      Quiet       : Boolean;
+      Dialog      : Dialog_Mode);
    --  Create a build command
    --  Force_Dialog indicates that the command should always be launched
    --  through the interactive dialog.
@@ -110,10 +110,11 @@ package Build_Command_Manager is
    -- Build_Main_Command --
    ------------------------

-   --  A command specialized in building a main, when knowing only its number.
+   --  A command specialized in building a main, when knowing only its number

    type Build_Main_Command is new Interactive_Command with record
       Target_Name  : Unbounded_String;
+      Target_Type  : Unbounded_String;
       Main         : Natural;
       Registry     : Build_Config_Registry_Access;
       Kernel       : GPS.Kernel.Kernel_Handle;
@@ -125,18 +126,18 @@ package Build_Command_Manager is
    overriding
    function Execute
      (Command : access Build_Main_Command;
-      Context : Interactive_Command_Context)
-      return Command_Return_Type;
+      Context : Interactive_Command_Context) return Command_Return_Type;
    --  See inherited documentation

    procedure Create
-     (Item         : out Build_Main_Command_Access;
-      Kernel       : GPS.Kernel.Kernel_Handle;
-      Registry     : Build_Config_Registry_Access;
-      Target_Name  : String;
-      Main         : Natural;
-      Quiet        : Boolean;
-      Dialog       : Dialog_Mode);
+     (Item        : out Build_Main_Command_Access;
+      Kernel      : GPS.Kernel.Kernel_Handle;
+      Registry    : Build_Config_Registry_Access;
+      Target_Name : String;
+      Target_Type : String;
+      Main        : Natural;
+      Quiet       : Boolean;
+      Dialog      : Dialog_Mode);
    --  Create a build command
    --  Force_Dialog indicates that the command should always be launched
    --  through the interactive dialog.
============================================================
--- builder/src/builder_facility_module-scripts.adb	035c85f61fedb415bbcda628efbc233c3ba30f2c
+++ builder/src/builder_facility_module-scripts.adb	cbf21aae426102e2abfbb6f0b47e8398e1615bec
@@ -17,25 +17,22 @@
 -- Place - Suite 330, Boston, MA 02111-1307, USA.                    --
 -----------------------------------------------------------------------

-with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
+with Ada.Strings.Unbounded;      use Ada, Ada.Strings.Unbounded;
 with Ada.Unchecked_Deallocation;

 with GNAT.OS_Lib;

-with GNATCOLL.VFS;       use GNATCOLL.VFS;
+with GNATCOLL.Scripts;           use GNATCOLL.Scripts;
+with GNATCOLL.VFS;               use GNATCOLL.VFS;

-with GPS.Kernel;         use GPS.Kernel;
-with GPS.Kernel.Actions; use GPS.Kernel.Actions;
-with GPS.Kernel.Scripts; use GPS.Kernel.Scripts;
-with GNATCOLL.Scripts;   use GNATCOLL.Scripts;
+with Build_Command_Manager;      use Build_Command_Manager;
+with Build_Configurations;       use Build_Configurations;
+with GPS.Kernel;                 use GPS.Kernel;
+with GPS.Kernel.Scripts;         use GPS.Kernel.Scripts;
+with GPS.Intl;                   use GPS.Intl;
+with String_List_Utils;          use String_List_Utils;
+with String_Utils;               use String_Utils;

-with GPS.Intl;           use GPS.Intl;
-
-with Build_Command_Manager; use Build_Command_Manager;
-with Build_Configurations;  use Build_Configurations;
-
-with String_List_Utils;  use String_List_Utils;
-
 package body Builder_Facility_Module.Scripts is

    ----------------
@@ -44,11 +41,10 @@ package body Builder_Facility_Module.Scr

    --  NOTE: these constants must match the names of the predefined targets
    --  registered in builder_support.py.
-   Compile_File_Target : constant String := "Compile File";
-   Build_File_Target : constant String := "Build <current file>";
-   Check_Syntax_Target : constant String := "Check Syntax";
+   Compile_File_Target   : constant String := "Compile File";
+   Build_File_Target     : constant String := "Build <current file>";
+   Check_Syntax_Target   : constant String := "Check Syntax";
    Check_Semantic_Target : constant String := "Check Semantic";
-   Build_Main_Target : constant String := "Build Main";

    --  BuildTarget class

@@ -81,14 +77,14 @@ package body Builder_Facility_Module.Scr
    procedure Shell_Handler
      (Data    : in out Callback_Data'Class;
       Command : String);
-   --  Shell command handler.
+   --  Shell command handler

-   function Get_Target_Class (Kernel : access Kernel_Handle_Record'Class)
-                              return Class_Type;
+   function Get_Target_Class
+     (Kernel : access Kernel_Handle_Record'Class) return Class_Type;
    --  Convenience function to get the target class

    function Get_Target_Name (Inst : Class_Instance) return String;
-   --  Convenience function to get the target stored in Inst.
+   --  Convenience function to get the target stored in Inst

    procedure Free (Ar : in out GNAT.OS_Lib.String_List);
    procedure Free (Ar : in out GNAT.OS_Lib.String_List_Access);
@@ -127,13 +123,13 @@ package body Builder_Facility_Module.Scr
      (Data    : in out Callback_Data'Class;
       Command : String)
    is
+      use String_List;
       Target_Class : constant Class_Type :=
-        Get_Target_Class (Get_Kernel (Data));
-      use String_List;
-      Kernel     : constant Kernel_Handle := Get_Kernel (Data);
-      Node       : List_Node;
-      Extra_Args : GNAT.OS_Lib.Argument_List_Access;
-      Info       : Virtual_File;
+                       Get_Target_Class (Get_Kernel (Data));
+      Kernel       : constant Kernel_Handle := Get_Kernel (Data);
+      Node         : List_Node;
+      Extra_Args   : GNAT.OS_Lib.Argument_List_Access;
+      Info         : Virtual_File;
    begin
       if Command = Constructor_Method then
          Name_Parameters (Data, Constructor_Args);
@@ -147,7 +143,7 @@ package body Builder_Facility_Module.Scr
                return;
             end if;

-            --  Verify that the target does exist.
+            --  Verify that the target does exist

             if Get_Target_From_Name (Registry, Name) = null then
                Set_Error_Msg
@@ -171,7 +167,7 @@ package body Builder_Facility_Module.Scr

             Remove_Target (Registry, Name);

-            --  ??? Need to update the IDE items: icon, menu, and build action.
+            Refresh_Graphical_Elements;
          end;

       elsif Command = "execute" then
@@ -221,7 +217,7 @@ package body Builder_Facility_Module.Scr
          Set_Return_Value_As_List (Data);
          while Node /= Null_Node loop
             Set_Return_Value
-              (Data, String_List_Utils.String_List.Data (Node));
+              (Data, Unprotect (String_List_Utils.String_List.Data (Node)));

             Node := Next (Node);
          end loop;
@@ -335,25 +331,6 @@ package body Builder_Facility_Module.Scr
          Class   => Get_File_Class (Kernel),
          Handler      => Shell_Handler'Access);

-      --  Register the "build main number x" actions
-
-      for J in 1 .. 4 loop
-         declare
-            C : Build_Main_Command_Access;
-         begin
-            Create (C, Kernel, Registry, Build_Main_Target,
-                    J, False, Default);
-            Register_Action
-              (Kernel      => Kernel,
-               Name        => (-"Build Main Number") & J'Img,
-               Command     => C,
-               Description => (-"Build the main source number") & J'Img,
-               Filter      => null,
-               Category    => -"Build",
-               Defined_In  => GNATCOLL.VFS.No_File);
-         end;
-      end loop;
-
       Bind_Default_Key (Kernel      => Kernel,
                         Action      => (-"Build Main Number 1"),
                         Default_Key => "F4");
@@ -379,9 +356,8 @@ package body Builder_Facility_Module.Scr

    procedure Free (Ar : in out GNAT.OS_Lib.String_List_Access) is
       use GNAT.OS_Lib;
-      procedure Free is new
-        Ada.Unchecked_Deallocation (GNAT.OS_Lib.String_List,
-                                    GNAT.OS_Lib.String_List_Access);
+      procedure Free is new Unchecked_Deallocation
+          (GNAT.OS_Lib.String_List, GNAT.OS_Lib.String_List_Access);

    begin
       if Ar /= null then
============================================================
--- builder/src/builder_facility_module.adb	8143384a8bdad497509889492d68e90dedf0ee3d
+++ builder/src/builder_facility_module.adb	6cd476838df33ecaaa231a5cd521e46ed1a9bbaf
@@ -23,6 +23,7 @@ with GNAT.OS_Lib;               use GNAT
 with Ada.Strings.Unbounded;     use Ada.Strings.Unbounded;

 with GNAT.OS_Lib;               use GNAT.OS_Lib;
+with GNAT.Regpat;               use GNAT.Regpat;

 with Glib;
 with Glib.Object;               use Glib.Object;
@@ -78,6 +79,10 @@ package body Builder_Facility_Module is

 package body Builder_Facility_Module is

+   Max_Number_Of_Mains : constant := 128;
+   --  The maximum number of Mains that we accept to display in the Menus
+   --  and toolbar.
+
    Me          : constant Debug_Handle := Create ("Builder_Facility_Module");
    Modes_Trace : constant Debug_Handle :=
      Create ("Builder.Modes", GNATCOLL.Traces.Off);
@@ -133,6 +138,9 @@ package body Builder_Facility_Module is
    --  The key in this map is a model name, and the element is a set of XML
    --  describing targets associated with this model.

+   package Unbounded_String_List is new Ada.Containers.Doubly_Linked_Lists
+     (Unbounded_String);
+
    type Builder_Module_ID_Record is
      new GPS.Kernel.Modules.Module_ID_Record
    with record
@@ -301,6 +309,11 @@ package body Builder_Facility_Module is
    --  Called every time the project view has changed, ie potentially the list
    --  of main units.

+   function On_Compute_Build_Targets
+     (Kernel : access Kernel_Handle_Record'Class;
+      Data   : access Hooks_Data'Class) return String;
+   --  Called when computing build targets
+
    procedure Add_Action_For_Target (T : Target_Access);
    --  Register a Kernel Action to build T

@@ -410,27 +423,13 @@ package body Builder_Facility_Module is
       pragma Unreferenced (Object, Builder);
       --  The filter guarantees we are on a File_Selection_Context

---        Library_Name : constant String :=
---                         Get_Attribute_Value
---                           (Project_Information (Context),
---                            Attribute => Library_Name_Attribute);
-      M            : Gtk_Menu := Gtk_Menu (Menu);
+      M : Gtk_Menu := Gtk_Menu (Menu);

    begin
       Add_Build_Menu
         (Menu         => M,
          Project      => Project_Information (Context),
          Kernel       => Get_Kernel (Context));
-
-      --  Check for library
-
---        if Library_Name /= "" then
---           Add_Build_Menu
---             (Menu    => M,
---              Project => Project_Information (Context),
---              Kernel  => Get_Kernel (Context),
---              Library => Library_Name);
---        end if;
    end Append_To_Menu;

    -------------
@@ -447,14 +446,56 @@ package body Builder_Facility_Module is
    ---------------

    function Get_Mains (Kernel : Kernel_Handle) return Argument_List is
+      Base_Project : Project_Type;

-      Base_Project     : Project_Type;
+      Root_Project : constant Project_Type := Get_Project (Kernel);

-      Root_Project : constant Project_Type := Get_Project (Kernel);
-      Root_Mains   : Argument_List :=
-        Get_Attribute_Value
-          (Root_Project,
-           Attribute => Main_Attribute);
+      function Get_Root_Mains return Argument_List;
+      --  Return the mains contained in the root project and all its
+      --  dependencies.
+
+      --------------------
+      -- Get_Root_Mains --
+      --------------------
+
+      function Get_Root_Mains return Argument_List is
+         Result   : Argument_List (1 .. Max_Number_Of_Mains);
+         Index    : Natural := 1;
+         --  Index of the first free element in Result.
+         Iterator :  Imported_Project_Iterator;
+      begin
+         Iterator := Start (Root_Project);
+
+         while Current (Iterator) /= No_Project loop
+            declare
+               Mains : Argument_List :=
+                 Get_Attribute_Value
+                   (Current (Iterator), Attribute => Main_Attribute);
+            begin
+               for J in Mains'Range loop
+                  if Mains (J)'Length > 0 then
+                     if Index > Result'Last then
+                        for K in J .. Mains'Last loop
+                           Free (Mains (K));
+                        end loop;
+                        exit;
+                     end if;
+
+                     Result (Index) := Mains (J);
+                     Index := Index + 1;
+                  end if;
+               end loop;
+            end;
+
+            exit when Index > Result'Last;
+
+            Next (Iterator);
+         end loop;
+
+         return Result (1 .. Index - 1);
+      end Get_Root_Mains;
+
+      Root_Mains   : Argument_List := Get_Root_Mains;
    begin
       Base_Project := Extended_Project (Root_Project);

@@ -526,28 +567,45 @@ package body Builder_Facility_Module is
    ---------------------------

    procedure Add_Action_For_Target (T : Target_Access) is
-      C    : Build_Command_Access;
-      N    : constant String := Get_Name (T);
-      Name : constant String := Action_Name (T);
+      C      : Build_Command_Access;
+      M      : Build_Main_Command_Access;
+      N      : constant String := Get_Name (T);
+      Name   : constant String := Action_Name (T);
+      Action : Unbounded_String;
+
    begin
-      --  We do not add actions for targets that represent mains, this is
-      --  handled via the <item1>, <item2> (...) mechanism.
-      if Get_Properties (T).Represents_Mains then
-         return;
-      end if;
+      if Length (Get_Properties (T).Target_Type) /= 0 then
+         --  Register the "build main number x"-like actions

-      Create
-        (C, Get_Kernel, Builder_Module_ID.Registry, N, "", False, Default);
+         for J in 1 .. 4 loop
+            Create (M, Get_Kernel, Builder_Module_ID.Registry, N,
+                    To_String (Get_Properties (T).Target_Type), J,
+                    False, Default);
+            Set_Unbounded_String (Action, N & (-" Number") & J'Img);
+            Register_Action
+              (Kernel      => Get_Kernel,
+               Name        => To_String (Action),
+               Command     => M,
+               Description => To_String (Action),
+               Filter      => null,
+               Category    => -"Build",
+               Defined_In  => GNATCOLL.VFS.No_File);
+            Builder_Module_ID.Actions.Append (Action);
+         end loop;
+      else
+         Create
+           (C, Get_Kernel, Builder_Module_ID.Registry, N, "", False, Default);

-      Register_Action (Kernel      => Get_Kernel,
-                       Name        => Name,
-                       Command     => C,
-                       Description => (-"Build target ") & N,
-                       Filter      => null,
-                       Category    => -"Build",
-                       Defined_In  => GNATCOLL.VFS.No_File);
+         Register_Action (Kernel      => Get_Kernel,
+                          Name        => Name,
+                          Command     => C,
+                          Description => (-"Build target ") & N,
+                          Filter      => null,
+                          Category    => -"Build",
+                          Defined_In  => GNATCOLL.VFS.No_File);

-      Builder_Module_ID.Actions.Append (To_Unbounded_String (Name));
+         Builder_Module_ID.Actions.Append (To_Unbounded_String (Name));
+      end if;
    end Add_Action_For_Target;

    ---------------------------------
@@ -643,10 +701,7 @@ package body Builder_Facility_Module is

       Free (N);

-      Clear_Menus;
-      Install_Menus;
-      Clear_Toolbar_Buttons;
-      Install_Toolbar_Buttons;
+      Refresh_Graphical_Elements;
    end Load_Targets;

    ------------------------------
@@ -745,10 +800,7 @@ package body Builder_Facility_Module is
    begin
       --  Clear the items that might depend on the number of mains

-      Clear_Menus;
-      Install_Menus;
-      Clear_Toolbar_Buttons;
-      Install_Toolbar_Buttons;
+      Refresh_Graphical_Elements;

    exception
       when E : others => Trace (Exception_Handle, E);
@@ -769,6 +821,41 @@ package body Builder_Facility_Module is
       end if;
    end On_Compilation_Finished;

+   ------------------------------
+   -- On_Compute_Build_Targets --
+   ------------------------------
+
+   function On_Compute_Build_Targets
+     (Kernel : access Kernel_Handle_Record'Class;
+      Data   : access Hooks_Data'Class) return String
+   is
+      Kind : constant String := String_Hooks_Args (Data.all).Value;
+   begin
+      if Kind = "main" then
+         declare
+            Mains  : Argument_List := Get_Mains (Kernel_Handle (Kernel));
+            Result : constant String := Argument_List_To_String (Mains);
+         begin
+            Free (Mains);
+            return Result;
+         end;
+      else
+         return "";
+      end if;
+   end On_Compute_Build_Targets;
+
+   --------------------------------
+   -- Refresh_Graphical_Elements --
+   --------------------------------
+
+   procedure Refresh_Graphical_Elements is
+   begin
+      Clear_Menus;
+      Install_Menus;
+      Clear_Toolbar_Buttons;
+      Install_Toolbar_Buttons;
+   end Refresh_Graphical_Elements;
+
    -------------------
    -- On_File_Saved --
    -------------------
@@ -881,6 +968,9 @@ package body Builder_Facility_Module is
          if T /= null
            and then not Builder_Module_ID.Actions.Contains
              (To_Unbounded_String (Get_Name (T)))
+           and then (Length (Get_Properties (T).Target_Type) = 0
+                     or else not Builder_Module_ID.Actions.Contains
+                       (To_Unbounded_String (Get_Name (T) & (-" Number 1"))))
          then
             Add_Action_For_Target (T);

@@ -1123,6 +1213,8 @@ package body Builder_Facility_Module is

       end Button_For_Target;

+      Targets : Unbounded_String;
+
    begin
       if Target = null
         or else not Get_Properties (Target).In_Toolbar
@@ -1130,13 +1222,24 @@ package body Builder_Facility_Module is
          return;
       end if;

-      if Get_Properties (Target).Represents_Mains then
+      Targets := Get_Properties (Target).Target_Type;
+
+      if Length (Targets) /= 0 then
          declare
-            Mains  : Argument_List := Get_Mains (Get_Kernel);
+            Data   : aliased String_Hooks_Args :=
+              (Hooks_Data with
+                 Length => Length (Targets),
+                 Value  => To_String (Targets));
+            Mains  : Argument_List_Access := Argument_String_To_List
+              (Run_Hook_Until_Not_Empty
+                 (Get_Kernel,
+                  Compute_Build_Targets_Hook,
+                  Data'Unchecked_Access));
+
          begin
             --  Do not display if no main is available.
             if Mains'Length > 0 then
-               Button_For_Target (Get_Name (Target), Mains);
+               Button_For_Target (Get_Name (Target), Mains.all);
             end if;

             Free (Mains);
@@ -1201,6 +1304,8 @@ package body Builder_Facility_Module is
          end if;
       end Menu_For_Action;

+      Targets : Unbounded_String;
+
    begin
       --  Do nothing is the target is not supposed to be shown in the menu
       if not Get_Properties (Target).In_Menu then
@@ -1221,9 +1326,20 @@ package body Builder_Facility_Module is
          end if;
       end if;

-      if Get_Properties (Target).Represents_Mains then
+      Targets := Get_Properties (Target).Target_Type;
+
+      if Length (Targets) /= 0 then
          declare
-            Mains  : Argument_List := Get_Mains (Get_Kernel);
+            Data   : aliased String_Hooks_Args :=
+              (Hooks_Data with
+                 Length => Length (Targets),
+                 Value  => To_String (Targets));
+            Mains  : Argument_List_Access := Argument_String_To_List
+              (Run_Hook_Until_Not_Empty
+                 (Get_Kernel,
+                  Compute_Build_Targets_Hook,
+                  Data'Unchecked_Access));
+
          begin
             for J in Mains'Range loop
                if Mains (J) /= null then
@@ -1264,9 +1380,6 @@ package body Builder_Facility_Module is

          if M /= null then
             Destroy (M);
-         else
-            Trace (Me, "Menu not found: "
-                   & Strip_Single_Underscores (To_String (Element (C))));
          end if;

          Next (C);
@@ -1327,17 +1440,11 @@ package body Builder_Facility_Module is
          Changes_Made);

       if Changes_Made then
-         --  Handle the toolbar
-         Clear_Toolbar_Buttons;
-         Install_Toolbar_Buttons;
-
          --  Recreate the actions
          Remove_All_Actions;
          Add_Actions_For_All_Targets;

-         --  Recreate the menu
-         Clear_Menus;
-         Install_Menus;
+         Refresh_Graphical_Elements;

          --  Save the user-defined targets
          Save_Targets;
@@ -1428,7 +1535,9 @@ package body Builder_Facility_Module is
          if N.Tag.all = "description" then
             Mode.Description := To_Unbounded_String (N.Value.all);
          elsif N.Tag.all = "supported-model" then
-            Mode.Models.Append (To_Unbounded_String (N.Value.all));
+            Mode.Models.Append
+              ((To_Unbounded_String (N.Value.all),
+                To_Unbounded_String (Get_Attribute (N, "filter"))));
          elsif N.Tag.all = "shadow" then
             Mode.Shadow := Boolean'Value (N.Value.all);
          elsif N.Tag.all = "server" then
@@ -1741,6 +1850,10 @@ package body Builder_Facility_Module is
          Func   => Wrapper (On_View_Changed'Access),
          Name   => "builder_facility_module.on_view_changed");

+      Add_Hook (Kernel, Compute_Build_Targets_Hook,
+                Wrapper (On_Compute_Build_Targets'Access),
+                Name => "builder_facility_module.compute_build_targets");
+
       --  Register the shell commands

       Builder_Facility_Module.Scripts.Register_Commands
@@ -1753,7 +1866,7 @@ package body Builder_Facility_Module is
       Insert (Get_Toolbar (Kernel), Space);

       --  Load the user-defined targets.
-      Add_Hook (Kernel, "gps_started",
+      Add_Hook (Kernel, GPS_Started_Hook,
                 Wrapper (On_GPS_Started'Access),
                 Name  => "builder_facility_module.gps_started");
    end Register_Module;
@@ -1812,12 +1925,35 @@ package body Builder_Facility_Module is
      (Model : String; Mode : String; Cmd_Line : GNAT.OS_Lib.Argument_List)
       return GNAT.OS_Lib.Argument_List_Access
    is
-      use Unbounded_String_List;
+      use Model_List;
       M         : Mode_Record;
-      C         : Unbounded_String_List.Cursor;
+      Model_Rec : Model_Record;
+      C         : Model_List.Cursor;
       Res       : Argument_List_Access;
       Supported : Boolean;

+      function Compute_Num_Args
+        (Args : Argument_List; Filter : String) return Natural;
+      --  Compute number of relevant arguments in Args that match Filter
+
+      function Compute_Num_Args
+        (Args : Argument_List; Filter : String) return Natural
+      is
+         Result  : Natural := 0;
+      begin
+         if Filter = "" then
+            return Args'Length;
+         else
+            for J in Args'Range loop
+               if Match (Filter, Args (J).all) then
+                  Result := Result + 1;
+               end if;
+            end loop;
+
+            return Result;
+         end if;
+      end Compute_Num_Args;
+
    begin
       Supported := True;

@@ -1848,7 +1984,9 @@ package body Builder_Facility_Module is

          Supported := False;
          while Has_Element (C) loop
-            if Element (C) = Model then
+            Model_Rec := Element (C);
+
+            if Model_Rec.Model = Model then
                Supported := True;
                exit;
             end if;
@@ -1872,7 +2010,10 @@ package body Builder_Facility_Module is
       --  Now let's apply the Mode. First we create the result with enough
       --  room.
       if M.Args /= null then
-         Res := new Argument_List (1 .. Cmd_Line'Length + M.Args'Length);
+         Res := new Argument_List
+           (1 .. Cmd_Line'Length
+                  + Compute_Num_Args
+                      (M.Args.all, To_String (Model_Rec.Filter)));
       else
          Res := new Argument_List (1 .. Cmd_Line'Length);
       end if;
@@ -1908,11 +2049,25 @@ package body Builder_Facility_Module is
          end loop;
       end if;

-      --  Append the extra args
-      for J in 1 .. Res'Last - Cmd_Line'Length loop
-         Res (J + Cmd_Line'Length) :=
-           new String'(M.Args (M.Args'First + J - 1).all);
-      end loop;
+      if Length (Model_Rec.Filter) = 0 then
+         --  Append the extra args
+         for J in 1 .. Res'Last - Cmd_Line'Length loop
+            Res (J + Cmd_Line'Length) :=
+              new String'(M.Args (M.Args'First + J - 1).all);
+         end loop;
+      else
+         declare
+            Filter : constant String := To_String (Model_Rec.Filter);
+            Index  : Natural := Cmd_Line'Length + 1;
+         begin
+            for J in M.Args'Range loop
+               if Match (Filter, M.Args (J).all) then
+                  Res (Index) := new String'(M.Args (J).all);
+                  Index := Index + 1;
+               end if;
+            end loop;
+         end;
+      end if;

       return Res;
    end Apply_Mode_Args;
@@ -1967,13 +2122,13 @@ package body Builder_Facility_Module is
            and then Mode.Active
          then
             declare
-               use Unbounded_String_List;
-               C2 : Unbounded_String_List.Cursor;
+               use Model_List;
+               C2 : Model_List.Cursor;
             begin
                C2 := Mode.Models.First;

                while Has_Element (C2) loop
-                  if Element (C2) = Model then
+                  if Element (C2).Model = Model then
                      Result (Index) := new String'(To_String (Mode.Name));
                      Index := Index + 1;
                   end if;
============================================================
--- builder/src/builder_facility_module.ads	cef6755512c957168a01e8c190e7e97df2bcc175
+++ builder/src/builder_facility_module.ads	c3f99e6fb9a08a5120fa1bdbc2e3dcf0deb2ab09
@@ -166,4 +166,8 @@ package Builder_Facility_Module is
    function Registry return Build_Configurations.Build_Config_Registry_Access;
    --  Return the registry stored in the module

+   procedure Refresh_Graphical_Elements;
+   --  Recompute the menus and toolbar icons, based on the targets described
+   --  in the Registry.
+
 end Builder_Facility_Module;
============================================================
--- builder/src/builder_module.adb	4a26e9ab61b4a0a355cec4740db117dffc760d9b
+++ builder/src/builder_module.adb	28dff7e565400acc916afde0cd3f1961d770784a
@@ -124,7 +124,7 @@ package body Builder_Module is
      (Run          : in out Run_Description;
       Ext_Terminal : Boolean;
       Command      : String);
-   --  Set the command to be run. Gets both exec name and args from Command.
+   --  Set the command to be run. Gets both exec name and args from Command

    type Builder_Module_ID_Record is
      new GPS.Kernel.Modules.Module_ID_Record
@@ -471,9 +471,7 @@ package body Builder_Module is
    procedure Loads_Xrefs_From_File
      (Kernel : access Kernel_Handle_Record'Class; File : Virtual_File) is
    begin
-      Update_Xref
-        (Get_Or_Create
-           (Get_Database (Kernel), File));
+      Update_Xref (Get_Or_Create (Get_Database (Kernel), File));
    end Loads_Xrefs_From_File;

    ----------------------------
@@ -571,7 +569,7 @@ package body Builder_Module is

    procedure Launch
      (Kernel : access Kernel_Handle_Record'Class;
-      Run : Run_Description)
+      Run    : Run_Description)
    is
       Console : Interactive_Console;
       Child   : MDI_Child;
@@ -689,7 +687,7 @@ package body Builder_Module is
               and then Command (Command'First) /= ASCII.NUL
             then
                Set_Command (Run, Active, Command);
-               Run.Directory    := new String'("");
+               Run.Directory := new String'("");

                if Is_Local (Execution_Server) then
                   Run.Title := new String'(-"Run: " & Command);
@@ -853,15 +851,15 @@ package body Builder_Module is
                                  Attribute => Main_Attribute);
          Loaded_Has_Mains : constant Boolean := Loaded_Mains'Length > 0;
          Extended_Project : constant Project_Type :=
-                              Parent_Project (Loaded_Project);
+                              Projects.Extended_Project (Loaded_Project);
          Iter             : Imported_Project_Iterator :=
                               Start (Loaded_Project);
          Current_Project  : Project_Type := Current (Iter);
          Set_Shortcut     : Boolean := True;
       begin
          if Builder_Module_ID.Run_Menu /= null then
-            Remove_All_Children (Builder_Module_ID.Run_Menu,
-                                 Is_Dynamic_Menu_Item'Access);
+            Remove_All_Children
+              (Builder_Module_ID.Run_Menu, Is_Dynamic_Menu_Item'Access);
          end if;

          --  ??? Few limitations on what is done here:
@@ -889,9 +887,10 @@ package body Builder_Module is
               or else Current_Project /= Extended_Project
             then
                declare
-                  Mains : Argument_List :=
-                            Get_Attribute_Value
-                              (Current_Project, Attribute => Main_Attribute);
+                  Mains           : Argument_List :=
+                                      Get_Attribute_Value
+                                        (Current_Project,
+                                         Attribute => Main_Attribute);
                   Context_Project : Project_Type;
                begin
                   --  We should compile main files from the extended project
============================================================
--- builder/src/commands-builder.adb	0566308f898745c50889925defac13e942200c97
+++ builder/src/commands-builder.adb	92443278cd0e02d4504ee7bb5c959abefd931aa7
@@ -1,7 +1,7 @@
 -----------------------------------------------------------------------
 --                               G P S                               --
 --                                                                   --
---                      Copyright (C) 2003-2008, AdaCore             --
+--                 Copyright (C) 2003-2008, AdaCore                  --
 --                                                                   --
 -- GPS is free software; you can redistribute it and/or modify  it   --
 -- under the terms of the GNU General Public License as published by --
@@ -17,30 +17,30 @@
 -- Place - Suite 330, Boston, MA 02111-1307, USA.                    --
 -----------------------------------------------------------------------

-with Ada.Strings;           use Ada.Strings;
-with Ada.Strings.Fixed;     use Ada.Strings.Fixed;
-with Ada.Strings.Maps;      use Ada.Strings.Maps;
-with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
+with Ada.Strings;             use Ada.Strings;
+with Ada.Strings.Fixed;       use Ada.Strings.Fixed;
+with Ada.Strings.Maps;        use Ada.Strings.Maps;
+with Ada.Strings.Unbounded;   use Ada.Strings.Unbounded;

-with GNAT.Expect;           use GNAT.Expect;
-with GNAT.Regpat;           use GNAT.Regpat;
-with GNAT.String_Split;     use GNAT.String_Split;
+with GNAT.Expect;             use GNAT.Expect;
+with GNAT.Regpat;             use GNAT.Regpat;
+with GNAT.String_Split;       use GNAT.String_Split;
 pragma Warnings (Off);
-with GNAT.Expect.TTY;       use GNAT.Expect.TTY;
+with GNAT.Expect.TTY;         use GNAT.Expect.TTY;
 pragma Warnings (On);

 with GNATCOLL.Scripts.Utils;

-with GPS.Kernel;            use GPS.Kernel;
-with GPS.Kernel.Console;    use GPS.Kernel.Console;
-with GPS.Kernel.Styles;     use GPS.Kernel.Styles;
-with GPS.Kernel.Timeout;    use GPS.Kernel.Timeout;
-with GPS.Location_View;     use GPS.Location_View;
-with GPS.Intl;              use GPS.Intl;
-with Traces;                use Traces;
-with Basic_Types;           use Basic_Types;
-with UTF8_Utils;            use UTF8_Utils;
-with String_Utils;          use String_Utils;
+with GPS.Kernel;              use GPS.Kernel;
+with GPS.Kernel.Console;      use GPS.Kernel.Console;
+with GPS.Kernel.Styles;       use GPS.Kernel.Styles;
+with GPS.Kernel.Timeout;      use GPS.Kernel.Timeout;
+with GPS.Location_View;       use GPS.Location_View;
+with GPS.Intl;                use GPS.Intl;
+with Traces;                  use Traces;
+with Basic_Types;             use Basic_Types;
+with UTF8_Utils;              use UTF8_Utils;
+with String_Utils;            use String_Utils;

 with Builder_Facility_Module; use Builder_Facility_Module;

@@ -59,7 +59,7 @@ package body Commands.Builder is
       --  a background mode.

       Shadow : Boolean := False;
-      --  Whether this is a Shadow build.
+      --  Whether this is a Shadow build

       Buffer : Unbounded_String;
       --  Stores the incomplete lines returned by the compilation process
@@ -161,8 +161,7 @@ package body Commands.Builder is
    -- End_Build_Callback --
    ------------------------

-   procedure End_Build_Callback
-     (Data : Process_Data; Status : Integer) is
+   procedure End_Build_Callback (Data : Process_Data; Status : Integer) is
    begin
       --  Raise the messages window is compilation was unsuccessful
       --  and no error was parsed. See D914-005
@@ -188,7 +187,7 @@ package body Commands.Builder is
       Str      : GNAT.OS_Lib.String_Access;

       Build_Data : Build_Callback_Data
-        renames Build_Callback_Data (Data.Callback_Data.all);
+      renames Build_Callback_Data (Data.Callback_Data.all);
    begin
       if not Data.Process_Died then
          Last_EOL := Index (Output, (1 => ASCII.LF), Backward);
@@ -341,8 +340,7 @@ package body Commands.Builder is
    ----------------------------

    Completed_Matcher : constant Pattern_Matcher := Compile
-     ("completed ([0-9]+) out of ([0-9]+) \(([^\n]*)%\)\.\.\.\n",
-      Single_Line);
+     ("completed ([0-9]+) out of ([0-9]+) \(([^\n]*)%\)\.\.\.\n", Single_Line);
    --  ??? This is configurable in some cases (from XML for instance), so
    --  we should not have a hard coded regexp here.

@@ -401,13 +399,13 @@ package body Commands.Builder is
       Synchronous    : Boolean;
       Use_Shell      : Boolean)
    is
+      Console  : constant Interactive_Console :=
+                   Get_Build_Console (Kernel, Shadow, False);
       Data     : Build_Callback_Data_Access;
       Success  : Boolean;
       Args     : Argument_List_Access;
       Cmd_Name : Unbounded_String;

-      Console : constant Interactive_Console :=
-        Get_Build_Console (Kernel, Shadow, False);
    begin
       Data := new Build_Callback_Data;
       Data.Target_Name := To_Unbounded_String (Target_Name);
@@ -437,8 +435,9 @@ package body Commands.Builder is
            and then Shell_Env /= ""
            and then Is_Local (Server)
          then
-            Args := new Argument_List'(new String'("-c"), new String'
-                                         (Argument_List_To_String (CL.all)));
+            Args := new Argument_List'
+              (new String'("-c"),
+               new String'(Argument_List_To_String (CL.all)));

             Launch_Process
               (Kernel,
============================================================
--- code_analysis/src/code_analysis.adb	93829282a986c7a754aa8f5deea4cb59520f9ab6
+++ code_analysis/src/code_analysis.adb	4c74db222b91bce2c7a42af3916213c013cedb9b
@@ -348,4 +348,23 @@ package body Code_Analysis is
       Unchecked_Free (Projects);
    end Free_Code_Analysis;

+   --------------
+   -- Is_Valid --
+   --------------
+
+   overriding function Is_Valid (Self : File_Coverage) return Boolean is
+   begin
+      return Self.Status = Valid;
+   end Is_Valid;
+
+   overriding function Is_Valid (Self : Project_Coverage) return Boolean is
+   begin
+      return Self.Status = Valid;
+   end Is_Valid;
+
+   overriding function Is_Valid (Self : Subprogram_Coverage) return Boolean is
+   begin
+      return Self.Status = Valid;
+   end Is_Valid;
+
 end Code_Analysis;
============================================================
--- code_analysis/src/code_analysis.ads	230e8825dbd08c1bd250a411d88ebd39df15a469
+++ code_analysis/src/code_analysis.ads	c0ee8e0e20dfe833a122c446835701eb7beab2ae
@@ -33,7 +33,8 @@ with Projects;
 with GNAT.Strings;                          use GNAT.Strings;

 with Projects;                              use Projects;
-with GNATCOLL.VFS;                                   use GNATCOLL.VFS;
+with GNATCOLL.VFS;                          use GNATCOLL.VFS;
+with GPS.Kernel.Standard_Hooks;

 package Code_Analysis is

@@ -43,6 +44,10 @@ package Code_Analysis is

    type Coverage_Status is
      (Valid,
+      Undetermined);
+
+   type File_Coverage_Status is
+     (Valid,
       File_Not_Found,
       --  Error status obtained if no Gcov file was found associated to a
       --  source file when trying to load Gcov info.
@@ -53,32 +58,64 @@ package Code_Analysis is
       --  gcov file found but empty.
       File_Corrupted,
       --  The gcov file could not be parsed.
-      Undeterminated
-      --  The status is undeterminated.
-     );
+      Undetermined);
+      --  The status is undetermined.

-   type Coverage is tagged record
-      Coverage : Natural;
-      Status   : Coverage_Status := Undeterminated;
+   type Coverage is abstract tagged record
+      Coverage : Natural := 0;
    end record;
    --  Basic code coverage information
    --  Record the Line's execution counts and the Subprogram, File and Project
    --  number of not covered lines

-   type Node_Coverage is new Coverage with record
+   function Is_Valid
+     (Self : Coverage) return Boolean is abstract;
+
+   type Line_Coverage is abstract new Coverage with null record;
+
+   function Line_Coverage_Info
+     (Coverage : Line_Coverage;
+      Bin_Mode : Boolean := False)
+      return GPS.Kernel.Standard_Hooks.Line_Information_Record is abstract;
+   --  Return a String_Access pointing on a message describing the coverage
+   --  state of the line from which the Coverage record had been extracted
+   --  If Bin_Mode is True, then the returned messages can only be between
+   --  (covered | not covered)
+
+   procedure Add_Location_If_Uncovered
+     (Coverage    : Line_Coverage;
+      Kernel      : GPS.Kernel.Kernel_Handle;
+      File        : GNATCOLL.VFS.Virtual_File;
+      Line_Number : Positive;
+      Line_Text   : String_Access;
+      Added       : in out Boolean) is abstract;
+   --  Adds location of the uncovered line to the location window. Set Added to
+   --  True if line has been added; otherwise preserve Added value.
+
+   type Node_Coverage is abstract new Coverage with record
       Children : Natural;
    end record;
    --  Extra node coverage information
    --  Children is the Subprogram, File or Project children count

+   type File_Coverage is new Node_Coverage with record
+      Status : File_Coverage_Status := Undetermined;
+   end record;
+
+   overriding function Is_Valid (Self : File_Coverage) return Boolean;
+
    type Subprogram_Coverage is new Node_Coverage with record
       Called : Natural;
+      Status : Coverage_Status := Undetermined;
    end record;
    --  Specific Subprogram extra info
    --  The number of time the subprogram has been called

+   overriding function Is_Valid (Self : Subprogram_Coverage) return Boolean;
+
    type Project_Coverage is new Node_Coverage with record
-      Have_Runs : Boolean := False;
+      Status    : Coverage_Status := Undetermined;
+      Have_Runs : Boolean         := False;
       Runs      : Natural;
    end record;
    --  Store project number of call if this info is available
@@ -86,6 +123,8 @@ package Code_Analysis is
    --  in their header, reporting the number of executions of the produced
    --  executable file

+   overriding function Is_Valid (Self : Project_Coverage) return Boolean;
+
    type Coverage_Access is access all Coverage'Class;

    type Analysis is record
============================================================
--- code_analysis/src/code_analysis_module.adb	9862bffa2270f27fa42d149e776110de0ed4f237
+++ code_analysis/src/code_analysis_module.adb	50afeb20706593d439c725257d8c28abb12fe36e
@@ -1633,7 +1633,8 @@ package body Code_Analysis_Module is
          Close_Child (Analysis.Child, Force => True);
       end if;

-      Remove_Location_Category (Kernel, Coverage_Category);
+      Remove_Location_Category (Kernel, Uncovered_Category);
+      Remove_Location_Category (Kernel, Partially_Covered_Category);
       Remove_Line_Information_Column (Kernel, No_File, CodeAnalysis_Cst);
       Free_Code_Analysis (Analysis.Projects);

@@ -1669,7 +1670,8 @@ package body Code_Analysis_Module is
          Close_Child (Analysis.Child, Force => True);
       end if;

-      Remove_Location_Category (Kernel, Coverage_Category);
+      Remove_Location_Category (Kernel, Uncovered_Category);
+      Remove_Location_Category (Kernel, Partially_Covered_Category);
       Remove_Line_Information_Column (Kernel, No_File, CodeAnalysis_Cst);
       Free_Code_Analysis (Analysis.Projects);
    end Clear_Analysis_Instance;
@@ -2991,8 +2993,7 @@ package body Code_Analysis_Module is
       Add_Hook
         (Kernel  => Kernel,
          Hook    => Project_Changing_Hook,
-         Func    =>
-           Wrapper (On_Project_Changing_Hook'Access),
+         Func    => Wrapper (On_Project_Changing_Hook'Access),
          Name    => "destroy_all_code_analysis");
       GPS.Kernel.Kernel_Desktop.Register_Desktop_Functions
         (Save_Desktop'Access, Load_Desktop'Access);
@@ -3051,6 +3052,8 @@ package body Code_Analysis_Module is
         (Kernel, "clear",
          Class   => Code_Analysis_Class,
          Handler => Destroy_All_Analyzes_From_Shell'Access);
+
+      Coverage_GUI.Register_Module (Kernel);
    end Register_Module;

 end Code_Analysis_Module;
============================================================
--- code_analysis/src/code_analysis_test.adb	9dcc9cefadd3279ccd828e48f8df4ec7a4e1caba
+++ code_analysis/src/code_analysis_test.adb	427b842632977c85d7207d5ee1dc25e7852ea2cd
@@ -24,6 +24,7 @@ with Code_Coverage;            use Code_
 with Code_Analysis;            use Code_Analysis;
 with Code_Analysis_Dump;       use Code_Analysis_Dump;
 with Code_Coverage;            use Code_Coverage;
+with Code_Coverage.Gcov;       use Code_Coverage.Gcov;

 with Projects;                 use Projects;
 with Projects.Registry;        use Projects.Registry;
@@ -140,14 +141,14 @@ procedure Code_Analysis_Test is
         (Projects, Load_Or_Find (Registry.all, Project_File));
       File_Contents := Read_File (Cov_File_Name);
       File_Node     := Get_Or_Create (Project_Node, Src_File_Name);
-      File_Node.Analysis_Data.Coverage_Data := new Node_Coverage;
+      File_Node.Analysis_Data.Coverage_Data := new File_Coverage;
       Add_File_Info (File_Node, File_Contents);

       -------------------------
       -- Add_Subprogram_Info --
       -------------------------

-      if File_Node.Analysis_Data.Coverage_Data.Status = Valid then
+      if File_Node.Analysis_Data.Coverage_Data.Is_Valid then
          Project_Node.Analysis_Data.Coverage_Data := new Project_Coverage;
             Get_Runs_Info_From_File
               (File_Contents,
@@ -156,7 +157,7 @@ procedure Code_Analysis_Test is
                Project_Coverage
                  (Project_Node.Analysis_Data.Coverage_Data.all).Have_Runs);

-         if File_Node.Analysis_Data.Coverage_Data.Status = Valid then
+         if File_Node.Analysis_Data.Coverage_Data.Is_Valid then
             Add_Subprogram_Info
               (File_Node, To_Construct_Tree
                  (Read_File (Src_File_Name).all, Ada_Lang));
============================================================
--- code_analysis/src/code_analysis_tree_model.adb	a25db384aa081a2df99b39c1bf244b2d222c07c4
+++ code_analysis/src/code_analysis_tree_model.adb	35ca458952551b0bf953cf2a997752e49042c864
@@ -116,8 +116,9 @@ package body Code_Analysis_Tree_Model is
       Sort_Arr  : Subprogram_Array
         (1 .. Integer (File_Node.Subprograms.Length));
    begin
-      if File_Node.Analysis_Data.Coverage_Data /= null and then
-         File_Node.Analysis_Data.Coverage_Data.Status = Valid then
+      if File_Node.Analysis_Data.Coverage_Data /= null
+        and then File_Node.Analysis_Data.Coverage_Data.Is_Valid
+      then
          Insert_After (Model, Iter, Parent, Sibling);
          Sibling := Iter;
       else
@@ -159,8 +160,9 @@ package body Code_Analysis_Tree_Model is
       Bin_Mode  : Boolean := False;
       Icons     : Code_Analysis_Icons) is
    begin
-      if File_Node.Analysis_Data.Coverage_Data /= null and then
-         File_Node.Analysis_Data.Coverage_Data.Status = Valid then
+      if File_Node.Analysis_Data.Coverage_Data /= null
+        and then File_Node.Analysis_Data.Coverage_Data.Is_Valid
+      then
          Insert_After (Model, Iter, Null_Iter, Sibling);
          Sibling := Iter;
       else
@@ -224,8 +226,9 @@ package body Code_Analysis_Tree_Model is
       Sort_Arr   : File_Array (1 .. Integer (Prj_Node.Files.Length));
       Child_Sibl : Gtk_Tree_Iter := Null_Iter;
    begin
-      if Prj_Node.Analysis_Data.Coverage_Data /= null and then
-         Prj_Node.Analysis_Data.Coverage_Data.Status = Valid then
+      if Prj_Node.Analysis_Data.Coverage_Data /= null
+        and then Prj_Node.Analysis_Data.Coverage_Data.Is_Valid
+      then
          Insert_After (Model, Iter, Null_Iter, Sibling);
          Sibling := Iter;
       else
============================================================
--- code_analysis/src/code_coverage.adb	ecb54712f181034d19fde81b5261baa444a6a2e8
+++ code_analysis/src/code_coverage.adb	dea30900103cdafc90005e509f5f557c5e7560eb
@@ -17,17 +17,20 @@
 -- Place - Suite 330, Boston, MA 02111-1307, USA.                    --
 -----------------------------------------------------------------------

-with Ada.Text_IO;       use Ada.Text_IO;
-with Ada.Strings;       use Ada.Strings;
-with Ada.Strings.Fixed; use Ada.Strings.Fixed;
-with GNAT.Regpat;       use GNAT.Regpat;
+with Ada.Text_IO;        use Ada.Text_IO;
+with Ada.Strings;        use Ada.Strings;
+with Ada.Strings.Fixed;  use Ada.Strings.Fixed;
+with GNAT.Regpat;        use GNAT.Regpat;
 with Glib;
-with GPS.Intl;          use GPS.Intl;
-with String_Utils;      use String_Utils;
-with GNATCOLL.Utils;    use GNATCOLL.Utils;
-with GNATCOLL.VFS;      use GNATCOLL.VFS;
-with Language;          use Language;
-with Code_Analysis_GUI; use Code_Analysis_GUI;
+with GPS.Intl;           use GPS.Intl;
+with String_Utils;       use String_Utils;
+with GNATCOLL.Utils;     use GNATCOLL.Utils;
+with GNATCOLL.VFS;       use GNATCOLL.VFS;
+with Language;           use Language;
+with Code_Analysis_GUI;  use Code_Analysis_GUI;
+with Code_Coverage.Gcov; use Code_Coverage.Gcov;
+with Code_Coverage.Xcov; use Code_Coverage.Xcov;
+with Coverage_GUI;

 package body Code_Coverage is

@@ -42,13 +45,15 @@ package body Code_Coverage is

    procedure Set_Error
      (File_Node  : Code_Analysis.File_Access;
-      Error_Code : Coverage_Status) is
+      Error_Code : File_Coverage_Status)
+   is
    begin
       if File_Node.Analysis_Data.Coverage_Data = null then
-         File_Node.Analysis_Data.Coverage_Data := new Coverage;
+         File_Node.Analysis_Data.Coverage_Data := new File_Coverage;
       end if;

-      File_Node.Analysis_Data.Coverage_Data.Status := Error_Code;
+      File_Coverage
+        (File_Node.Analysis_Data.Coverage_Data.all).Status := Error_Code;

       if File_Node.Lines = null then
          --  Set an empty line array in order to make File_Node a "finished"
@@ -58,127 +63,6 @@ package body Code_Coverage is
       end if;
    end Set_Error;

-   -------------------
-   -- Add_File_Info --
-   -------------------
-
-   procedure Add_File_Info
-     (File_Node     : Code_Analysis.File_Access;
-      File_Contents : String_Access)
-   is
-      Current           : Natural;
-      Line_Regexp       : constant Pattern_Matcher := Compile
-        ("^ +(\d+|#####): *(\d+):(.*$)", Multiple_Lines);
-      Line_Matches      : Match_Array (0 .. 3);
-      Last_Line_Regexp  : constant Pattern_Matcher := Compile
-        ("^ +(\d+|#####|-): *(\d+):", Multiple_Lines);
-      Last_Line_Matches : Match_Array (0 .. 2);
-      Line_Num          : Natural;
-      Lines_Count       : Natural := 0;
-      Not_Cov_Count     : Natural := 0;
-   begin
-      if File_Node.Analysis_Data.Coverage_Data = null then
-         File_Node.Analysis_Data.Coverage_Data := new Node_Coverage;
-      end if;
-
-      --------------------------------------
-      -- Determination of the line number --
-      --------------------------------------
-
-      Current := File_Contents'Last;
-      Current := Index (File_Contents.all, (1 => ASCII.LF), Current, Backward);
-
-      if Current = File_Contents'Last then
-         if Current > 0 then
-            Current := Index
-              (File_Contents.all, (1 => ASCII.LF), Current - 1, Backward);
-
-            if Current = 0 then
-               Set_Error (File_Node, File_Corrupted);
-               --  The .gcov file is not a valid Gcov file.
-               --  No last source code line found.
-               return;
-            end if;
-         else
-            Set_Error (File_Node, File_Empty);
-            --  the .gcov file is not a valid Gcov file.
-            return;
-         end if;
-      end if;
-
-      loop
-         Match
-           (Last_Line_Regexp, File_Contents.all, Last_Line_Matches, Current);
-
-         exit when Last_Line_Matches (0) /= No_Match;
-
-         if Current > 0 then
-            Current := Index
-              (File_Contents.all, (1 => ASCII.LF), Current - 1, Backward);
-
-            if Current = 0 then
-               Set_Error (File_Node, File_Corrupted);
-               --  The .gcov file is not a valid Gcov file.
-               --  No last source code line found.
-               return;
-            end if;
-         else
-            Set_Error (File_Node, File_Corrupted);
-            --  the .gcov file is not a valid Gcov file.
-            return;
-         end if;
-      end loop;
-
-      -------------------------------
-      -- line coverage information --
-      -------------------------------
-
-      File_Node.Lines := new Line_Array (1 .. Natural'Value (File_Contents
-        (Last_Line_Matches (2).First .. Last_Line_Matches (2).Last)));
-      --  Create a Line_Array with exactly the number of elements corresponding
-      --  to the number of code lines in the original source code file.
-
-      File_Node.Lines.all := (others => Null_Line);
-      Current := File_Contents'First;
-
-      loop
-         Match (Line_Regexp, File_Contents.all, Line_Matches, Current);
-
-         exit when Line_Matches (0) = No_Match;
-
-         Lines_Count := Lines_Count + 1;
-         Line_Num := Natural'Value
-           (File_Contents (Line_Matches (2).First .. Line_Matches (2).Last));
-         File_Node.Lines (Line_Num).Number := Line_Num;
-         File_Node.Lines (Line_Num).Analysis_Data.Coverage_Data :=
-           new Coverage;
-         File_Node.Lines (Line_Num).Analysis_Data.Coverage_Data.Status :=
-           Valid;
-
-         case File_Contents (Line_Matches (1).First) is
-            when '#' =>
-               File_Node.Lines (Line_Num).Analysis_Data.Coverage_Data.Coverage
-                 := 0;
-               File_Node.Lines (Line_Num).Contents := new String'
-                 (File_Contents
-                    (Line_Matches (3).First .. Line_Matches (3).Last));
-               Not_Cov_Count := Not_Cov_Count + 1;
-            when others =>
-               File_Node.Lines (Line_Num).Analysis_Data.Coverage_Data.Coverage
-                 := Natural'Value
-                 (File_Contents
-                    (Line_Matches (1).First .. Line_Matches (1).Last));
-         end case;
-
-         Current := Line_Matches (0).Last + 1;
-      end loop;
-
-      Node_Coverage (File_Node.Analysis_Data.Coverage_Data.all).Children :=
-        Lines_Count;
-      File_Node.Analysis_Data.Coverage_Data.Coverage := Not_Cov_Count;
-      File_Node.Analysis_Data.Coverage_Data.Status := Valid;
-   end Add_File_Info;
-
    -----------------------------
    -- Get_Runs_Info_From_File --
    -----------------------------
@@ -316,8 +200,9 @@ package body Code_Coverage is
             File_Node := Element (Cur);
             Next (Cur);

-            if File_Node.Analysis_Data.Coverage_Data /= null and then
-              File_Node.Analysis_Data.Coverage_Data.Status = Valid then
+            if File_Node.Analysis_Data.Coverage_Data /= null
+              and then File_Node.Analysis_Data.Coverage_Data.Is_Valid
+            then
                Data.Children := Data.Children + Node_Coverage
                  (File_Node.Analysis_Data.Coverage_Data.all).Children;
                Data.Coverage := Data.Coverage +
@@ -388,18 +273,57 @@ package body Code_Coverage is
    procedure XML_Dump_Coverage (Coverage : Coverage_Access; Loc : Node_Ptr) is
    begin
       if Coverage /= null then
-         Set_Attribute (Loc, "status", Status_Message (Coverage.Status));
+         if Coverage.Is_Valid then
+            Set_Attribute (Loc, "coverage", Natural'Image (Coverage.Coverage));
+         end if;

-         if Coverage.Status = Valid then
-            Set_Attribute (Loc, "coverage", Natural'Image (Coverage.Coverage));
+         if Coverage.all in Xcov_Line_Coverage'Class then
+            Set_Attribute
+              (Loc,
+               "status",
+               Xcov_Line_Coverage_Status'Image
+                 (Xcov_Line_Coverage (Coverage.all).Status));

-            if Coverage.all in Node_Coverage'Class then
+         elsif Coverage.all in Gcov_Line_Coverage'Class then
+            Set_Attribute
+              (Loc,
+               "status",
+               Gcov_Line_Coverage_Status'Image
+                 (Gcov_Line_Coverage (Coverage.all).Status));
+
+         elsif Coverage.all in Node_Coverage'Class then
+            if Coverage.Is_Valid then
                Set_Attribute (Loc, "children", Natural'Image
                               (Node_Coverage (Coverage.all).Children));
-               if Coverage.all in Subprogram_Coverage'Class then
+            end if;
+
+            if Coverage.all in Subprogram_Coverage'Class then
+               Set_Attribute
+                 (Loc,
+                  "status",
+                  Coverage_Status'Image
+                    (Subprogram_Coverage (Coverage.all).Status));
+
+               if Coverage.Is_Valid then
                   Set_Attribute (Loc, "called", Natural'Image
                                  (Subprogram_Coverage (Coverage.all).Called));
-               elsif Coverage.all in Project_Coverage'Class then
+               end if;
+
+            elsif Coverage.all in File_Coverage'Class then
+               Set_Attribute
+                 (Loc,
+                  "status",
+                  File_Coverage_Status'Image
+                    (File_Coverage (Coverage.all).Status));
+
+            elsif Coverage.all in Project_Coverage'Class then
+               Set_Attribute
+                 (Loc,
+                  "status",
+                  Coverage_Status'Image
+                    (Project_Coverage (Coverage.all).Status));
+
+               if Coverage.Is_Valid then
                   if Project_Coverage (Coverage.all).Have_Runs then
                      Set_Attribute (Loc, "runs", Natural'Image
                                     (Project_Coverage (Coverage.all).Runs));
@@ -418,55 +342,137 @@ package body Code_Coverage is
      (Coverage : in out Coverage_Access;
       Loc      : Node_Ptr)
    is
+      function Status_Value
+        (Status : String) return Coverage_Status;
+      --  Return the coverage status associated with an error message
+
+      function Status_Value
+        (Status : String) return File_Coverage_Status;
+      --  Return the coverage status associated with an error message
+
+      function Status_Value
+        (Status : String) return Xcov_Line_Coverage_Status;
+      --  Return the coverage status associated with an error message
+
+      function Status_Value
+        (Status : String) return Gcov_Line_Coverage_Status;
+      --  Return the coverage status associated with an error message
+
+      ------------------
+      -- Status_Value --
+      ------------------
+
+      function Status_Value
+        (Status : String) return Coverage_Status is
+      begin
+         return Coverage_Status'Value (Status);
+
+      exception
+         when Constraint_Error =>
+            return Undetermined;
+      end Status_Value;
+
+      function Status_Value
+        (Status : String) return File_Coverage_Status is
+      begin
+         return File_Coverage_Status'Value (Status);
+
+      exception
+         when Constraint_Error =>
+            return Undetermined;
+      end Status_Value;
+
+      function Status_Value
+        (Status : String) return Xcov_Line_Coverage_Status is
+      begin
+         return Xcov_Line_Coverage_Status'Value (Status);
+
+      exception
+         when Constraint_Error =>
+            return Undetermined;
+      end Status_Value;
+
+      function Status_Value
+        (Status : String) return Gcov_Line_Coverage_Status is
+      begin
+         return Gcov_Line_Coverage_Status'Value (Status);
+
+      exception
+         when Constraint_Error =>
+            return Undetermined;
+      end Status_Value;
+
       Txt_Status : constant String := Get_Attribute (Loc, "status");
-      Status     : Coverage_Status;
+
    begin
       if Txt_Status /= "" then
-         Status := Status_Value (Txt_Status);
+         if Loc.Tag.all = "Line" then
+            case Coverage_GUI.Current_Coverage_Tool is
+               when Coverage_GUI.Gcov =>
+                  Coverage := new Gcov_Line_Coverage;
+                  Gcov_Line_Coverage (Coverage.all).Status :=
+                    Status_Value (Txt_Status);

-         if Status = Valid then
-            if Loc.Tag.all = "Line" then
-               Coverage := new Code_Analysis.Coverage;
-            else
-               if Loc.Tag.all = "Subprogram" then
-                  declare
-                     Txt_Called : constant String :=
-                                    Get_Attribute (Loc, "called");
-                  begin
-                     Coverage := new Subprogram_Coverage;
+               when Coverage_GUI.Xcov =>
+                  Coverage := new Xcov_Line_Coverage;
+                  Xcov_Line_Coverage (Coverage.all).Status :=
+                    Status_Value (Txt_Status);
+            end case;

-                     if Txt_Called /= "" then
-                        Subprogram_Coverage (Coverage.all).Called :=
-                          Natural'Value (Txt_Called);
-                     end if;
-                  end;
-               elsif Loc.Tag.all = "File" then
-                  Coverage := new Node_Coverage;
-               elsif Loc.Tag.all = "Project" then
-                  declare
-                     Txt_Runs : constant String := Get_Attribute (Loc, "runs");
-                  begin
-                     Coverage := new Project_Coverage;
+         elsif Loc.Tag.all = "Subprogram" then
+            Coverage := new Subprogram_Coverage;
+            Subprogram_Coverage (Coverage.all).Status :=
+              Status_Value (Txt_Status);

-                     if Txt_Runs /= "" then
-                        Project_Coverage (Coverage.all).Have_Runs := True;
-                        Project_Coverage (Coverage.all).Runs :=
-                          Natural'Value (Txt_Runs);
-                     end if;
-                  end;
-               end if;
+            if Coverage.Is_Valid then
+               Node_Coverage (Coverage.all).Children :=
+                 Natural'Value (Get_Attribute (Loc, "children"));

+               declare
+                  Txt_Called : constant String :=
+                    Get_Attribute (Loc, "called");
+               begin
+                  if Txt_Called /= "" then
+                     Subprogram_Coverage (Coverage.all).Called :=
+                       Natural'Value (Txt_Called);
+                  end if;
+               end;
+            end if;
+
+         elsif Loc.Tag.all = "File" then
+            Coverage := new File_Coverage;
+            File_Coverage (Coverage.all).Status := Status_Value (Txt_Status);
+
+            if Coverage.Is_Valid then
                Node_Coverage (Coverage.all).Children :=
                  Natural'Value (Get_Attribute (Loc, "children"));
             end if;

-            Coverage.Coverage := Natural'Value
-              (Get_Attribute (Loc, "coverage"));
-         else
-            Coverage := new Code_Analysis.Coverage;
+         elsif Loc.Tag.all = "Project" then
+            Coverage := new Project_Coverage;
+            Project_Coverage (Coverage.all).Status :=
+              Status_Value (Txt_Status);
+
+            if Coverage.Is_Valid then
+               Node_Coverage (Coverage.all).Children :=
+                 Natural'Value (Get_Attribute (Loc, "children"));
+
+               declare
+                  Txt_Runs : constant String := Get_Attribute (Loc, "runs");
+               begin
+                  if Txt_Runs /= "" then
+                     Project_Coverage (Coverage.all).Have_Runs := True;
+                     Project_Coverage (Coverage.all).Runs :=
+                       Natural'Value (Txt_Runs);
+                  end if;
+               end;
+            end if;
          end if;

-         Coverage.Status := Status;
+         if Coverage.Is_Valid then
+            Coverage.Coverage :=
+              Natural'Value (Get_Attribute (Loc, "coverage"));
+         end if;
       end if;
    end XML_Parse_Coverage;

@@ -501,63 +507,6 @@ package body Code_Coverage is
       end if;
    end First_Project_With_Coverage_Data;

-   ------------------------
-   -- Line_Coverage_Info --
-   ------------------------
-
-   function Line_Coverage_Info
-     (Coverage : Coverage_Access;
-      Bin_Mode : Boolean := False) return Line_Information_Record
-   is
-      Pango_Markup_To_Open_1 : constant String := "<span foreground=""";
-      Pango_Markup_To_Open_2 : constant String := """>";
-      Pango_Markup_To_Close  : constant String := "</span>";
-
-      Result : Line_Information_Record;
-
-   begin
-      if Bin_Mode then
-         case Coverage.Coverage is
-         when 0 =>
-            Result.Image := Uncovered_Line_Pixbuf;
-            Result.Tooltip_Text := new String'
-              (-"The code for this line has not been executed.");
-         when others =>
-            Result.Image := Covered_Line_Pixbuf;
-            Result.Tooltip_Text := new String'
-              (-"The code for this line has been executed.");
-         end case;
-      else
-         case Coverage.Coverage is
-         when 0 =>
-            Result.Text := new
-              String'(Pango_Markup_To_Open_1
-                      & "red"
-                      & Pango_Markup_To_Open_2
-                      & "#"
-                      & Pango_Markup_To_Close);
-         when 1 =>
-            Result.Text := new
-              String'(Pango_Markup_To_Open_1
-                      & "black"
-                      & Pango_Markup_To_Open_2
-                      & (-" 1 time ")
-                      & Pango_Markup_To_Close);
-         when others =>
-            Result.Text := new
-              String'
-                (Pango_Markup_To_Open_1
-                 & "black"
-                 & Pango_Markup_To_Open_2
-                 & Image (Coverage.Coverage)
-                 & " times"
-                 & Pango_Markup_To_Close);
-         end case;
-      end if;
-
-      return Result;
-   end Line_Coverage_Info;
-
    ---------------
    -- Fill_Iter --
    ---------------
@@ -641,7 +590,7 @@ package body Code_Coverage is
       end Txt_Sub;

    begin
-      if Coverage.Status = Valid then
+      if Coverage.Is_Valid then
          declare
             Cov_Txt     : constant String :=
                             Natural'Image (Coverage.Coverage);
@@ -671,52 +620,11 @@ package body Code_Coverage is

       else
          Set (Tree_Store, Iter, Cov_Col,
-              " " & Status_Message (Coverage.Status));
+              " underermined"); -- & Status_Message (Coverage.Status));
          Set (Tree_Store, Iter, Cov_Sort, Glib.Gint (0));
          Set (Tree_Store, Iter, Cov_Bar_Val, Glib.Gint (0));
          Set (Tree_Store, Iter, Cov_Bar_Txt, -"n/a");
       end if;
    end Fill_Iter;

-   --------------------
-   -- Status_Message --
-   --------------------
-
-   function Status_Message
-     (Status : Coverage_Status) return String is
-   begin
-      case Status is
-         when File_Not_Found   => return -"Gcov file not found";
-         when File_Out_Of_Date => return -"Gcov file out-of-date";
-         when File_Corrupted   => return -"Gcov file corrupted";
-         when File_Empty       => return -"Gcov file empty";
-         when Valid            => return -"Gcov file valid";
-         when Undeterminated   => return -"Status undeterminated";
-      end case;
-   end Status_Message;
-
-   ------------------
-   -- Status_Value --
-   ------------------
-
-   function Status_Value
-     (Status : String) return Coverage_Status is
-   begin
-      if    Status = -"Gcov file not found"   then
-         return File_Not_Found;
-      elsif Status = -"Gcov file out-of-date" then
-         return File_Out_Of_Date;
-      elsif Status = -"Gcov file corrupted"   then
-         return File_Corrupted;
-      elsif Status = -"Gcov file empty"       then
-         return File_Empty;
-      elsif Status = -"Gcov file valid"       then
-         return Valid;
-      elsif Status = -"Status undeterminated" then
-         return Undeterminated;
-      end if;
-
-      return Undeterminated;
-   end Status_Value;
-
 end Code_Coverage;
============================================================
--- code_analysis/src/code_coverage.ads	c309beec06460e2e95f5a0615a2dce466b22c1a4
+++ code_analysis/src/code_coverage.ads	f12392dabe8aaf757419e092f1fa8e93a482d296
@@ -29,31 +29,13 @@ with Code_Analysis;  use Code_Analysis;
 with Projects;       use Projects;
 with Code_Analysis;  use Code_Analysis;

-with GPS.Kernel.Standard_Hooks; use GPS.Kernel.Standard_Hooks;
-
 package Code_Coverage is

    procedure Set_Error
      (File_Node  : Code_Analysis.File_Access;
-      Error_Code : Coverage_Status);
+      Error_Code : File_Coverage_Status);
    --  Sets a coverage data with Error_Code for Status to the given File_Node

-   function Status_Message
-     (Status : Coverage_Status) return String;
-   --  Return the status associated error message
-   --  Return null if the status is valid
-
-   function Status_Value
-     (Status : String) return Coverage_Status;
-   --  Return the coverage status associated with an error message
-   --  Return null if no coverage status is corresponding
-
-   procedure Add_File_Info
-     (File_Node     : Code_Analysis.File_Access;
-      File_Contents : String_Access);
-   --  Parse the File_Contents and fill the File_Node with gcov info
-   --  And set Line_Count and Covered_Lines
-
    procedure Get_Runs_Info_From_File
      (File_Contents : String_Access;
       Prj_Runs      : out Positive;
@@ -105,14 +87,6 @@ package Code_Coverage is
    --  analysis.
    --  Return No_Project if no project contains such data.

-   function Line_Coverage_Info
-     (Coverage : Coverage_Access;
-      Bin_Mode : Boolean := False) return Line_Information_Record;
-   --  Return a String_Access pointing on a message describing the coverage
-   --  state of the line from which the Coverage record had been extracted
-   --  If Bin_Mode is True, then the returned messages can only be between
-   --  (covered | not covered)
-
    procedure Fill_Iter
      (Tree_Store : Gtk_Tree_Store;
       Iter       : Gtk_Tree_Iter;
============================================================
--- code_analysis/src/coverage_gui.adb	c70e6310ba697d5ebb3a0d8d52dfe0dec9a34458
+++ code_analysis/src/coverage_gui.adb	90875772831135c14642eda457c79025eddb03b2
@@ -20,12 +20,12 @@ with GNAT.OS_Lib;               use GNAT
 with Ada.Calendar;              use Ada.Calendar;
 with GNAT.Strings;
 with GNAT.OS_Lib;               use GNAT.OS_Lib;
-with GPS.Kernel.Styles;         use GPS.Kernel.Styles;
 with GPS.Kernel.Console;        use GPS.Kernel.Console;
 with GPS.Kernel.Contexts;       use GPS.Kernel.Contexts;
 with GPS.Kernel.Project;        use GPS.Kernel.Project;
 with GPS.Kernel.Standard_Hooks; use GPS.Kernel.Standard_Hooks;
 with GPS.Location_View;         use GPS.Location_View;
+with Default_Preferences.Enums;

 with Language;                  use Language;
 with Projects;                  use Projects;
@@ -36,9 +36,16 @@ with Code_Analysis_GUI;
 with String_Utils;              use String_Utils;
 with Code_Coverage;             use Code_Coverage;
 with Code_Analysis_GUI;
+with Code_Coverage.Gcov;
+with Code_Coverage.Xcov;

 package body Coverage_GUI is

+   package Coverage_Toolchain_Preferences is
+      new Default_Preferences.Enums.Generics (Coverage_Toolchain_Kinds);
+
+   Coverage_Toolchain_Preference : Coverage_Toolchain_Preferences.Preference;
+
    ---------------------------
    -- Add_Gcov_Project_Info --
    ---------------------------
@@ -120,14 +127,21 @@ package body Coverage_GUI is
             end if;
          end;

-         Add_File_Info (File_Node, File_Contents);
+         case Current_Coverage_Tool is
+            when Gcov =>
+               Code_Coverage.Gcov.Add_File_Info (File_Node, File_Contents);

+            when Xcov =>
+               Code_Coverage.Xcov.Add_File_Info (File_Node, File_Contents);
+         end case;
+
          --  Check for project runs info
-         if File_Node.Analysis_Data.Coverage_Data.Status = Valid and then
+         if File_Node.Analysis_Data.Coverage_Data.Is_Valid and then
            Project_Node.Analysis_Data.Coverage_Data = null
          then
             Project_Node.Analysis_Data.Coverage_Data := new Project_Coverage;
-            Project_Node.Analysis_Data.Coverage_Data.Status := Valid;
+            Project_Coverage
+              (Project_Node.Analysis_Data.Coverage_Data.all).Status := Valid;
             Get_Runs_Info_From_File
               (File_Contents,
                Project_Coverage
@@ -136,7 +150,7 @@ package body Coverage_GUI is
                  (Project_Node.Analysis_Data.Coverage_Data.all).Have_Runs);
          end if;

-         if File_Node.Analysis_Data.Coverage_Data.Status = Valid then
+         if File_Node.Analysis_Data.Coverage_Data.Is_Valid then
             declare
                Lang : constant Language_Access :=
                         Get_Language_From_File (Handler, Src_File);
@@ -177,7 +191,9 @@ package body Coverage_GUI is
      (Kernel    : Kernel_Handle;
       File_Node : Code_Analysis.File_Access) is
    begin
-      Remove_Location_Category (Kernel, Coverage_Category, File_Node.Name);
+      Remove_Location_Category (Kernel, Uncovered_Category, File_Node.Name);
+      Remove_Location_Category
+        (Kernel, Partially_Covered_Category, File_Node.Name);
    end Clear_File_Locations;

    --------------------------------
@@ -189,15 +205,20 @@ package body Coverage_GUI is
       File_Node : Code_Analysis.File_Access;
       Subp_Node : Subprogram_Access) is
    begin
-      if File_Node.Analysis_Data.Coverage_Data.Status = Valid then
+      if File_Node.Analysis_Data.Coverage_Data.Is_Valid then
          for J in Subp_Node.Start .. Subp_Node.Stop loop
             if File_Node.Lines (J) /= Null_Line and then
               File_Node.Lines (J).Analysis_Data.Coverage_Data.Coverage = 0 then
                Remove_Location_Category
                  (Kernel,
-                  Coverage_Category,
+                  Uncovered_Category,
                   File_Node.Name,
                   File_Node.Lines (J).Number);
+               Remove_Location_Category
+                 (Kernel,
+                  Partially_Covered_Category,
+                  File_Node.Name,
+                  File_Node.Lines (J).Number);
             end if;
          end loop;
       end if;
@@ -215,13 +236,14 @@ package body Coverage_GUI is
    begin
       Code_Analysis_GUI.Initialize_Graphics (Kernel);

-      if File_Node.Analysis_Data.Coverage_Data.Status = Valid then
+      if File_Node.Analysis_Data.Coverage_Data.Is_Valid then
          Line_Info  := new Line_Information_Array (File_Node.Lines'Range);

          for J in File_Node.Lines'Range loop
             if File_Node.Lines (J) /= Null_Line then
                Line_Info (J) := Line_Coverage_Info
-                 (File_Node.Lines (J).Analysis_Data.Coverage_Data,
+                 (Line_Coverage'Class
+                    (File_Node.Lines (J).Analysis_Data.Coverage_Data.all),
                   Binary_Coverage_Mode);
             else
                Line_Info (J).Text := new String'(" ");
@@ -258,28 +280,24 @@ package body Coverage_GUI is
      (Kernel    : Kernel_Handle;
       File_Node : Code_Analysis.File_Access)
    is
-      No_File_Added : Boolean := True;
+      File_Added : Boolean := False;
    begin
-      if File_Node.Analysis_Data.Coverage_Data.Status = Valid then
+      if File_Node.Analysis_Data.Coverage_Data.Is_Valid then
          for J in File_Node.Lines'Range loop
             if File_Node.Lines (J) /= Null_Line then
-               if File_Node.Lines (J).Analysis_Data.Coverage_Data.Coverage
-                 = 0 then
-                  No_File_Added := False;
-                  Insert_Location
-                    (Kernel             => Kernel,
-                     Category           => Coverage_Category,
-                     File               => File_Node.Name,
-                     Text               => File_Node.Lines (J).Contents.all,
-                     Line               => J,
-                     Column             => 1,
-                     Highlight          => True,
-                     Highlight_Category => Builder_Warnings_Style);
-               end if;
+               Line_Coverage'Class
+                 (File_Node.Lines
+                    (J).Analysis_Data.Coverage_Data.all).
+                 Add_Location_If_Uncovered
+                 (Kernel,
+                  File_Node.Name,
+                  J,
+                  File_Node.Lines (J).Contents,
+                  File_Added);
             end if;
          end loop;

-         if No_File_Added then
+         if not File_Added then
             GPS.Kernel.Console.Insert
               (Kernel, -"There is no uncovered line in " &
                Base_Name (File_Node.Name));
@@ -367,21 +385,21 @@ package body Coverage_GUI is
    procedure List_Subprogram_Uncovered_Lines
      (Kernel    : Kernel_Handle;
       File_Node : Code_Analysis.File_Access;
-      Subp_Node : Subprogram_Access) is
+      Subp_Node : Subprogram_Access)
+   is
+      Added : Boolean := False;
    begin
-      if File_Node.Analysis_Data.Coverage_Data.Status = Valid then
+      if File_Node.Analysis_Data.Coverage_Data.Is_Valid then
          for J in Subp_Node.Start .. Subp_Node.Stop loop
-            if File_Node.Lines (J) /= Null_Line and then
-              File_Node.Lines (J).Analysis_Data.Coverage_Data.Coverage = 0 then
-               Insert_Location
-                 (Kernel             => Kernel,
-                  Category           => Coverage_Category,
-                  File               => File_Node.Name,
-                  Text               => File_Node.Lines (J).Contents.all,
-                  Line               => J,
-                  Column             => 1,
-                  Highlight          => True,
-                  Highlight_Category => Builder_Warnings_Style);
+            if File_Node.Lines (J) /= Null_Line then
+               Line_Coverage'Class
+                 (File_Node.Lines (J).Analysis_Data.Coverage_Data.all).
+                 Add_Location_If_Uncovered
+                   (Kernel,
+                    File_Node.Name,
+                    J,
+                    File_Node.Lines (J).Contents,
+                    Added);
             end if;
          end loop;
       else
@@ -447,31 +465,46 @@ package body Coverage_GUI is
       Gcov_Root : String_Access;
       Result    : GNATCOLL.VFS.Virtual_File;
    begin
-      Gcov_Root := Getenv ("GCOV_ROOT");
+      case Current_Coverage_Tool is
+         when Gcov =>
+            Gcov_Root := Getenv ("GCOV_ROOT");

-      if Gcov_Root /= null
-        and then Gcov_Root.all = ""
-      then
-         --  If GCOV_ROOT is set but empty, look for files in the object
-         --  directory of the root project.
-         Free (Gcov_Root);
-      end if;
+            if Gcov_Root /= null
+              and then Gcov_Root.all = ""
+            then
+               --  If GCOV_ROOT is set but empty, look for files in the object
+               --  directory of the root project.
+               Free (Gcov_Root);
+            end if;

-      if Gcov_Root = null then
-         --  Look for the gcov file in the object directory of the root
-         --  project.
-         return Create
-           (Object_Path
-              (Get_Root_Project (Get_Registry (Kernel).all), False, False)
-            & Directory_Separator & Base_Name (Source) & Gcov_Extension_Cst);
-      else
-         --  Look for the gcov file in the path pointed by GCOV_ROOT
-         Result := Create
-           (Gcov_Root.all & Directory_Separator &
-            Base_Name (Source) & Gcov_Extension_Cst);
-         Free (Gcov_Root);
-         return Result;
-      end if;
+            if Gcov_Root = null then
+               --  Look for the gcov file in the object directory of the root
+               --  project.
+               return Create
+                 (Object_Path
+                    (Get_Root_Project
+                       (Get_Registry (Kernel).all), False, False)
+                  & Directory_Separator & Base_Name (Source)
+                  & Gcov_Extension_Cst);
+
+            else
+               --  Look for the gcov file in the path pointed by GCOV_ROOT
+               Result := Create
+                 (Gcov_Root.all & Directory_Separator &
+                  Base_Name (Source) & Gcov_Extension_Cst);
+
+               Free (Gcov_Root);
+               return Result;
+            end if;
+
+         when Xcov =>
+            return Create
+              (Object_Path
+                 (Get_Root_Project
+                    (Get_Registry (Kernel).all), False, False)
+               & Directory_Separator & Base_Name (Source)
+               & Xcov_Extension_Cst);
+      end case;
    end Find_Gcov_File;

    --------------------
@@ -493,15 +526,17 @@ package body Coverage_GUI is
             File_Node := Get_Or_Create
               (Prj_Node, File_Information (Context));

-            if File_Node.Analysis_Data.Coverage_Data /= null and then
-              File_Node.Analysis_Data.Coverage_Data.Status = Valid then
+            if File_Node.Analysis_Data.Coverage_Data /= null
+              and then File_Node.Analysis_Data.Coverage_Data.Is_Valid
+            then
                return True;
             end if;
          end;

       else
-         if Prj_Node.Analysis_Data.Coverage_Data /= null and then
-           Prj_Node.Analysis_Data.Coverage_Data.Status = Valid then
+         if Prj_Node.Analysis_Data.Coverage_Data /= null
+           and then Prj_Node.Analysis_Data.Coverage_Data.Is_Valid
+         then
             return True;
          end if;
       end if;
@@ -509,4 +544,31 @@ package body Coverage_GUI is
       return False;
    end Have_Gcov_Info;

+   ---------------------------
+   -- Current_Coverage_Tool --
+   ---------------------------
+
+   function Current_Coverage_Tool return Coverage_Toolchain_Kinds is
+   begin
+      return Coverage_Toolchain_Preference.Get_Pref;
+   end Current_Coverage_Tool;
+
+   ---------------------
+   -- Register_Module --
+   ---------------------
+
+   procedure Register_Module
+     (Kernel : access GPS.Kernel.Kernel_Handle_Record'Class)
+   is
+   begin
+      Coverage_Toolchain_Preference :=
+        Coverage_Toolchain_Preferences.Create
+          (Kernel.Get_Preferences,
+           "coverage-toolchain",
+           "Coverage toolchain",
+           "Coverage Analysis",
+           "",
+           Gcov);
+   end Register_Module;
+
 end Coverage_GUI;
============================================================
--- code_analysis/src/coverage_gui.ads	798a2eb90301a2c542ce1327df8c19eedfd644f6
+++ code_analysis/src/coverage_gui.ads	189e184a8f7f94b1f5a29661999b6a9e5704a025
@@ -35,9 +35,21 @@ package Coverage_GUI is
    Gcov_Extension_Cst : constant String := ".gcov";
    --  Constant String that represents the extension of GCOV files

-   CodeAnalysis_Cst   : constant String := "CodeAnalysis";
-   Coverage_Category  : constant Glib.UTF8_String := -"Uncovered lines";
+   Xcov_Extension_Cst : constant String := ".xcov";
+   --  Constant String that represents the extension of XCOV files

+   type Coverage_Toolchain_Kinds is (Gcov, Xcov);
+
+   function Current_Coverage_Tool return Coverage_Toolchain_Kinds;
+   --  Returns currently selected coverage tool.
+
+   CodeAnalysis_Cst : constant String := "CodeAnalysis";
+
+   Uncovered_Category         : constant Glib.UTF8_String :=
+     -"Uncovered lines";
+   Partially_Covered_Category : constant Glib.UTF8_String :=
+     -"Partially covered lines";
+
    Binary_Coverage_Trace : constant Debug_Handle :=
                           Create ("BINARY_COVERAGE_MODE", GNATCOLL.Traces.On);
    Binary_Coverage_Mode  : Boolean;
@@ -138,4 +150,8 @@ package Coverage_GUI is
    --  Verify that contextual Project and/or file if any, have associated
    --  coverage information in their corresponding node of the analysis tree.

+   procedure Register_Module
+     (Kernel : access GPS.Kernel.Kernel_Handle_Record'Class);
+   --  Register module.
+
 end Coverage_GUI;
============================================================
--- common/src/basic_mapper.adb	9421e82683128e309810cdd9e0c4bf21b83b40f6
+++ common/src/basic_mapper.adb	ec5563dfdf295e2b78811f1f34456726cc39add4
@@ -19,7 +19,6 @@ with Unchecked_Deallocation;

 with Ada.Text_IO;
 with Unchecked_Deallocation;
-with Glib.Convert; use Glib.Convert;

 package body Basic_Mapper is

@@ -157,8 +156,7 @@ package body Basic_Mapper is
          Mapper := new File_Mapper;
       end if;

-      Ada.Text_IO.Open
-        (File, Ada.Text_IO.In_File, Locale_From_UTF8 (File_Name));
+      Ada.Text_IO.Open (File, Ada.Text_IO.In_File, File_Name);

       while Last_2 >= 0
         and then Last_1 >= 0
============================================================
--- common/src/config.ads.in	715c49740d989e4747d70cdb531e7d3b4984e608
+++ common/src/config.ads.in	1f0e843b7141ab09a68194f70ff2b8543c3a7932
@@ -27,17 +27,17 @@ package Config is
    pragma Style_Checks (Off);

    type Host_Type is (Windows, Unix, VMS, Unknown);
-   --  Possible kind of host where GPS is built.
+   --  Possible kind of host where GPS is built

    ---------------
    -- Constants --
    ---------------

    Version : constant String := "@GPS_VERSION@";
-   --  Version number of this software.
+   --  Version number of this software

    Target  : constant String := "@TARGET@";
-   --  Target for which GPS is built.
+   --  Target for which GPS is built

    Prefix : constant String := "@prefix@";
    --  Default prefix used e.g for finding support files like po files.
@@ -53,20 +53,20 @@ package Config is
    Source_Date : constant String := "unknown date";

    Max_Frame : constant := 500;
-   --  Maximum number of frames displayed in the backtrace window.
+   --  Maximum number of frames displayed in the backtrace window

    Max_Tasks : constant := 999;
-   --  Maximum number of tasks/threads displayed in the tasks/threads windows.
+   --  Maximum number of tasks/threads displayed in the tasks/threads windows

    Max_PD : constant := 99;
    --  Maximum number of protection domains displayed in the
    --  protection domain window.

    Max_Column_Width : constant := 200;
-   --  Maximum width (in pixels) for a column in a list.
+   --  Maximum width (in pixels) for a column in a list

    Need_To_Strip_CR : constant Boolean := @STRIP_CR@;
-   --  True on systems where lines are separated by both LF and CR.
+   --  True on systems where lines are separated by both LF and CR

    Async_Commands : constant Boolean := True;
    --  True if user commands are handled asynchronousely, to avoid recursion
@@ -78,34 +78,40 @@ package Config is
    --  is a GUI only process (e.g under windows).

    Layout_Width : constant := 20;
-   --  Width for the area reserved for the buttons in the source/asm editor.
+   --  Width for the area reserved for the buttons in the source/asm editor

    Exec_Command : constant String := "@EXEC_COMMAND@";
-   --  Command used to run helpers.
+   --  Command used to run helpers

    Default_Font : constant String := "@DEFAULT_FONT@";
-   --  Default system font used in the preferences.
+   --  Default system font used in the preferences

    Default_Ps : constant String :=
      "@DEFAULT_PS@";
-   --  Command used to list processes on a native system.
+   --  Command used to list processes on a native system. The String is on
+   --  its own line to avoid exceeding line length.

    Default_Print_Cmd : constant String := "@PRINT_CMD@";
-   --  Command used to print a file.
+   --  Command used to print a file

    Default_Opaque_MDI : constant Boolean := @OPAQUE_MDI@;
-   --  Default value for the MDI opaque preference.
+   --  Default value for the MDI opaque preference

    Default_Diff_Cmd : constant String := "@DIFF_CMD@";
-   --  Command used to generate a diff between two files.
+   --  Command used to generate a diff between two files

    Default_Diff3_Cmd : constant String := "@DIFF3_CMD@";
-   --  Command used to generate a diff between three files.
+   --  Command used to generate a diff between three files

    Default_Patch_Cmd : constant String := "@PATCH_CMD@";
-   --  Command used to apply a patch file.
+   --  Command used to apply a patch file

    Support_Execution_Window : constant Boolean := @EXECUTION_WINDOW@;
-   --  Whether separate debugger execution window is supported by the target.
+   --  Whether separate debugger execution window is supported by the target

+   Default_Charset : constant String := "@CHARSET@";
+   --  Default charset for the host, used throughout GPS to convert strings
+   --  from outside GPS (e.g. pathnames, compiler output, file contents, ...)
+   --  to UTF-8 internally.
+
 end Config;
============================================================
--- common/src/filesystems.adb	3e8552a2f5dc08e0c148086dd79ef48ef4e601e5
+++ common/src/filesystems.adb	c8ce53cb47c6a7f6bc1a7cc9cd8303abfc237f39
@@ -1,7 +1,7 @@
 -----------------------------------------------------------------------
 --                               G P S                               --
 --                                                                   --
---                      Copyright (C) 2006-2008, AdaCore             --
+--                 Copyright (C) 2006-2008, AdaCore                  --
 --                                                                   --
 -- GPS is free  software;  you can redistribute it and/or modify  it --
 -- under the terms of the GNU General Public License as published by --
@@ -17,21 +17,24 @@
 -- Place - Suite 330, Boston, MA 02111-1307, USA.                    --
 -----------------------------------------------------------------------

-with Machine_Descriptors;                use Machine_Descriptors;
+with Glib.Convert;                       use Glib.Convert;
+
+pragma Warnings (Off);
+with GNAT.Expect.TTY.Remote;             use GNAT.Expect.TTY.Remote;
+pragma Warnings (On);
+with GNAT.Strings;                       use GNAT.Strings;
+
+with GNATCOLL.Filesystem.Unix;           use GNATCOLL.Filesystem.Unix;
 with GNATCOLL.Filesystem.Unix.Remote;    use GNATCOLL.Filesystem.Unix.Remote;
 with GNATCOLL.Filesystem.Windows;        use GNATCOLL.Filesystem.Windows;
 with GNATCOLL.Filesystem.Windows.Remote;
 use  GNATCOLL.Filesystem.Windows.Remote;
 with GNATCOLL.Filesystem.Transport;      use GNATCOLL.Filesystem.Transport;
-with GNAT.Strings;                       use GNAT.Strings;
-with Remote;

-pragma Warnings (Off);
-with GNAT.Expect.TTY.Remote;             use GNAT.Expect.TTY.Remote;
-pragma Warnings (On);
+with Config;                             use Config;
+with Machine_Descriptors;                use Machine_Descriptors;
+with Remote;

-with Glib.Convert;                       use Glib.Convert;
-
 package body Filesystems is

    package SLU renames String_List_Utils;
@@ -118,10 +121,10 @@ package body Filesystems is
    --------------------

    overriding procedure Spawn_Remotely
-     (Transport           : access GPS_Transport_Record;
-      Descriptor          : out GNAT.Expect.Process_Descriptor_Access;
-      Host                : String;
-      Args                : GNAT.Strings.String_List)
+     (Transport  : access GPS_Transport_Record;
+      Descriptor : out GNAT.Expect.Process_Descriptor_Access;
+      Host       : String;
+      Args       : GNAT.Strings.String_List)
    is
       pragma Unreferenced (Transport);
    begin
@@ -158,9 +161,12 @@ package body Filesystems is
          --  Local filesystem
          case Typ is
             when Unix =>
-               FS := new GNATCOLL.Filesystem.Unix.Unix_Filesystem_Record;
+               FS := new Unix_Filesystem_Record;
+               Set_Locale_To_Display_Encoder (FS.all, Encode_To_UTF8'Access);

             when Windows =>
+               --  On Windows we do not want to convert file name to UTF-8 as
+               --  they are already in UTF-8.
                FS := new Windows_Filesystem_Record;
          end case;

@@ -177,9 +183,10 @@ package body Filesystems is
                       Host      => Nickname,
                       Transport => Transport'Access);
          end case;
+
+         Set_Locale_To_Display_Encoder (FS.all, Encode_To_UTF8'Access);
       end if;

-      Set_Locale_To_Display_Encoder (FS.all, Encode_To_UTF8'Access);
       return FS;
    end Filesystem_Factory;

@@ -247,7 +254,38 @@ package body Filesystems is
       return Get_Host (File.Get_Filesystem);
    end Get_Host;

+   ----------------------
+   -- Filename_To_UTF8 --
+   ----------------------
+
+   function Filename_To_UTF8 (Name : String) return String is
+   begin
+      if Config.Host = Windows then
+         return Name;
+      else
+         return Locale_To_UTF8 (Name);
+      end if;
+   end Filename_To_UTF8;
+
+   ------------------------
+   -- Filename_From_UTF8 --
+   ------------------------
+
+   function Filename_From_UTF8 (Name : String) return String is
+   begin
+      if Config.Host = Windows then
+         return Name;
+      else
+         return Locale_From_UTF8 (Name);
+      end if;
+   end Filename_From_UTF8;
+
 begin
-   Set_Locale_To_Display_Encoder
-     (Get_Local_Filesystem.all, Encode_To_UTF8'Access);
+   --  On Windows we do not want to convert the filename in UTF-8 as all
+   --  filenames are returned from the OS as UTF-8 encoded.
+
+   if Config.Host /= Windows then
+      Set_Locale_To_Display_Encoder
+        (Get_Local_Filesystem.all, Encode_To_UTF8'Access);
+   end if;
 end Filesystems;
============================================================
--- common/src/filesystems.ads	77f8d14869bfbe42749ae6b1764e869e6589bdee
+++ common/src/filesystems.ads	441ee4139c3d477fb32e355c74038e6e2bc74451
@@ -1,7 +1,7 @@
 -----------------------------------------------------------------------
 --                               G P S                               --
 --                                                                   --
---                      Copyright (C) 2006-2008, AdaCore             --
+--                 Copyright (C) 2006-2008, AdaCore                  --
 --                                                                   --
 -- GPS is free  software;  you can redistribute it and/or modify  it --
 -- under the terms of the GNU General Public License as published by --
@@ -31,7 +31,7 @@ package Filesystems is

    function Get_Filesystem (Nickname : String) return Filesystem_Access;
    --  Retrieve the filesystem of the specified server
-   --  Raise Invalid_Nickname if Nickname does not correspond to a server
+   --  Raise Invalid_Nickname if Nickname does not correspond to a server.

    function Is_Local_Filesystem
      (FS : access Filesystem_Record'Class) return Boolean;
@@ -62,4 +62,11 @@ package Filesystems is
    function Is_Local (File : Virtual_File) return Boolean;
    --  Whether the file is on the local host or on a remote host

+   function Filename_To_UTF8 (Name : String) return String;
+   --  Used to convert a filename into the proper internal representation
+   --  expected by GPS with is UTF-8.
+
+   function Filename_From_UTF8 (Name : String) return String;
+   --  Convert a filename encoded in UTF-8 back into the local encoding
+
 end Filesystems;
============================================================
--- common/src/gui_utils.adb	0e7b29da864656161cc541232329ca1ac4336124
+++ common/src/gui_utils.adb	aa2c4530bdbb2c9a6b343a0546c6f64effbd99c4
@@ -1,7 +1,7 @@
 -----------------------------------------------------------------------
 --                               G P S                               --
 --                                                                   --
---                      Copyright (C) 2000-2008, AdaCore             --
+--                 Copyright (C) 2000-2008, AdaCore                  --
 --                                                                   --
 -- GVD is free  software;  you can redistribute it and/or modify  it --
 -- under the terms of the GNU General Public License as published by --
@@ -23,7 +23,6 @@ with GNATCOLL.Utils;           use GNATC
 with GNAT.OS_Lib;              use GNAT.OS_Lib;
 with GNATCOLL.Utils;           use GNATCOLL.Utils;

-with Glib.Convert;             use Glib.Convert;
 with Glib.Object;              use Glib.Object;
 with Glib.Properties;          use Glib.Properties;
 with Glib.Unicode;             use Glib.Unicode;
@@ -90,6 +89,7 @@ with Config;                   use Confi
 with Pango.Layout;             use Pango.Layout;

 with Config;                   use Config;
+with Filesystems;              use Filesystems;
 with String_List_Utils;        use String_List_Utils;
 with String_Utils;             use String_Utils;
 with System;                   use System;
@@ -121,7 +121,7 @@ package body GUI_Utils is
      (Render : access GObject_Record'Class;
       Params : Glib.Values.GValues;
       Data   : Model_Column);
-   --  Called when a toggle renderer is clicked on.
+   --  Called when a toggle renderer is clicked on

    function Button_Press_For_Contextual_Menu
      (Widget : access Gtk_Widget_Record'Class;
@@ -615,7 +615,7 @@ package body GUI_Utils is
                Grab_Focus (Widget);
                Show_All (Menu);

-               --  See comments in Button_Press_For_Contextual_Menu above.
+               --  See comments in Button_Press_For_Contextual_Menu above

                if Host = Windows then
                   Popup (Menu,
@@ -855,7 +855,7 @@ package body GUI_Utils is

       Line_Height := (Pango.Font.Get_Ascent (Font_Metrics) +
                         Pango.Font.Get_Descent (Font_Metrics)) / 1024;
-      --  ??? 1024 is PANGO_SCALE. We should retrieve it from C macro.
+      --  ??? 1024 is PANGO_SCALE. We should retrieve it from C macro

       Pango.Font.Unref (Font_Metrics);
       Unref (Font_Rec);
@@ -863,7 +863,7 @@ package body GUI_Utils is
       --  We retrieve the screen's height
       Max_Height := Gdk.Screen.Get_Height (Gdk.Screen.Get_Default);

-      --  And then we determine the maximum number of lines in the tooltip.
+      --  And then we determine the maximum number of lines in the tooltip
       Max_Lines := Max_Height / Line_Height - 1;

       Nb_Lines := 1;
@@ -949,7 +949,7 @@ package body GUI_Utils is
       Path      : String) is
    begin
       Initialize (Gtk_Menu_Item (Menu_Item),
-                  Krunch (Locale_To_UTF8 (Label), 60));
+                  Krunch (Filesystems.Filename_To_UTF8 (Label), 60));
       Menu_Item.Full_Path := Path;
    end Initialize;

@@ -1275,11 +1275,11 @@ package body GUI_Utils is
          if More_Than_One then
             Node := First (Completions);

-            --  Get the range copy the current line.
+            --  Get the range copy the current line

             Line := Get_Line (Last_Iter);

-            --  Get the offset of the prompt.
+            --  Get the offset of the prompt

             Offset := Get_Line_Offset (Prompt_Iter);

@@ -1315,7 +1315,7 @@ package body GUI_Utils is
             Scroll_Mark_Onscreen (View, Prompt_End_Mark);
          end if;

-         --  Insert the completion, if any.
+         --  Insert the completion, if any

          if Completions /= Null_List then
             Get_End_Iter (Buffer, Pos);
@@ -1417,7 +1417,7 @@ package body GUI_Utils is
       Button := Add_Button (Dialog, Stock_Cancel, Gtk_Response_Cancel);

       Show_All (Dialog);
-      --  Make sure the dialog is presented to the user.
+      --  Make sure the dialog is presented to the user
       Present (Dialog);

       if Urgent then
============================================================
--- common/src/gui_utils.ads	f089a4cd875e74ef646b0f3d3eb37a302c43b661
+++ common/src/gui_utils.ads	b45839f44172bb515afc2b23599cf35b4ddf29d5
@@ -84,7 +84,7 @@ package GUI_Utils is
       Stock_Id : String;
       Label    : String);
    --  Create a new button, that uses the image from a stock icon, but with
-   --  a specific text
+   --  a specific text.

    ----------------------
    -- Combos and lists --
@@ -231,7 +231,7 @@ package GUI_Utils is
       Name   : String;
       Column : Gint) return Gtk.Tree_Model.Gtk_Tree_Iter;
    --  Find in Model a node matching Name in Column.
-   --  return Gtk_Null_Iter if there is no such node
+   --  return Gtk_Null_Iter if there is no such node.

    procedure Expand_Row
      (Tree  : access Gtk.Tree_View.Gtk_Tree_View_Record'Class;
@@ -322,7 +322,7 @@ package GUI_Utils is
    -- Full_Path_Menu_Item --
    -------------------------

-   --  This widget is used to associate strings to menu items.
+   --  This widget is used to associate strings to menu items

    type Full_Path_Menu_Item_Record (Length : Natural) is
      new Gtk.Menu_Item.Gtk_Menu_Item_Record with private;
@@ -332,17 +332,17 @@ package GUI_Utils is
      (Menu_Item : out Full_Path_Menu_Item;
       Label     : String := "";
       Path      : String := "");
-   --  Create a new menu item with the given Path as associated string.
+   --  Create a new menu item with the given Path as associated string

    procedure Initialize
      (Menu_Item : access Full_Path_Menu_Item_Record'Class;
       Label     : String;
       Path      : String);
-   --  Internal initialization function.
+   --  Internal initialization function

    function Get_Path
      (Menu_Item : access Full_Path_Menu_Item_Record) return String;
-   --  Return the string associated with Menu_Item.
+   --  Return the string associated with Menu_Item

    ------------
    -- Events --
============================================================
--- common/src/histories.adb	d6cf0471fe48f335d5d52629f61053e455613eea
+++ common/src/histories.adb	167179ad1f1bd573a788856ab9bb9e00f5b45e07
@@ -1,7 +1,7 @@
 -----------------------------------------------------------------------
 --                               G P S                               --
 --                                                                   --
---                  Copyright (C) 2002-2008, AdaCore                 --
+--                 Copyright (C) 2002-2008, AdaCore                  --
 --                                                                   --
 -- GPS is free  software;  you can redistribute it and/or modify  it --
 -- under the terms of the GNU General Public License as published by --
@@ -66,7 +66,7 @@ package body Histories is
    procedure Update_History_Item
      (Item : access Gtk_Widget_Record'Class;
       Value  : History_Key_Access);
-   --  Called when the button is toggled.
+   --  Called when the button is toggled

    type Menu_Changed_Notifier_Record is new Changed_Notifier_Record with record
       Menu     : Gtk_Menu_Item;
@@ -178,8 +178,8 @@ package body Histories is
       Allow       : Boolean;
       Merge_First : Boolean := False)
    is
-      Current : constant History_Key_Access := Create_New_Key_If_Necessary
-        (Hist, Key, Strings);
+      Current : constant History_Key_Access :=
+                  Create_New_Key_If_Necessary (Hist, Key, Strings);
    begin
       Current.Allow_Duplicates := Allow;
       Current.Merge_First := Merge_First;
@@ -207,6 +207,7 @@ package body Histories is
       if File = null then
          Trace (Me, "Couldn't load history file: " & Err.all);
          Free (Err);
+
       else
          Key := File.Child;

@@ -241,50 +242,52 @@ package body Histories is
                N := Key.Child;

                case Value.Typ is
-               when Strings =>
-                  Num := 0;
+                  when Strings =>
+                     Num := 0;

-                  while N /= null loop
-                     if N.Tag.all /= "Length" then
-                        Num := Num + 1;
+                     while N /= null loop
+                        if N.Tag.all /= "Length" then
+                           Num := Num + 1;
+                        end if;
+                        N := N.Next;
+                     end loop;
+
+                     Value.Max_Length := -1;
+                     if Num /= 0 then
+                        Value.List := new String_List (1 .. Num);
+                     else
+                        Value.List := null;
                      end if;
-                     N := N.Next;
-                  end loop;
+                     N := Key.Child;
+                     Num := 1;

-                  Value.Max_Length := -1;
-                  if Num /= 0 then
-                     Value.List := new String_List (1 .. Num);
-                  else
-                     Value.List := null;
-                  end if;
-                  N := Key.Child;
-                  Num := 1;
+                     while N /= null loop
+                        if N.Tag.all = "Length" then
+                           begin
+                              Value.Max_Length := Integer'Value (N.Value.all);
+                           exception
+                              when Constraint_Error => null;
+                           end;

-                  while N /= null loop
-                     if N.Tag.all = "Length" then
-                        begin
-                           Value.Max_Length := Integer'Value (N.Value.all);
-                        exception
-                           when Constraint_Error => null;
-                        end;
-                     elsif N.Value /= null then
-                        Value.List (Num) := new String'(N.Value.all);
-                        Num := Num + 1;
+                        elsif N.Value /= null then
+                           Value.List (Num) := new String'(N.Value.all);
+                           Num := Num + 1;
+
+                        else
+                           Value.List (Num) := new String'("");
+                           Num := Num + 1;
+                        end if;
+                        N := N.Next;
+                     end loop;
+
+                  when Booleans =>
+                     if N /= null
+                       and then N.Tag.all = "value"
+                     then
+                        Value.Value := Boolean'Value (N.Value.all);
                      else
-                        Value.List (Num) := new String'("");
-                        Num := Num + 1;
+                        Value.Value := False;
                      end if;
-                     N := N.Next;
-                  end loop;
-
-               when Booleans =>
-                  if N /= null
-                    and then N.Tag.all = "value"
-                  then
-                     Value.Value := Boolean'Value (N.Value.all);
-                  else
-                     Value.Value := False;
-                  end if;
                end case;
             end if;

@@ -524,12 +527,12 @@ package body Histories is
    -----------------

    procedure Set_History
-     (Hist      : in out History_Record;
-      Key       : History_Key;
-      Value     : Boolean)
+     (Hist  : in out History_Record;
+      Key   : History_Key;
+      Value : Boolean)
    is
-      Val : constant History_Key_Access := Create_New_Key_If_Necessary
-        (Hist, Key, Booleans);
+      Val : constant History_Key_Access :=
+              Create_New_Key_If_Necessary (Hist, Key, Booleans);
    begin
       Val.Value := Value;

@@ -543,11 +546,11 @@ package body Histories is
    -----------------

    function Get_History
-     (Hist      : History_Record;
-      Key       : History_Key) return Boolean
+     (Hist : History_Record;
+      Key  : History_Key) return Boolean
    is
-      Val : constant History_Key_Access := Create_New_Key_If_Necessary
-        (Hist, Key, Booleans);
+      Val : constant History_Key_Access :=
+              Create_New_Key_If_Necessary (Hist, Key, Booleans);
    begin
       return Val.Value;
    end Get_History;
============================================================
--- common/src/interactive_consoles.adb	71fc4a12e7189fbaf3dca0b66ce43d619017324f
+++ common/src/interactive_consoles.adb	032b6ca5095c0c16af1a981f766e5320732dab97
@@ -1696,9 +1696,19 @@ package body Interactive_Consoles is
       Last_Iter   : Gtk_Text_Iter;

    begin
+      --  In case the console gets killed when handling the command, for
+      --  instance "quit" in the debugger
+
+      Ref (Console);
+
       Output := new String'
         (Console.Handler (Console, Command, Console.User_Data));

+      if In_Destruction_Is_Set (Console) then
+         Unref (Console);
+         return;
+      end if;
+
       if Console.Handler /= Default_Command_Handler'Access then
          Get_End_Iter (Console.Buffer, Last_Iter);
          Insert (Console.Buffer, Last_Iter, Output.all);
@@ -1723,6 +1733,8 @@ package body Interactive_Consoles is
       end if;

       Free (Output);
+
+      Unref (Console);
    end Execute_Command;

    ----------------
============================================================
--- common/src/remote-path-translator.adb	698969b0f5a15ad491a40c8cd0b86fce3efa41a7
+++ common/src/remote-path-translator.adb	3356103e497991ccd30490bd8e3ab1baba0c8074
@@ -215,10 +215,11 @@ package body Remote.Path.Translator is
            Get_Local_Filesystem.To_Unix (Path);
          --  The input path in unix style
          U_Frompath    : constant String :=
-           Get_Local_Filesystem.To_Unix (Path_From);
+                           Get_Local_Filesystem.To_Unix (Path_From);
          --  The local root dir, in unix style
          U_Subpath  : constant String :=
-           U_Path (U_Path'First + U_Frompath'Length .. U_Path'Last);
+                           U_Path
+                             (U_Path'First + U_Frompath'Length .. U_Path'Last);
       begin

          --  At this point, we have the from and to moint points. Let's
@@ -277,7 +278,7 @@ package body Remote.Path.Translator is
       end loop;

       if not Has_Element (Cursor) then
-         --  Not configured mirror path.
+         --  Not configured mirror path
          Mirror := Null_Path;
       end if;

============================================================
--- common/src/string_list_utils.adb	68370f0ce127f79f603657a5c77cdc680654495b
+++ common/src/string_list_utils.adb	13f811e99b1322cdcfc28d2374c0caf4ecb5d115
@@ -220,4 +220,33 @@ package body String_List_Utils is
       end;
    end Longest_Prefix;

+   function Longest_Prefix
+     (L : GNAT.Strings.String_List_Access) return String is
+   begin
+      if L = null or else L'Length = 0 then
+         return "";
+      end if;
+
+      declare
+         First_S : constant String := L (L'First).all;
+         Length  : Natural         := First_S'Length;
+      begin
+         for K in L'Range loop
+            Length := Natural'Min (Length, L (K)'Length);
+            while Length > 0
+              and then First_S
+                (First_S'First .. First_S'First + Length - 1) /=
+                L (K) (L (K)'First .. L (K)'First + Length - 1)
+            loop
+               Length := Length - 1;
+            end loop;
+
+            --  No need to continue further if there is no prefix
+            exit when Length = 0;
+         end loop;
+
+         return First_S (First_S'First .. First_S'First + Length - 1);
+      end;
+   end Longest_Prefix;
+
 end String_List_Utils;
============================================================
--- common/src/string_list_utils.ads	9c8d5ddf67c500bdfd733d125154c31fd3341969
+++ common/src/string_list_utils.ads	7936fd46b93afa12379e71aa33cfbd914603fc3a
@@ -17,9 +17,11 @@
 -- Place - Suite 330, Boston, MA 02111-1307, USA.                    --
 -----------------------------------------------------------------------

+with GNAT.OS_Lib;
+with GNAT.Strings;
+
 with Generic_List;
 with List_Utils;
-with GNAT.OS_Lib;

 package String_List_Utils is

@@ -55,6 +57,10 @@ package String_List_Utils is
    --  Return the longest prefix of all the strings in L. The empty string is
    --  returned if there is no common suffix.

+   function Longest_Prefix
+     (L : GNAT.Strings.String_List_Access) return String;
+   --  Likewise for the String_List_Access
+
    procedure Add_Unique_Sorted
      (L : in out String_List.List;
       S : String);
============================================================
--- common/src/string_utils.ads	63e0f1a0f71d63dbfc89387ea7856fd56852cf4c
+++ common/src/string_utils.ads	95c04b650c4852f43b9cd90c139a4340cb9358d3
@@ -200,9 +200,8 @@ package String_Utils is
       Continuation : String := "...") return String;
    --  Replace in string S all ASCII.LF and ASCII.HT characters with a space,
    --  and replace multiple spaces with a single one. Return the resulting
-   --  string with at most Max_Length character. Continuation is added at the
-   --  end of the string if cut.
-   --  S should be encoded in UTF-8.
+   --  string with at most Max_Length character including the continuation
+   --  characters. S should be encoded in UTF-8.

    function Krunch
      (S                 : String;
============================================================
--- common/src/utf8_utils.adb	59d91e0fc93c1419a35068a3cd80a7a9acb7650a
+++ common/src/utf8_utils.adb	88ddee2b95ef27280f0b8879643eaecedb144814
@@ -1,7 +1,7 @@
 -----------------------------------------------------------------------
 --                               G P S                               --
 --                                                                   --
---                      Copyright (C) 2007-2008, AdaCore             --
+--                 Copyright (C) 2007-2008, AdaCore                  --
 --                                                                   --
 -- GPS is free  software;  you can redistribute it and/or modify  it --
 -- under the terms of the GNU General Public License as published by --
@@ -17,11 +17,11 @@
 -- Place - Suite 330, Boston, MA 02111-1307, USA.                    --
 -----------------------------------------------------------------------

-with Glib.Error;                use Glib.Error;
-with Glib.Convert;              use Glib.Convert;
-with Glib.Unicode;              use Glib.Unicode;
+with Interfaces.C.Strings; use Interfaces.C.Strings;

-with Interfaces.C.Strings;      use Interfaces.C.Strings;
+with Glib.Error;           use Glib.Error;
+with Glib.Convert;         use Glib.Convert;
+with Glib.Unicode;         use Glib.Unicode;

 package body UTF8_Utils is

@@ -48,6 +48,7 @@ package body UTF8_Utils is
       if Valid then
          --  The string is UTF-8, nothing to do
          return;
+
       else
          --  The string is not valid UTF-8, assume it is encoded using the
          --  locale.
@@ -70,7 +71,7 @@ package body UTF8_Utils is

             else
                Error_Free (Error);
-               --  ??? We could make some use of the error message.
+               --  ??? We could make some use of the error message

                --  Locale_To_UTF8 does not clarify whether Tentative is
                --  allocated some memory or not in case of failure. In doubt,
@@ -104,6 +105,7 @@ package body UTF8_Utils is
             Free (Output);
             return S;
          end;
+
       else
          return "";
       end if;
============================================================
# configure is binary
============================================================
--- configure.in	3edcf408dd66fbd53191fe7266482e790f48668d
+++ configure.in	5190661de942f1f9e3a17081ead7a36e23064411
@@ -1,4 +1,4 @@
-ADC_REVISION($Revision: 131186 $)
+ADC_REVISION($Revision: 131917 $)
 AC_INIT(gps/src/gps-main.adb)

 AC_CANONICAL_SYSTEM
@@ -24,6 +24,7 @@ EXECUTION_WINDOW=True
 DIFF3_CMD="diff3"
 PATCH_CMD="patch"
 EXECUTION_WINDOW=True
+CHARSET="ISO-8859-1"

 TARGET=$host
 EXEC_PREFIX="$prefix"
@@ -121,6 +122,7 @@ case "${host}" in
 	HOST_TYPE=Windows
 	PATH_STYLE=CYGWIN
 	SSH_ESCAPE=\'~\'
+	CHARSET="ISO-8859-1"
 	;;

       *-darwin* ) STRIP_CR=True ;;
@@ -155,6 +157,7 @@ AC_SUBST(SSH_ESCAPE)
 AC_SUBST(HOST_TYPE)
 AC_SUBST(EXECUTION_WINDOW)
 AC_SUBST(SSH_ESCAPE)
+AC_SUBST(CHARSET)

 AC_CONFIG_SUBDIRS(kernel/src_info/sn)
 AC_CONFIG_SUBDIRS(kernel/src_info/sn/snsrc)
============================================================
--- custom/src/custom_module.adb	80aceda3399d136bdd08caf34eb2f11cc9042e12
+++ custom/src/custom_module.adb	e7773a654d6ae452ea3183d0dd9ec626482037d3
@@ -85,6 +85,9 @@ package body Custom_Module is
    Factory_Cst       : aliased constant String := "factory";
    Group_Cst         : aliased constant String := "group";
    Visibility_Filter_Cst : aliased constant String := "visibility_filter";
+   Description_Cst   : aliased constant String := "description";
+   Category_Cst      : aliased constant String := "category";
+   Key_Cst           : aliased constant String := "key";

    Menu_Get_Params : constant Cst_Argument_List :=
      (1 => Path_Cst'Access);
@@ -151,40 +154,44 @@ package body Custom_Module is
      (Data : in out Callback_Data'Class; Command : String);
    --  Handles all shell commands for GPS.Contextual

-   type Contextual_Shell_Cmd is new Interactive_Command with record
-      Contextual  : Class_Instance;
-      On_Activate : Subprogram_Type;
+   procedure Action_Handler
+     (Data : in out Callback_Data'Class; Command : String);
+   --  Handles all shell commands for GPS.Action
+
+   type Subprogram_Command_Record is new Interactive_Command with record
+      Pass_Context : Boolean := True;
+      --  Whether the context should be passed as Arg to On_Activate
+
+      On_Activate  : Subprogram_Type;
    end record;
-   type Contextual_Shell_Command is access all Contextual_Shell_Cmd'Class;
-   overriding procedure Free (Cmd : in out Contextual_Shell_Cmd);
+   type Subprogram_Command is access all Subprogram_Command_Record'Class;
+   overriding procedure Free (Cmd : in out Subprogram_Command_Record);
    overriding function Execute
-     (Command : access Contextual_Shell_Cmd;
+     (Command : access Subprogram_Command_Record;
       Context : Interactive_Command_Context) return Command_Return_Type;
    --  Type used to define contextual menus from a scripting language

-   type Contextual_Shell_Filters is new Action_Filter_Record with record
-      Contextual : Class_Instance;
+   type Subprogram_Filter_Record is new Action_Filter_Record with record
       Filter     : Subprogram_Type;
    end record;
-   type Contextual_Shell_Filter is access all Contextual_Shell_Filters'Class;
+   type Subprogram_Filter is access all Subprogram_Filter_Record'Class;
    overriding function Filter_Matches_Primitive
-     (Filter  : access Contextual_Shell_Filters;
+     (Filter  : access Subprogram_Filter_Record;
       Context : Selection_Context) return Boolean;
+   overriding procedure Free (Filter : in out Subprogram_Filter_Record);
    --  Type used to define contextual menus from a scripting language

-   type Contextual_Shell_Labels is new Contextual_Menu_Label_Creator_Record
+   type Subprogram_Label_Record is new Contextual_Menu_Label_Creator_Record
    with record
-      Contextual : Class_Instance;
       Label      : Subprogram_Type;
    end record;
-   type Contextual_Shell_Label is access all Contextual_Shell_Labels'Class;
+   type Subprogram_Label is access all Subprogram_Label_Record'Class;
    overriding function Get_Label
-     (Creator : access Contextual_Shell_Labels;
+     (Creator : access Subprogram_Label_Record;
       Context : Selection_Context) return String;
    --  Type used to define contextual menus from a scripting language

    type Create_Dynamic_Contextual is new Submenu_Factory_Record with record
-      Contextual  : Class_Instance;
       On_Activate : Subprogram_Type;
       Factory     : Subprogram_Type;
    end record;
@@ -225,12 +232,28 @@ package body Custom_Module is
       Node         : Node_Ptr);
    --  Parse a <switches> node, and returns the corresponding configuration

+   function Filter_From_Argument
+     (Data   : Callback_Data'Class;
+      Nth    : Integer) return Action_Filter;
+   --  Convert one of the arguments of Data into a filter. This argument can be
+   --  specified either as a string referencing a predefined filter, or as a
+   --  subprogram callback
+
    ----------
    -- Free --
    ----------

-   overriding procedure Free (Cmd : in out Contextual_Shell_Cmd) is
+   overriding procedure Free (Filter : in out Subprogram_Filter_Record) is
    begin
+      Free (Filter.Filter);
+   end Free;
+
+   ----------
+   -- Free --
+   ----------
+
+   overriding procedure Free (Cmd : in out Subprogram_Command_Record) is
+   begin
       Free (Cmd.On_Activate);
    end Free;

@@ -286,7 +309,7 @@ package body Custom_Module is
       Factory : Dynamic_Context)
    is
       Script : constant Scripting_Language :=
-        Get_Script (Factory.Contextual.Contextual);
+        Get_Script (Factory.Contextual.On_Activate.all);
       C : Callback_Data'Class := Create (Script, Arguments_Count => 3);
       Tmp : Boolean;
       pragma Unreferenced (Tmp);
@@ -312,18 +335,13 @@ package body Custom_Module is
       Menu    : access Gtk.Menu.Gtk_Menu_Record'Class)
    is
       pragma Unreferenced (Object);
-      Script : constant Scripting_Language := Get_Script (Factory.Contextual);
-      Contextual_Class : constant Class_Type := New_Class
-        (Get_Kernel (Script), "Contextual");
+      Script : constant Scripting_Language :=
+        Get_Script (Factory.On_Activate.all);
       C : Callback_Data'Class := Create (Script, Arguments_Count => 1);
       Item : Python_Menu_Item;
    begin
-      Trace (Me, "Append_To_Menu "
-             & String'(Get_Data (Factory.Contextual, Contextual_Class)));
+      Set_Nth_Arg (C, 1, Create_Context (Script, Context));

-      Set_Nth_Arg
-        (C, 1, Create_Context (Get_Script (Factory.Contextual), Context));
-
       declare
          List : String_List := Execute (Factory.Factory, C);
       begin
@@ -361,20 +379,32 @@ package body Custom_Module is
    -------------

    overriding function Execute
-     (Command : access Contextual_Shell_Cmd;
+     (Command : access Subprogram_Command_Record;
       Context : Interactive_Command_Context) return Command_Return_Type
    is
-      C : Callback_Data'Class := Create
-        (Get_Script (Command.Contextual), Arguments_Count => 1);
-      Tmp : Boolean;
-      pragma Unreferenced (Tmp);
+      Count : Natural := 0;
    begin
-      Set_Nth_Arg
-        (C, 1, Create_Context
-           (Get_Script (Command.Contextual),
-            Selection_Context (Context.Context)));
-      Tmp := Execute (Command.On_Activate, C);
-      Free (C);
+      if Command.Pass_Context then
+         Count := Count + 1;
+      end if;
+
+      declare
+         C : Callback_Data'Class := Create
+           (Get_Script (Command.On_Activate.all), Arguments_Count => Count);
+         Tmp : Boolean;
+         pragma Unreferenced (Tmp);
+      begin
+         if Command.Pass_Context then
+            Set_Nth_Arg
+              (C, 1, Create_Context
+                 (Get_Script (Command.On_Activate.all),
+                  Selection_Context (Context.Context)));
+         end if;
+
+         Tmp := Execute (Command.On_Activate, C);
+         Free (C);
+      end;
+
       return Success;
    end Execute;

@@ -383,7 +413,7 @@ package body Custom_Module is
    ------------------------------

    overriding function Filter_Matches_Primitive
-     (Filter  : access Contextual_Shell_Filters;
+     (Filter  : access Subprogram_Filter_Record;
       Context : Selection_Context) return Boolean
    is
       C : Callback_Data'Class := Create
@@ -402,7 +432,7 @@ package body Custom_Module is
    ---------------

    overriding function Get_Label
-     (Creator : access Contextual_Shell_Labels;
+     (Creator : access Subprogram_Label_Record;
       Context : Selection_Context) return String
    is
       C : Callback_Data'Class := Create
@@ -1500,9 +1530,9 @@ package body Custom_Module is
       Contextual_Class : constant Class_Type :=
                            New_Class (Kernel, "Contextual");
       Inst             : Class_Instance;
-      Cmd              : Contextual_Shell_Command;
-      Filter           : Contextual_Shell_Filter;
-      Label            : Contextual_Shell_Label;
+      Cmd              : Subprogram_Command;
+      Filter           : Subprogram_Filter;
+      Label            : Subprogram_Label;
       Subp             : Subprogram_Type;
    begin
       if Command = Constructor_Method then
@@ -1536,8 +1566,7 @@ package body Custom_Module is
             Tmp : Subprogram_Type;
          begin
             Tmp := Nth_Arg (Data, 2); --  May raise No_Such_Parameter
-            Cmd := new Contextual_Shell_Cmd;
-            Cmd.Contextual := Inst;
+            Cmd := new Subprogram_Command_Record;
             Cmd.On_Activate := Tmp;
          exception
             when No_Such_Parameter =>
@@ -1546,14 +1575,13 @@ package body Custom_Module is

          Subp := Nth_Arg (Data, 4, null);
          if Subp /= null then
-            Filter := new Contextual_Shell_Filters'
-              (Action_Filter_Record with Contextual => Inst, Filter => Subp);
+            Filter := new Subprogram_Filter_Record'
+              (Action_Filter_Record with Filter => Subp);
          end if;

          Subp := Nth_Arg (Data, 3, null);
          if Subp /= null then
-            Label := new Contextual_Shell_Labels'
-              (Contextual => Inst, Label => Subp);
+            Label := new Subprogram_Label_Record'(Label => Subp);
             Register_Contextual_Menu
               (Kernel,
                Name              => Get_Data (Inst, Contextual_Class),
@@ -1584,8 +1612,8 @@ package body Custom_Module is

          Subp := Nth_Arg (Data, 5, null);
          if Subp /= null then
-            Filter  := new Contextual_Shell_Filters'
-              (Action_Filter_Record with Contextual => Inst, Filter => Subp);
+            Filter  := new Subprogram_Filter_Record'
+              (Action_Filter_Record with Filter => Subp);
          end if;

          Register_Contextual_Submenu
@@ -1595,8 +1623,7 @@ package body Custom_Module is
             Visibility_Filter => Nth_Arg (Data, 9, True),
             Label             => Nth_Arg (Data, 4, ""),
             Submenu           => new Create_Dynamic_Contextual'
-              (Contextual  => Inst,
-               Factory     => Nth_Arg (Data, 2),
+              (Factory     => Nth_Arg (Data, 2),
                On_Activate => Nth_Arg (Data, 3)),
             Ref_Item          => Nth_Arg (Data, 6, ""),
             Add_Before        => Nth_Arg (Data, 7, True),
@@ -1622,6 +1649,156 @@ package body Custom_Module is
       when E : others => Trace (Exception_Handle, E);
    end Contextual_Handler;

+   --------------------------
+   -- Filter_From_Argument --
+   --------------------------
+
+   function Filter_From_Argument
+     (Data   : Callback_Data'Class;
+      Nth    : Integer) return Action_Filter
+   is
+      Filter    : Action_Filter;
+      Filter_Cb : Subprogram_Type;
+   begin
+      --  First case: the filter is a string referencing a predefined
+      --  filter (it could be a string naming a subprogram in some of the
+      --  scripts, though, so we need to test whether such a predefined
+      --  filter exists)
+
+      begin
+         declare
+            Name : constant String := Nth_Arg (Data, Nth, "");
+         begin
+            if Name = "" then
+               --  Parameter was not specified, no filter to use
+               return null;
+            end if;
+
+            Filter := Lookup_Filter (Get_Kernel (Data), Name);
+            if Filter /= null then
+               return Filter;
+            end if;
+         end;
+
+      exception
+         when Invalid_Parameter =>
+            --  The parameter was not a string
+            null;
+      end;
+
+      --  Either the parameter was not a string, or did not match an existing
+      --  filter. It could be a subprogram_type in some scripting languages so
+      --  we try that as well. We let the Invalid_Parameter exception through
+      --  in case some other type of argument was specified.
+
+      Filter_Cb := Nth_Arg (Data, Nth);
+      return new Subprogram_Filter_Record'
+        (Action_Filter_Record with
+         Filter     => Filter_Cb);
+   end Filter_From_Argument;
+
+   --------------------
+   -- Action_Handler --
+   --------------------
+
+   procedure Action_Handler
+     (Data : in out Callback_Data'Class; Command : String)
+   is
+      Kernel : constant Kernel_Handle := Get_Kernel (Data);
+      Action_Class : constant Class_Type := New_Class
+        (Kernel, "Action", Base => Get_GUI_Class (Kernel));
+      Inst : Class_Instance;
+   begin
+      if Command = Constructor_Method then
+         Name_Parameters (Data, (1 => Name_Cst'Access));
+         Inst := Nth_Arg (Data, 1, Action_Class);
+         Set_Data (Inst, Action_Class, Value => String'(Nth_Arg (Data, 2)));
+
+      elsif Command = "create" then
+         Name_Parameters (Data, (1 => On_Activate_Cst'Access,
+                                 2 => Filter_Cst'Access,
+                                 3 => Category_Cst'Access,
+                                 4 => Description_Cst'Access));
+         Inst := Nth_Arg (Data, 1, Action_Class);
+
+         declare
+            Name : constant String := String'(Get_Data (Inst, Action_Class));
+            Filter  : constant Action_Filter := Filter_From_Argument (Data, 3);
+            Category    : constant String := Nth_Arg (Data, 4, "General");
+            Descr       : constant String := Nth_Arg (Data, 5, "");
+            Cmd         : Subprogram_Command;
+         begin
+            Cmd := new Subprogram_Command_Record;
+            Cmd.Pass_Context := False;
+            Cmd.On_Activate  := Nth_Arg (Data, 2);
+
+            Register_Action
+              (Kernel,
+               Name        => Name,
+               Command     => Cmd,
+               Description => Descr,
+               Category    => Category,
+               Filter      => Filter);
+         end;
+
+      elsif Command = "key" then
+         Name_Parameters (Data, (1 => Key_Cst'Access));
+         Inst := Nth_Arg (Data, 1, Action_Class);
+         Bind_Default_Key
+           (Kernel      => Kernel,
+            Action      => String'(Get_Data (Inst, Action_Class)),
+            Default_Key => Nth_Arg (Data, 2));
+
+      elsif Command = "menu" then
+         Name_Parameters (Data, (1 => Path_Cst'Access,
+                                 2 => Ref_Cst'Access,
+                                 3 => Add_Before_Cst'Access));
+         Inst := Nth_Arg (Data, 1, Action_Class);
+
+         declare
+            Path   : constant String  := Nth_Arg (Data, 2);
+            Ref    : constant String  := Nth_Arg (Data, 3, "");
+            Before : constant Boolean := Nth_Arg (Data, 4, True);
+            Action : constant Action_Record_Access :=
+              Lookup_Action (Kernel, String'(Get_Data (Inst, Action_Class)));
+         begin
+            if Action /= null then
+               Register_Menu
+                 (Kernel,
+                  Parent_Path => Dir_Name (Path),
+                  Text        => Base_Name (Path),
+                  Ref_Item    => Ref,
+                  Add_Before  => Before,
+                  Callback    => null,
+                  Action      => Action);
+            end if;
+         end;
+
+      elsif Command = "contextual" then
+         Name_Parameters (Data, (1 => Path_Cst'Access,
+                                 2 => Ref_Cst'Access,
+                                 3 => Add_Before_Cst'Access));
+         Inst := Nth_Arg (Data, 1, Action_Class);
+
+         declare
+            Path   : constant String  := Nth_Arg (Data, 2);
+            Ref    : constant String  := Nth_Arg (Data, 3, "");
+            Before : constant Boolean := Nth_Arg (Data, 4, True);
+            Action : constant Action_Record_Access :=
+              Lookup_Action (Kernel, String'(Get_Data (Inst, Action_Class)));
+         begin
+            if Action /= null then
+               Register_Contextual_Menu
+                 (Kernel,
+                  Name        => Path,
+                  Ref_Item    => Ref,
+                  Add_Before  => Before,
+                  Action      => Action);
+            end if;
+         end;
+      end if;
+   end Action_Handler;
+
    ---------------------
    -- Register_Module --
    ---------------------
@@ -1631,7 +1808,8 @@ package body Custom_Module is
    is
       Menu_Class : constant Class_Type := New_Class
         (Kernel, "Menu", Base => Get_GUI_Class (Kernel));
-
+      Action_Class : constant Class_Type := New_Class
+        (Kernel, "Action", Base => Get_GUI_Class (Kernel));
       Contextual_Class : constant Class_Type := New_Class
         (Kernel, "Contextual");
    begin
@@ -1649,6 +1827,37 @@ package body Custom_Module is

       Register_Command
         (Kernel, Constructor_Method,
+         Class         => Action_Class,
+         Minimum_Args  => 1,
+         Maximum_Args  => 1,
+         Handler       => Action_Handler'Access);
+      Register_Command
+        (Kernel, "create",
+         Class         => Action_Class,
+         Minimum_Args  => 1,
+         Maximum_Args  => 4,
+         Handler       => Action_Handler'Access);
+      Register_Command
+        (Kernel, "key",
+         Class         => Action_Class,
+         Minimum_Args  => 1,
+         Maximum_Args  => 1,
+         Handler       => Action_Handler'Access);
+      Register_Command
+        (Kernel, "menu",
+         Class         => Action_Class,
+         Minimum_Args  => 1,
+         Maximum_Args  => 3,
+         Handler       => Action_Handler'Access);
+      Register_Command
+        (Kernel, "contextual",
+         Class         => Action_Class,
+         Minimum_Args  => 1,
+         Maximum_Args  => 3,
+         Handler       => Action_Handler'Access);
+
+      Register_Command
+        (Kernel, Constructor_Method,
          Class        => Menu_Class,
          Handler      => Menu_Handler'Access);
       Register_Command
============================================================
--- distrib/.gps_wrapper	07f0c88210fe331760589c4e6dd82119e94323c9
+++ distrib/.gps_wrapper	6de489133800c2f03d20eecea997fcbfc0f31362
@@ -1,7 +1,7 @@
 #!/bin/sh
 # .gps_wrapper
 #
-# Copyright 2002-2006 by AdaCore
+# Copyright 2002-2008 AdaCore

 prog=`basename $0`
 root=`dirname $0`
@@ -28,6 +28,10 @@ GTK_EXE_PREFIX=$root
 GTK_DATA_PREFIX=$root
 GTK_EXE_PREFIX=$root

+if [ -d $root/lib/gps ]; then
+  unset GTK2_RC_FILES
+fi
+
 if [ -f $root/etc/fonts/fonts.conf ]; then
   FONTCONFIG_FILE=$root/etc/fonts/fonts.conf
   export FONTCONFIG_FILE
============================================================
--- distrib/doinstall	f989c237fa30112254a37ca6977f931e9f23461d
+++ distrib/doinstall	2d9b20419959ce0250b0a56971a9d3c18fb0df20
@@ -119,8 +119,16 @@ install_binaries() {
   if [ -d lib/gps-xorg ]; then
     if [ "`type Xorg 2>/dev/null | cut -d' ' -f3`" != "" ]; then
       ln -s gps-xorg lib/gps
+      if [ -f /usr/lib/libexpat.so.1 ]; then
+        ln -s /usr/lib/libexpat.so.1 lib/gps/libexpat.so.0
+      else
+        ln -s /usr/lib/libexpat.so lib/gps/libexpat.so.1
+      fi
     else
       ln -s gps-xfree lib/gps
+      if [ -f /usr/lib/libexpat.so.1 ]; then
+        ln -s /usr/lib/libexpat.so.1 lib/gps/libexpat.so.0
+      fi
     fi
   fi

============================================================
--- distrib/features	b6e28b9b55f076568cbe6395fa855e2f00526fec
+++ distrib/features	955c2600ffb1adf38f2d1d50a1030210e110eab4
@@ -1,5 +1,5 @@
 ====================================================
-GPS 4.4 NEW FEATURES LIST Current as of Oct 22, 2008
+GPS 4.4 NEW FEATURES LIST Current as of Nov 03, 2008
 ====================================================

 Copyright (c) 2007-2008, AdaCore
@@ -15,6 +15,13 @@ New features on 4.4.0
 New features on 4.4.0
 ---------------------

+NF-44-HA23-007 New menus in Edit->Selection (2008-10-23)
+
+  The following new menus are available under Edit->Selection:
+  - Move Left/Right: shift the selection one character left or right
+  - Serialize: automatically increment a number in a set of adjacent lines
+  - Untabify: replace tabs with spaces in the selection
+
 NF-44-HA03-020 File changed dialog checks for diffs (2008-10-03)

   When GPS detects that a file has changed on the disk, it displays
@@ -28,6 +35,14 @@ NF-44-HA03-015 Double-clicking in breakp
   It is now possible to double-click in the list of breakpoints in
   the breakpoints editor window to jump to any of these locations.

+NF-44-H927-002 Speed up update VCS action (2008-10-29)
+
+  It is now possible to disable status operation after an update.
+  This speed-up the update action as status is an expensive
+  operation. On slow network it can make a big difference.
+  At the same time GPS has been enhanced to parse the update output
+  to update file status accordingly.
+
 NF-44-GB03-007 Export debugger data window to png (2008-10-01)

   The debugger Data window can now be exported to png like all
@@ -45,3 +60,22 @@ NF-44-G903-012 Call stack window cleared
   The debugger callstack is now cleared while the debugged program is
   running or has terminated to avoid confusion arising from an outdated
   callstack.
+
+NF-44-E817-003 Message on the VCS Explorer when no VCS defined (2008-10-27)
+
+  When no VCS is defined on the root project and all projects it
+  depends on a message is displayed into the VCS Explorer.
+
+NF-44-DB04-011 New auto VCS mode (2008-10-27)
+
+  The new "auto" VCS_Kind mode can be used to let GPS automatically select
+  the proper external VCS. This is useful in the context where different
+  people are not using the same VCS locally. For example developers
+  tracking a Subversion repository using Git (git-svn module).
+
+NF-44-DA05-003 VCS menus are now filtered (2008-11-03)
+
+  The main VCS menu is filtered to contain only the VCS actions
+  which are at least defined in one generic VCS. The VCS
+  Activities menu is also filtered to propose actions that
+  are available on the project VCS.
============================================================
--- distrib/known-problems	752991e08fcca67bbaf06853e33f07ec4feb7309
+++ distrib/known-problems	7ba5937d702b36c642620b7bdcc8e50822ff3c12
@@ -1,443 +1,13 @@ Known Problems fixed in GPS 4.4.0
 Known Problems fixed in GPS 4.4.0

-Known Problems fixed in GPS 4.3.0
+- HB04-009: Debugger console has no keyboard focus on title click
+  Problem:    If you click in the title bar or the tab of the debugger
+              console, the cursor is not activated in the console, and
+              you need to click inside it before typing
+  Workaround: Click in the middle of the console to give it focus

-- H915-002: File view from project filter no working
-  Problem:    On the file view when activating the
-              "Show files from project only" filter there is nothing
-              displayed.
-  Workaround: Do not activate the filter or use the project explorer
+- D502-003: Procedure name too long and overlap with VCS status
+  Problem:    On the editor's status bar if a procedure name is
+              too long it will overlap with the VCS status.
+  Workaround: Use the VCS Explorer which displays the proper status

-- H909-012: Wrong setting of gprbuild --target switch
-  Problem:    When using a full pathname for the gnatmake command in the
-              project file (e.g. "c:/gnatpro/bin/powerpc-elf-gnatmake"), GPS
-              will launch gprbuild with the wrong --target switch.
-  Workaround: Launch gprbuild using the Build->Make->Custom... menu, or use
-              gprmake.
-
-- H903-019: Generated documentation is displayed incorrectly with IE6
-  Problem:    The documentation generator engine of GPS generates html code
-              that uses the CSS style "white-space: pre;" which is not handled
-              by IE6.
-  Workaround: Use Firefox, IE7, Opera or Safari. They are known to handle
-              correctly this CSS style.
-
-- H902-002: Duplicate locations for SPARK Examiner error messages
-  Problem:    If you use the spark module and examine a file, it happens
-              that the location window has duplicate entries for error
-              messages with lines greater than 100.
-  Workaround: Ignore those extra lines, they have no impact on the result
-
-- H805-023: Some references refered to as "read references"
-  Problem:    When you search for references to an entity, GPS will report
-              some of these as "read reference" when they really are just an
-              occurrence of the name. The GNAT compiler does not make a
-              distinction between the two cases, and such references are now
-              marked as "reference"
-  Workaround: None needed, this is just textual
-
-- H730-020: List of main files cleared after a scenario change
-  Problem:    When changing the value of a scenario variable for a project file
-              that declares a main file with an empty name such as in:
-                 for Main use ("");
-              the list of main files in the Build/Make and Build/Run menus is
-              cleared. Furthermore, those menus contain unexpected separators
-              (one per main file with an empty name).
-  Workaround: Although syntactically correct, this pattern has an undefined
-              semantics. The right syntax to achieve the desireable goal is
-              the following:
-                 for Main use (); --  Note that double quotes have been removed
-
-- H725-018: Refactoring->Rename does not ignore casing
-  Problem:    When using the 'Rename' refactoring, identifiers are not
-              considered with insensitive casing, thus failing to modify
-              some occurrences
-  Workaround: Use the Search & Replace capability instead.
-
-- H725-002: Miscomputation of highlighling when using visual comparison
-  Problem:    When using the visual comparison feature of GPS (via the
-              /Tools/Compare/* or the /VCS/Compare* menus), the portion of
-              lines that have been modified are highlighted. In some cases
-              this fine grained highlighting will not appear at places it
-              should.
-  Workaround: No known workaround. As the line is modified, it will be
-              be highlighted though, but the exact characters on the line that
-              are modified will not.
-
-- H724-004: Cannot search for package instantiation
-  Problem:    If you use the contextual menu "Find References to ..." on a
-              generic package, and then ask to only see its instantiations,
-              you will currently not get any output
-  Workaround: Look for "read references" to that package.
-
-- H716-010: filedeps.py plug-in missing some dependencies
-  Problem:    If you search, through this plug-in, why file A depends on file
-              B, it is possible that the plug-in does not find any such
-              dependency whereas the compiler detects one
-  Workaround: Update the filedeps.py script. You do not need a new version of
-              GPS.
-
-- H714-013: Protection domains menu disabled with wtx4 debugger
-  Problem:    The "Protection Domains" menu entry is not enabled when
-              using a VxWorks653 wtx4-based debugger
-  Workaround: Use the debugger console to access this information. Use
-              "info pds" to list protection domains, and "pd <pd id>" to
-	      switch between domains.
-
-- H711-009: GPS hangs when closing and opening files
-  Problem:    Under some circumstances, GPS might hang when opening a file
-              and potentially crash. An identified scenario is when two new
-              files are created using GPS, saved, closed, and opened again.
-              A similar behavior can be observed when renaming a file.
-  Workaround: Create new files or rename files outside GPS before loading them.
-
-- H630-002: Incorrect file in xref after changing scenario
-  Problem:    GPS incorrectly resets its internal xref cache when the scenario
-              variables are changed. Do a query from file A, which ends into
-              file B (for instance B contains the body of an entity referenced
-              in A). Then change the scenario so that the object directories
-              are now different, and B no longer belongs to the project. If
-              you redo the same query as before, you will again end up in B,
-              whereas you should end up in another file C instead.
-  Workaround: Put the following python file in $HOME/.gps/plug-ins:
-              import GPS
-              def on_view_changed (h): GPS.reset_xref_db()
-              GPS.Hook ("project_view_changed").add (on_view_changed)
-
-- H612-018: GPS hangs when it cannot write to the log file
-  Problem:    Due to special circumstances, GPS might not be able to write to
-              the log file (e.g NFS errors) and as a result just hangs.
-  Workaround: Remove the first line of the traces.cfg file that is located
-              under %USERPROFILE%/.gps on Windows or $HOME/.gps/ on other
-              platforms and which contains ">log.$$".
-
-- H612-013: Inability to set breakpoints at some locations
-  Problem:    Recent GNAT Pro packages comes with a new version of GDB (6.8)
-              which makes use of a new feature that is not properly handled
-              by GPS (multiple locations breakpoints). As a result it might not
-              be possible to set breakpoints in some particular locations.
-              Furthermore, after GPS refused to set a breakpoint, it is not
-              possible to open the breakpoint editor. Finally, this can also
-              generate some instabilities.
-  Workaround: It can help to compile with no optimization (-O0). Otherwise it
-              is still possible to use an older version of GDB (coming from a
-              previous release of GNAT Pro).
-
-- H704-007: Closing nodes in call graph still shows locations
-  Problem:    If you select the contextual menu "... calls", you get a
-              call tree, which shows location on its right-hand part. If
-              you fold the toplevel node, the locations are still visible,
-              although clicking on them has no effect
-  Workaround: Expand the node again, and select the entity for which you
-              want to see the locations.
-
-- H611-032: File Dependencies plug-in fails
-  Problem:    If you active the filedeps.py plugin, you see a new menu
-              /Navigate/Show File Dependency Path. However, this menu will
-              not work and report a python error
-  Workaround: open the python console, and type the following command,
-              replacing file names as appropriate:
-              filedeps.print_dependency_path \
-                (GPS.File ("file1"), GPS.File ("file2"))
-
-- H606-009: Incorrect file loaded in debugger with extending project
-  Problem:    If you are loading an extending project is GPS which does not
-              explicitely overrides its parent's Main attribute, then an
-              incorrect executable (the one from the parent project) will be
-              loaded in the debugger
-  Workaround: Define the Main attribute explicitely in the extending project.
-
-- H604-001: Delay in scripts execution in batch mode
-  Problem:    When launching GPS with the option "--load=<a script>", the
-              script only gets executed after the end of all background tasks
-              such as the loading of the entity database for the Smart
-              Completion.
-  Workaround: Disable the preferences/scripts that launch these background
-              tasks (such as the Smart Completion).
-
-- H602-007: Cannot write data into read-only files
-  Problem:    GPS does not properly detect that a file is read-only.
-              This prevents GPS from temporarily set the file to writable
-              to save the content as it is supposed to happen.
-  Workaround: Set manually the file to writable.
-
-- H529-001: Separator for combo boxes not supported in XML files
-  Problem:    If you defined a "separator" attribute for a <combo> switch
-              in the XML files, that separator is ignored
-  Workaround: None.
-
-- H526-009: Subversion status not properly reported
-  Problem:    The "Needs merge" status is reported as "Needs update" in the
-              VCS Explorer.
-  Workaround: Use Subversion from the command line to get proper status.
-
-- H512-021: Visual Differences is slow
-  Problem:    It can take a long time to compute Visual Differences (for
-              instance through the menu Tools->Compare or through VCS queries.
-  Workaround: Disable the computation of fine changes. This is done by
-              setting the "Fine Change Color" preference to the same value as
-              the "Change Color" preference, in the "Visual Diff" panel.
-
-- H504-003: Subversion compare two revisions not working
-  Problem:    The "Compare two revisions" VCS action is not working with
-              Subversion. The action seems to be ignored and no error
-              message is displayed.
-  Workaround: Compare both versions from the command line.
-
-- H427-004: Subversion head revisions log not displayed
-  Problem:    In the VCS Subversion log output, the head revisions are not
-              displayed if they correspond to changes not yet updated
-              locally.
-  Workaround: Do an update of the file before displaying the log.
-
-- H415-015: Wrong file used when compiling a file with no project
-  Problem:    When compiling a file which does not belong to the current
-              project hierarchy and a file with the same basename exists
-              in one of the projects, this file is compiled instead of
-              generating an error message.
-  Workaround: Make sure your files always belong to a project.
-
-- H409-028: Fix the activity contextual menu with multiple selected files
-  Problem:    When selecting multiple files on the VCS Explorer the
-              activity oriented entries in the contextual menu where not
-              always accurate. The menu "Commit as new Activity" or "Add to
-              Activity" could be present even though a selected file was
-              already in an activity. The menu "Remove from Activity" was
-              not listed if the first selected file had no activity.
-  Workaround: Select only files belonging to the same activity.
-
-- H407-006: Confusion when editing scenario variables
-  Problem:    The dialog used to edit a scenario variable appears
-              confusing to some users, who expect that changing the Name
-              will in fact select another existing variable. Documentation
-              was updated, and the label in the dialog changed to "Rename to".
-  Workaround: None needed.
-
-- H327-025: No source directories displayed in the project explorer
-  Problem:    When the project explorer hidden directories is empty
-              all source directories are hidden in the project explorer.
-  Workaround: Set the pattern to its default "^((\..+)|CVS)$" or do not
-              filter the hidden directories (see option in project explorer
-              contextual menu).
-
-- H319-009 Coverage annotations missing in the editors
-  Problem:    When querying the code coverage annotation on a source editor,
-              no symbols appear in the margin to indicate which lines are
-              covered and which lines are not.
-  Workaround: The detailed information is present in the .gcov files and via
-              tooltips.
-
-- H316-002: Cannot remove multiple files from an activity using VCS Explorer
-  Problem:    Files selected in the VCS Explorer cannot be removed from the
-              activity.
-  Workaround: Remove files using the VCS Activities explorer.
-
-- H314-018: Cannot add a file into an activity
-  Problem:    It is not possible to add a file into an activity using the
-              Version Control contextual menu on the editor.
-  Workaround: Use the VCS Explorer to add files into the activity.
-
-- H312-026: Cannot display coverage information of C source files.
-  Problem:    When trying to display a coverage report for a project containing
-              C source files, the report does not contain all the source files
-              of the project, and only one C file.
-  Workaround: Load separately the coverage information of each Ada source file
-
-- H311-032: Cannot close debugger multiple choice dialog under Windows
-  Problem:    When debugging under Windows, and a multiple choice dialog is
-              displayed (when e.g. putting a breakpoint on an overloaded
-              function), the close button will not always work properly, and
-              the underlying debugger may crash.
-  Workaround: Use the 'cancel' choice and 'OK' button instead to close the
-              dialog.
-
-- H309-006: VCS revisions not properly updated
-  Problem:    In some cases (when the VCS cache already contains
-              revision information) the files statuses are not properly
-              updated. For example after a commit, doing a Query status
-              won't show the new revision number of the committed files.
-  Workaround: Use the external VCS command to get the revision numbers.
-
-- H307-006: Cannot add multiple files into an anonymous activity
-  Problem:    When multiple files are selected in the VCS Explorer only
-              the first selected file gets added into the anonymous
-              activity when using the "Commit as new Activity" action.
-  Workaround: Add each file individually.
-
-- H227-011: ispell and isearch in floating windows
-  Problem:    When you try to use one of the two plugins in a floating editor,
-              the expected popup window is not displayed correctly. GPS might
-              even crash depending on your environment.
-  Workaround: Unfloat the editor before using these plugins
-
-- H225-011: Closing a floating assembly view crashes GPS
-  Problem:    Closing the assembly view after the debug session has been
-              terminated may crash GPS if the assembly view was in floating
-              mode.
-  Workaround: Be sure to close the assembly view before terminating the debug
-              session or unfloat it before closing it.
-
-- H225-023: Cannot displaying anonymous structures from g++ 4.1
-  Problem:    When trying to display an anonymous structure generated by
-              a g++ compiler there is an extra dotted name (ie .1) confusing
-              GPS.
-  Workaround: Use the 'print' contextual menu to display the values in the
-              debugger console instead.
-
-- H222-027: Duplicate -gnaty in project after editing properties
-  Problem:    In some cases, in particular when you are using -gnaty<digit>,
-              the resulting project file has duplicate entries for -gnaty
-              switches. In addition, this results in extra case statements
-              generated in the project.
-  Workaround: Edit the project manually.
-
-- H222-027: Editing project properties changes casing in project name
-  Problem:    If you edit the properties of a project, the casing of its name
-              might be changed (words are capitalized, and any specific casing
-              you previously had is lost).
-  Workaround: Projects are really case insensitive, so this issue only affects
-              you if you are also editing projects manually. In such a case,
-              you will need to overwrite GPS change.
-
-- H218-005: Exception in dispatching.py plug-in when closing buffers
-  Problem:    If you have activated the dispatching.py plug-in (which highlights
-              dispatching calls in Ada code), and close a buffer just after you
-              open it, an error message is displayed in the Messages window.
-  Workaround: Wait a while before closing the buffer (so that all highlighting
-              is done). You can also simply ignore the error message, which has
-              no side effect.
-
-- H207-009: Infinite loop when computing the Dispatching Calls menu
-  Problem:    In some cases, GPS might end up in an infinite loop when
-              computing the list of entities that could possibly be called
-              from a dispatching call.
-  Workaround: The problem seems to appear mostly on simple projects. If that
-              is a frequent issue to you, you can disable the dispatching call
-              search by changing the preference "Submenu for dispatching calls"
-
-- H204-015: Project files variable references on external default not supported
-  Problem:    A project file using a variable reference to specify an
-              external default value was not loaded properly.
-  Workaround: Specify the default value as a literal string.
-
-- H201-015: Crash when launching an external command producing lots of output
-  Problem:    When GPS launches an external command defined through an
-              <external> XML tag, for instance in custom scripts or predefined
-              plugins such as the Metrics plugin, GPS might run out of memory
-              and crash if the command launched produces a very large amount of
-              output.
-  Workaround: Make sure that the commands launched do not produce huge output.
-              If needed, use a wrapper around the tool that will strip extra
-              output and call this wrapper from GPS instead of directly the
-              tool.
-
-- H129-003: Tooltip not properly displayed
-  Problem:    It sometimes appears that a tooltip does not contain the name
-              of the underlying entity and a GTK+ warning might be emitted.
-  Workaround: Close the tooltip and display it again.
-
-- H124-016: Last long word not displayed in the memory view
-  Problem:    Depending on the first address specified in the memory view and
-              from which memory is read, the last long word might not be
-              displayed and replaced with dashes instead.
-  Workaround: Adjust the address from which memory is read or use the x/ command
-              of GDB directly.
-
-- H122-026: Changing Ada switches for a file does not work
-  Problem:    When using the switches editor to change the switches associated
-              with a particular file, changes are not taken into account and
-              might lead to unexpected behaviors.
-  Workaround: Specify the swithes directly in the project file.
-
-- H117-021: Crash when expanding nodes in the Project Explorer
-  Problem:    After checking or unchecking items in the Project Explorer
-              contextual menu, GPS might crash or show unexpected
-              behavior after expanding or collapsing nodes.
-  Workaround: Restart GPS after having checked/unchecked items in the
-              contextual menu.
-
-- H115-022: Directories without source not hidden
-  Problem:    Directories containing no source file are not hidden in the
-              Project Explorer even-though the hidden directory pattern
-              would match.
-  Workaround: Edit the project file to remove the directories you want to
-              hide.
-
-- H108-001: Issues with floating windows.
-  Problem:    GPS might hang upon starting if there is more than one floating
-              window in the stored desktop.
-  Workaround: Remove the file "desktop.xml" in the .gps directory.
-
-- H103-004: Revisions not properly highlighted
-  Problem:    When clicking on the revision links on annotated files, the
-              corresponding revision is not highlighted if the revision is
-              already  present in the Revision View.
-  Workaround: Close the Revision View before clicking on the version links.
-
-- GC19-004: "Debug->Interrupt" not working in remote mode when using rsh
-  Problem:    When debugging a program in remote mode, using rsh, using
-              "Interrupt" has no effect.
-  Workaround: Use ssh instead.
-
-- GC17-004: Editing project reverses the order of packages
-  Problem:    When you edit a project that contains several packages, GPS
-              reverts the order of the packages in the resulting file,
-              instead of preserving it.
-  Workaround: Edit the project a second time
-
-- GC13-020: Option --debug looking for executables in PATH
-  Problem:    When launching GPS with the option "--debug=executable", looks
-              for executable in the PATH, instead of looking in the current
-              directory first.
-  Workaround: Specify the full path to the executable.
-
-- GC07-025: Ouline View can't display large profile
-  Problem:    Routines with a large profile (more than 50 parameters)
-              won't be properly output in the outline view.
-  Workaround: Disable the output of the routine profile.
-
-- GC04-018: GPS not compatible with firefox 1.5
-  Problem:    GPS is not compatible with firefox 1.5, which does not support
-              the -new-tab switch. When you select an entry in the /Help menu,
-              firefox is open but the file is not visible
-  Workaround: copy-paste the URL from the GPS Messages window into the location
-              bar in firefox
-
-- GB20-003: VCS not properly detected for subprojects
-  Problem:    When using a hierarchy of projects, if a subproject has a VCS set
-              but the root project does not have a VCS set, GPS is unable to
-              call VCS operations on sources belonging to the subproject.
-  Workaround: Set a VCS on the root project.
-
-- GA26-033: Start/Continue button restarts the program when in remote mode
-  Problem:    When using GPS to debug a program using the "remote" protocol,
-              the first push on the Start/Continue button causes the program
-              to be restarted, instead of continuing the execution.
-  Workaround: Type "cont" in the debugger console instead of pressing the
-              Start/Continue button.
-
-- G906-021: Auto fixing doesn't indent correctly "pragma Unreferenced"
-  Problem:    When GPS insert a "pragma Unreferenced" to fix an unreferenced
-              entity warning, the indentation of the pragma may be incorrect.
-  Workaround: Manually fix the indentation.
-
-- G621-018: Auto fixing cannot remove variables containing "is"
-  Problem:    When a variable type or initialization contains the string "is",
-              and is not referenced, the auto fix proposed by GPS doesn't
-              manage to remove it properly.
-  Workaround: Remove manually the variable.
-
-- FA23-004: Mischosen "from" as parameter name in the python API
-  Problem:    "from" had been chosen as a parameter name of several methods of
-              the GPS.EditorBuffer class. As a result, it was not possible to
-              use named parameters for these methods as "from" is a python
-              keyword. It has been replaced with "frm".
-  Workaround: Do not use named parameters for methods that have a formal
-              parameter named "from".
-
-- F427-020: GPS slow when displaying some text files
-  Problem:    When editing some text files such as .texi files, GPS is
-              sometimes very slow when inserting new characters.
-  Workaround: Disable the synx higlighting by setting another language
-              for the file.
-
============================================================
--- docs/Makefile.in	6373ff752d508ea748d5ab7a82292a9908b9eae3
+++ docs/Makefile.in	bda5d5e013301bb9b8fce8b089a82765a09e99c7
@@ -26,7 +26,7 @@ tutorial: gps-tutorial.html
 	touch stamp-pdf

 tutorial: gps-tutorial.html
-doc:      gps.txt gps.html gps.pdf gps.pdf4print
+doc:      gps.txt gps.html gps.pdf
 gps_pg:   gps_pg.pdf gps_pg.html

 .PHONY: gps.html
@@ -49,13 +49,6 @@ gps.pdf gps.txt: ${TEXI} stamp-pdf

 gps.pdf gps.txt: ${TEXI} stamp-pdf

-gps.pdf4print: ${TEXI} stamp-pdf
-	@-if [ -f gps.pdf ]; then mv gps.pdf gps.pdf.bck; fi
-	@-rm -f gps.dvi gps.aux gps.toc
-	pdftex '\let\forprinting=1\input gps.texi'
-	mv gps.pdf gps.pdf4print
-	@-if [ -f gps.pdf.bck ]; then mv gps.pdf.bck gps.pdf; fi
-
 %.pdf::
 ifneq (${TEXI2DVI},)
 	echo x | ${TEXI2DVI} -p $<
@@ -108,7 +101,6 @@ clean: clean-temp-files

 clean: clean-temp-files
 	-$(RM) gps-tutorial*.html gps_*.html gps.pdf gps.dvi gps.txt stamp-*
-	-$(RM) gps.pdf4print
 	-${RM} -rf gps/

 mostlyclean: clean
============================================================
# docs/about.jpg is binary
============================================================
# docs/aliases.jpg is binary
============================================================
--- docs/gps-welcome-public.html	69ff2512020254c2b56b95beb4dc3a0bb5def4ea
+++ docs/gps-welcome-public.html	4e263646afb55fa217dec197acb405895caa3e4c
@@ -61,7 +61,7 @@ tool and modules.
 </UL>

 <P><HR><P>
-Copyright (C) 2002-2007, AdaCore.
+Copyright (C) 2002-2008, AdaCore.

 </BODY>
 </HTML>
============================================================
--- docs/gps-welcome.html	12e425fe250d5ff1ebc470bcc592878764f43ca0
+++ docs/gps-welcome.html	a58e772f7518d2053e43ec57d46eb31b74e56a45
@@ -149,7 +149,7 @@ GPS provides the following features:
 </UL>

 <P><HR><P>
-Copyright (C) 2002-2007, AdaCore.
+Copyright (C) 2002-2008, AdaCore.

 </BODY>
 </HTML>
============================================================
--- docs/gps.texi	e7178b148b6cba4a16fe76e89be1dc1fe6834086
+++ docs/gps.texi	26da3e6ae8c6041bc584d4d861f322b26e45e402
@@ -29,8 +29,8 @@
 @end flushright
 @sp 2
 @subtitle Version @value{GPSVersion}
-@subtitle Document revision level $Revision: 131281 $
-@subtitle Date: $Date: 2008-10-22 11:58:29 +0200 (Wed, 22 Oct 2008) $
+@subtitle Document revision level $Revision: 132094 $
+@subtitle Date: $Date: 2008-11-07 02:21:51 +0100 (Fri, 07 Nov 2008) $
 @author AdaCore

 @page
@@ -57,7 +57,7 @@ @top Using the GNAT Programming Studio

 Version @value{GPSVersion}

-Date: $Date: 2008-10-22 11:58:29 +0200 (Wed, 22 Oct 2008) $
+Date: $Date: 2008-11-07 02:21:51 +0100 (Fri, 07 Nov 2008) $

 Copyright @copyright{} 2001-2008, AdaCore
 This document may be copied, in whole or in part, in any form or by any
@@ -155,6 +155,9 @@ @top Using the GNAT Programming Studio

 Compilation/Build
 * The Build Menu::
+* The Target Configuration Dialog::
+* The Build Mode::
+* Working with two compilers::

 Source Browsing
 * General Issues::
@@ -231,6 +234,7 @@ @top Using the GNAT Programming Studio
 * Adding stock icons::
 @c * Defining a documentation format::
 * Remote programming customization::
+* Customizing build Targets and Models::

 Adding support for new tools
 * Defining supported languages::
@@ -296,7 +300,7 @@ @chapter Introduction
 project management; general graph technology giving access to many different
 browsers such as source dependency, project dependency, call graphs,
 entity view, etc@dots{}; fully integrated visual debugger; generic
-version control system, providing access to CVS, Subversion, ClearCase,
+version control system, providing access to CVS, Subversion, ClearCase, GIT,
 and any other via xml plug-ins; many other tools such as a visual comparison,
 automatic generation of files, source reformatting.

@@ -305,12 +309,14 @@ @chapter Introduction
 a first level, available through the preferences and key manager dialogs;
 a second level, which allows you to customize your menu items, tool bar and key
 bindings; a third level, which allows you to automate processing through
-scripts (via xml and python scripting).
-See @ref{Customizing and Extending GPS} for more details.
+scripts (via xml and python scripting). See @ref{Customizing and Extending GPS}
+for more details.

 GPS also interacts with most versions of command-line tools such as
-gcc, gdb, gnatmake, etc@dots{}.
+gcc, gdb, gnatmake, gcov, etc@dots{}.

+@image{main-gps, 9.7cm}
+
 @c --------------------------------------------------------------------
 @node Description of the Main Windows
 @chapter Description of the Main Windows
@@ -494,6 +500,8 @@ @section The Tool Bar
 @cindex clipboard
 cut to clipboard, copy to clipboard, paste from clipboard;
 go to previous/next location;
+@cindex build
+select build mode, compile file, build project, clean project;
 @cindex debugger
 start/continue the debugging session, step/next execution, finish
 current procedure.
@@ -1032,11 +1040,11 @@ @section The Shell and Python Windows
 by GPS, and allow you to type commands such as editing a file or
 compiling without using the menu items or the mouse.

-Some of these windows, especially the python window, might not be
-visible in your version of GPS, if GPS wasn't compiled with the
-support for that specific scripting language.
+An OS shell window is now also available in GPS, providing a simple access
+to the underlying OS shell as defined by the @code{SHELL} or @code{COMSPEC}
+environment variables.

-To show the shell consoles, select the menu @code{Tools}.
+To show the shell consoles, select the menu @code{Tools->Consoles}.

 See @ref{Scripting GPS} for more information on using
 scripting languages within GPS.
@@ -1243,13 +1251,20 @@ @section The Help Menu
 @item Welcome
 Open the GPS Welcome page.

-@item Open HTML file...
-Open a file selection dialog to load an HTML file.
-
 @item Contents
 Open a special HTML file that contains links for all the
 documentation files currently registered in GPS, @xref{Adding New Help Files}.

+@item GPS
+Submenu containing GPS documentation items.
+
+@item GNAT Runtime
+Submenu referencing all GNAT run-time files available, and a direct access
+to the corresponding specs containing embedded documentation.
+
+@item Python extensions
+Gives access to the GPS API available via python.
+
 @item About
 Display a dialog giving information about the versions of GPS and GNAT used:

@@ -1386,8 +1401,12 @@ @section Closing Windows
 to where you were before.

 Alternatively, you can also select the window by clicking anywhere in
-its title bar, and then select the menu @code{Window->Close}
+its title bar, and then select the menu @code{Window->Close}.

+Finally, a window can be closed by right-clicking in the associated
+notebook tab (if the tabs are visible), and select @code{Close} in the
+contextual menu.
+
 @c --------------------------------------------------------------------
 @node Splitting Windows
 @section Splitting Windows
@@ -2388,6 +2407,68 @@ @subsection The Edit Menu
 external command, which will take the current selection as input. The output of
 the command will replace the contents of the selection on success.

+@item Serialize
+Increment a set of numbers found on adjacent lines.
+The exact behavior depends on whether there is a current selection or not.
+
+If there is no selection, then the set of lines considered is from
+the current line on and includes all adjacent lines that have at
+least one digit in the original columns. In the following example,
+'|' marks the place where the cursor is at the beginning:
+
+@smallexample
+  AAA |10 AAA
+  CCC 34567 CCC
+  DDD DDD
+@end smallexample
+
+then only the first two lines will be modified, and will become
+
+@smallexample
+  AAA 10 AAA
+  CCC 11 CCC
+  DDD DDD
+@end smallexample
+
+If there is a selection, all the lines in the selection are
+modified. For each line, the columns that had digits in the first
+line are modified, no matter what they actually contain. In the
+example above, if you select all three lines, the replacement becomes
+
+@smallexample
+  AAA 10 AAA
+  CCC 11567 CCC
+  DDD 12D
+@end smallexample
+
+ie only the fifth and sixth columns are modified since only those
+columns contained digits in the first line. This feature assumes that
+you are selecting a relevant set of lines. But it allows you to
+transform blank lines more easily. For instance, if you have
+
+@smallexample
+  AAA 1
+  BBB
+  CCC
+@end smallexample
+
+this is transformed into
+
+@smallexample
+  AAA 1
+  BBB 2
+  CCC 3
+@end smallexample
+
+@item Untabify
+Replace all tabs in the current selection (or in the whole buffer if
+there is no selection) by the appropriate number of spaces
+
+@item Move Right
+@itemx Move Left
+Shift the currently selected lines (or the current line if there is no
+selection) one character to the right or to the left
+
 @end table

 @item Fold all blocks
@@ -4678,7 +4759,7 @@ @section The Switches Editor

 @iftex
 @cindex screen shot
-@image{switch-editor-revert, 11.7cm}
+@image{switch-editor-revert, 11.3cm}
 @end iftex

 @ifhtml
@@ -4991,6 +5072,8 @@ @chapter Compilation/Build

 @menu
 * The Build Menu::
+* The Target Configuration Dialog::
+* The Build Mode::
 * Working with two compilers::
 @end menu

@@ -5002,6 +5085,8 @@ @section The Build Menu
 note that this menu is fully configurable via the @code{Targets} dialog,
 so what is documented in this manual are the default menus.

+See @ref{The Target Configuration Dialog}.
+
 @table @b
 @item Check Syntax
 Check the syntax of the current source file. Display an error message in
@@ -5127,7 +5212,10 @@ @section The Build Menu
 @item Settings
    @table @i
    @item Targets
-   @c ??? TODO
+     @cindex Targets
+     This opens the Target Configuration Dialog.
+     @xref{The Target Configuration Dialog}.
+
    @item Toolchains
      @cindex Toolchains
      Open a dialog allowing the configuration of GPS for working with two
@@ -5151,6 +5239,135 @@ @section The Build Menu
 If your application is build through a Makefile, you should probably load
 the @file{Makefile.py} startup script (see the menu @code{/Tools/Plug-ins}).

+@node The Target Configuration Dialog
+@section The Target Configuration Dialog
+@cindex Targets
+
+@noindent
+GPS provides an interface for launching operations like building projects,
+compiling individual files, performing syntax or semantic checks, and so on.
+All these operations have in common that they involve launching an external
+command, and parsing the output for error messages. In GPS, these operations
+are called "Targets", and can be configured either through the Target
+Configuration dialog, or through XML configuration.
+@xref{Customizing build Targets and Models}.
+
+@iftex
+@cindex screen shot
+@image{target-configuration-dialog, 12.7cm}
+@end iftex
+
+@ifhtml
+@cindex screen shot
+@image{target-configuration-dialog}
+@end ifhtml
+
+This dialog is divided in two areas: on the left, a tree listing Targets, and,
+in the main area, a panel for configuring the Target which is currently
+selected in the tree.
+
+@subsection The Targets tree
+
+The Tree contains a list of targets, organized by categories.
+
+On top of the tree are three buttons:
+
+@itemize @bullet
+@item The Add button creates a new target.
+@item The Remove button removes the currently selected target. Note that only
+ user-defined targets can be removed, the default targets created by GPS cannot
+ be removed.
+@item The Clone button creates a new user-defined target which is identical
+ to the currently selected target.
+@end itemize
+
+@subsection The configuration panel
+
+On top of the configuration panel, one can select the Target model.
+The Model determines the graphical options available in the
+"Command line" frame.
+
+The "Revert" button resets all target settings to their original value.
+
+The "Options" frame contains a number of options that are available for all
+Targets.
+
+@itemize @bullet
+@item The Launch mode indicates the way the target is launched:
+  @itemize @bullet
+  @item Manually:
+    the target is launched when clicking on the corresponding icon
+    in the toolbar, or when activating the corresponding menu item.
+    In the latter case, a dialog is displayed, allowing last-minute
+    modifications of the command line.
+
+  @item Manually with dialog:
+    same as Manually, but the dialog is always displayed, even when
+    clicking on the toolbar icon.
+
+  @item Manually with no dialog:
+    same as Manually, but the dialog is never displayed, even when
+    activating the menu item.
+
+  @item On file save:
+    the Target is launched automatically by GPS when a file is saved.
+    The dialog is never displayed.
+  @end itemize
+
+@item Target type: type of target described. If empty, or set to
+  @code{Normal}, represents a simple target. If set to another value,
+  represents multiple subtargets.
+  For example, if set to @code{main}, each subtarget corresponds
+  to a Main source as defined in the currently loaded project.
+  Other custom values may be defined, and then handled via the
+  @code{compute_build_targets} hook.
+
+@item Display button in toolbar: when active, a button is displayed in
+  the main toolbar, allowing to quickly launch a Target.
+
+@item Display item in menu: whether to display a menu item corresponding
+  to the Target. By default, Targets in the "File" category are listed
+  directly in the Build menu, and Targets in other categories are listed
+  in a submenu corresponding to the name of the category.
+
+@end itemize
+
+The "Command line" contains a graphical interface for some configurable
+ elements of the Target, which are specific to the Model of this Target.
+
+The full command line is displayed at the bottom. Note that it may contain
+Macro Arguments. For instance if the command line contains the string "%PP",
+GPS will expand this to the full path to the current project. For a full
+list of available Macros, see @ref{Macro arguments}.
+
+@node The Build Mode
+@section The Build Mode
+@cindex Mode
+
+@noindent
+GPS provides an easy way to build your project with different options, through
+the Mode selection, located in the main toolbar.
+
+When the Mode selection is set to @code{default}, the build is done using the
+switches defined in the project. When the Mode selection is set to another
+value, then specialized parameters are passed to the builder. For instance, the
+@code{gcov} Mode adds all the compilation parameters needed to instrument the
+produced objects and executables to work with the @code{gcov} tool.
+
+In addition to changing the build parameters, the Mode selection has the effect
+of changing the output directory for objects and executables. For instance,
+objects produced under the @code{debug} mode will be located in the
+@code{debug} subdirectories of the object directories defined by the project.
+This allows switching from one Mode to another without having to erase the
+objects pertaining to a different Mode.
+
+It is possible to define new Modes using XML customization, see
+@ref{Customizing build Targets and Models}.
+
+Note that the Build Mode affects only builds done using recent versions of
+gnatmake and gprbuild. The Mode selection has no effect on builds done through
+Targets that launch other builders.
+
 @node Working with two compilers
 @section Working with two compilers
 @cindex Toolchains
@@ -5169,7 +5386,7 @@ @section Working with two compilers

 @iftex
 @cindex screen shot
-@image{toolchains-config, 12.7cm}
+@image{toolchains-config, 9.7cm}
 @end iftex

 @ifhtml
@@ -7030,36 +7247,76 @@ @chapter Version Control System

 GPS offers the possibility for multiple developers to work on the same project,
 through the integration of version control systems (VCS). Each project can be
-associated to a VCS, through the @code{VCS} tab in the Project property
+associated to a VCS, through the @code{VCS} tab in the Project properties
 editor. @xref{The Project Properties Editor}.

 GPS does not come with any version control system: it uses underlying
-command-line systems such as CVS, Subversion or ClearCase to perform
+command-line systems such as Subversion or ClearCase to perform
 the low level operations, and provides a high level user interface on
 top of them. Be sure to have a properly installed version control
 system before enabling it under GPS.

-The systems that are supported out of the box in GPS are CVS, Subversion and
-ClearCase. There are two interfaces to ClearCase: the standard
-ClearCase interface, which is built-in and uses a generic GPS
-terminology for VCS operations, and the Native ClearCase interface,
-which is fully customizable and uses by default the terminology
-specific to ClearCase. There are also two interfaces for Subversion on
-Windows, one for Cygwin/Subversion and one for native Subversion.
+The systems that are supported out of the box in GPS are:

+@table @b
+@item Auto
+GPS can be setup to auto-detect the actual VCS to use for each
+project. This is done by selecting @code{Auto} in the @code{VCS} tab
+of the Project properties editor. @xref{The Project Properties Editor}.
+
+@item ClearCase
+
+The standard ClearCase interface, which is built-in and uses a generic GPS
+terminology for VCS operations.
+
 Note that, at the moment, only Snapshot Views are supported in the
 ClearCase integration; Dynamic Views are not supported.

-It is also possible to add your own support for other version control systems,
-or modify the existing CVS, Subversion and ClearCase interfaces,
-see @ref{Adding support for new Version Control Systems} for more information.
+@item ClearCase Native

-When using CVS or Subversion, GPS will also need a corresponding
-@command{patch} command that usually comes with it. If you are under
-Windows, be sure to install a set of CVS and patch executables that
-are compatible. Additionally a GNU @command{diff} command is required to
-use Subversion.
+Which is fully customizable and uses by default the terminology
+specific to ClearCase.

+Note that, at the moment, only Snapshot Views are supported in the
+ClearCase integration; Dynamic Views are not supported.
+
+@item CVS
+
+The Concurrent Version System.
+
+GPS needs a corresponding @command{patch} command that usually comes with it.
+
+@item Git
+
+Distributed fast source code management. Support for Git on GPS is
+partial. Basic commands are supported but the full power of Git (like
+working with the index) is only available on the command line.
+
+GPS needs a corresponding @command{diff} command that usually comes with it.
+
+@item Subversion
+
+The Subversion version control system. Note that on Windows this
+version is intended to be used with Cygwin/Subversion and fully supports the
+Cygwin path names.
+
+GPS needs a corresponding @command{patch} and @command{diff} command
+that usually comes with it.
+
+@item Subversion Windows
+
+The Windows native Subversion version control system. The external
+Subversion commands are expected to be built for the Win32
+subsystem. This version does not support Cygwin path names.
+
+GPS needs a corresponding @command{patch} and @command{diff} command
+that usually comes with it.
+@end table
+
+It is also possible to add your own support for other version control systems,
+or modify one of the existing interfaces, see
+@ref{Adding support for new Version Control Systems} for more information.
+
 It is recommended that you first get familiar with the version control
 system that you intend to use in GPS first, since many concepts used in GPS
 assume basic knowledge of the underlying system.
@@ -7069,11 +7326,6 @@ @chapter Version Control System
 the checking in and out of files, the querying of file status, file revision
 history, comparison between various revisions, and so on.

-Administration of VCS systems is not handled by GPS at this
-stage. Therefore, before working on a project using version control
-system, make sure that the system is properly set-up before launching
-GPS.
-
 @cindex password
 Note: the set-up must make sure that the VCS commands can be launched without
 entering a password.
@@ -7870,6 +8122,7 @@ @section The Tools Menu
 @code{SHELL} and @code{COMSPEC} to determine which shell to use. This is
 currently a relatively simple implementation, without support for e.g.
 completion or ANSI codes.
+@xref{The Shell and Python Windows}.

 @item Auxiliary Builds
 Open the console containing auxiliary builds output. For now, only
@@ -8955,20 +9208,13 @@ @section The Preferences Dialog
 is navigated through the menu @code{Edit->Paste} and
 @code{Edit->Paste Previous}, as described earlier in this guide.

-@item Multi language build
-Whether GPS should build more than just Ada sources for projects containing Ada
-and other languages (e.g. C).
-
-By default, GPS will call gnatmake to build projects containing Ada sources,
-meaning that non Ada sources won't be built. By enabling this preference,
-a multi-language build tool (see below), will be called.
-
 @item Multi language builder
-The multi-language builder to be used in case multi-language build has been
-activated (see above).
+The multi-language builder to be used in case a multi-language or non Ada
+project has been loaded.

 By default, @code{gprbuild} will be used. Alternatively, its prototype
-@code{gprmake} can be selected although we do not recommend it at this stage.
+@code{gprmake} can be selected to help the transition, although we do not
+recommend it at this stage.

 @item Jump to first location
 @cindex location
@@ -9035,7 +9281,13 @@ @section The Preferences Dialog
 are stacked.

 @item Notebook tabs position
-Indicates where the notebook tabs should be displayed
+Indicates where the notebook tabs should be displayed by default. It is
+possible to select the position of tabs individually for each notebook
+by right-clicking in any of their tabs and chosing a new position in the
+contextual menu. This position will be saved as part of the desktop and
+restored the next time you restart GPS. However, if you change the value
+of this preference, all notebooks will reset the position of their tabs
+to match the new value of the preference.

 @end table

@@ -9734,6 +9986,20 @@ @section The Preferences Dialog

 @end table

+@item @b{VCS}
+@cindex vcs
+
+@table @i
+
+@item Implicit status
+@cindex Implicit status
+Whether a status action can be launched as part of another action. For
+example to get the revision numbers of new files after an update
+command. If the network connection with the repository is slow
+disabling this command can speed-up the VCS actions.
+
+@end table
+
 @item @b{Visual diff}
 @cindex visual diff
 @cindex file comparison
@@ -10001,6 +10267,18 @@ @section The Preferences Dialog

 @end table

+@item @b{Coverage Analysis}
+@anchor{Coverage Analysis Preferences}
+
+@table @i
+
+@item Coverage toolchain
+
+Select which coverage toolchain (@code{gcov} or @code{xcov}) to use from
+the @code{Tools->Coverage} menu.
+
+@end table
+
 @end itemize

 @c -----------------------------------------------------------------
@@ -10195,6 +10473,7 @@ @section Customizing through XML and Pyt
 * Adding stock icons::
 @c * Defining a documentation format::
 * Remote programming customization::
+* Customizing build Targets and Models::
 @end menu

 @c -----------------------------------------------------------------------
@@ -10725,7 +11004,9 @@ @subsection Macro arguments

 @item %builder
 Replaced by the default builder configured in GPS.
-This can be e.g. @code{gnatmake}, or @code{gprbuild}.
+This can be e.g. @code{gnatmake} if your project contains only Ada code,
+or @code{gprbuild} for non Ada or multi-language projects, or @code{gprmake}
+if you have set the multi language builder preference accordingly.
 Note: this macro is only available in the commands defined in the Build
 Manager and the Build Launcher dialogs.

@@ -10795,6 +11076,10 @@ @subsection Macro arguments
 @item %gnatmake
 Replaced by the gnatmake executable configured in your project file.

+@item %gprbuild
+Replaced by the gprbuild or gprmake command line configured in your project
+file.
+
 @item %gprclean
 Replaced by the default cleaner configured in GPS.
 This can be e.g. @code{gnat clean}, or @code{gprclean}.
@@ -10928,11 +11213,25 @@ @subsection Macro arguments
 Note: this macro is only available in the commands defined in the Build
 Manager and the Build Launcher dialogs.

-@item %M
-Replaced by the base filename of the Main source being considered for building.
+@item %T
+Replaced by the subtarget being considered for building.
+Depending on the context, this can correspond to e.g. the base filename of a
+Main source, or makefile targets.
 Note: this macro is only available in the commands defined in the Build
 Manager and the Build Launcher dialogs.

+@item %attr(Package'Name[,default])
+Replaced by the project attribute @code{Package'Name}, in other words, the
+attribute @code{Name} from the package @code{Package}. @code{Package'} is
+optional if @code{Name} is a top level attribute (e.g. @code{Object_Dir}).
+
+If the attribute is not defined in the project, an optional @code{default}
+value is returned, or an empty string if not.
+
+Note: This macro is only available in the commands defined in the Build
+Manager and Build Launcher dialogs, and only supports single string attributes,
+not lists.
+
 @item %%
 Replaced by the % sign.
 @end table
@@ -12522,9 +12821,9 @@ @subsubsection Declaring the new attribu
 @item @code{hide_in} (a string, default value: "")

 This XML attribute defines the various context in which this attribute
-should not be editable graphically. Currently, GPS provides two such
-contexts ("wizard" and "properties", corresponding to the project
-creation wizard and the project properties editor). If any of those
+should not be editable graphically. Currently, GPS provides three such
+contexts ("wizard", "library_wizard" and "properties", corresponding to the
+project creation wizards and the project properties editor). If any of those
 context is specified in hide_in, then the widget to edit this
 attribute will not be shown. The goal is to keep the graphical
 interface simple.
@@ -13624,6 +13923,188 @@ @subsubsection Defining a remote path tr
 @end table

 @c --------------------------------------------------------------------------
+@node Customizing build Targets and Models
+@subsection Customizing build Targets and Models
+@c --------------------------------------------------------------------------
+
+@noindent
+The information displayed in @ref{The Target Configuration Dialog} and in
+the Mode selection can be customized through XML.
+
+@menu
+* Defining new Target Models::
+* Defining new Targets::
+* Defining new Modes::
+@end menu
+
+@node Defining new Target Models
+@subsubsection Defining new Target Models
+@cindex Model
+
+Models are defined in a @code{target-model} node which has one attributes,
+@code{name}, which contains the name of the model, and which supports the
+following sub-nodes:
+
+@table @code
+@item <icon>
+   The stock name of the icon to associate by default with targets of this
+   model.
+@item <description>
+   A one-line description of what the Model supports
+@item <server>
+   Optional, defaulting to @code{Build_Server}. Indicates the server used for
+   launching Targets of this model. @xref{Remote operations}.
+@item <uses-shell>
+   Optional, defaulting to @code{False}. A boolean indicating whether Targets
+   of this model should be launched via the shell pointed to by the SHELL
+   environment variable.
+@item <command-line>
+   Contains a number of @code{<arg>} nodes, each containing an argument of the
+   default command line for this model, starting with the executable.
+@item <switches command="executable_name">
+   The graphical description of the switches.
+   (@pxref{Defining tool switches})
+@end table
+
+@smallexample
+<?xml version="1.0" ?>
+   <my_model>
+   <target-model name="gprclean" category="">
+      <description>Clean compilation artefacts with gprclean</description>
+      <command-line>
+         <arg>gprclean</arg>
+         <arg>-P%PP</arg>
+         <arg>%X</arg>
+      </command-line>
+      <icon>gps-clean</icon>
+      <switches command="%(tool_name)s" columns="1">
+         <check label="Clean recursively" switch="-r"
+                tip="Clean all projects recursively" />
+      </switches>
+   </target-model>
+</my_model>
+@end smallexample
+
+@node Defining new Targets
+@subsubsection Defining new Targets
+@cindex Target
+
+Targets are defined in a @code{target} node which has three attributes:
+
+@table @code
+@item name
+   Contains the name of the Target. It must be a unique name.
+   Underscores are interpreted as menu mnemonics. To represent an actual
+   underscore, use a double underscore.
+@item category
+   The category which contains the Target, for purposes of ordering the
+   tree in the Target Configuration Dialog, and for ordering in the Build
+   menu.Underscores are interpreted as menu mnemonics. To represent an actual
+   underscore, use a double underscore.
+   If @code{category} begins and ends with an underscore, the menu for the
+   Target is placed in the toplevel Build menu.
+@item model
+   The name of the Model of which this Target inherits initially.
+@end table
+
+@table @code
+@item <icon>
+   The stock name of the icon to associate by default with the Target.
+@item <in-toolbar>
+   Optional, defaulting to @code{False}. A boolean indicating whether the
+   Target should have an associated icon in the Toolbar.
+@item <in-menu>
+   Optional, defaulting to @code{True}. A boolean indicating whether the
+   Target should have an associated entry in the Build menu.
+@item <read-only>
+   Optional, defaulting to @code{False}. A boolean indicating whether the
+   Target can be removed by the user.
+@item <target-type>
+   Optional, defaulting to an empty string. A string indicating whether the
+   Target represents a simple target (if empty), or a
+   family of Targets. The name represents a parameter passed to the
+   @code{compute_build_targets} hook. If set to @code{main}, a new subtarget
+   will be create for each Main source defined in the project.
+@item <launch-mode>
+   Optional, defaulting to @code{MANUALLY}. Indicates how the Target should be
+   launched. Possible values are @code{MANUALLY}, @code{MANUALLY_WITH_DIALOG},
+   @code{MANUALLY_WITH_NO_DIALOG}, and @code{ON_FILE_SAVE}.
+@item <server>
+   Optional, defaulting to @code{Build_Server}. Indicates the server used for
+   launching Target. @xref{Remote operations}.
+@item <command-line>
+   Contains a number of @code{<arg>} nodes, each containing an argument of the
+   default command line for this Target, starting with the executable.
+@end table
+
+@smallexample
+<?xml version="1.0" ?>
+<my_target>
+   <target model="gprclean" category="C_lean" name="Clean _All">
+       <in-toolbar>TRUE</in-toolbar>
+       <icon>gps-clean</icon>
+       <launch-mode>MANUALLY_WITH_DIALOG</launch-mode>
+       <read-only>TRUE</read-only>
+       <command-line>
+          <arg>%gprclean</arg>
+          <arg>-r</arg>
+          <arg>%eL</arg>
+          <arg>-P%PP</arg>
+          <arg>%X</arg>
+       </command-line>
+  </target>
+</my_target>
+@end smallexample
+
+@node Defining new Modes
+@subsubsection Defining new Modes
+@cindex Mode
+
+Modes are defined in a @code{builder-mode} node which has one attributes,
+@code{name}, which contains the name of the model, and which supports the
+following sub-nodes:
+
+@table @code
+@item <description>
+   A one-line description of what the Mode does
+@item <subdir>
+   Optional. The base name of the subdirectory to create for this Mode.
+   The macro argument @code{%subdir} in the @code{extra-args} nodes will be
+   substituted with this.
+@item <supported-model>
+   The name of a model supported by this Mode. There can be multiple
+   @code{supported-model} nodes, each corresponding to a supported Model.
+   Optionally, you can specify a @code{filter} attribute for this node,
+   corresponding to the switches that are relevant for this mode. By default,
+   all switches will be taken into account.
+   The @code{extra-args} of the Mode that match @code{filter} will be passed
+   to commands of the supported Models.
+@item <extra-args>
+   Contains a list of @code{<arg>} nodes, each containing one extra argument
+   to append to the command line when launching Targets while this Mode is
+   active.
+   Macros are supported in the @code{<arg>} nodes.
+@end table
+
+@smallexample
+<?xml version="1.0" ?>
+<my_mode>
+ <builder-mode name="optimization">
+  <description>Build with code optimization activated</description>
+  <subdir>optimized_objects</subdir>
+  <supported-model>builder</supported-model>
+  <supported-model>gnatmake</supported-model>
+  <supported-model filter="--subdirs=">gprclean</supported-model>
+  <extra-args>
+     <arg>--subdirs=%subdir</arg>
+     <arg>-cargs</arg>
+     <arg>-O2</arg>
+  </extra-args>
+ </builder-mode>
+</my_mode>
+@end smallexample
+
+@c --------------------------------------------------------------------------
 @node Adding support for new tools
 @section Adding support for new tools
 @cindex external tool
@@ -16018,6 +16499,13 @@ @subsubsection The VCS node
 commit on directories and can take the values @code{TRUE} or @code{FALSE}.
 If it is set to @code{TRUE} it means that the VCS supports commit on
 directories this is the case for @code{Subversion} for example.
+
+@item administrative_directory
+The attribute @code{administrative_directory} specifies the name of
+the directory where the external VCS stores the local repository
+information. For example for Subversion this is @file{.svn}. This
+information is used when the project is setup to select automatically
+the external VCS. @xref{Version Control System}.
 @end table

 Note that to support group commit with shared log on GPS both
@@ -16140,7 +16628,7 @@ @subsubsection Output parsers
 The following parsers can be implemented in the @code{vcs} node.

 @table @b
-   @item @code{<status_parser>} and @code{<local_status_parser>}
+   @item @code{<status_parser>}, @code{<local_status_parser>} and @code{<update_parser>}
 These parsers are used by the command VCS.status_parse, to parse a string for
 the status of files controlled by a VCS.

============================================================
# docs/main-gps.jpg is binary
============================================================
# docs/messages.jpg is binary
============================================================
# docs/toolchains-config.jpg is binary
============================================================
--- docs/tutorial.texi	5e30ceaf1cccb779854a6faa78ba45c29a0128a8
+++ docs/tutorial.texi	580d3a931773f297e81bfd78f0b29dfbdd7b42a9
@@ -10,8 +10,8 @@

 @title GNAT Programming Studio Tutorial
 @subtitle Version @value{GPSVersion}
-@subtitle Document revision level $Revision: 131186 $
-@subtitle Date: $Date: 2008-10-21 18:52:44 +0200 (Tue, 21 Oct 2008) $
+@subtitle Document revision level $Revision: 131514 $
+@subtitle Date: $Date: 2008-10-27 12:52:06 +0100 (Mon, 27 Oct 2008) $
 @author AdaCore

 @page
@@ -37,7 +37,7 @@ @top GNAT Programming Studio Tutorial

 Version @value{GPSVersion}

-Date: $Date: 2008-10-21 18:52:44 +0200 (Tue, 21 Oct 2008) $
+Date: $Date: 2008-10-27 12:52:06 +0100 (Mon, 27 Oct 2008) $

 Copyright @copyright{} 2002-2007, AdaCore.
 This document may be copied, in whole or in part, in any form or by any
@@ -158,7 +158,8 @@ @chapter Building applications

 @noindent

-Select the icon @code{Build Main: sdc.adb} on the toolbar: this will launch
+Select the icon @code{Build Main: sdc.adb} on the toolbar (third icon
+from the right): this will launch
 a complete build of the @i{sdc} application. Note also that you can use a
 key binding directly instead of this tool bar button (@key{F4}), or use the
 corresponding menu item @code{Build->Project->sdc.adb}. If you use the menu
@@ -184,7 +185,7 @@ @chapter Building applications
 Note that on some window managers or desktop environments,
 @key{Ctrl-Tab} is already defined. If this is the case, you can change this
 shortcut from the key shortcuts dialog (menu @code{Edit->Key shortcuts},
-@code{Source editor} section, @code{Format selection} item).
+@code{Menus} section, @code{/Edit/Format Selection} item).

 You can then fix all the remaining errors by selecting the whole block
 (from line 28 to line 40) and pressing @key{Ctrl-Tab}. To select a block,
@@ -302,14 +303,7 @@ @chapter Code Completion
 code assist capabilities.

 Type @key{enter} to create a new line, and then @code{Scr}, and hit
-@key{Ctrl+Space}. If you've never used
-auto-completion before, GPS will pop a window asking you if you want to enable
-the auto-completion engine. Answer "yes". You will see at the bottom right of
-GPS a progress bar, showing the status of the completion database load. Note
-that you can still work during this operation. The auto completion mechanism
-can be disabled from the preferences if needed.
-
-Wait until the progress bar disappears, and then hit @key{Ctrl+Space} again.
+@key{Ctrl+Space}.
 A completion popup will be displayed, showing all the entities of the project
 begining with @code{Scr}. Select @code{Screen_Output}. The code will be
 automatically completed in the editor. Then add a dot in your code. The
@@ -417,8 +411,8 @@ @chapter Debug
 Save the file (@key{Ctrl-S});
 End the debug session: menu @code{Debug->Terminate};
 Rebuild (press @key{F4} key);
-Rerun (menu @code{Build->Run->sdc}): the program now completes as expected.
-Close the execution window.
+Rerun (menu @code{Build->Run->sdc}, click on @code{OK}): the program now
+completes as expected. Close the execution window.

 @c --------------------------------------------------------------------
 @node Call Graph
@@ -453,7 +447,8 @@ @chapter Call Graph
 The items can also be moved: move e.g @code{msg} item around.

 You can also recompute the layout of all the current items by using
-the contextual menu @code{Refresh layout}.
+the browser's contextual menu @code{Refresh layout} (move the mouse on the
+browser's background, with no box underneath, and right click).

 Click on left arrow of @code{msg}
 to display who is calling @code{msg}. Notice that @code{view} calls @code{msg}.
@@ -490,7 +485,7 @@ @chapter Locations Tree
 Do the same for the spec, save the file.

 Close the @file{stack.ads} and @file{stack.adb} files (menu File->Close,
-or using the shortcut @key{Ctrl-W}), as well as the call graph window.
+or using the shortcut @key{Ctrl-W}).
 Rebuild by pressing the @key{F4} key.

 @c "Let's now have a look at all the changes we've done so far, by looking at
@@ -571,8 +566,8 @@ @section Project Wizard
 Click on @code{Forward}: we are now on the @code{VCS page}. @i{VCS} stands
 for @i{Version Control System}.
 GPS provides a generic framework for @i{VCS} which allows it to support
-new systems easily. Systems supported by default are CVS, ClearCase and
-Subversion. Select @code{CVS}.
+new systems easily. Systems supported by default are CVS, ClearCase,
+Subversion and GIT. Select @code{CVS}.

 Click on @code{Forward}: this is the source directories selection,
 used to specify the project's sources. Click on the @code{Add} button,
@@ -709,10 +704,6 @@ @section Project dependencies
 In the browser, you can move the project items, and select them to highlight
 the dependencies.

-Close the project browser by clicking on the @code{[x]} sign at the top right
-area of the window, or by typing @key{Ctrl-W}, or by using the menu
-@code{File->Close}.
-
 @c --------------------------------------------------------------------
 @node Epilogue
 @chapter Epilogue
============================================================
# docs/welcome.jpg is binary
============================================================
--- gnatlib/Makefile.conf.in	0c64275b323860d0df365ca3480e4c88c30982a7
+++ gnatlib/Makefile.conf.in	184925bff1cce1ffc44621adf6e036a7894edee9
@@ -132,7 +132,6 @@ endif
 	cd ${libdir}; ${LN_S} ${TARNAME}/${LIBRARY_TYPE}/${LIBFULL} ${LIBNAME}.${basename ${VERSION}}
 	cd ${libdir}; ${LN_S} ${TARNAME}/${LIBRARY_TYPE}/${LIBFULL} ${LIBNAME}.${VERSION}
 endif
-	cd ${libdir}; ${LN_S} ${TARNAME}/${LIBRARY_TYPE}/${LIBFULL} ${LIBNAME}

 endif

@@ -147,6 +146,10 @@ installsources:
 # install would complain.
 installsources:
 	${CP} -p ${wildcard ${addsuffix *.ad?, ${SRCDIRS}}} ${includedir}/${TARNAME}
-	cd ${includedir}/${TARNAME}; ls ${notdir ${wildcard ${addsuffix *.ad?, ${SRCDIRS}}}} > ${libdir}/gnat/${TARNAME}/${basename ${PROJECT}}.lgpr
+ifeq (${OS},Windows_NT)
+	cd ${includedir}/${TARNAME}; ls ${notdir ${wildcard ${addsuffix *.ad?, ${SRCDIRS}}}} | grep -v unix > ${libdir}/gnat/${TARNAME}/${basename ${PROJECT}}.lgpr
+else
+	cd ${includedir}/${TARNAME}; ls ${notdir ${wildcard ${addsuffix *.ad?, ${SRCDIRS}}}} | grep -v win32 > ${libdir}/gnat/${TARNAME}/${basename ${PROJECT}}.lgpr
+endif

 force:
============================================================
--- gnatlib/aclocal.m4	f1f77d5cf57d44c3489816f2a8ab100892f4803e
+++ gnatlib/aclocal.m4	b6e617700678d224a6b06ef3703b2cc09d452e0c
@@ -265,6 +265,9 @@ AC_HELP_STRING(
                   ;;
              esac
              ;;
+          *-darwin* )
+             PYTHON_LIBS="-ldl -lm ${PYTHON_LIBS}"
+             ;;
           x86_64-*-* )
              PYTHON_LIBS="-Wl,-export-dynamic -lm -ldl ${PYTHON_LIBS}"
              ;;
@@ -273,15 +276,17 @@ AC_HELP_STRING(
              ;;
           i[[3456]]86-*win32* | i[[3456]]86-*mingw32* | i[[3456]]86-*cygwin* )
              ;;
-          *-darwin* )
-             PYTHON_LIBS="-ldl -lm ${PYTHON_LIBS}"
-             ;;
           *-freebsd* )
              PYTHON_LIBS="-lm -lutil ${PYTHON_LIBS}"
              ;;
       esac

-      PYTHON_LIBS="-L${PYTHON_DIR} -lpython${PYTHON_VERSION} ${PYTHON_LIBS}"
+      if [ -f ${PYTHON_DIR}/libpython${PYTHON_VERSION}.a ]; then
+         PYTHON_LIBS="${PYTHON_DIR}/libpython${PYTHON_VERSION}.a ${PYTHON_LIBS}"
+      else
+         PYTHON_LIBS="-L${PYTHON_DIR} -lpython${PYTHON_VERSION} ${PYTHON_LIBS}"
+      fi
+
       if test x$PYTHON_WIN32 == xyes; then
          PYTHON_CFLAGS="-I${PYTHON_BASE}/include"
       else
============================================================
--- gnatlib/configure	3e1e88ef5118a27a04b9888e5e0703ad196b4672
+++ gnatlib/configure	dac8c5731f6966303847c3339bd66cb73032eca3
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.57 for gnatcoll 1.1w.
+# Generated by GNU Autoconf 2.57 for gnatcoll 1.2w.
 #
 # Report bugs to <report@adacore.com>.
 #
@@ -268,8 +268,8 @@ PACKAGE_TARNAME='gnatcoll'
 # Identity of this package.
 PACKAGE_NAME='gnatcoll'
 PACKAGE_TARNAME='gnatcoll'
-PACKAGE_VERSION='1.1w'
-PACKAGE_STRING='gnatcoll 1.1w'
+PACKAGE_VERSION='1.2w'
+PACKAGE_STRING='gnatcoll 1.2w'
 PACKAGE_BUGREPORT='report@adacore.com'

 # Factoring default headers for most tests.
@@ -778,7 +778,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures gnatcoll 1.1w to adapt to many kinds of systems.
+\`configure' configures gnatcoll 1.2w to adapt to many kinds of systems.

 Usage: $0 [OPTION]... [VAR=VALUE]...

@@ -840,7 +840,7 @@ if test -n "$ac_init_help"; then

 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of gnatcoll 1.1w:";;
+     short | recursive ) echo "Configuration of gnatcoll 1.2w:";;
    esac
   cat <<\_ACEOF

@@ -939,7 +939,7 @@ if $ac_init_version; then
 test -n "$ac_init_help" && exit 0
 if $ac_init_version; then
   cat <<\_ACEOF
-gnatcoll configure 1.1w
+gnatcoll configure 1.2w
 generated by GNU Autoconf 2.57

 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
@@ -954,7 +954,7 @@ running configure, to aid debugging if c
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.

-It was created by gnatcoll $as_me 1.1w, which was
+It was created by gnatcoll $as_me 1.2w, which was
 generated by GNU Autoconf 2.57.  Invocation command line was

   $ $0 $@
@@ -3477,6 +3477,9 @@ echo "${ECHO_T}yes (version $PYTHON_MAJO
                   ;;
              esac
              ;;
+          *-darwin* )
+             PYTHON_LIBS="-ldl -lm ${PYTHON_LIBS}"
+             ;;
           x86_64-*-* )
              PYTHON_LIBS="-Wl,-export-dynamic -lm -ldl ${PYTHON_LIBS}"
              ;;
@@ -3485,15 +3488,17 @@ echo "${ECHO_T}yes (version $PYTHON_MAJO
              ;;
           i[3456]86-*win32* | i[3456]86-*mingw32* | i[3456]86-*cygwin* )
              ;;
-          *-darwin* )
-             PYTHON_LIBS="-ldl -lm ${PYTHON_LIBS}"
-             ;;
           *-freebsd* )
              PYTHON_LIBS="-lm -lutil ${PYTHON_LIBS}"
              ;;
       esac

-      PYTHON_LIBS="-L${PYTHON_DIR} -lpython${PYTHON_VERSION} ${PYTHON_LIBS}"
+      if [ -f ${PYTHON_DIR}/libpython${PYTHON_VERSION}.a ]; then
+         PYTHON_LIBS="${PYTHON_DIR}/libpython${PYTHON_VERSION}.a ${PYTHON_LIBS}"
+      else
+         PYTHON_LIBS="-L${PYTHON_DIR} -lpython${PYTHON_VERSION} ${PYTHON_LIBS}"
+      fi
+
       if test x$PYTHON_WIN32 == xyes; then
          PYTHON_CFLAGS="-I${PYTHON_BASE}/include"
       else
@@ -4459,7 +4464,7 @@ cat >&5 <<_CSEOF
 } >&5
 cat >&5 <<_CSEOF

-This file was extended by gnatcoll $as_me 1.1w, which was
+This file was extended by gnatcoll $as_me 1.2w, which was
 generated by GNU Autoconf 2.57.  Invocation command line was

   CONFIG_FILES    = $CONFIG_FILES
@@ -4514,7 +4519,7 @@ ac_cs_version="\\

 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-gnatcoll config.status 1.1w
+gnatcoll config.status 1.2w
 configured by $0, generated by GNU Autoconf 2.57,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"

============================================================
--- gnatlib/configure.in	5c3af66a46ccd36b3212e47e1f6b04d60b7abcf8
+++ gnatlib/configure.in	7db1db42473e84c6c4d85748a30e7a97647e3d18
@@ -1,5 +1,5 @@
 # Set the version number below
-AC_INIT(gnatcoll,1.1w,report@adacore.com,gnatcoll)
+AC_INIT(gnatcoll,1.2w,report@adacore.com,gnatcoll)
 AC_CANONICAL_SYSTEM

 AC_PROG_LN_S
============================================================
--- gnatlib/src/gnatcoll-filesystem-unix-remote.adb	0856b41d83c956412fe3737a70d7e5e2d656e0ab
+++ gnatlib/src/gnatcoll-filesystem-unix-remote.adb	a5e52d2ba799b9a1363fd2b280345bfd43d21798
@@ -64,7 +64,7 @@ package body GNATCOLL.Filesystem.Unix.Re
    -- Home_Dir --
    --------------

-   function Home_Dir (FS   : Remote_Unix_Filesystem_Record) return String is
+   function Home_Dir (FS : Remote_Unix_Filesystem_Record) return String is
       Args : GNAT.OS_Lib.Argument_List :=
                (new String'("echo"),
                 new String'("$HOME"));
============================================================
--- gnatlib/src/gnatcoll-filesystem.adb	1eb7e242da4881b462875b4aed5933ec818b347b
+++ gnatlib/src/gnatcoll-filesystem.adb	bb459f22f09330beba8528c5a953463e0e0ae215
@@ -19,14 +19,16 @@ with Ada.Unchecked_Deallocation;

 with Ada.Directories;           use Ada.Directories;
 with Ada.Unchecked_Deallocation;
+with Interfaces.C.Strings;      use Interfaces.C, Interfaces.C.Strings;
+
+with GNAT.Calendar;
+with GNAT.Directory_Operations; use GNAT.Directory_Operations;
+with GNAT.OS_Lib;               use GNAT.OS_Lib;
+
 with GNATCOLL.Filesystem.Windows;
 with GNATCOLL.Filesystem.Unix;
 with GNATCOLL.Mmap;             use GNATCOLL.Mmap;
 with GNATCOLL.Utils;            use GNATCOLL.Utils;
-with GNAT.Calendar;
-with GNAT.Directory_Operations; use GNAT.Directory_Operations;
-with GNAT.OS_Lib;               use GNAT.OS_Lib;
-with Interfaces.C.Strings;      use Interfaces.C, Interfaces.C.Strings;

 package body GNATCOLL.Filesystem is

@@ -239,21 +241,22 @@ package body GNATCOLL.Filesystem is
             if J < Path'Last - 3
               and then Path (J .. J + 3) = Dir_Separator & ".." & Dir_Separator
             then
-               return Normalize (FS, Path (Path'First .. Last_Dir) &
-                                     Path (J + 4 .. Path'Last));
+               return Normalize
+                 (FS,
+                  Path (Path'First .. Last_Dir) & Path (J + 4 .. Path'Last));

             elsif J < Path'Last - 2
               and then Path (J .. J + 2) = Dir_Separator & '.' & Dir_Separator
             then
-               return Normalize (FS, Path (Path'First .. J) &
-                                     Path (J + 3 .. Path'Last));
+               return Normalize
+                 (FS, Path (Path'First .. J) & Path (J + 3 .. Path'Last));
             end if;

             Last_Dir := J;
          end if;
       end loop;

-      return Path;
+      return Normalize_Pathname (Path, Case_Sensitive => False);
    end Normalize;

    --------------
@@ -689,7 +692,8 @@ package body GNATCOLL.Filesystem is

       C_Str : chars_ptr := Internal;
       Str   : constant String :=
-        GNAT.Directory_Operations.Format_Pathname (To_Ada (Value (C_Str)));
+                GNAT.Directory_Operations.Format_Pathname
+                  (To_Ada (Value (C_Str)));
    begin
       Free (C_Str);
       return Ensure_Directory (Filesystem_Record'Class (FS), Str);
============================================================
--- gnatlib/src/gnatcoll-filesystem.ads	2728926b836e9502ad5e3e642b3d2554730da8d2
+++ gnatlib/src/gnatcoll-filesystem.ads	e2b0258cd89436015a75866a23d2bb268903c422
@@ -34,6 +34,7 @@ package GNATCOLL.Filesystem is
    type Filesystem_Access is access all Filesystem_Record'Class;

    function Get_Local_Filesystem return Filesystem_Access;
+   pragma Inline (Get_Local_Filesystem);
    --  Return an instance of the local filesystem running on the current host.
    --  This notion is slightly ambiguous when one involves NFS mounts (for
    --  instance a Unix machine might be mounting a windows filesystem), but
@@ -321,14 +322,14 @@ package GNATCOLL.Filesystem is
      (FS             : Filesystem_Record;
       Local_Dir_Name : String;
       Dirs_Only      : Boolean := False;
-      Files_Only     : Boolean := False)
-      return GNAT.Strings.String_List;
+      Files_Only     : Boolean := False) return GNAT.Strings.String_List;
    --  Read the specified directory and returns a list of filenames
    --  (base names). If Dirs_Only is set, then the files returned are directory
    --  only. Same for Files_Only, concerning regular files.
    --  This does not return the two special directories "." and ".."

 private
+
    type Filesystem_Record is abstract tagged record
       Locale_To_Display_Encoder : Encoder_Function;
    end record;
============================================================
--- gnatlib/src/gnatcoll-mmap__win32.adb	3a74855254cd415eb78415cb6d00e4c5bca5e85b
+++ gnatlib/src/gnatcoll-mmap__win32.adb	bf8c9a98e72d439bff06464f1cd84cd2d7bcfa67
@@ -35,6 +35,9 @@ package body GNATCOLL.Mmap is
    procedure To_Disk (File : in out Mapped_File);
    --  Write the file back to disk if necessary, and free memory

+   function From_Utf8 (Filename : in String) return String;
+   --  Convert an UTF-8 filename to a Win32 native UTF-16
+
    --  The Win package contains copy of definition found in recent System.Win32
    --  unit provided with the GNAT compiler. The copy is needed to be able to
    --  compile this unit with older compilers. Note that this internal Win
@@ -61,6 +64,8 @@ package body GNATCOLL.Mmap is
       GENERIC_WRITE : constant := 16#40000000#;
       OPEN_EXISTING : constant := 3;

+      CP_UTF8       : constant := 65001;
+
       type OVERLAPPED is record
          Internal     : DWORD;
          InternalHigh : DWORD;
@@ -107,7 +112,7 @@ package body GNATCOLL.Mmap is
          dwCreationDisposition : DWORD;
          dwFlagsAndAttributes  : DWORD;
          hTemplateFile         : HANDLE) return HANDLE;
-      pragma Import (Stdcall, CreateFile, "CreateFileA");
+      pragma Import (Stdcall, CreateFile, "CreateFileW");

       function WriteFile
         (hFile                  : HANDLE;
@@ -129,39 +134,48 @@ package body GNATCOLL.Mmap is
       pragma Import (Stdcall, CloseHandle, "CloseHandle");

       function GetFileSize
-        (HFile : HANDLE; LpFileSizeHigh : access DWORD) return DWORD;
+        (hFile : HANDLE; lpFileSizeHigh : access DWORD) return DWORD;
       pragma Import (Stdcall, GetFileSize, "GetFileSize");

       function SetFilePointer
-        (HFile                : HANDLE;
-         LDistanceToMove      : LONG;
-         LpDistanceToMoveHigh : access LONG;
-         DwMoveMethod         : DWORD) return DWORD;
+        (hFile                : HANDLE;
+         lDistanceToMove      : LONG;
+         lpDistanceToMoveHigh : access LONG;
+         dwMoveMethod         : DWORD) return DWORD;
       pragma Import (Stdcall, SetFilePointer, "SetFilePointer");

       function CreateFileMapping
-        (HFile                : HANDLE;
-         LpSecurityAttributes : access SECURITY_ATTRIBUTES;
-         FlProtect            : DWORD;
-         DwMaximumSizeHigh    : DWORD;
-         DwMaximumSizeLow     : DWORD;
-         LpName               : System.Address) return HANDLE;
-      pragma Import (Stdcall, CreateFileMapping, "CreateFileMappingA");
+        (hFile                : HANDLE;
+         lpSecurityAttributes : access SECURITY_ATTRIBUTES;
+         flProtect            : DWORD;
+         dwMaximumSizeHigh    : DWORD;
+         dwMaximumSizeLow     : DWORD;
+         lpName               : System.Address) return HANDLE;
+      pragma Import (Stdcall, CreateFileMapping, "CreateFileMappingW");

       function MapViewOfFile
-        (HFileMappingObject   : HANDLE;
-         DwDesiredAccess      : DWORD;
-         DwFileOffsetHigh     : DWORD;
-         DwFileOffsetLow      : DWORD;
-         DwNumberOfBytesToMap : SIZE_T) return System.Address;
+        (hFileMappingObject   : HANDLE;
+         dwDesiredAccess      : DWORD;
+         dwFileOffsetHigh     : DWORD;
+         dwFileOffsetLow      : DWORD;
+         dwNumberOfBytesToMap : SIZE_T) return System.Address;
       pragma Import (Stdcall, MapViewOfFile, "MapViewOfFile");

-      function UnmapViewOfFile (LpBaseAddress : System.Address) return BOOL;
+      function UnmapViewOfFile (lpBaseAddress : System.Address) return BOOL;
       pragma Import (Stdcall, UnmapViewOfFile, "UnmapViewOfFile");

-      procedure GetSystemInfo (LpSystemInfo : LP_SYSTEM_INFO);
+      procedure GetSystemInfo (lpSystemInfo : LP_SYSTEM_INFO);
       pragma Import (Stdcall, GetSystemInfo, "GetSystemInfo");

+      function MultiByteToWideChar
+        (CodePage       : WORD;
+         dwFlags        : DWORD;
+         lpMultiByteStr : System.Address;
+         cchMultiByte   : WORD;
+         lpWideCharStr  : System.Address;
+         cchWideChar    : WORD) return BOOL;
+      pragma Import (Stdcall, MultiByteToWideChar, "MultiByteToWideChar");
+
    end Win;

    use Win;
@@ -171,6 +185,22 @@ package body GNATCOLL.Mmap is
    function To_Address is
      new Ada.Unchecked_Conversion (HANDLE, System.Address);

+   ---------------
+   -- From_Utf8 --
+   ---------------
+
+   function From_Utf8 (Filename : in String) return String is
+      C_Filename : constant String := Filename & ASCII.Nul;
+      W_Filename : String (1 .. C_Filename'Length * 2);
+      Res        : Win.BOOL;
+      pragma Unreferenced (Res);
+   begin
+      Res := Win.MultiByteToWideChar
+        (Win.CP_UTF8, 0,
+         C_Filename'Address, -1, W_Filename'Address, C_Filename'Length);
+      return W_Filename;
+   end From_Utf8;
+
    -------------------
    -- Get_Page_Size --
    -------------------
@@ -253,10 +283,10 @@ package body GNATCOLL.Mmap is
      (Filename              : String;
       Use_Mmap_If_Available : Boolean := True) return Mapped_File
    is
-      C_File : constant String := Filename & ASCII.NUL;
+      W_File : constant String := From_Utf8 (Filename);
       H      : constant HANDLE :=
                  CreateFile
-                   (C_File'Address, GENERIC_READ, Win.FILE_SHARE_READ,
+                   (W_File'Address, GENERIC_READ, Win.FILE_SHARE_READ,
                     null, OPEN_EXISTING, Win.FILE_ATTRIBUTE_NORMAL, 0);
       SizeH  : aliased DWORD;
       Size   : File_Size;
@@ -298,10 +328,10 @@ package body GNATCOLL.Mmap is
      (Filename              : String;
       Use_Mmap_If_Available : Boolean := True) return Mapped_File
    is
-      C_File : constant String := Filename & ASCII.NUL;
+      W_File : constant String := From_Utf8 (Filename);
       H      : constant HANDLE :=
                  CreateFile
-                   (C_File'Address, GENERIC_READ + GENERIC_WRITE, 0,
+                   (W_File'Address, GENERIC_READ + GENERIC_WRITE, 0,
                     null, OPEN_EXISTING, Win.FILE_ATTRIBUTE_NORMAL, 0);
       SizeH  : aliased DWORD;
       Size   : File_Size;
============================================================
--- gnatlib/src/gnatcoll-scripts-impl.adb	057c95387f2dc691e90f9399b7559792520efb7c
+++ gnatlib/src/gnatcoll-scripts-impl.adb	5da1991bc1de8321d2eee377cd214e7e2658a8b5
@@ -125,16 +125,41 @@ package body GNATCOLL.Scripts.Impl is
    procedure Console_Command_Handler
      (Data : in out Callback_Data'Class; Command : String)
    is
+      type Mode_Kinds is (Text, Log, Error);
+
       Text_Cst : aliased constant String := "text";
       Size_Cst : aliased constant String := "size";
+      Mode_Cst : aliased constant String := "mode";
       Inst     : constant Class_Instance := Nth_Arg (Data, 1, Any_Class);
       Console  : Virtual_Console;
+      Mode     : Mode_Kinds := Text;
    begin
       if Command = "write" then
-         Name_Parameters (Data, (1 => Text_Cst'Unchecked_Access));
+         Name_Parameters (Data, (1 => Text_Cst'Unchecked_Access,
+                                 2 => Mode_Cst'Unchecked_Access));
+
+         if Number_Of_Arguments (Data) = 3 then
+            begin
+               Mode := Mode_Kinds'Value (Nth_Arg (Data, 3));
+            exception
+               when Constraint_Error =>
+                  Set_Error_Msg (Data, "Wrong value for ""mode"" parameter");
+                  return;
+            end;
+         end if;
+
          Console := Get_Data (Inst);
          if Console /= null then
-            Insert_Text (Console, Nth_Arg (Data, 2));
+            case Mode is
+               when Text =>
+                  Insert_Text (Console, Nth_Arg (Data, 2));
+
+               when Log =>
+                  Insert_Log (Console, Nth_Arg (Data, 2));
+
+               when Error =>
+                  Insert_Error (Console, Nth_Arg (Data, 2));
+            end case;
          else
             Set_Error_Msg (Data, "Console was closed by user");
          end if;
@@ -190,7 +215,7 @@ package body GNATCOLL.Scripts.Impl is
       Register_Command
         (Repo, "write",
          Minimum_Args => 1,
-         Maximum_Args => 1,
+         Maximum_Args => 2,
          Class        => Class,
          Handler      => Console_Command_Handler'Access);
       Register_Command
============================================================
--- gnatlib/src/gnatcoll-sql.adb	18f1fdb9f83344e991964a7d3cfc9ecba3b85d74
+++ gnatlib/src/gnatcoll-sql.adb	df15c50675965259357b549e26fdc9d051cc6c75
@@ -2048,6 +2048,17 @@ package body GNATCOLL.SQL is
       return Result;
    end SQL_In;

+   function SQL_In
+     (Self : SQL_Field'Class; List : String) return SQL_Criteria
+   is
+      Result : SQL_Criteria;
+   begin
+      Result.Criteria.Data      := new SQL_Criteria_Data (Criteria_In);
+      Result.Criteria.Data.Arg  := +Self;
+      Result.Criteria.Data.In_String := To_Unbounded_String (List);
+      return Result;
+   end SQL_In;
+
    ----------------
    -- SQL_Not_In --
    ----------------
@@ -2181,31 +2192,6 @@ package body GNATCOLL.SQL is
          return Data.Value.all = "TRUE";
       end Is_True2;

---        function Any1 return SQL_Field_Internal_Access;
---        function Named1 return Named_Field_Internal_Access;
---        function Any2 return SQL_Field_Internal_Access;
---        function Named2 return Named_Field_Internal_Access;
---
---        function Any1 return SQL_Field_Internal_Access is
---        begin
---           return Self.Criteria.Data.Arg1.Data.Field.Data;
---        end Any1;
---
---        function Named1 return Named_Field_Internal_Access is
---        begin
---           return Named_Field_Internal_Access (Any1);
---        end Named1;
---
---        function Any2 return SQL_Field_Internal_Access is
---        begin
---           return Self.Criteria.Data.Arg2.Data.Field.Data;
---        end Any2;
---
---        function Named2 return Named_Field_Internal_Access is
---        begin
---           return Named_Field_Internal_Access (Any2);
---        end Named2;
-
       Result : Unbounded_String;
       C      : Criteria_List.Cursor;
       C2     : Field_List.Cursor;
@@ -2301,7 +2287,7 @@ package body GNATCOLL.SQL is
                end loop;

                Append (Result, To_String (Self.Criteria.Data.Subquery));
-
+               Append (Result, To_String (Self.Criteria.Data.In_String));
                Append (Result, ")");

             when Null_Criteria =>
============================================================
--- gnatlib/src/gnatcoll-sql.ads	51eebc66d3f2b83d090a2c8a2be314b2d7bc283b
+++ gnatlib/src/gnatcoll-sql.ads	0ccbb7725e55e9ba254145c7fe321b6a1a093b9a
@@ -558,6 +558,8 @@ package GNATCOLL.SQL is
    function SQL_In
      (Self : SQL_Field'Class; List : SQL_Field_List) return SQL_Criteria;
    function SQL_In
+     (Self : SQL_Field'Class; List : String) return SQL_Criteria;
+   function SQL_In
      (Self : SQL_Field'Class; Subquery : SQL_Query) return SQL_Criteria;
    function SQL_Not_In
      (Self : SQL_Field'Class; List : SQL_Field_List) return SQL_Criteria;
@@ -1177,9 +1179,10 @@ private
             Criterias : Criteria_List.List;

          when Criteria_In | Criteria_Not_In =>
-            Arg      : SQL_Field_Pointer;
-            List     : SQL_Field_List;
-            Subquery : SQL_Query;
+            Arg       : SQL_Field_Pointer;
+            List      : SQL_Field_List;
+            Subquery  : SQL_Query;
+            In_String : Ada.Strings.Unbounded.Unbounded_String;

          when Null_Criteria =>
             Arg3 : SQL_Field_Pointer;
============================================================
--- gnatlib/src/gnatcoll-vfs.adb	006f5f7a26828ab62762c716bad997901edd1ad3
+++ gnatlib/src/gnatcoll-vfs.adb	68f3f6136e156d316ead5495a786b218d0616a50
@@ -22,10 +22,12 @@ with Ada.Characters.Handling;
 with Ada.Unchecked_Deallocation;
 with Ada.Strings.Hash;
 with Ada.Characters.Handling;
+
 with GNAT.Case_Util;            use GNAT.Case_Util;
 with GNAT.Directory_Operations; use GNAT.Directory_Operations;
 with GNAT.Heap_Sort;            use GNAT.Heap_Sort;
 with GNAT.OS_Lib;               use GNAT.OS_Lib;
+
 with GNATCOLL.Filesystem;       use GNATCOLL.Filesystem;
 with GNATCOLL.Utils;            use GNATCOLL.Utils;

============================================================
--- gnatlib/src/gnatcoll-vfs.ads	7b3f0c3901e6d1353293428d9609ae81ec44ea0c
+++ gnatlib/src/gnatcoll-vfs.ads	1e0514efe2d049e4a268822c63ca0ab58fba5325
@@ -256,13 +256,13 @@ package GNATCOLL.VFS is
    --  needed.

    function Get_Root (File : Virtual_File) return Virtual_File;
-   --  returns root directory of the file
+   --  Return root directory of the file

    function Get_Parent (Dir : Virtual_File) return Virtual_File;
-   --  return the parent directory if it exists, else No_File is returned
+   --  Return the parent directory if it exists, else No_File is returned

    function Sub_Dir (Dir : Virtual_File; Name : String) return Virtual_File;
-   --  returns sub directory Name if it exists, else No_File is returned
+   --  Return sub directory Name if it exists, else No_File is returned

    procedure Change_Dir (Dir : Virtual_File);
    --  Changes working directory. Raises Directory_Error if Dir_Name does not
============================================================
--- gps/src/gps-callbacks.adb	b45c969d7f17f159353ab2031da9ed13b65dc011
+++ gps/src/gps-callbacks.adb	3b02331665e4a5c51aad9998da58c02b744a774a
@@ -26,6 +26,7 @@ with GPS.Kernel.Preferences;    use GPS.

 with GPS.Kernel.Hooks;          use GPS.Kernel.Hooks;
 with GPS.Kernel.Preferences;    use GPS.Kernel.Preferences;
+with GPS.Kernel.Standard_Hooks; use GPS.Kernel.Standard_Hooks;
 with Traces;                    use Traces;

 package body GPS.Callbacks is
@@ -33,8 +34,6 @@ package body GPS.Callbacks is
    Me        : constant Debug_Handle := Create ("GPS");
    Gtk_Trace : constant Debug_Handle := Create ("Gtk+");

-   GPS_Started_Hook : constant Hook_Name := "gps_started";
-
    -------------
    -- Gtk_Log --
    -------------
============================================================
--- gps/src/gps-main.adb	f427eccd467c5fed86ebc31c5e687654f2f8209d
+++ gps/src/gps-main.adb	b3b788653e6ad03ae412f361374978eba6b5b0cb
@@ -19,6 +19,7 @@ with Ada.Text_IO;               use Ada.

 with Ada.Strings.Fixed;         use Ada.Strings.Fixed;
 with Ada.Text_IO;               use Ada.Text_IO;
+
 with GNAT.Command_Line;         use GNAT.Command_Line;
 with GNAT.Directory_Operations; use GNAT, GNAT.Directory_Operations;
 pragma Warnings (Off);
@@ -31,13 +32,15 @@ with GNATCOLL.VFS;              use GNAT
 with GNATCOLL.Filesystem;       use GNATCOLL.Filesystem;
 with GNATCOLL.Traces;
 with GNATCOLL.VFS;              use GNATCOLL.VFS;
-with Gdk.Pixbuf;                use Gdk.Pixbuf;

+with Glib.Convert;              use Glib.Convert;
 with Glib.Error;                use Glib.Error;
 with Glib.Messages;             use Glib.Messages;
 with Glib.Object;               use Glib.Object;
 with Glib.Properties;           use Glib.Properties;

+with Gdk.Pixbuf;                use Gdk.Pixbuf;
+
 with Gtk;                       use Gtk;
 with Gtk.Enums;                 use Gtk.Enums;
 with Gtk.Handlers;              use Gtk.Handlers;
@@ -45,17 +48,17 @@ with Gtk.Window;                use Gtk.
 with Gtk.Main;                  use Gtk.Main;
 with Gtk.Rc;
 with Gtk.Window;                use Gtk.Window;
+with Gtk_Utils;                 use Gtk_Utils;

-with Gtk_Utils;                 use Gtk_Utils;
 with Gtkada.Dialogs;            use Gtkada.Dialogs;
 with Gtkada.Intl;
-with GPS.Intl;                  use GPS.Intl;
 with Gtkada.MDI;                use Gtkada.MDI;

 with Config;                    use Config;
 with DDE;
 with File_Utils;
 with GPS.Callbacks;             use GPS.Callbacks;
+with GPS.Intl;                  use GPS.Intl;
 with GPS.Kernel;                use GPS.Kernel;
 with GPS.Kernel.Clipboard;      use GPS.Kernel.Clipboard;
 with GPS.Kernel.Console;        use GPS.Kernel.Console;
@@ -171,6 +174,8 @@ procedure GPS.Main is
                         Create ("MODULE.External_Editor", GNATCOLL.Traces.On);
    VCS_Trace              : constant Debug_Handle :=
                         Create ("MODULE.VCS", GNATCOLL.Traces.On);
+   ClearCase_Trace        : constant Debug_Handle :=
+                        Create ("MODULE.ClearCase", GNATCOLL.Traces.On);
    Custom_Trace           : constant Debug_Handle :=
                         Create ("MODULE.Custom", GNATCOLL.Traces.On);
    Action_Editor_Trace    : constant Debug_Handle :=
@@ -210,8 +215,6 @@ procedure GPS.Main is
    Toolchains_Trace       : constant Debug_Handle :=
                       Create ("MODULE.Toolchains", GNATCOLL.Traces.On);

-   GPS_Started_Hook       : constant Hook_Name := "gps_started";
-
    --  If any of these debug handles is active, the correponding module
    --  is loaded.

@@ -334,6 +337,33 @@ procedure GPS.Main is
    -------------------

    procedure Init_Settings is
+
+      function Get_Env (Name : String) return String_Access;
+      --  Returns the environment variable named Name. On Windows make sure
+      --  that the variable content is converted to Utf8. This is needed for
+      --  all variables used to build pathnames.
+
+      -------------
+      -- Get_Env --
+      -------------
+
+      function Get_Env (Name : String) return String_Access is
+         Tmp : String_Access := Getenv (Name);
+      begin
+         if Tmp.all /= "" then
+            declare
+               U_Tmp : constant String_Access :=
+                         new String'(Locale_To_UTF8 (Tmp.all));
+            begin
+               Free (Tmp);
+               return U_Tmp;
+            end;
+
+         else
+            return Tmp;
+         end if;
+      end Get_Env;
+
       Dir_Created : Boolean := False;
       File        : File_Type;
       Charset     : String_Access;
@@ -365,19 +395,30 @@ procedure GPS.Main is
          Free (Tmp);

          Tmp := Getenv ("GPS_STARTUP_LD_LIBRARY_PATH");
-         Setenv ("LD_LIBRARY_PATH", Tmp.all);
+         if Tmp.all /= "" then
+            Setenv ("LD_LIBRARY_PATH", Tmp.all);
+         end if;
       end if;

       Free (Tmp);

+      --  Under Darwin, GPS_STARTUP_DYLD_LIBRARY_PATH might be set when GPS
+      --  is launched through the startup script. In this case it contains the
+      --  value that should be set as DYLD_LIBRARY_PATH.
+      Tmp := Getenv ("GPS_STARTUP_DYLD_LIBRARY_PATH");
+      if Tmp.all /= "" then
+         Setenv ("DYLD_LIBRARY_PATH", Tmp.all);
+      end if;
+      Free (Tmp);
+
       Charset := Getenv ("CHARSET");

       if Charset.all = "" then
          --  Gtk+ does not like if CHARSET is not defined.
          --  Need to set CHARSET *before* calling Gtk.Main.Init, so cannot
-         --  use Get_Pref here
+         --  use Get_Pref here.

-         Setenv ("CHARSET", "ISO-8859-1");
+         Setenv ("CHARSET", Config.Default_Charset);
       end if;

       Free (Charset);
@@ -388,16 +429,16 @@ procedure GPS.Main is

       Setenv ("TERM", "dumb");

-      Home := Getenv ("GPS_HOME");
+      Home := Get_Env ("GPS_HOME");

       if Home.all = "" then
          Free (Home);
-         Home := Getenv ("HOME");
+         Home := Get_Env ("HOME");
       end if;

       if Home.all = "" then
          Free (Home);
-         Home := Getenv ("USERPROFILE");
+         Home := Get_Env ("USERPROFILE");
       end if;

       if Home'Length > 2
@@ -408,7 +449,7 @@ procedure GPS.Main is
          --  %USERPROFILE%

          Tmp := Home;
-         Home := Getenv (Tmp (Tmp'First + 1 .. Tmp'Last - 1));
+         Home := Get_Env (Tmp (Tmp'First + 1 .. Tmp'Last - 1));
          Free (Tmp);
       end if;

@@ -521,8 +562,7 @@ procedure GPS.Main is

             Create
               (File,
-               Name => File_Utils.Name_As_Directory (Dir.all)
-                 & "traces.cfg");
+               Name => File_Utils.Name_As_Directory (Dir.all) & "traces.cfg");
             Put_Line (File, ">log.$$");
             Put_Line (File, "+");
             Put_Line (File, "DEBUG.COLORS=no");
@@ -1157,6 +1197,7 @@ procedure GPS.Main is
                            Mode => Error);
                         Line := 1;
                   end;
+
                else
                   Open_File_Editor
                     (GPS_Main.Kernel,
@@ -1352,6 +1393,9 @@ procedure GPS.Main is

       if Active (VCS_Trace) then
          VCS_Module.Register_Module (GPS_Main.Kernel);
+      end if;
+
+      if Active (ClearCase_Trace) then
          VCS.ClearCase.Register_Module (GPS_Main.Kernel);
       end if;

@@ -1643,6 +1687,11 @@ procedure GPS.Main is
       Cleanup_Needed := False;
       Exiting := True;

+      --  We want to close the debuggers first, to avoid saving debugger
+      --  consoles in the desktop.
+
+      GVD_Module.Debug_Terminate (Kernel);
+
       if Started and then Save_Desktop_On_Exit.Get_Pref then
          Save_Desktop (Kernel);
       end if;
============================================================
--- gps/src/gps-menu.adb	3f59d11f03d442f68271913c2d762e628315511a
+++ gps/src/gps-menu.adb	4643f7917d9ab126cfbe77f8ebf648d9a1097577
@@ -116,7 +116,7 @@ package body GPS.Menu is
      (Widget : access GObject_Record'Class; Kernel : Kernel_Handle)
    is
       pragma Unreferenced (Widget);
-      Dir    : Virtual_File;
+      Dir : Virtual_File;

    begin
       Dir := Select_Directory
@@ -190,8 +190,7 @@ package body GPS.Menu is

    overriding function Execute
      (Command : access Clipboard_Command;
-      Context : Interactive_Command_Context)
-      return Command_Return_Type
+      Context : Interactive_Command_Context) return Command_Return_Type
    is
       pragma Unreferenced (Context);
       W : constant Gtk_Widget := Get_Current_Focus_Widget (Command.Kernel);
@@ -205,6 +204,7 @@ package body GPS.Menu is
             when Paste_Previous => Paste_Previous_Clipboard (Clipboard, W);
          end case;
          return Commands.Success;
+
       else
          return Commands.Failure;
       end if;
@@ -291,14 +291,14 @@ package body GPS.Menu is
    begin
       declare
          Filename : constant Virtual_File :=
-           Select_File
-             (-"Open Project",
-              File_Pattern      => "*.gpr",
-              Pattern_Name      => -"Project files",
-              Parent            => Get_Current_Window (Kernel),
-              Use_Native_Dialog => Use_Native_Dialogs.Get_Pref,
-              Kind              => Open_File,
-              History           => Get_History (Kernel));
+                      Select_File
+                        (-"Open Project",
+                         File_Pattern      => "*.gpr",
+                         Pattern_Name      => -"Project files",
+                         Parent            => Get_Current_Window (Kernel),
+                         Use_Native_Dialog => Use_Native_Dialogs.Get_Pref,
+                         Kind              => Open_File,
+                         History           => Get_History (Kernel));
       begin
          if Filename /= GNATCOLL.VFS.No_File then
             Load_Project (Kernel, Filename);
@@ -321,14 +321,14 @@ package body GPS.Menu is
    begin
       declare
          Filename : constant Virtual_File :=
-           Select_File
-             (-"Open Project",
-              File_Pattern      => "*.gpr",
-              Pattern_Name      => -"Project files",
-              Parent            => Get_Current_Window (Kernel),
-              Remote_Browsing   => True,
-              Kind              => Open_File,
-              History           => Get_History (Kernel));
+                      Select_File
+                        (-"Open Project",
+                         File_Pattern    => "*.gpr",
+                         Pattern_Name    => -"Project files",
+                         Parent          => Get_Current_Window (Kernel),
+                         Remote_Browsing => True,
+                         Kind            => Open_File,
+                         History         => Get_History (Kernel));
       begin
          if Filename /= GNATCOLL.VFS.No_File then
             Load_Project (Kernel, Filename);
============================================================
--- gvd/gvd/advanced_breakpoint_pkg.adb	789e6662646370d030bf7ff5e39a4f4f1249ab2b
+++ gvd/gvd/advanced_breakpoint_pkg.adb	e8f3f52d2ec1909938b6efe0b20a70235f3634d6
@@ -1,8 +1,7 @@
 -----------------------------------------------------------------------
 --                              G P S                                --
 --                                                                   --
---                     Copyright (C) 2000-2007                       --
---                             AdaCore                               --
+--                     Copyright (C) 2000-2008, AdaCore              --
 --                                                                   --
 -- GPS is free  software;  you can redistribute it and/or modify  it --
 -- under the terms of the GNU General Public License as published by --
@@ -128,7 +127,7 @@ package body Advanced_Breakpoint_Pkg is
       Pack_Start (Advanced_Breakpoint.Vbox33,
                   Advanced_Breakpoint.Label105, False, False, 0);

-      Gtk_New (Ignore_Count_Combo_Adj, 0.0, 0.0, 10000.0, 1.0, 10.0, 10.0);
+      Gtk_New (Ignore_Count_Combo_Adj, 0.0, 0.0, 10000.0, 1.0, 10.0);
       Gtk_New (Advanced_Breakpoint.Ignore_Count_Combo,
                Ignore_Count_Combo_Adj, 1.0, 0);
       Set_Numeric (Advanced_Breakpoint.Ignore_Count_Combo, False);
============================================================
--- gvd/gvd/breakpoints_pkg.adb	3af52a5e470400c0e2dbe4d6184c84e403149fd9
+++ gvd/gvd/breakpoints_pkg.adb	e4eeb4730d048e8f42911a9de4404ab55bf47fd2
@@ -1,8 +1,7 @@
 -----------------------------------------------------------------------
 --                              G P S                                --
 --                                                                   --
---                     Copyright (C) 2000-2007                       --
---                             AdaCore                               --
+--                     Copyright (C) 2000-2008, AdaCore              --
 --                                                                   --
 -- GPS is free  software;  you can redistribute it and/or modify  it --
 -- under the terms of the GNU General Public License as published by --
@@ -148,7 +147,7 @@ package body Breakpoints_Pkg is
       Set_Line_Wrap (Breakpoints.Label62, False);
       Pack_Start (Breakpoints.Hbox5, Breakpoints.Label62, False, False, 0);

-      Gtk_New (Line_Spin_Adj, 1.0, 0.0, 1.0e+08, 1.0, 10.0, 10.0);
+      Gtk_New (Line_Spin_Adj, 1.0, 1.0, 1.0e+08, 1.0, 10.0);
       Gtk_New (Breakpoints.Line_Spin, Line_Spin_Adj, 1.0, 0);
       Set_Numeric (Breakpoints.Line_Spin, False);
       Set_Snap_To_Ticks (Breakpoints.Line_Spin, False);
============================================================
--- gvd/gvd/debugger-gdb.adb	557206c5a1f2636da48a4f7b305c51d462a3ff45
+++ gvd/gvd/debugger-gdb.adb	8615ab3009abb14c430452d28fd44088ab68907c
@@ -119,7 +119,8 @@ package body Debugger.Gdb is
    --  with no file information

    Breakpoint_Pattern        : constant Pattern_Matcher := Compile
-     ("^(\d+)\s+(breakpoint|\w+? watchpoint)\s+(keep|dis|del)\s+([yn])"
+     ("^(\d+)\s+(breakpoint|\w+? watchpoint|catchpoint)\s+"
+      & "(keep|dis|del)\s+([yn])"
       & "\s+(<MULTIPLE>\s+)*((0x0*)?(\S+))?\s+(.*)$",
       Multiple_Lines);
    --  Pattern to match a single line in "info breakpoint"
@@ -1677,6 +1678,7 @@ package body Debugger.Gdb is
         or else Looking_At (Command, Command'First + 1, "break")
         or else Looking_At (Command, Command'First, "b ")
         or else Looking_At (Command, Command'First, "watch")
+        or else Looking_At (Command, Command'First, "catch")
         or else Looking_At (Command, Command'First, "awatch")
         or else Looking_At (Command, Command'First, "rwatch")
         or else Looking_At (Command, Command'First, "delete")
============================================================
--- gvd/gvd/debugger.adb	4f41c19ea8266920e15c8e2c0b02588747d99704
+++ gvd/gvd/debugger.adb	a1eefa876eba9d00bc3567cda1d63d752e456584
@@ -651,10 +651,24 @@ package body Debugger is
       First   : Positive;

    begin
-      loop
-         --  Each command is separated with a ASCII.LF and is handled
-         --  separately.
+      --  When there are multiple commands separated by ASCII.LF, Force_Send
+      --  applies to the command set as a whole. If the debugger is processing
+      --  a command, we send none of them, otherwise we send them all without
+      --  queuing any of them. Chaining of commands through ASCII.LF seems to
+      --  only occur in a few limited cases anyway (Set_Breakpoint_Command for
+      --  instance).

+      if not Force_Send
+        and then Command_In_Process (Get_Process (Debugger))
+      then
+         --  Will be processed by the same Send later on
+         Queue_Command (Debugger, Cmd, Empty_Buffer, Mode);
+         return;
+      end if;
+
+      --  Each command is separated with a ASCII.LF and is handled separately
+
+      loop
          First := Last;
          Skip_To_Char (Cmd, Last, ASCII.LF);

@@ -670,57 +684,52 @@ package body Debugger is
          --  we are waiting for a prompt, we should not be queuing the command
          --  still this would return to the caller before we saw the prompt.

-         if not Force_Send
-           and then Command_In_Process (Get_Process (Debugger))
-         then
-            Queue_Command
-              (Debugger, Cmd (First .. Last - 1), Empty_Buffer, Mode);
-         else
-            Send_Internal_Pre
-              (Debugger, Cmd (First .. Last - 1), Empty_Buffer, Mode);
+         Send_Internal_Pre
+           (Debugger, Cmd (First .. Last - 1), Empty_Buffer, Mode);

-            case Mode is
-               when Invisible_Command =>
-                  if Last > Cmd'Last and then Wait_For_Prompt then
+         case Mode is
+            when Invisible_Command =>
+               if Last > Cmd'Last and then Wait_For_Prompt then
+                  --  Only wait for the prompt on the last command when
+                  --  there are multiple commands separated by ASCII.LF
+                  Wait_Prompt (Debugger_Access (Debugger));
+                  Debugger.Continuation_Line := False;
+                  Send_Internal_Post (Debugger, Mode);
+               end if;
+
+            when Visible_Command =>
+               if Wait_For_Prompt then
+                  if not Async_Commands then
+                     --  Synchronous handling of commands, simple case
+
                      Wait_Prompt (Debugger_Access (Debugger));
                      Debugger.Continuation_Line := False;
                      Send_Internal_Post (Debugger, Mode);
-                  end if;

-               when Visible_Command =>
-                  if Wait_For_Prompt then
-                     if not Async_Commands then
-                        --  Synchronous handling of commands, simple case
+                  else
+                     --  Asynchronous handling of commands, install a
+                     --  callback on the debugger's output file descriptor.

-                        Wait_Prompt (Debugger_Access (Debugger));
-                        Debugger.Continuation_Line := False;
-                        Send_Internal_Post (Debugger, Mode);
+                     Process := GVD.Process.Convert (Debugger);
+                     pragma Assert (Process.Timeout_Id = 0);

-                     else
-                        --  Asynchronous handling of commands, install a
-                        --  callback on the debugger's output file descriptor.
+                     Process.Timeout_Id := Debugger_Timeout.Add
+                       (Debug_Timeout, Output_Available'Access, Process);
+                  end if;

-                        Process := GVD.Process.Convert (Debugger);
-                        pragma Assert (Process.Timeout_Id = 0);
+               else
+                  if Mode >= Visible then
+                     --  Clear the current output received from the debugger
+                     --  to avoid confusing the prompt detection, since
+                     --  we're sending input in the middle of a command,
+                     --  which is delicate.

-                        Process.Timeout_Id := Debugger_Timeout.Add
-                          (Debug_Timeout, Output_Available'Access, Process);
-                     end if;
-
-                  else
-                     if Mode >= Visible then
-                        --  Clear the current output received from the debugger
-                        --  to avoid confusing the prompt detection, since
-                        --  we're sending input in the middle of a command,
-                        --  which is delicate.
-
-                        Process_Proxies.Empty_Buffer (Get_Process (Debugger));
-                        Process := GVD.Process.Convert (Debugger);
-                        Set_Busy (Process, False);
-                     end if;
+                     Process_Proxies.Empty_Buffer (Get_Process (Debugger));
+                     Process := GVD.Process.Convert (Debugger);
+                     Set_Busy (Process, False);
                   end if;
-            end case;
-         end if;
+               end if;
+         end case;

          exit when Last > Cmd'Last;

============================================================
--- gvd/gvd/gvd-consoles.adb	4e959cc7df997d1324015d5bbe333e35aa7502cc
+++ gvd/gvd/gvd-consoles.adb	a95c215f613f48967337308cadd4522aad0d57ff
@@ -485,6 +485,7 @@ package body GVD.Consoles is
    ---------------

    procedure Close_TTY (Console : access Debuggee_Console_Record'Class) is
+      Debugger : Debugger_Access;
    begin
       if Console.TTY_Initialized then
          if Console.Debuggee_Id /= 0 then
@@ -492,10 +493,14 @@ package body GVD.Consoles is
             Console.Debuggee_Id := 0;
          end if;

-         if Get_Process (Console) /= null
-           and then Get_Process (Console).Debugger /= null
-         then
-            Set_TTY (Get_Process (Console).Debugger,  "");
+         if Get_Process (Console) /= null then
+            Debugger := Get_Process (Console).Debugger;
+
+            if Debugger /= null
+              and then not Command_In_Process (Get_Process (Debugger))
+            then
+               Set_TTY (Get_Process (Console).Debugger,  "");
+            end if;
          end if;

          Close_TTY (Console.Debuggee_TTY);
============================================================
--- gvd/gvd/gvd-generic_view.adb	ade6eba9887487ee012458a20d207c3d7a576e6d
+++ gvd/gvd/gvd-generic_view.adb	e0fb0265a68efeea3a2418ae3bca36e3a6d3ebf7
@@ -285,6 +285,7 @@ package body GVD.Generic_View is
          Gtk_New (Child, View,
                   Flags          => MDI_Child_Flags,
                   Group          => Group,
+                  Focus_Widget   => Gtk_Widget (View),
                   Default_Width  => 150,
                   Default_Height => 150,
                   Module         => Get_Module);
============================================================
--- gvd/gvd/gvd-process.adb	e54fd21d368b1b0b42c1e1c2da8a37ec60110d1a
+++ gvd/gvd/gvd-process.adb	054d31ca82ce38fd7ab6f6ded94c6212df2abe5c
@@ -53,6 +53,7 @@ with GPS.Kernel.Hooks;           use GPS
 with GNAT.Directory_Operations;  use GNAT.Directory_Operations;
 with GPS.Intl;                   use GPS.Intl;
 with GPS.Kernel.Hooks;           use GPS.Kernel.Hooks;
+with GPS.Kernel.MDI;             use GPS.Kernel.MDI;
 with GPS.Kernel.Modules;         use GPS.Kernel.Modules;
 with GPS.Kernel.Preferences;     use GPS.Kernel.Preferences;
 with GPS.Kernel.Properties;      use GPS.Kernel.Properties;
@@ -629,37 +630,39 @@ package body GVD.Process is
       Matched : GNAT.Regpat.Match_Array (0 .. 0);
       Start   : Positive := Str'First;
    begin
-      if Is_Command then
-         Insert (Process.Debugger_Text, Str, False, True, True);
-      else
-         while Start <= Str'Last loop
-            Match (Highlighting_Pattern (Process.Debugger),
-                   Str (Start .. Str'Last),
-                   Matched);
+      if Process.Debugger_Text /= null then
+         if Is_Command then
+            Insert (Process.Debugger_Text, Str, False, True, True);
+         else
+            while Start <= Str'Last loop
+               Match (Highlighting_Pattern (Process.Debugger),
+                      Str (Start .. Str'Last),
+                      Matched);

-            if Matched (0) /= No_Match then
-               if Matched (0).First - 1 >= Start then
+               if Matched (0) /= No_Match then
+                  if Matched (0).First - 1 >= Start then
+                     Insert (Process.Debugger_Text,
+                             Str (Start .. Matched (0).First - 1),
+                             False, False);
+                  end if;
+
                   Insert (Process.Debugger_Text,
-                          Str (Start .. Matched (0).First - 1),
+                          Str (Matched (0).First .. Matched (0).Last),
+                          False, True);
+                  Start := Matched (0).Last + 1;
+
+               else
+                  Insert (Process.Debugger_Text,
+                          Str (Start .. Str'Last),
                           False, False);
+                  Start := Str'Last + 1;
                end if;
+            end loop;
+         end if;

-               Insert (Process.Debugger_Text,
-                       Str (Matched (0).First .. Matched (0).Last),
-                       False, True);
-               Start := Matched (0).Last + 1;
-
-            else
-               Insert (Process.Debugger_Text,
-                       Str (Start .. Str'Last),
-                       False, False);
-               Start := Str'Last + 1;
-            end if;
-         end loop;
+         Highlight_Child
+           (Find_MDI_Child (Process.Window.MDI, Process.Debugger_Text));
       end if;
-
-      Highlight_Child
-        (Find_MDI_Child (Process.Window.MDI, Process.Debugger_Text));
    end Output_Text;

    ------------------------
@@ -1105,7 +1108,8 @@ package body GVD.Process is
            and then Support_TTY (Process.Debugger)
            and then GNAT.TTY.TTY_Supported);

-      Grab_Focus (Process.Debugger_Text);
+      Raise_Child
+        (Find_MDI_Child (Get_MDI (Window.Kernel), Process.Debugger_Text));

       Set_Busy (Process, False);
       Success := True;
@@ -1493,12 +1497,20 @@ package body GVD.Process is
            and then (Continuation_Line (Debugger.Debugger)
                      or else Debugger.Registered_Dialog /= null)
          then
+            --  For interactive command, we always send them immediately to
+            --  the debugger, since this might be an answer to a gdb question
+            --  ("restart process (y/n) ?")
             Send
               (Debugger.Debugger,
-               Command, Wait_For_Prompt => False, Mode => Mode);
+               Command, Wait_For_Prompt => False, Mode => Mode,
+               Force_Send => Debugger.Interactive_Command);
          else
             if Output = null then
-               Send (Debugger.Debugger, Check (Command), Mode => Mode);
+               --  Force_Send is always false so that commands are queue. We
+               --  are not in a secondary prompt anyway (which should be when
+               --  we have a Registered_Dialog).
+               Send (Debugger.Debugger, Check (Command), Mode => Mode,
+                     Force_Send => False);
             else
                Output.all :=
                  new String'(Send
============================================================
--- gvd/gvd/memory_view_pkg.adb	45ff643cbfb2c17ebef3dccb91f837920aaaedaa
+++ gvd/gvd/memory_view_pkg.adb	b9f57e7269d2756561a7e4ac24ce0bd7bfb50747
@@ -1,8 +1,7 @@
 -----------------------------------------------------------------------
 --                              G P S                                --
 --                                                                   --
---                     Copyright (C) 2000-2007                       --
---                             AdaCore                               --
+--                     Copyright (C) 2000-2008, AdaCore              --
 --                                                                   --
 -- GPS is free  software;  you can redistribute it and/or modify  it --
 -- under the terms of the GNU General Public License as published by --
@@ -268,7 +267,7 @@ package body Memory_View_Pkg is
       Add (Memory_View.Pgdn, Arrow2);

       Gtk_New
-        (Adjustment, 16.0, 1.0, 30.0, 1.0, 0.0, 0.0);
+        (Adjustment, 16.0, 1.0, 30.0, 1.0, 0.0);
       Gtk_New
         (Memory_View.Lines_Spin, Adjustment, 0.0, 0);
       Entry_Return_Callback.Connect
============================================================
--- help/src/help_module.adb	98596a60fec355c9a7dabc676b48608173514f9f
+++ help/src/help_module.adb	d3cb8a8a4cf8842b888b1135555930e7affb5f5f
@@ -22,14 +22,15 @@ with GNAT.Directory_Operations;  use GNA
 with Ada.Strings.Unbounded;      use Ada.Strings.Unbounded;

 with GNAT.Directory_Operations;  use GNAT.Directory_Operations;
+with GNAT.OS_Lib;                use GNAT.OS_Lib;
+with GNAT.Strings;
+
 with GNATCOLL.Mmap;              use GNATCOLL.Mmap;
-with GNAT.OS_Lib;                use GNAT.OS_Lib;
 with GNATCOLL.Scripts;           use GNATCOLL.Scripts;
 with GNATCOLL.Utils;             use GNATCOLL.Utils;
-with GNAT.Strings;
+with GNATCOLL.VFS;               use GNATCOLL.VFS;

 with Glib;                       use Glib;
-with Glib.Convert;               use Glib.Convert;
 with Glib.Object;                use Glib.Object;
 with Glib.Xml_Int;               use Glib.Xml_Int;

@@ -53,8 +54,8 @@ with File_Utils;                 use Fil
 with GPS.Kernel.Custom;          use GPS.Kernel.Custom;
 with Traces;                     use Traces;
 with File_Utils;                 use File_Utils;
+with Filesystems;                use Filesystems;
 with Generic_List;
-with GNATCOLL.VFS;               use GNATCOLL.VFS;
 with String_Utils;               use String_Utils;
 with Welcome_Page;               use Welcome_Page;
 with XML_Parsers;
@@ -316,14 +317,14 @@ package body Help_Module is
       end if;

       Full := Locate_Regular_File
-        (Locale_From_UTF8 (Name), Help_Module_ID.Doc_Path.all);
+        (Filesystems.Filename_From_UTF8 (Name), Help_Module_ID.Doc_Path.all);

       if Full = null then
          return GNATCOLL.VFS.No_File;

       else
          declare
-            F : constant String := Locale_To_UTF8 (Full.all);
+            F : constant String := Filesystems.Filename_To_UTF8 (Full.all);
          begin
             Free (Full);
             return Create (F);
@@ -513,11 +514,9 @@ package body Help_Module is
       Tmp   : Glib.Xml_Int.Node_Ptr;
    begin
       Trace (Me, "Parsing XML file "
-             & Get_System_Dir (Kernel)
-             & "share/gps/shell_commands.xml");
+             & Get_System_Dir (Kernel) & "share/gps/shell_commands.xml");
       XML_Parsers.Parse
-        (File  =>
-           Get_System_Dir (Kernel) & "share/gps/shell_commands.xml",
+        (File  => Get_System_Dir (Kernel) & "share/gps/shell_commands.xml",
          Tree  => Tmp,
          Error => Error);
       if Error /= null then
@@ -924,7 +923,7 @@ package body Help_Module is
                      GPS_Window (Get_Main_Window (Kernel));
       About_File : constant String :=
                      GNAT.Directory_Operations.Format_Pathname
-          (Get_System_Dir (Kernel) & "/share/gps/about.txt");
+                       (Get_System_Dir (Kernel) & "/share/gps/about.txt");
       Contents   : GNAT.Strings.String_Access;

    begin
@@ -969,7 +968,8 @@ package body Help_Module is
       Level  : Customization_Level)
    is
       pragma Unreferenced (Level);
-      Kernel : constant Kernel_Handle := Get_Kernel (Module.all);
+      Kernel                 : constant Kernel_Handle :=
+                                 Get_Kernel (Module.all);
       Name, Descr, Menu, Cat : Node_Ptr;
       Shell, Shell_Lang      : GNAT.Strings.String_Access;
       Field                  : Node_Ptr;
============================================================
--- kernel/src/default_preferences.adb	b2b02ba3f0149ab4f33eb4d7d7b370120db5b86a
+++ kernel/src/default_preferences.adb	d81d3dcef5533d22627bed436aaf12b3e5b512f7
@@ -1333,8 +1333,7 @@ package body Default_Preferences is
                Lower => Gdouble (Pref.Int_Min_Value),
                Upper => Gdouble (Pref.Int_Max_Value),
                Step_Increment => 1.0,
-               Page_Increment => 10.0,
-               Page_Size      => 10.0);
+               Page_Increment => 10.0);
       Gtk_New (Spin, Adj, 1.0, The_Digits => 0);
       Set_Editable (Spin, True);

============================================================
--- kernel/src/gps-kernel-hooks.adb	f58a519dfcc5d0d528d6a9eee1e6e4400887df25
+++ kernel/src/gps-kernel-hooks.adb	97af39a00cff36245fd38c71211afb7888831283
@@ -1617,8 +1617,11 @@ package body GPS.Kernel.Hooks is
         (Kernel, File_Changed_Detected_Hook, File_Hook_Type);

       Register_Hook_Return_Boolean
-        (Kernel, Compilation_Starting_Hook, String_Boolean_Hook_Type);
+        (Kernel, Compilation_Starting_Hook, Compilation_Hook_Type);

+      Register_Hook_Return_String
+        (Kernel, Compute_Build_Targets_Hook, String_Hook_Type);
+
       Register_Command
         (Kernel, Constructor_Method,
          Class        => Hook_Class,
============================================================
--- kernel/src/gps-kernel-macros.adb	aecdc2c5ebfadf6cb98a84c0a4aebacf8e55c797
+++ kernel/src/gps-kernel-macros.adb	52a0dfbc088b88faf61276878b9bab0db5115e62
@@ -193,7 +193,9 @@ package body GPS.Kernel.Macros is
          return Image (Integer (Column_Information (Context)));

       elsif Param = "a" then
-         return Category_Information (Context);
+         if Has_Category_Information (Context) then
+            return Category_Information (Context);
+         end if;

       elsif Param = "s" then
          if Has_Entity_Name_Information (Context) then
============================================================
--- kernel/src/gps-kernel-mdi.adb	b99052c9de7e485d2cd8f8bf9a573627415aed05
+++ kernel/src/gps-kernel-mdi.adb	26d9ffc4e4f1a8c4b48bed8409584d15a7370a09
@@ -1,7 +1,7 @@
 -----------------------------------------------------------------------
 --                               G P S                               --
 --                                                                   --
---                      Copyright (C) 2005-2008, AdaCore             --
+--                 Copyright (C) 2005-2008, AdaCore                  --
 --                                                                   --
 -- GPS is free  software;  you can redistribute it and/or modify  it --
 -- under the terms of the GNU General Public License as published by --
@@ -17,6 +17,8 @@
 -- Place - Suite 330, Boston, MA 02111-1307, USA.                    --
 -----------------------------------------------------------------------

+with GNATCOLL.VFS;             use GNATCOLL.VFS;
+
 with Glib.Values;              use Glib.Values;

 with Gtk.Box;                  use Gtk.Box;
@@ -43,7 +45,6 @@ with Projects;                 use Proje
 with GPS.Kernel.Project;       use GPS.Kernel.Project;
 with GPS.Main_Window;          use GPS.Main_Window;
 with Projects;                 use Projects;
-with GNATCOLL.VFS;                      use GNATCOLL.VFS;

 package body GPS.Kernel.MDI is

@@ -174,7 +175,7 @@ package body GPS.Kernel.MDI is
       --  against that of the source editor module. The ID for that module
       --  needs to be moved to gps.kernel.ads.

-      --  First, try to find the editor using the normalized name of File.
+      --  First, try to find the editor using the normalized name of File
       Child := Find_MDI_Child_By_Name
         (MDI, Full_Name (File, Normalize => True).all);

@@ -327,6 +328,7 @@ package body GPS.Kernel.MDI is
          for C in Children'Range loop
             Add_Child_If_Needed (Children (C));
          end loop;
+
       else
          if Project_Modified (Get_Project (Handle), Recursive => True) then
             Num_Unsaved := Num_Unsaved + 1;
@@ -449,6 +451,7 @@ package body GPS.Kernel.MDI is
                               Parent  => Get_Current_Window (Handle));
                            return False;
                         end if;
+
                      else
                         Child := Find_MDI_Child_By_Name
                           (Get_MDI (Handle), Name);
@@ -473,6 +476,7 @@ package body GPS.Kernel.MDI is
          end if;

          Destroy (Dialog);
+
       else
          Unref (Model);
       end if;
============================================================
--- kernel/src/gps-kernel-preferences.adb	d5bf08104489f31c25cd8a51e74f4bbe60376ef0
+++ kernel/src/gps-kernel-preferences.adb	23b524646f7b750e48a949a4e5b25a4764581914
@@ -1,7 +1,7 @@
 -----------------------------------------------------------------------
 --                               G P S                               --
 --                                                                   --
---                      Copyright (C) 2001-2008, AdaCore             --
+--                 Copyright (C) 2001-2008, AdaCore                  --
 --                                                                   --
 -- GPS is free  software;  you can redistribute it and/or modify  it --
 -- under the terms of the GNU General Public License as published by --
@@ -383,16 +383,6 @@ package body GPS.Kernel.Preferences is
          Page    => -"General",
          Default => From_Project);

-      Multi_Language_Build := Create
-        (Manager => Kernel.Preferences,
-         Name    => "General-Multi-Language-Build",
-         Label   => -"Multi language build",
-         Doc     =>
-         -("Whether GPS should build more than just Ada " &
-           "sources for projects containing Ada and other (e.g. C) languages"),
-         Default => False,
-         Page    => -"General");
-
       Multi_Language_Builder := Multi_Language_Builder_Policy_Prefs.Create
         (Manager => Kernel.Preferences,
          Name    => "General-Multi-Language-Builder",
@@ -799,6 +789,19 @@ package body GPS.Kernel.Preferences is
          Label   => -"Vertical layout",
          Page    => -"Browsers");

+      -- VCS --
+
+      Implicit_Status := Create
+        (Manager => Kernel.Preferences,
+         Name    => "VCS-Implicit-Status",
+         Default => True,
+         Doc     => -("If disabled, the status command will never be called"
+           & " implicitly as part of another VCS action. For example after"
+           & " an update the status is requested from the repository. This"
+           & " may take some time depending on the network connection speed."),
+         Label   => -"Implicit status",
+         Page    => -"VCS");
+
       -- Diff_Utils --

       Diff_Cmd := Create
@@ -827,6 +830,7 @@ package body GPS.Kernel.Preferences is
                       & " Changing this parameter requires restarting GPS."),
          Default => False,
          Page    => -"Visual diff");
+
       -- Messages --

       Message_Highlight := Create
@@ -1420,7 +1424,7 @@ package body GPS.Kernel.Preferences is

    procedure Edit_Preferences (Kernel : access Kernel_Handle_Record'Class) is
       procedure On_Changed (Manager : access Preferences_Manager_Record'Class);
-      --  Called when the preferences have been changed.
+      --  Called when the preferences have been changed

       ----------------
       -- On_Changed --
@@ -1440,10 +1444,10 @@ package body GPS.Kernel.Preferences is
       end if;

       Edit_Preferences
-        (Manager           => Kernel.Preferences,
-         Parent            => Get_Main_Window (Kernel),
-         On_Changed        => On_Changed'Unrestricted_Access,
-         Custom_Pages      => Preferences_Pages.all);
+        (Manager      => Kernel.Preferences,
+         Parent       => Get_Main_Window (Kernel),
+         On_Changed   => On_Changed'Unrestricted_Access,
+         Custom_Pages => Preferences_Pages.all);

       Save_Preferences (Kernel, Get_Home_Dir (Kernel) & "preferences");
    end Edit_Preferences;
============================================================
--- kernel/src/gps-kernel-preferences.ads	ba267cb7bf5bfc19caec2a398c0f44a9135efedf
+++ kernel/src/gps-kernel-preferences.ads	42cf8fb3c97e2ebf683b76a53366058b40d5cfc2
@@ -1,7 +1,7 @@
 -----------------------------------------------------------------------
 --                               G P S                               --
 --                                                                   --
---                      Copyright (C) 2001-2008, AdaCore             --
+--                 Copyright (C) 2001-2008, AdaCore                  --
 --                                                                   --
 -- GPS is free  software;  you can redistribute it and/or modify  it --
 -- under the terms of the GNU General Public License as published by --
@@ -44,7 +44,7 @@ package GPS.Kernel.Preferences is

    procedure Save_Preferences
      (Kernel : access Kernel_Handle_Record'Class; File_Name : String);
-   --  See Default_Preferences.Save_Preferences.
+   --  See Default_Preferences.Save_Preferences

    procedure Set_Pref
      (Pref   : Boolean_Preference;
@@ -128,28 +128,27 @@ package GPS.Kernel.Preferences is
    Auto_Save              : Boolean_Preference;
    Save_Desktop_On_Exit   : Boolean_Preference;
    Save_Editor_Desktop    : Editor_Desktop_Policy_Prefs.Preference;
-   Multi_Language_Build   : Boolean_Preference;
    Multi_Language_Builder : Multi_Language_Builder_Policy_Prefs.Preference;
    Auto_Jump_To_First     : Boolean_Preference;
    Tooltip_Color          : Color_Preference;

    -- Messages --
-   Message_Highlight      : Color_Preference;
-   Error_Src_Highlight    : Color_Preference;
-   Warning_Src_Highlight  : Color_Preference;
-   Style_Src_Highlight    : Color_Preference;
-   Search_Src_Highlight   : Color_Preference;
-   File_Pattern           : String_Preference;
-   File_Pattern_Index     : Integer_Preference;
-   Line_Pattern_Index     : Integer_Preference;
-   Column_Pattern_Index   : Integer_Preference;
-   Secondary_File_Pattern           : String_Preference;
-   Secondary_File_Pattern_Index     : Integer_Preference;
-   Secondary_Line_Pattern_Index     : Integer_Preference;
-   Secondary_Column_Pattern_Index   : Integer_Preference;
-   Message_Pattern_Index  : Integer_Preference;
-   Style_Pattern_Index    : Integer_Preference;
-   Warning_Pattern_Index  : Integer_Preference;
+   Message_Highlight              : Color_Preference;
+   Error_Src_Highlight            : Color_Preference;
+   Warning_Src_Highlight          : Color_Preference;
+   Style_Src_Highlight            : Color_Preference;
+   Search_Src_Highlight           : Color_Preference;
+   File_Pattern                   : String_Preference;
+   File_Pattern_Index             : Integer_Preference;
+   Line_Pattern_Index             : Integer_Preference;
+   Column_Pattern_Index           : Integer_Preference;
+   Secondary_File_Pattern         : String_Preference;
+   Secondary_File_Pattern_Index   : Integer_Preference;
+   Secondary_Line_Pattern_Index   : Integer_Preference;
+   Secondary_Column_Pattern_Index : Integer_Preference;
+   Message_Pattern_Index          : Integer_Preference;
+   Style_Pattern_Index            : Integer_Preference;
+   Warning_Pattern_Index          : Integer_Preference;

    -- Diff_Utils --
    Diff_Cmd            : String_Preference;
@@ -187,11 +186,11 @@ package GPS.Kernel.Preferences is
    --  Of type Dispatching_Menu_Policy

    -- External Commands --
-   List_Processes                : String_Preference;
-   Html_Browser                  : String_Preference;
-   Execute_Command               : String_Preference;
-   Print_Command                 : String_Preference;
-   Max_Output_Length             : Integer_Preference;
+   List_Processes            : String_Preference;
+   Html_Browser              : String_Preference;
+   Execute_Command           : String_Preference;
+   Print_Command             : String_Preference;
+   Max_Output_Length         : Integer_Preference;

    -- MDI --
    MDI_Opaque            : Boolean_Preference;
@@ -230,10 +229,11 @@ package GPS.Kernel.Preferences is
    Title_Color               : Color_Preference;

    -- VCS --
-   Hide_Up_To_Date     : Boolean_Preference;
-   Hide_Not_Registered : Boolean_Preference;
-   CVS_Command         : String_Preference;
-   ClearCase_Command   : String_Preference;
+   Implicit_Status           : Boolean_Preference;
+   Hide_Up_To_Date           : Boolean_Preference;
+   Hide_Not_Registered       : Boolean_Preference;
+   CVS_Command               : String_Preference;
+   ClearCase_Command         : String_Preference;

    --  Debugger preferences are registered in GVD.Preferences

============================================================
--- kernel/src/gps-kernel-project.adb	60b0edfa96dcc75ccb2c1d84c15fa6a08cb76d4c
+++ kernel/src/gps-kernel-project.adb	bb8e9cb6975adfb1e062280637cd85bbd4e93c92
@@ -561,13 +561,7 @@ package body GPS.Kernel.Project is
          --  the calls below will just speed up the processing in
          --  Recompute_View when a new project is loaded.

-         --  Note that gnatls_server is set when computing predefined paths
-         if Kernel.Gnatls_Server = null
-           or else Kernel.Gnatls_Server.all /= Get_Nickname (Build_Server)
-           or else not Same_Project
-         then
-            Entities.Reset (Get_Database (Kernel));
-         end if;
+         Entities.Reset (Get_Database (Kernel));

          --  Always call Compute_Predefined_Paths who detects if recomputation
          --  is really needed. This is also used to get the value of
@@ -757,8 +751,6 @@ package body GPS.Kernel.Project is
       Entities.Foreach_Source_File
         (Get_Database (Handle), Reset_File_If_External'Access);

-      --  Entities.Reset (Get_Database (Handle));
-
       Run_Hook (Handle, Project_View_Changed_Hook);
       Pop_State (Kernel_Handle (Handle));
    end Recompute_View;
============================================================
--- kernel/src/gps-kernel-remote.adb	de7dc707a2c45d9a5fadb92cfc618e984d18c5e6
+++ kernel/src/gps-kernel-remote.adb	aecccf075179014d9e73c0756b9c08d4e2a31dd9
@@ -17,10 +17,10 @@
 -- Place - Suite 330, Boston, MA 02111-1307, USA.                    --
 -----------------------------------------------------------------------

-with Ada.Exceptions;             use Ada.Exceptions;
+with Ada.Exceptions;             use Ada, Ada.Exceptions;
 with Ada.Unchecked_Conversion;
 with Ada.Unchecked_Deallocation;
-with Ada.Strings.Unbounded;
+with Ada.Strings.Unbounded;      use Ada.Strings.Unbounded;

 with GNAT.Directory_Operations;  use GNAT.Directory_Operations;
 with GNAT.Expect;                use GNAT.Expect;
@@ -145,12 +145,13 @@ package body GPS.Kernel.Remote is

    type Connection_Debug is new Connection_Debugger_Record with record
       Kernel  : Kernel_Handle;
-      Title   : String_Access;
+      Title   : GNAT.OS_Lib.String_Access;
       Console : Interactive_Console;
    end record;

-   function Create (Kernel : Kernel_Handle;
-                    Title  : String) return Connection_Debugger;
+   function Create
+     (Kernel : Kernel_Handle;
+      Title  : String) return Connection_Debugger;
    --  Create a Connection_Debug object

    overriding procedure Print
@@ -184,8 +185,7 @@ package body GPS.Kernel.Remote is
    is
       Console : Interactive_Console;
    begin
-      Console :=
-        Create_Interactive_Console (Dbg.Kernel, Dbg.Title.all);
+      Console := Create_Interactive_Console (Dbg.Kernel, Dbg.Title.all);

       case Mode is
          when Input =>
@@ -243,7 +243,7 @@ package body GPS.Kernel.Remote is
    Enter_Remote_Path_String : constant String := -"<enter remote path here>";

    Synchronisation_String : constant
-     array (Synchronisation_Type) of String_Access :=
+     array (Synchronisation_Type) of GNAT.OS_Lib.String_Access :=
                               (Never          => new String'("Never"),
                                Once_To_Local  => new String'("Once to local"),
                                Once_To_Remote => new String'("Once to remote"),
@@ -375,8 +375,9 @@ package body GPS.Kernel.Remote is
       Default_Server : String);
    --  Creates the server_list_editor dialog

-   procedure On_Changed (W                 : access Gtk_Widget_Record'Class;
-                         Connection_Params : Boolean);
+   procedure On_Changed
+     (W                 : access Gtk_Widget_Record'Class;
+      Connection_Params : Boolean);
    --  Called when one of the entries has changed
    --  Connection_Params tells if connection configuration changed. If set, the
    --   machine cannot be browsed until 'Apply' is called.
@@ -411,7 +412,7 @@ package body GPS.Kernel.Remote is
    type Server_Config is record
       Is_Local : Boolean := True;
       --  Is_Local Tells if the server is the local machine or not
-      Nickname : String_Access;
+      Nickname : GNAT.OS_Lib.String_Access;
       --  Identifier of the server
    end record;
    type Servers_Config is array (Distant_Server_Type) of Server_Config;
@@ -512,7 +513,7 @@ package body GPS.Kernel.Remote is
                              Get_Attribute (Node, "debug_console", "false");
       Field              : Glib.String_Ptr;
       Max_Nb_Connections : Natural;
-      User_Name          : String_Access;
+      User_Name          : GNAT.OS_Lib.String_Access;
       Timeout            : Natural;
       Extra_Init_Cmds    : GNAT.OS_Lib.Argument_List_Access;
       Nb_Init_Cmds       : Natural;
@@ -713,9 +714,9 @@ package body GPS.Kernel.Remote is
    ------------------------------

    procedure Load_Remote_Config (Kernel : Kernel_Handle) is
-      Filename : constant String := Get_Home_Dir (Kernel) & "remote.xml";
+      Filename    : constant String := Get_Home_Dir (Kernel) & "remote.xml";
       File, Child : Node_Ptr;
-      Err : String_Access;
+      Err         : GNAT.OS_Lib.String_Access;

    begin
       if Is_Regular_File (Filename) then
@@ -724,6 +725,7 @@ package body GPS.Kernel.Remote is

          if File = null then
             Insert (Kernel, Err.all, Mode => Error);
+
          else
             Child := File.Child;

@@ -748,11 +750,12 @@ package body GPS.Kernel.Remote is
    ------------------------

    procedure Save_Remote_Config (Kernel : Kernel_Handle) is
-      Filename   : constant String := Get_Home_Dir (Kernel) & "remote.xml";
+      Filename                    : constant String :=
+                                      Get_Home_Dir (Kernel) & "remote.xml";
       File, Item, Child, Cmd_Node : Node_Ptr;
-      Desc       : Machine_Descriptor;
-      Nb_Desc    : Natural;
-      Success    : Boolean;
+      Desc                        : Machine_Descriptor;
+      Nb_Desc                     : Natural;
+      Success                     : Boolean;

    begin
       Trace (Me, "Saving " & Filename);
@@ -775,6 +778,7 @@ package body GPS.Kernel.Remote is
             Set_Attribute (Item, "remote_access", Desc.Access_Name.all);
             Set_Attribute (Item, "network_name", Desc.Network_Name.all);
             Set_Attribute (Item, "nickname", Desc.Nickname.all);
+
             if Desc.Dbg = null then
                Set_Attribute (Item, "debug_console", "false");
             else
@@ -865,11 +869,11 @@ package body GPS.Kernel.Remote is
    -------------

    procedure Gtk_New
-     (Widget      : out Paths_Widget;
-      Dialog      : Gtk_Dialog)
+     (Widget : out Paths_Widget;
+      Dialog : Gtk_Dialog)
    is
-      Pix    : Gtk_Image;
-      Label  : Gtk_Label;
+      Pix   : Gtk_Image;
+      Label : Gtk_Label;
    begin
       Widget := new Paths_Widget_Record;
       Gtk.Frame.Initialize (Widget, -"Path Translations");
@@ -946,13 +950,17 @@ package body GPS.Kernel.Remote is
      (Widget : Paths_Widget;
       FS     : Filesystem_Record'Class)
    is
-      List   : Path_Row_List.Glist;
-      Row    : Path_Row;
+      List : Path_Row_List.Glist;
+      Row  : Path_Row;
       use type Path_Row_List.Glist;

       procedure Update (P : in out Mirror_Path);
       --  Update the Mirror path with values in the widget

+      ------------
+      -- Update --
+      ------------
+
       procedure Update (P : in out Mirror_Path) is
       begin
          Update_Path (Path_Row_List.Get_Data (List), FS, P);
@@ -973,9 +981,9 @@ package body GPS.Kernel.Remote is
    ------------------

    procedure Add_Path_Row
-     (Widget      : Paths_Widget;
-      Row_Number  : Guint;
-      Cursor      : Mirror_List.Cursor)
+     (Widget     : Paths_Widget;
+      Row_Number : Guint;
+      Cursor     : Mirror_List.Cursor)
    is
       Path : constant Mirror_Path := Mirror_List.Element (Cursor);
       Pix  : Gtk_Image;
@@ -1159,7 +1167,7 @@ package body GPS.Kernel.Remote is
      (Widget : Paths_Widget;
       Row    : in out Path_Row)
    is
-      procedure Free is new Ada.Unchecked_Deallocation
+      procedure Free is new Unchecked_Deallocation
         (Path_Row_Record, Path_Row);
    begin
       Remove (Widget.Table, Row.Local_Frame);
@@ -1231,7 +1239,7 @@ package body GPS.Kernel.Remote is
       end if;

       Path.Set_Tentative_Local_Path
-        (Get_Local_Filesystem.Ensure_Directory  (Local));
+        (Get_Local_Filesystem.Ensure_Directory (Local));
       Path.Set_Tentative_Remote_Path
         (FS.Ensure_Directory (Remote));
       Path.Set_Tentative_Synchronisation (Sync);
@@ -1241,8 +1249,7 @@ package body GPS.Kernel.Remote is
    -- On_Add_Path_Clicked --
    -------------------------

-   procedure On_Add_Path_Clicked (W : access Gtk_Widget_Record'Class)
-   is
+   procedure On_Add_Path_Clicked (W : access Gtk_Widget_Record'Class) is
       Widget : Paths_Widget_Record renames Paths_Widget_Record (W.all);
       Path   : constant Mirror_Path := Null_Path;
    begin
@@ -1311,12 +1318,12 @@ package body GPS.Kernel.Remote is
    ----------------------

    procedure On_Browse_Remote (Widget : access Path_Cb_Data'Class) is
-      Current_Dir  : constant String :=
-                       Get_Text (Widget.Row.Remote_Entry);
-      Start_Dir    : Virtual_File := No_File;
-      Dialog       : constant Server_List_Editor :=
-                       Server_List_Editor (Widget.Widget.Dialog);
-      Gtk_Resp     : Message_Dialog_Buttons;
+      Current_Dir : constant String :=
+                      Get_Text (Widget.Row.Remote_Entry);
+      Start_Dir   : Virtual_File := No_File;
+      Dialog      : constant Server_List_Editor :=
+                      Server_List_Editor (Widget.Widget.Dialog);
+      Gtk_Resp    : Message_Dialog_Buttons;
       pragma Unreferenced (Gtk_Resp);
    begin
       if Dialog.Selected_Machine = null then
@@ -1893,18 +1900,18 @@ package body GPS.Kernel.Remote is
       ------------------

       function Check_Fields
-        (Model          : Gtk.Tree_Store.Gtk_Tree_Store;
-         Iter           : Gtk.Tree_Model.Gtk_Tree_Iter;
-         Dialog         : Server_List_Editor) return Boolean
+        (Model  : Gtk.Tree_Store.Gtk_Tree_Store;
+         Iter   : Gtk.Tree_Model.Gtk_Tree_Iter;
+         Dialog : Server_List_Editor) return Boolean
       is
-         Nickname  : constant String := Get_String (Model, Iter, Name_Col);
+         Nickname         : constant String :=
+                              Get_String (Model, Iter, Name_Col);
          Has_Network_Name : Boolean;
          Has_Access_Name  : Boolean;
          Has_Shell_Name   : Boolean;
-         Error_Str        : Ada.Strings.Unbounded.Unbounded_String;
+         Error_Str        : Unbounded_String;
          Ret              : Message_Dialog_Buttons;
          pragma Unreferenced (Ret);
-         use type Ada.Strings.Unbounded.Unbounded_String;

       begin
          Has_Network_Name := Get_Text (Dialog.Network_Name_Entry) /= "";
@@ -1917,7 +1924,7 @@ package body GPS.Kernel.Remote is
            or else not Has_Access_Name
            or else not Has_Shell_Name
          then
-            Error_Str := Ada.Strings.Unbounded.To_Unbounded_String
+            Error_Str := To_Unbounded_String
               (-"The following items are missing for server ") &
                Nickname & ":";

@@ -1934,7 +1941,7 @@ package body GPS.Kernel.Remote is
             end if;

             Ret := Message_Dialog
-              (Ada.Strings.Unbounded.To_String (Error_Str),
+              (To_String (Error_Str),
                Dialog_Type => Error,
                Buttons     => Button_OK,
                Parent      => Gtk_Window (Dialog));
@@ -3195,7 +3202,7 @@ package body GPS.Kernel.Remote is

          declare
             Use_Cr_Lf_String_Access : constant Glib.String_Ptr :=
-                                      Get_Field (Node, "use_cr_lf");
+                                        Get_Field (Node, "use_cr_lf");
          begin
             if Use_Cr_Lf_String_Access = null then
                Use_Cr_Lf := False;
@@ -3258,12 +3265,14 @@ package body GPS.Kernel.Remote is
                Start_Command             => Start_Command.all,
                Start_Command_Common_Args => Start_Command_Common_Args.all,
                Start_Command_User_Args   => Start_Command_User_Args.all,
-               Send_Interrupt            => String_Access (Interrupt),
-               User_Prompt_Ptrn          => String_Access (User_Prompt_Ptrn),
+               Send_Interrupt            =>
+                 GNAT.OS_Lib.String_Access (Interrupt),
+               User_Prompt_Ptrn          =>
+                 GNAT.OS_Lib.String_Access (User_Prompt_Ptrn),
                Password_Prompt_Ptrn      =>
-                 String_Access (Password_Prompt_Ptrn),
+                 GNAT.OS_Lib.String_Access (Password_Prompt_Ptrn),
                Passphrase_Prompt_Ptrn    =>
-                 String_Access (Passphrase_Prompt_Ptrn),
+                 GNAT.OS_Lib.String_Access (Passphrase_Prompt_Ptrn),
                Extra_Prompt_Array        => Extra_Ptrns,
                Use_Cr_Lf                 => Use_Cr_Lf,
                Use_Pipes                 => Use_Pipes);
@@ -3322,8 +3331,7 @@ package body GPS.Kernel.Remote is
          --  Check that all servers are local
          for J in Distant_Server_Type'Range loop
             if not Is_Local (J) then
-               Trace
-                 (Me, "server " & Server_Type'Image (J) & " not local");
+               Trace (Me, "server " & Server_Type'Image (J) & " not local");
                return False;
             end if;
          end loop;
@@ -3491,17 +3499,21 @@ package body GPS.Kernel.Remote is
       Sync_Once_Dirs : Boolean;
       Queue_Id       : String  := "")
    is
-      List           : Mirror_List_Access;
-      Cursor         : Mirror_List.Cursor;
-      Path           : Mirror_Path;
-      From_Path      : Ada.Strings.Unbounded.Unbounded_String;
-      To_Path        : Ada.Strings.Unbounded.Unbounded_String;
-      Machine        : Machine_Descriptor_Record;
-      Need_Sync      : Boolean;
+      List      : Mirror_List_Access;
+      Cursor    : Mirror_List.Cursor;
+      Path      : Mirror_Path;
+      From_Path : Unbounded_String;
+      To_Path   : Unbounded_String;
+      Machine   : Machine_Descriptor_Record;
+      Need_Sync : Boolean;

       function Get_Queue_Id return String;
       --  Get a new queue id if needed

+      ------------------
+      -- Get_Queue_Id --
+      ------------------
+
       function Get_Queue_Id return String is
       begin
          if Queue_Id /= "" then
@@ -3567,42 +3579,36 @@ package body GPS.Kernel.Remote is

          if Need_Sync then
             if From = "" then
-               From_Path := Ada.Strings.Unbounded.To_Unbounded_String
-                   (Path.Get_Local_Path);
-               To_Path   := Ada.Strings.Unbounded.To_Unbounded_String
-                   (Path.Get_Remote_Path);
+               From_Path := To_Unbounded_String (Path.Get_Local_Path);
+               To_Path   := To_Unbounded_String (Path.Get_Remote_Path);
                Machine   := Machine_Descriptor_Record
                  (Get_Machine_Descriptor (To).all);

             else
-               From_Path := Ada.Strings.Unbounded.To_Unbounded_String
-                 (Path.Get_Remote_Path);
-               To_Path   := Ada.Strings.Unbounded.To_Unbounded_String
-                 (Path.Get_Local_Path);
+               From_Path := To_Unbounded_String (Path.Get_Remote_Path);
+               To_Path   := To_Unbounded_String (Path.Get_Local_Path);
                Machine   := Machine_Descriptor_Record
                  (Get_Machine_Descriptor (From).all);
             end if;

             declare
                Data : aliased Rsync_Hooks_Args :=
-                 (Hooks_Data with
-                  Tool_Name_Length => Machine.Rsync_Func.all'Length,
-                  Src_Name_Length  => From'Length,
-                  Dest_Name_Length => To'Length,
-                  Queue_Id_Length  => The_Queue_Id'Length,
-                  Src_Path_Length  => Ada.Strings.Unbounded.Length (From_Path),
-                  Dest_Path_Length => Ada.Strings.Unbounded.Length (To_Path),
-                  Tool_Name        => Machine.Rsync_Func.all,
-                  Src_Name         => From,
-                  Dest_Name        => To,
-                  Queue_Id         => The_Queue_Id,
-                  Src_Path         =>
-                    Ada.Strings.Unbounded.To_String (From_Path),
-                  Dest_Path        =>
-                    Ada.Strings.Unbounded.To_String (To_Path),
-                  Synchronous      => Blocking,
-                  Print_Output     => Print_Output,
-                  Print_Command    => Print_Command);
+                        (Hooks_Data with
+                         Tool_Name_Length => Machine.Rsync_Func.all'Length,
+                         Src_Name_Length  => From'Length,
+                         Dest_Name_Length => To'Length,
+                         Queue_Id_Length  => The_Queue_Id'Length,
+                         Src_Path_Length  => Length (From_Path),
+                         Dest_Path_Length => Length (To_Path),
+                         Tool_Name        => Machine.Rsync_Func.all,
+                         Src_Name         => From,
+                         Dest_Name        => To,
+                         Queue_Id         => The_Queue_Id,
+                         Src_Path         => To_String (From_Path),
+                         Dest_Path        => To_String (To_Path),
+                         Synchronous      => Blocking,
+                         Print_Output     => Print_Output,
+                         Print_Command    => Print_Command);

             begin
                Trace (Me, "run sync hook for " & Data.Src_Path);
@@ -3613,10 +3619,8 @@ package body GPS.Kernel.Remote is
                   GPS.Kernel.Console.Insert
                     (Kernel,
                      Machine.Rsync_Func.all & (-" failure: ") &
-                     (-"Directories ") &
-                     Ada.Strings.Unbounded.To_String (From_Path) &
-                     (-" and ") &
-                     Ada.Strings.Unbounded.To_String (To_Path) &
+                     (-"Directories ") & To_String (From_Path) &
+                     (-" and ") & To_String (To_Path) &
                      (-" are not synchronized properly. ") &
                      (-"Please verify your network configuration"),
                      Mode => Error);
@@ -3665,22 +3669,22 @@ package body GPS.Kernel.Remote is
    -----------

    procedure Spawn
-     (Kernel            : Kernel_Handle;
-      Arguments         : GNAT.OS_Lib.Argument_List;
-      Server            : Server_Type;
-      Pd                : out GNAT.Expect.Process_Descriptor_Access;
-      Success           : out Boolean;
-      Use_Ext_Terminal  : Boolean := False;
-      Console           : Interactive_Consoles.Interactive_Console := null;
-      Show_Command      : Boolean := True;
-      Directory         : String := "";
-      Use_Pipes         : Boolean := True)
+     (Kernel           : Kernel_Handle;
+      Arguments        : GNAT.OS_Lib.Argument_List;
+      Server           : Server_Type;
+      Pd               : out GNAT.Expect.Process_Descriptor_Access;
+      Success          : out Boolean;
+      Use_Ext_Terminal : Boolean := False;
+      Console          : Interactive_Consoles.Interactive_Console := null;
+      Show_Command     : Boolean := True;
+      Directory        : String := "";
+      Use_Pipes        : Boolean := True)
    is
-      Exec                  : String_Access;
-      Old_Dir               : String_Access;
-      Args                  : Argument_List_Access;
+      Exec    : GNAT.OS_Lib.String_Access;
+      Old_Dir : GNAT.OS_Lib.String_Access;
+      Args    : Argument_List_Access;

-      function Check_Exec (Exec : String) return String_Access;
+      function Check_Exec (Exec : String) return GNAT.OS_Lib.String_Access;
       --  Check that executable is on the path, and return the full path if
       --  found, return null otherwise.

@@ -3691,9 +3695,9 @@ package body GPS.Kernel.Remote is
       -- Check_Exec --
       ----------------

-      function Check_Exec (Exec : String) return String_Access is
-         Full_Exec : String_Access;
-         Norm_Exec : String_Access;
+      function Check_Exec (Exec : String) return GNAT.OS_Lib.String_Access is
+         Full_Exec : GNAT.OS_Lib.String_Access;
+         Norm_Exec : GNAT.OS_Lib.String_Access;
       begin
          if Server = Build_Server then
             Full_Exec := Locate_Compiler_Executable (Exec);
@@ -3749,9 +3753,7 @@ package body GPS.Kernel.Remote is
          Args := new Argument_List'(Clone (Arguments));
       end if;

-      if Console /= null
-        and then Show_Command
-      then
+      if Console /= null and then Show_Command then
          if Is_Local (Server) then
             Insert (Console,
                     Argument_List_To_String (Arguments),
@@ -3804,7 +3806,7 @@ package body GPS.Kernel.Remote is
          --  Set buffer_size to 0 for dynamically allocated buffer (prevents
          --  possible overflow)
          declare
-            Oldpath : String_Access;
+            Oldpath : GNAT.OS_Lib.String_Access;
          begin
             if Is_Toolchains_Active then
                Oldpath := Getenv ("PATH");
@@ -3879,14 +3881,13 @@ package body GPS.Kernel.Remote is
          Insert
            (Kernel,
             -"Error while trying to execute " & Args (Args'First).all & ": " &
-            Ada.Exceptions.Exception_Message (E),
+            Exception_Message (E),
             Mode => Error);
       when E : Invalid_Nickname =>
          Success := False;
          Insert
            (Kernel,
-            -"Remote configuration error: " &
-            Ada.Exceptions.Exception_Message (E),
+            -"Remote configuration error: " & Exception_Message (E),
             Mode => Error);
    end Spawn;

============================================================
--- kernel/src/gps-kernel-standard_hooks.adb	0e76dda6b83c4fb2e5e8873dffa9d2497d061423
+++ kernel/src/gps-kernel-standard_hooks.adb	98899a9d1dc9b02e9b14aec95b48b3825046be92
@@ -61,6 +61,8 @@ package body GPS.Kernel.Standard_Hooks i

    function From_Callback_Data_Open_File
      (Data : Callback_Data'Class) return Hooks_Data'Class;
+   function From_Callback_Data_Compilation
+     (Data : Callback_Data'Class) return Hooks_Data'Class;
    function From_Callback_Data_String
      (Data : Callback_Data'Class) return Hooks_Data'Class;
    function From_Callback_Data_String_Boolean
@@ -508,6 +510,23 @@ package body GPS.Kernel.Standard_Hooks i
          Normalize         => Nth_Arg (Data, 5));
    end From_Callback_Data_Line_Info;

+   ------------------------------------
+   -- From_Callback_Data_Compilation --
+   ------------------------------------
+
+   function From_Callback_Data_Compilation
+     (Data : Callback_Data'Class) return Hooks_Data'Class
+   is
+      Category : constant String := Nth_Arg (Data, 2);
+   begin
+      return Compilation_Hooks_Args'
+        (Hooks_Data with
+         Length   => Category'Length,
+         Value    => Category,
+         Quiet    => Nth_Arg (Data, 3),
+         Shadow   => Nth_Arg (Data, 4));
+   end From_Callback_Data_Compilation;
+
    ---------------------------------
    -- From_Callback_Data_Location --
    ---------------------------------
@@ -1064,6 +1083,10 @@ package body GPS.Kernel.Standard_Hooks i
          Args_Creator => From_Callback_Data_String_Boolean'Access);

       Register_Hook_Data_Type
+        (Kernel, Compilation_Hook_Type,
+         Args_Creator => From_Callback_Data_Compilation'Access);
+
+      Register_Hook_Data_Type
         (Kernel, Project_Hook_Type,
          Args_Creator => From_Callback_Data_Project'Access);

============================================================
--- kernel/src/gps-kernel-standard_hooks.ads	69b6b4860bc4de8e138d236eb403e88391019b8b
+++ kernel/src/gps-kernel-standard_hooks.ads	218082c84512cb9bafde8f33e269f2adeb020dec
@@ -34,6 +34,12 @@ package GPS.Kernel.Standard_Hooks is

 package GPS.Kernel.Standard_Hooks is

+   -----------------
+   -- GPS Started --
+   -----------------
+
+   GPS_Started_Hook : constant Hook_Name := "gps_started";
+
    -----------
    -- Hooks --
    -----------
============================================================
--- kernel/src/gps-kernel-timeout.adb	307a6c2042ec1c9fb2e62309b846f03112c1e75d
+++ kernel/src/gps-kernel-timeout.adb	45d5d11a160ca4223a84ce65b277b46af8699710
@@ -214,8 +214,10 @@ package body GPS.Kernel.Timeout is

          if Command.Data.Console /= null then
             Trace (Me, "Connect the command_handler to the console");
-            Set_Command_Handler (Command.Data.Console, Data_Handler'Access,
-                                 Command.Data.all'Address);
+            Set_Command_Handler
+              (Command.Data.Console, Data_Handler'Access,
+               Command.Data.all'Address);
+
             Command.Data.Delete_Id := Object_Return_Callback.Object_Connect
               (Command.Data.Console, Gtk.Widget.Signal_Delete_Event,
                Delete_Handler'Access, GObject (Command.Data));
@@ -224,6 +226,7 @@ package body GPS.Kernel.Timeout is
          Command.Data.Start_Time := Ada.Calendar.Clock;

          Trace (Me, "Spawn the process");
+
          Spawn (Command.Data.D.Kernel,
                 Command.Data.Args.all,
                 Command.Data.Server,
@@ -259,6 +262,7 @@ package body GPS.Kernel.Timeout is
       then
          Trace (Me, "Process is finished");
          return Failure;
+
       else
          if Command.Data.Synchronous then
             Success := Process_Cb (Command.Data);
============================================================
--- kernel/src/gps-kernel.adb	5a992e70e78324a12fb38cb677dfd482ca5d0dda
+++ kernel/src/gps-kernel.adb	65d3376d6ac7515763d16014f5103b43d0e15a81
@@ -64,7 +64,6 @@ with Basic_Mapper;              use Basi
 with Gtkada.MDI;                use Gtkada.MDI;

 with Basic_Mapper;              use Basic_Mapper;
-
 with Default_Preferences;       use Default_Preferences;
 with Entities.Queries;          use Entities.Queries;
 with Entities;                  use Entities;
@@ -1575,12 +1574,6 @@ package body GPS.Kernel is

       Destroy_Clipboard (Handle);
       Destroy (Handle.Preferences);
-      Free (Handle.Gnatls_Cache);
-      Free (Handle.Gnatls_Server);
-      Free (Handle.GNAT_Version);
-      Free (Handle.Home_Dir);
-      Free (Handle.Prefix);
-      Free (Handle.Construct_Database);
       Remote_Descriptors.Finalize;

       Destroy (Handle.Registry.all);
@@ -1619,6 +1612,13 @@ package body GPS.Kernel is

       Destroy (Handle.Scripts);

+      Free (Handle.Gnatls_Cache);
+      Free (Handle.Gnatls_Server);
+      Free (Handle.GNAT_Version);
+      Free (Handle.Home_Dir);
+      Free (Handle.Prefix);
+      Free (Handle.Construct_Database);
+
       --  Free the memory allocated by gtk+, and disconnect all the callbacks,
       --  reclaiming the associated memory.
       Trace (Me, "Destroying the GPS kernel");
@@ -2403,7 +2403,7 @@ package body GPS.Kernel is
          L := Next (L);
       end loop;

-      --  Command is not in list: we steal a reference to it.
+      --  Command is not in list: we steal a reference to it

       Commands.Command_Queues.Append
         (Kernel.Perma_Commands, Commands.Command_Access (Command));
============================================================
--- kernel/src/gps-kernel.ads	a74998e6e7d33a3d1adfd1888ad1d3463644950a
+++ kernel/src/gps-kernel.ads	a4d8d88d79ea6f9a60dd9b2358909b2ba1de09b5
@@ -24,9 +24,10 @@ with System;
 with Ada.Unchecked_Deallocation;
 with System;

-with GNATCOLL.Scripts;
 with GNAT.Strings;
 with GNAT.Regpat;
+with GNATCOLL.Scripts;
+with GNATCOLL.VFS;

 with Glib.Object;  use Glib;
 with Glib.Xml_Int;
@@ -56,7 +57,6 @@ with Task_Manager;
 with Projects.Registry;
 with Switches_Chooser;
 with Task_Manager;
-with GNATCOLL.VFS;

 package GPS.Kernel is

@@ -779,6 +779,12 @@ package GPS.Kernel is
    File_Status_Changed_Hook      : constant Hook_Name := "file_status_changed";
    --  Called when the status of a file is changed : Modified, Unmodified...

+   --  Hooks with String_Hooks_Args argument
+   Compute_Build_Targets_Hook : constant Hook_Name := "compute_build_targets";
+   --  Called when computing list of build targets, e.g. list of mains, or list
+   --  of Makefile targets. The string parameter gives the kind of target to
+   --  be computed (e.g. "main", "makefile").
+
 private

    type Filter_Type is (Filter_And, Filter_Or, Filter_Not, Standard_Filter);
@@ -958,7 +964,8 @@ private
    --  User_Level   : system and user custom files loaded

    type Kernel_Scripts_Repository is
-      new GNATCOLL.Scripts.Scripts_Repository_Record with record
+     new GNATCOLL.Scripts.Scripts_Repository_Record
+   with record
       Kernel : Kernel_Handle;
    end record;

============================================================
--- kernel/src_info/ali_parser.adb	d83a4e48b8f56f63721fe440d1319a2d5be2f9ef
+++ kernel/src_info/ali_parser.adb	7099fb7294937b811d5c05acac93c0bf77ab3b7b
@@ -1,7 +1,7 @@
 -----------------------------------------------------------------------
 --                               G P S                               --
 --                                                                   --
---                     Copyright (C) 2003-2008, AdaCore              --
+--                 Copyright (C) 2003-2008, AdaCore                  --
 --                                                                   --
 -- GPS is free  software;  you can redistribute it and/or modify  it --
 -- under the terms of the GNU General Public License as published by --
@@ -169,7 +169,7 @@ package body ALI_Parser is
      (Handler : access LI_Handler_Record'Class;
       LI      : LI_File;
       Id      : Unit_Id) return Source_File;
-   --  Return a handle to the file matching Id.
+   --  Return a handle to the file matching Id

    procedure Process_Sdep
      (Handler : access LI_Handler_Record'Class;
@@ -177,7 +177,7 @@ package body ALI_Parser is
       Dep_Id  : Sdep_Id;
       Sunits  : Unit_To_Sfile_Table;
       Sfile   : in out Source_Dependency);
-   --  Return a handle to a specific file dependency (Dep).
+   --  Return a handle to a specific file dependency (Dep)

    procedure Process_Sdeps
      (Handler : access LI_Handler_Record'Class;
@@ -192,7 +192,7 @@ package body ALI_Parser is
       File              : Source_File;
       Deps              : Sdep_To_Sfile_Table;
       Imported_Projects : Project_Type_Array);
-   --  Register the dependencies for all files in Deps into File.
+   --  Register the dependencies for all files in Deps into File

    procedure Process_Withs
      (Sunits            : Unit_To_Sfile_Table;
@@ -237,7 +237,7 @@ package body ALI_Parser is
       Xref_Ent              : Nat;
       Sfiles                : Sdep_To_Sfile_Table;
       First_Sect, Last_Sect : Nat);
-   --  Save the Xref Entity information in the New_LI_File structure.
+   --  Save the Xref Entity information in the New_LI_File structure

    procedure Process_Xref_Section
      (Handler               : access ALI_Handler_Record'Class;
@@ -245,14 +245,14 @@ package body ALI_Parser is
       Xref_Sect             : Nat;
       Sfiles                : Sdep_To_Sfile_Table;
       First_Sect, Last_Sect : Nat);
-   --  Save the Xref information associated to the given With_Record.
+   --  Save the Xref information associated to the given With_Record

    procedure Process_Xrefs
      (Handler               : access ALI_Handler_Record'Class;
       LI                    : LI_File;
       Sfiles                : Sdep_To_Sfile_Table;
       First_Sect, Last_Sect : Nat);
-   --  Save the Xref information in the New_LI_File structure.
+   --  Save the Xref information in the New_LI_File structure

    function Update_ALI
      (Handler   : access ALI_Handler_Record'Class; LI : LI_File;
@@ -277,7 +277,7 @@ package body ALI_Parser is
       Xref_Ent              : Nat;
       Sfiles                :  Sdep_To_Sfile_Table;
       First_Sect, Last_Sect : Nat);
-   --  Process the parent type of an entity declared in Xref_Ent.
+   --  Process the parent type of an entity declared in Xref_Ent

    procedure Process_Overriding_Ref
      (Handler               : access ALI_Handler_Record'Class;
@@ -365,7 +365,7 @@ package body ALI_Parser is
       if C in E_Kind_To_Char'Range then
          return E_Kind_To_Char (C);
       else
-         --  If we reach this point, the character is illegal.
+         --  If we reach this point, the character is illegal
          Trace (Me, "Char_To_E_Kind: Invalid character '" & C & ''');
          return Unresolved_Entity_Kind;
       end if;
@@ -381,7 +381,7 @@ package body ALI_Parser is
       if C in Char_To_Reference_Kind'Range then
          return Char_To_Reference_Kind (C);
       else
-         --  If we reach this point, the character is illegal.
+         --  If we reach this point, the character is illegal
          Trace (Me, "Char_To_R_Kind: Invalid character '" & C'Img & ''');
          return Reference;
       end if;
@@ -397,7 +397,7 @@ package body ALI_Parser is
       Id      : Unit_Id) return Source_File
    is
       Base_Name : constant String :=
-                    Locale_To_UTF8
+                    Filesystems.Filename_To_UTF8
                       (Get_String (Units.Table (Id).Sfile));
       File      : Source_File;

@@ -452,7 +452,7 @@ package body ALI_Parser is
       Dep         : Sdep_Record renames Sdep.Table (Dep_Id);
       Is_Separate : constant Boolean := Dep.Subunit_Name /= No_Name;
       Base_Name   : constant String :=
-                      Locale_To_UTF8 (Get_String (Dep.Sfile));
+                      Filesystems.Filename_To_UTF8 (Get_String (Dep.Sfile));
       L           : LI_File := LI;
    begin
       --  Do we have one of the files belonging to LI itself ?
@@ -1418,9 +1418,10 @@ package body ALI_Parser is
                declare
                   Path : constant String := Object_Path (P, False, True, True);
                   File : constant String :=
-                    Locale_From_UTF8
-                      (Short_ALI_Filename (Short_ALI_Filename'First .. Last)
-                       & Extension);
+                           Filesystems.Filename_From_UTF8
+                             (Short_ALI_Filename
+                                (Short_ALI_Filename'First .. Last)
+                              & Extension);
                begin
                   if Path /= "" then
                      Dir := Locate_Regular_File (File, Path);
@@ -1433,7 +1434,7 @@ package body ALI_Parser is
          end;

          if P /= Project then
-            P := Parent_Project (P);
+            P := Extended_Project (P);
          else
             P := No_Project;
          end if;
@@ -1617,7 +1618,7 @@ package body ALI_Parser is

          --  Check other projects earlier in the extending tree
          if P /= Project then
-            P := Parent_Project (P);
+            P := Extended_Project (P);
          else
             P := No_Project;
          end if;
@@ -1635,7 +1636,7 @@ package body ALI_Parser is
       Source_Filename : Virtual_File;
       Project         : Project_Type) return Virtual_File
    is
-      LI : Virtual_File;
+      LI  : Virtual_File;
       Ext : Project_Type;
    begin
       case Get_Unit_Part_From_Filename (Project, Source_Filename) is
============================================================
--- kernel/src_info/projects-registry.adb	6984348e9231d0a829281326b8672f254ffba83e
+++ kernel/src_info/projects-registry.adb	155b5cc8da77f57240a438962f98feb5551ce994
@@ -26,7 +26,10 @@ with GNAT.Case_Util;            use GNAT
 with GNAT.Directory_Operations; use GNAT.Directory_Operations;
 with GNAT.OS_Lib;               use GNAT.OS_Lib;
 with GNAT.Case_Util;            use GNAT.Case_Util;
+
+with GNATCOLL.Traces;
 with GNATCOLL.Utils;            use GNATCOLL.Utils;
+with GNATCOLL.VFS;              use GNATCOLL.VFS;

 with ALI;
 with Namet;                     use Namet;
@@ -37,11 +40,9 @@ with Stringt;
 with Snames;                    use Snames;
 with Stringt;

-with Glib.Convert;              use Glib.Convert;
-
 with Csets;
 with File_Utils;                use File_Utils;
-with GNATCOLL.Traces;
+with Filesystems;               use Filesystems;
 with GPS.Intl;                  use GPS.Intl;
 with OS_Utils;                  use OS_Utils;
 with Prj.Com;                   use Prj.Com;
@@ -58,7 +59,6 @@ with Types;                     use Type
 with String_Hash;
 with Traces;                    use Traces;
 with Types;                     use Types;
-with GNATCOLL.VFS;              use GNATCOLL.VFS;

 package body Projects.Registry is

@@ -181,11 +181,8 @@ package body Projects.Registry is
       --  The list of source files in Predefined_Source_Path

       Xrefs_Subdir : GNAT.Strings.String_Access;
-      --  Object dirs subdirectory containing the cross-refs.
+      --  Object dirs subdirectory containing the cross-refs

-      Mode_Subdir             : GNAT.Strings.String_Access;
-      --  Object dirs subdirectory for current builder mode.
-
       Extensions : Languages_Htable.String_Hash_Table.HTable;
       --  The extensions registered for each language

@@ -993,7 +990,8 @@ package body Projects.Registry is
                Current_Source : constant Name_Id :=
                                   String_Elements (Registry) (Sources).Value;
                UTF8           : constant String :=
-                                  Locale_To_UTF8 (Name_Buffer (1 .. Name_Len));
+                                  Filesystems.Filename_To_UTF8
+                                    (Name_Buffer (1 .. Name_Len));
                Directory      : Name_Id := No_Name;
                Unit           : Unit_Project;
             begin
@@ -1033,8 +1031,9 @@ package body Projects.Registry is
                            --  non-utf8 file systems.
                            Get_Name_String (Directory);
                            declare
-                              Dir : constant String := Locale_To_UTF8
-                                (Name_Buffer (1 .. Name_Len));
+                              Dir : constant String :=
+                                      Filesystems.Filename_To_UTF8
+                                        (Name_Buffer (1 .. Name_Len));
                            begin
                               Name_Len := Dir'Length;
                               Name_Buffer (1 .. Name_Len) := Dir;
@@ -1439,7 +1438,8 @@ package body Projects.Registry is

          declare
             File : constant String :=
-                     Locale_To_UTF8 (Name_Buffer (1 .. Name_Len));
+                     Filesystems.Filename_To_UTF8
+                       (Name_Buffer (1 .. Name_Len));
          begin
             --  The project manager duplicates files that contain several
             --  units. Only add them once in the project sources.
@@ -1470,6 +1470,12 @@ package body Projects.Registry is

       --  Nothing to do if the only language is Ada, since this has already
       --  been taken care of.
+      --  ??? This is actually wrong in the case of a project created through
+      --  the debugger: the runtime files, for instance, were not found yet in
+      --  the source dirs, and were not part of the list of source files
+      --  returned by the project manager. But when we process the sources
+      --  below (Process_Explicit_Source), they get added. Luckily it seems
+      --  that gdb never creates an Ada-only project in any case

       if Languages'Length = 0
         or else (Languages'Length = 1
@@ -1575,7 +1581,9 @@ package body Projects.Registry is
                --  Convert the file to UTF8

                declare
-                  UTF8      : String := Locale_To_UTF8 (Buffer (1 .. Length));
+                  UTF8      : String :=
+                                Filesystems.Filename_To_UTF8
+                                  (Buffer (1 .. Length));
                   Part      : Unit_Part;
                   Unit_Name : Name_Id;
                begin
@@ -2140,7 +2148,8 @@ package body Projects.Registry is
       Use_Object_Path : Boolean;
       Project         : Project_Type := No_Project)
    is
-      Locale                 : constant String := Locale_From_UTF8 (Filename);
+      Locale                 : constant String :=
+                                 Filesystems.Filename_From_UTF8 (Filename);
       Project2, Real_Project : Project_Type;
       Path                   : GNAT.Strings.String_Access;
       Iterator               : Imported_Project_Iterator;
@@ -2154,7 +2163,7 @@ package body Projects.Registry is

       if Is_Absolute_Path (Filename) then
          declare
-            S : constant String := Locale_To_UTF8
+            S : constant String := Filesystems.Filename_To_UTF8
               (Normalize_Pathname (Locale, Resolve_Links => False));
          begin
             Name_Len := S'Length;
@@ -2259,7 +2268,7 @@ package body Projects.Registry is

          if Path /= null then
             declare
-               Full : constant String := Locale_To_UTF8
+               Full : constant String := Filesystems.Filename_To_UTF8
                  (Normalize_Pathname
                     (Path.all, Resolve_Links => False));
             begin
@@ -2368,8 +2377,8 @@ package body Projects.Registry is
          --  Else just open the relative paths. This is mostly intended
          --  for files opened from the command line.
          return Create
-           (Full_Filename => Locale_To_UTF8
-              (Normalize_Pathname (Locale_From_UTF8 (Name),
+           (Full_Filename => Filesystems.Filename_To_UTF8
+              (Normalize_Pathname (Filesystems.Filename_From_UTF8 (Name),
                                    Resolve_Links => False)));
       end if;
    end Create;
@@ -2410,13 +2419,14 @@ package body Projects.Registry is
    procedure Set_Mode_Subdir
      (Registry : in out Project_Registry; Subdir : String)
    is
+      pragma Unreferenced (Registry);
    begin
-      if Registry.Data.Mode_Subdir /= null then
-         GNAT.Strings.Free (Registry.Data.Mode_Subdir);
+      if Prj.Subdirs /= null then
+         Types.Free (Prj.Subdirs);
       end if;

       if Subdir /= "" then
-         Registry.Data.Mode_Subdir := new String'(Subdir);
+         Prj.Subdirs := new String'(Subdir);
       end if;
    end Set_Mode_Subdir;

@@ -2438,14 +2448,15 @@ package body Projects.Registry is
    -- Get_Mode_Subdir --
    ---------------------

-   function Get_Mode_Subdir
-     (Registry : Project_Registry) return String is
+   function Get_Mode_Subdir (Registry : Project_Registry) return String
+   is
+      pragma Unreferenced (Registry);
    begin
-      if Registry.Data.Mode_Subdir = null then
+      if Prj.Subdirs = null then
          return "";
       end if;

-      return Registry.Data.Mode_Subdir.all;
+      return Prj.Subdirs.all;
    end Get_Mode_Subdir;

    --------------
============================================================
--- kernel/src_info/projects.adb	51b2e995fb3b412d5efe92afbe9c98bef1ee6261
+++ kernel/src_info/projects.adb	4cb6582f670546c79d338fb3d9f831c1a8547ab4
@@ -20,7 +20,6 @@ with Ada.Strings.Fixed;          use Ada
 with Ada.Characters.Handling;    use Ada.Characters.Handling;
 with Ada.Strings;                use Ada.Strings;
 with Ada.Strings.Fixed;          use Ada.Strings.Fixed;
-with Ada.Strings.Unbounded;      use Ada.Strings.Unbounded;
 with Ada.Strings.Hash;
 with Ada.Strings.Maps.Constants; use Ada.Strings.Maps.Constants;
 with Ada.Text_IO;                use Ada, Ada.Text_IO;
@@ -50,7 +49,8 @@ with Traces;
 with Snames;                     use Snames;
 with String_Hash;
 with Traces;
-with GNATCOLL.VFS;                        use GNATCOLL.VFS;
+with Types;                      use Types;
+with GNATCOLL.VFS;               use GNATCOLL.VFS;

 package body Projects is

@@ -481,14 +481,14 @@ package body Projects is
       Recursive : Boolean;
       Has_VCS   : Boolean := False) return GNAT.Strings.String_List_Access
    is
-      Iter    : Imported_Project_Iterator := Start (Project, Recursive);
-      Count   : Natural := 0;
-      P       : Project_Type;
-      Sources : GNAT.Strings.String_List_Access;
-      Result  : GNAT.Strings.String_List_Access;
-      Src     : String_List_Id;
-      Index   : Natural := 1;
       Current_Dir : constant String := Get_Current_Dir;
+      Iter        : Imported_Project_Iterator := Start (Project, Recursive);
+      Count       : Natural := 0;
+      P           : Project_Type;
+      Sources     : GNAT.Strings.String_List_Access;
+      Result      : GNAT.Strings.String_List_Access;
+      Src         : String_List_Id;
+      Index       : Natural := 1;
    begin
       loop
          P := Current (Iter);
@@ -572,81 +572,42 @@ package body Projects is
       Including_Libraries : Boolean := True;
       Xrefs_Dirs          : Boolean := False) return String
    is
-      function Handle_Subdir (Path : String) return String;
+      View : constant Project_Id := Get_View (Project);
+
+      function Handle_Subdir (Id : Namet.Path_Name_Type) return String;
       --  for all directories defined in Path, detect if "From_Subdir" exists,
       --  and return it instead.

-      function Get_Subdir return String;
-      --  Return the object subdir that needs to be used, or empty string
-
-      function Get_Subdir return String is
-         Reg : Project_Registry renames
-                 Project_Registry (Get_Registry (Project));
-      begin
-         if Xrefs_Dirs and then Get_Xrefs_Subdir (Reg) /= "" then
-            return Get_Xrefs_Subdir (Reg);
-         else
-            return Get_Mode_Subdir (Reg);
-         end if;
-      end Get_Subdir;
-
       -------------------
       -- Handle_Subdir --
       -------------------

-      function Handle_Subdir (Path : String) return String is
-         From_Subdir : constant String := Get_Subdir;
+      function Handle_Subdir (Id : Namet.Path_Name_Type) return String is
+         Path : constant String := Name_As_Directory (Get_String (Id));
+         Reg  : constant Project_Registry :=
+                  Project_Registry (Get_Registry (Project));
       begin
-         if From_Subdir = "" then
+         if not Xrefs_Dirs or else Get_Xrefs_Subdir (Registry => Reg) = "" then
             return Path;
+         elsif Projects_Table (Project) (View).Externally_Built then
+            return Path;
+         elsif Prj.Subdirs /= null then
+            return Name_As_Directory
+              (Path (Path'First .. Path'Last - Prj.Subdirs.all'Length - 1) &
+               Get_Xrefs_Subdir (Registry => Reg));
+         else
+            return Name_As_Directory
+              (Path & Get_Xrefs_Subdir (Registry => Reg));
          end if;
-
-         declare
-            Iter        : File_Utils.Path_Iterator;
-            Ret         : Unbounded_String := Null_Unbounded_String;
-
-         begin
-            Iter := File_Utils.Start (Path);
-
-            while not At_End (Path, Iter) loop
-               declare
-                  Dir : constant GNATCOLL.VFS.Virtual_File :=
-                          GNATCOLL.VFS.Create (Current (Path, Iter));
-                  Subdir : constant GNATCOLL.VFS.Virtual_File :=
-                             GNATCOLL.VFS.Create_From_Dir (Dir, From_Subdir);
-               begin
-                  if Ret /= Null_Unbounded_String then
-                     Append (Ret, Path_Separator);
-                  end if;
-
-                  if Subdir.Is_Directory then
-                     Append (Ret, Subdir.Full_Name.all);
-                  else
-                     if Active (Debug) then
-                        Trace (Debug, "Object_Path: no subdir " & From_Subdir &
-                               " in " & Subdir.Full_Name.all);
-                     end if;
-
-                     Append (Ret, Dir.Full_Name.all);
-                  end if;
-               end;
-
-               Iter := Next (Path, Iter);
-            end loop;
-
-            return To_String (Ret);
-         end;
       end Handle_Subdir;

-      View : constant Project_Id := Get_View (Project);
    begin
       if View = Prj.No_Project then
          return "";

       elsif Recursive then
-         return Handle_Subdir
-           (Prj.Env.Ada_Objects_Path
-              (View, Project.View_Tree, Including_Libraries).all);
+         return Prj.Env.Ada_Objects_Path
+           (View, Project.View_Tree, Including_Libraries).all;

       elsif Including_Libraries
         and then Projects_Table (Project)(View).Library
@@ -657,21 +618,19 @@ package body Projects is
                                              No_Path_Information
          then
             return Handle_Subdir
-              (Get_String
-                 (Projects_Table (Project) (View).Library_ALI_Dir.Name));
+              (Projects_Table (Project) (View).Library_ALI_Dir.Name);
          else
             return Handle_Subdir
-              (Get_String
                 (Projects_Table (Project) (View).Object_Directory.Display_Name)
-               & Path_Separator & Get_String
-                 (Projects_Table (Project) (View).Library_ALI_Dir.Name));
+              & Path_Separator
+              & Handle_Subdir
+                 (Projects_Table (Project) (View).Library_ALI_Dir.Name);
          end if;
       elsif Projects_Table (Project)(View).Object_Directory /=
                                              No_Path_Information
       then
          return Handle_Subdir
-           (Get_String
-              (Projects_Table (Project) (View).Object_Directory.Display_Name));
+              (Projects_Table (Project) (View).Object_Directory.Display_Name);

       else
          return "";
@@ -688,6 +647,7 @@ package body Projects is
       --  precomputed when the project is loaded
       if Get_View (Project) = Prj.No_Project then
          return 0;
+
       else
          return Length (Project.View_Tree,
                         Projects_Table
@@ -1630,26 +1590,9 @@ package body Projects is
              (Name_Id
               (Projects_Table
                 (Project)(Get_View (Project)).Exec_Directory.Display_Name));
-            Reg : Project_Registry renames
-                    Project_Registry (Get_Registry (Project));
          begin
             if Exec /= "" then
-               if Get_Mode_Subdir (Reg) = "" then
-                  return Name_As_Directory (Exec);
-               else
-                  declare
-                     Dir : constant GNATCOLL.VFS.Virtual_File :=
-                             GNATCOLL.VFS.Create
-                               (Name_As_Directory (Exec) &
-                                Get_Mode_Subdir (Reg));
-                  begin
-                     if Dir.Is_Directory then
-                        return Dir.Full_Name.all;
-                     else
-                        return Name_As_Directory (Exec);
-                     end if;
-                  end;
-               end if;
+               return Name_As_Directory (Exec);
             else
                return Name_As_Directory
                  (Object_Path (Project, Recursive => False));
@@ -1864,7 +1807,7 @@ package body Projects is
             Index := Index - 1;
          end loop;

-         Current := Parent_Project (Current);
+         Current := Extended_Project (Current);
          exit when Current = No_Project;
       end loop;

@@ -1896,7 +1839,7 @@ package body Projects is
             Start.Data.Importing_Projects := new Name_Id_Array'(Importing.all);
          end if;

-         Start := Parent_Project (Start);
+         Start := Extended_Project (Start);
          exit when Start = No_Project;
       end loop;

@@ -2824,24 +2767,6 @@ package body Projects is
       return Current (Iter) /= No_Project;
    end Has_Imported_Projects;

-   --------------------
-   -- Parent_Project --
-   --------------------
-
-   function Parent_Project (Project : Project_Type) return Project_Type is
-      Extend : constant Project_Node_Id := Extended_Project_Of
-        (Project_Declaration_Of (Project.Node, Project.Tree),
-         Project.Tree);
-   begin
-      if Extend = Empty_Node then
-         return No_Project;
-      else
-         return Get_Project_From_Name
-           (Project.Data.Registry.all,
-            Prj.Tree.Name_Of (Extend, Project.Tree));
-      end if;
-   end Parent_Project;
-
    ----------
    -- Prj1 --
    ----------
============================================================
--- kernel/src_info/projects.ads	47cb814c94cbcae37ab83c5670207b564f080cd6
+++ kernel/src_info/projects.ads	ed15a6e88aea46d9db70011dcb041af04e33fa90
@@ -91,7 +91,7 @@ package Projects is
       Project         : Projects.Project_Type;
       Use_Source_Path : Boolean := True;
       Use_Object_Path : Boolean := True) return GNATCOLL.VFS.Virtual_File;
-   --  Create a new instance of the file.
+   --  Create a new instance of the file

    -------------------
    -- Project files --
@@ -135,14 +135,10 @@ package Projects is
    --  Return the directory that contains the project file.
    --  No_File is returned if the project is No_Project.

-   function Parent_Project (Project : Project_Type) return Project_Type;
-   --  Return the project that Project is extending, or No_Project if there are
-   --  none.
-
    function Extended_Project
      (Project : Project_Type) return Project_Type;
    --  Return the project extended by project, or No_Project is there is none.
-   --  ??? What happens with "extends all" projects ?x
+   --  ??? What happens with "extends all" projects ?

    function Extending_Project
      (Project : Project_Type; Recurse : Boolean := False) return Project_Type;
@@ -196,7 +192,7 @@ package Projects is
    --  If an Xrefs Subdir is set in the project registry to a non-empty string,
    --  and Xrefs_Dir is set, then the corresponding subdirectory is returned if
    --  it exists. Else, the subdir corresponding to the current builder mode
-   --  is returned.
+   --  is returned. This mode only works when recursive is unset.

    function Directory_Contains_Files
      (Project   : Project_Type;
@@ -483,7 +479,7 @@ package Projects is
    --  No_Project is returned if there are no more projects to process.

    procedure Next (Iterator : in out Imported_Project_Iterator);
-   --  Move to the next imported project.
+   --  Move to the next imported project

    function Is_Limited_With
      (Iterator : Imported_Project_Iterator) return Boolean;
@@ -687,16 +683,16 @@ private
      (Project   : Project_Type;
       Dir_Name  : String;
       Has_Files : Boolean);
-   --  Update the directories cache.
+   --  Update the directories cache

    procedure Destroy (Project : in out Project_Type);
-   --  Free the memory associated with the project.
+   --  Free the memory associated with the project

    procedure Set_Is_Normalized (Project : Project_Type; Normalized : Boolean);
    --  Indicate the normalization status of the project

    procedure Set_View_Is_Complete (Project : Project_Type; Complete : Boolean);
-   --  Indicate whether the view for the project was correctly computed.
+   --  Indicate whether the view for the project was correctly computed

    function Is_External_Variable
      (Var  : Prj.Tree.Project_Node_Id;
============================================================
--- keymanager/src/keymanager_module-macros.adb	49718c1a1320e4cb1c7485f57a147707171dff2c
+++ keymanager/src/keymanager_module-macros.adb	e4a0dd37feecbd836bbaef18ef57436559187247
@@ -1,7 +1,7 @@
 -----------------------------------------------------------------------
 --                               G P S                               --
 --                                                                   --
---                     Copyright (C) 2003-2008, AdaCore              --
+--                 Copyright (C) 2003-2008, AdaCore                  --
 --                                                                   --
 -- GPS is free  software;  you can redistribute it and/or modify  it --
 -- under the terms of the GNU General Public License as published by --
@@ -17,69 +17,74 @@
 -- Place - Suite 330, Boston, MA 02111-1307, USA.                    --
 -----------------------------------------------------------------------

-with Ada.Calendar;            use Ada.Calendar;
-with Commands.Interactive;    use Commands, Commands.Interactive;
-with Gdk.Event;               use Gdk.Event;
-with Gdk.Types.Keysyms;       use Gdk.Types, Gdk.Types.Keysyms;
-with Glib.Convert;            use Glib, Glib.Convert;
-with Glib.Main;               use Glib.Main;
-with Glib.Object;             use Glib.Object;
-with GNATCOLL.Scripts;            use GNATCOLL.Scripts;
-with GNAT.Strings;            use GNAT.Strings;
+with Ada.Calendar;              use Ada.Calendar;
+
+with GNAT.Strings;              use GNAT.Strings;
+with GNATCOLL.Scripts;          use GNATCOLL.Scripts;
+with GNATCOLL.VFS;              use GNATCOLL.VFS;
 with GNATCOLL.Traces;
-with GPS.Kernel;              use GPS.Kernel;
-with GPS.Kernel.Actions;      use GPS.Kernel.Actions;
-with GPS.Kernel.Console;      use GPS.Kernel.Console;
-with GPS.Kernel.Hooks;        use GPS.Kernel.Hooks;
-with GPS.Kernel.MDI;          use GPS.Kernel.MDI;
-with GPS.Kernel.Modules;      use GPS.Kernel.Modules;
-with GPS.Kernel.Preferences;  use GPS.Kernel.Preferences;
-with GPS.Kernel.Scripts;      use GPS.Kernel.Scripts;
+
+with Glib.Main;                 use Glib, Glib.Main;
+with Glib.Object;               use Glib.Object;
+with Gdk.Event;                 use Gdk.Event;
+with Gdk.Types.Keysyms;         use Gdk.Types, Gdk.Types.Keysyms;
+with Gtk.Menu_Item;             use Gtk.Menu_Item;
+with Gtk.Widget;                use Gtk.Widget;
+with Gtk.Window;                use Gtk.Window;
+with Gtkada.File_Selector;      use Gtkada.File_Selector;
+with Gtkada.Macro;              use Gtkada.Macro;
+with Gtkada.MDI;                use Gtkada.MDI;
+
+with Commands.Interactive;      use Commands, Commands.Interactive;
+with Filesystems;               use Filesystems;
+with GPS.Kernel;                use GPS.Kernel;
+with GPS.Kernel.Actions;        use GPS.Kernel.Actions;
+with GPS.Kernel.Console;        use GPS.Kernel.Console;
+with GPS.Kernel.Hooks;          use GPS.Kernel.Hooks;
+with GPS.Kernel.MDI;            use GPS.Kernel.MDI;
+with GPS.Kernel.Modules;        use GPS.Kernel.Modules;
+with GPS.Kernel.Preferences;    use GPS.Kernel.Preferences;
+with GPS.Kernel.Scripts;        use GPS.Kernel.Scripts;
 with GPS.Kernel.Standard_Hooks; use GPS.Kernel.Standard_Hooks;
-with GPS.Intl;                use GPS.Intl;
-with Gtkada.File_Selector;    use Gtkada.File_Selector;
-with Gtkada.Macro;            use Gtkada.Macro;
-with Gtkada.MDI;              use Gtkada.MDI;
-with Gtk.Menu_Item;           use Gtk.Menu_Item;
-with Gtk.Widget;              use Gtk.Widget;
-with Gtk.Window;              use Gtk.Window;
-with Traces;                  use Traces;
-with GNATCOLL.VFS;                     use GNATCOLL.VFS;
+with GPS.Intl;                  use GPS.Intl;
+with Traces;                    use Traces;

 package body KeyManager_Module.Macros is
-   Me        : constant Debug_Handle := Create ("Keymanager.Macros");

+   Me                  : constant Debug_Handle := Create ("Keymanager.Macros");
+
    Mouse_Macro_Support : constant Debug_Handle :=
-     Create ("Keymanager.Mouse_Macro", GNATCOLL.Traces.Off);
+                           Create
+                             ("Keymanager.Mouse_Macro", GNATCOLL.Traces.Off);
    --  ??? For now disable by default since this is a work in progress

    File_Cst                  : aliased constant String := "file";
    Speed_Cst                 : aliased constant String := "speed";
    Load_Macro_Cmd_Parameters : constant Cst_Argument_List :=
-     (1 => File_Cst'Access);
+                                 (1 => File_Cst'Access);
    Play_Macro_Cmd_Parameters : constant Cst_Argument_List :=
-     (1 => Speed_Cst'Access);
+                                 (1 => Speed_Cst'Access);

    type Events_Mask is array (Gdk_Event_Type) of Boolean;
    --  What type of events should be recorded

    type Event_Set is record
-      Events           : Macro_Item_Access;
-      --  Set of events recorded.
+      Events        : Macro_Item_Access;
+      --  Set of events recorded

-      Last_Event       : Macro_Item_Access;
-      --  Last event recorded.
+      Last_Event    : Macro_Item_Access;
+      --  Last event recorded

-      Prev_Time         : Guint32;
-      --  Time of previous event recorded.
+      Prev_Time     : Guint32;
+      --  Time of previous event recorded

-      Current_Event    : Macro_Item_Access;
-      --  Current event being replayed.
+      Current_Event : Macro_Item_Access;
+      --  Current event being replayed

-      Speed            : Duration := 1.0;
-      --  Speed at which replay is made. 1.0 means normal speed.
+      Speed         : Duration := 1.0;
+      --  Speed at which replay is made. 1.0 means normal speed

-      Child            : GPS_MDI_Child;
+      Child         : GPS_MDI_Child;
       --  Current MDI window when we started playing the macro. This is used
       --  to create undo groups. This will not work when multiple editors are
       --  impacted by the macro, but will enhance behavior when inside a
@@ -112,7 +117,7 @@ package body KeyManager_Module.Macros is
       --  Mask of events to record

       Start_Clock       : Ada.Calendar.Time;
-      --  Start time of event replay.
+      --  Start time of event replay

       Time_Spent        : Guint32;
       --  Virtual time spent so far in events (addition of Events.Time)
@@ -145,7 +150,7 @@ package body KeyManager_Module.Macros is
    procedure Macro_Command_Handler
      (Data    : in out Callback_Data'Class;
       Command : String);
-   --  Interactive command handler for the key manager module.
+   --  Interactive command handler for the key manager module

    function Record_Macro
      (Kernel : Kernel_Handle;
@@ -158,7 +163,7 @@ package body KeyManager_Module.Macros is
      (Kernel : Kernel_Handle;
       Speed  : Duration := 1.0;
       Macro  : Event_Set_Access);
-   --  Play current set of events.
+   --  Play current set of events

    procedure Stop_Macro
      (Kernel : Kernel_Handle;
@@ -169,17 +174,17 @@ package body KeyManager_Module.Macros is
    --  Stop running current macro as a result of the "stop_macro_action_hook'

    function Load_Macro
-     (Kernel  : access Kernel_Handle_Record'Class;
-      File    : Virtual_File) return Event_Set_Access;
-   --  Load macro file.
+     (Kernel : access Kernel_Handle_Record'Class;
+      File   : Virtual_File) return Event_Set_Access;
+   --  Load macro file

    procedure On_Load_Macro
      (Widget : access GObject_Record'Class; Kernel : Kernel_Handle);
-   --  Callback for loading set of events to replay.
+   --  Callback for loading set of events to replay

    procedure On_Save_Macro
      (Widget : access GObject_Record'Class; Kernel : Kernel_Handle);
-   --  Save last set of events recorded.
+   --  Save last set of events recorded

    function Play_Macro_Timer (Events : Event_Set_Access) return Boolean;
    --  Move to next event, and play it
@@ -452,7 +457,7 @@ package body KeyManager_Module.Macros is

    function Play_Macro_Timer (Events : Event_Set_Access) return Boolean is
       Kernel        : constant Kernel_Handle :=
-        Get_Kernel (Keymanager_Macro_Module.all);
+                        Get_Kernel (Keymanager_Macro_Module.all);
       Current_Event : Macro_Item_Access renames Events.Current_Event;
       Success       : Boolean;
       Id            : G_Source_Id;
@@ -486,7 +491,7 @@ package body KeyManager_Module.Macros is
      (Kernel : Kernel_Handle;
       Events : Event_Set_Access)
    is
-      Macro         : constant String := '/' & (-"Tools/Macro") & '/';
+      Macro : constant String := '/' & (-"Tools/Macro") & '/';
    begin
       Events.Current_Event := null;

@@ -503,8 +508,8 @@ package body KeyManager_Module.Macros is
    procedure Stop_Macro_Hook_Cb (Kernel : access Kernel_Handle_Record'Class) is
    begin
       if Keymanager_Macro_Module.Current_Macro /= null then
-         Stop_Macro (Kernel_Handle (Kernel),
-                     Keymanager_Macro_Module.Current_Macro);
+         Stop_Macro
+           (Kernel_Handle (Kernel), Keymanager_Macro_Module.Current_Macro);
       end if;
    end Stop_Macro_Hook_Cb;

@@ -517,10 +522,10 @@ package body KeyManager_Module.Macros is
       Speed  : Duration := 1.0;
       Macro  : Event_Set_Access)
    is
-      Macro_Menu    : constant String := '/' & (-"Tools/Macro") & '/';
-      Id            : G_Source_Id;
+      Macro_Menu : constant String := '/' & (-"Tools/Macro") & '/';
+      Id         : G_Source_Id;
       pragma Unreferenced (Id);
-      C             : MDI_Child;
+      C          : MDI_Child;

    begin
       if Macro /= null then
@@ -531,6 +536,7 @@ package body KeyManager_Module.Macros is
             Trace (Me, "Play_Macro: a macro is already playing, stopping it"
                    & " and cancelling new call to play");
             Stop_Macro (Kernel, Keymanager_Macro_Module.Current_Macro);
+
          else
             Macro.Current_Event := Macro.Events;

@@ -603,7 +609,7 @@ package body KeyManager_Module.Macros is
    is
       pragma Unreferenced (Widget);
       Events : constant Macro_Item_Access :=
-        Keymanager_Macro_Module.Current_Macro.Events;
+                 Keymanager_Macro_Module.Current_Macro.Events;
    begin
       if Events = null then
          return;
@@ -612,20 +618,20 @@ package body KeyManager_Module.Macros is
       declare
          Success : Boolean;
          Name    : constant Virtual_File :=
-           Select_File
-             (Title             => -"Save Macro As",
-              Parent            => Get_Current_Window (Kernel),
-              Use_Native_Dialog => Use_Native_Dialogs.Get_Pref,
-              Kind              => Save_File,
-              History           => Get_History (Kernel));
+                     Select_File
+                       (Title             => -"Save Macro As",
+                        Parent            => Get_Current_Window (Kernel),
+                        Use_Native_Dialog => Use_Native_Dialogs.Get_Pref,
+                        Kind              => Save_File,
+                        History           => Get_History (Kernel));

       begin
          if Name = GNATCOLL.VFS.No_File then
             return;
          end if;

-         Success :=
-           Save_List (Locale_From_UTF8 (Full_Name (Name).all), Events);
+         Success := Save_List
+           (Filesystems.Filename_From_UTF8 (Full_Name (Name).all), Events);

          if not Success then
             Insert (Kernel, -"Error while saving macro", Mode => Error);
@@ -641,8 +647,8 @@ package body KeyManager_Module.Macros is
    ----------------

    function Load_Macro
-     (Kernel  : access Kernel_Handle_Record'Class;
-      File    : Virtual_File) return Event_Set_Access
+     (Kernel : access Kernel_Handle_Record'Class;
+      File   : Virtual_File) return Event_Set_Access
    is
       pragma Unreferenced (Kernel);
       Buffer  : String_Access := Read_File (File);
@@ -670,7 +676,7 @@ package body KeyManager_Module.Macros is
    is
       pragma Unreferenced (Kernel);
       Macro       : constant Event_Set_Access :=
-        Keymanager_Macro_Module.Current_Macro;
+                      Keymanager_Macro_Module.Current_Macro;
       Event_Type  : constant Gdk_Event_Type := Get_Event_Type (Event);
       Key_Item    : Macro_Item_Key_Access;
       Button_Item : Macro_Item_Mouse_Access;
@@ -692,7 +698,7 @@ package body KeyManager_Module.Macros is
                Macro.Last_Event := Item;

             else
-               --  Store the relative time, to ease replay.
+               --  Store the relative time, to ease replay

                Item.Prev := Macro.Last_Event;
                Macro.Last_Event.Next := Item;
============================================================
--- navigation/src/navigation_module.adb	347994dfd17021585628aea69673b238d09d69d0
+++ navigation/src/navigation_module.adb	3aa4cad20ed56a59fa90ad8b43fd654fef63efbf
@@ -318,6 +318,7 @@ package body Navigation_Module is
          if File = null then
             Insert (Kernel, Err.all, Mode => Error);
             Free (Err);
+
          else
             M.Markers := new Location_Marker_Array
               (1 .. Max_Locations_In_History);
@@ -699,6 +700,7 @@ package body Navigation_Module is
             if B_Start /= 0 then
                if B_Start /= Line then
                   Set_Current_Line (Kernel, File, B_Start);
+
                else
                   --  We are already at the start of the block, look for
                   --  enclosing block.
============================================================
--- prj_editor/src/creation_wizard-extending.adb	b6ee6d02ec94acbf1015157a417f762f0b4c6f42
+++ prj_editor/src/creation_wizard-extending.adb	c9756a03f5553a58b77e26004327680049f755b6
@@ -246,8 +246,8 @@ package body Creation_Wizard.Extending i
       --  is itself an expanding project, we prefer to expand the original
       --  project.

-      while Parent_Project (Parent) /= No_Project loop
-         Parent := Parent_Project (Parent);
+      while Extended_Project (Parent) /= No_Project loop
+         Parent := Extended_Project (Parent);
       end loop;

       Set_Extended_Project
@@ -336,7 +336,7 @@ package body Creation_Wizard.Extending i
    begin
       --  Search whether there is already a project extending File_Project
       while Current (Iter) /= No_Project
-        and then Parent_Project (Current (Iter)) /= File_Project
+        and then Extended_Project (Current (Iter)) /= File_Project
       loop
          Next (Iter);
       end loop;
@@ -444,7 +444,7 @@ package body Creation_Wizard.Extending i
    begin
       --  If the current root project is an extending all project

-      if Parent_Project (Get_Project (Kernel)) /= No_Project then
+      if Extended_Project (Get_Project (Kernel)) /= No_Project then
          File := File_Information (Context);
          if File /= GNATCOLL.VFS.No_File then
             Project := Get_Project_From_File
@@ -452,7 +452,7 @@ package body Creation_Wizard.Extending i

             --  If the file doesn't already belong to an extending project
             if Project /= No_Project
-              and then Parent_Project (Project) = No_Project
+              and then Extended_Project (Project) = No_Project
             then
                return True;
             end if;
============================================================
--- prj_editor/src/project_explorers.adb	0b9bb404849c68f4a4c7c70a6269b2961f863cec
+++ prj_editor/src/project_explorers.adb	8aba2e0e8ec8c02de4fc0d8ae72ae2bc09ca0de1
@@ -24,9 +24,9 @@ with GNATCOLL.Traces;

 with GNAT.OS_Lib;               use GNAT.OS_Lib;
 with GNATCOLL.Traces;
+with GNATCOLL.VFS;              use GNATCOLL.VFS;

 with Glib;                      use Glib;
-with Glib.Convert;              use Glib.Convert;
 with Glib.Object;               use Glib.Object;
 with Glib.Values;               use Glib.Values;
 with Glib.Xml_Int;              use Glib.Xml_Int;
@@ -68,6 +68,7 @@ with File_Utils;                use File
 with Entities;
 with Find_Utils;                use Find_Utils;
 with File_Utils;                use File_Utils;
+with Filesystems;               use Filesystems;
 with Histories;                 use Histories;
 with GPS.Kernel;                use GPS.Kernel;
 with GPS.Kernel.Console;        use GPS.Kernel.Console;
@@ -88,7 +89,6 @@ with Traces;                    use Trac
 with String_Utils;              use String_Utils;
 with Tooltips;
 with Traces;                    use Traces;
-with GNATCOLL.VFS;                       use GNATCOLL.VFS;

 package body Project_Explorers is

@@ -313,7 +313,7 @@ package body Project_Explorers is
    function Key_Press
      (Explorer : access Gtk_Widget_Record'Class;
       Event    : Gdk_Event) return Boolean;
-   --  Calledback on a key press.
+   --  Calledback on a key press

    procedure Tree_Select_Row_Cb
      (Explorer : access Gtk.Widget.Gtk_Widget_Record'Class; Args : GValues);
@@ -783,9 +783,9 @@ package body Project_Explorers is
    ---------------

    function Sort_Func
-     (Model     : access Gtk.Tree_Model.Gtk_Tree_Model_Record'Class;
-      A         : Gtk.Tree_Model.Gtk_Tree_Iter;
-      B         : Gtk.Tree_Model.Gtk_Tree_Iter) return Gint
+     (Model : access Gtk.Tree_Model.Gtk_Tree_Model_Record'Class;
+      A     : Gtk.Tree_Model.Gtk_Tree_Iter;
+      B     : Gtk.Tree_Model.Gtk_Tree_Iter) return Gint
    is
       A_Before_B : Gint := -1;
       B_Before_A : Gint := 1;
@@ -800,6 +800,10 @@ package body Project_Explorers is
       --  Compare the two nodes alphabetically
       --  ??? Should take into account the sorting order

+      ------------------
+      -- Alphabetical --
+      ------------------
+
       function Alphabetical return Gint is
          A_Name : constant String := Get_String (Model, A, Column);
          B_Name : constant String := Get_String (Model, B, Column);
@@ -912,8 +916,9 @@ package body Project_Explorers is
    procedure Preferences_Changed
      (Kernel : access Kernel_Handle_Record'Class)
    is
-      Child : constant MDI_Child := Find_MDI_Child_By_Tag
-        (Get_MDI (Kernel), Project_Explorer_Record'Tag);
+      Child    : constant MDI_Child :=
+                   Find_MDI_Child_By_Tag
+                     (Get_MDI (Kernel), Project_Explorer_Record'Tag);
       Explorer : Project_Explorer_Access;
    begin
       if Child /= null then
@@ -1181,10 +1186,11 @@ package body Project_Explorers is
       if Extending_Project (Project) /= No_Project then
          --  ??? We could use a different icon instead
          Set (Explorer.Tree.Model, N, Base_Name_Column,
-              Locale_To_UTF8 (Node_Text) & " (extended)" & Name_Suffix);
+              Filesystems.Filename_To_UTF8
+                (Node_Text) & " (extended)" & Name_Suffix);
       else
          Set (Explorer.Tree.Model, N, Base_Name_Column,
-              Locale_To_UTF8 (Node_Text & Name_Suffix));
+              Filesystems.Filename_To_UTF8 (Node_Text & Name_Suffix));
       end if;

       Set_Node_Type (Explorer.Tree.Model, N, Node_Type, False);
@@ -1241,28 +1247,45 @@ package body Project_Explorers is
       ------------------

       procedure Process_Node (Iter : Gtk_Tree_Iter; Project : Project_Type) is
-         It : Gtk_Tree_Iter := Children (Exp.Tree.Model, Iter);
-         It2 : Gtk_Tree_Iter;
+         It   : Gtk_Tree_Iter := Children (Exp.Tree.Model, Iter);
+         It2  : Gtk_Tree_Iter;
+         Path : Gtk_Tree_Path;
       begin
          while It /= Null_Iter loop
             Iter_Copy (Source => It, Dest => It2);
-            Next (Exp.Tree.Model, It);
-            case Get_Node_Type (Exp.Tree.Model, It2) is
+            Next (Exp.Tree.Model, It2);
+
+            --  Storing an iter (It2) here is not enough because
+            --  Update_Directory_Node_Text may invalidate it. This is why we
+            --  use a Gtk_Tree_Path instead.
+
+            if It2 = Null_Iter then
+               Path := null;
+            else
+               Path := Get_Path (Exp.Tree.Model, It2);
+            end if;
+
+            case Get_Node_Type (Exp.Tree.Model, It) is
                when Project_Node
                   | Modified_Project_Node
                   | Extends_Project_Node =>
                   Process_Node
-                    (It2, Get_Project_From_Node
-                     (Exp.Tree.Model, Exp.Kernel, It2, False));
+                    (It, Get_Project_From_Node
+                     (Exp.Tree.Model, Exp.Kernel, It, False));

                when Directory_Node
                  | Obj_Directory_Node
                  | Exec_Directory_Node =>
-                  Update_Directory_Node_Text (Exp, Project, It2);
+                  Update_Directory_Node_Text (Exp, Project, It);

                when others =>
                   null;
             end case;
+
+            exit when Path = null;
+
+            It := Get_Iter (Exp.Tree.Model, Path);
+            Path_Free (Path);
          end loop;
       end Process_Node;

@@ -1300,7 +1323,7 @@ package body Project_Explorers is
       Node_Type : Directory_Node_Types) is
    begin
       Set (Explorer.Tree.Model, Node, Absolute_Name_Column,
-           Locale_To_UTF8 (Name_As_Directory (Directory)));
+           Filesystems.Filename_To_UTF8 (Name_As_Directory (Directory)));

       Update_Directory_Node_Text (Explorer, Project, Node);

@@ -1856,6 +1879,7 @@ package body Project_Explorers is
       end Is_Hidden;

       S_Dirs   : File_Node_Hash.Map;
+      Old_Dirs : File_Node_Hash.Map;
       S_Files  : File_Node_Hash.Map;
       S_Cursor : File_Node_Hash.Cursor;
    begin
@@ -1877,7 +1901,7 @@ package body Project_Explorers is
          case Get_Node_Type (Explorer.Tree.Model, N) is
             when Directory_Node =>
                Include
-                 (S_Dirs, Get_Absolute_Name (Explorer.Tree.Model,  N), N);
+                 (Old_Dirs, Get_Absolute_Name (Explorer.Tree.Model,  N), N);

                N3 := Children (Explorer.Tree.Model, N);
                while N3 /= Null_Iter loop
@@ -1927,7 +1951,12 @@ package body Project_Explorers is
          Iter_Copy (Source => N2, Dest => N);
       end loop;

-      --  Now add each file (and missing source dirs when needed)
+      --  Now add each file (and missing source dirs when needed). The
+      --  directories are created based on the needs of the files, not on the
+      --  source dirs attribute (this is done later for the directories that
+      --  contain no file) so that when a project is created through the
+      --  debugger for instance it doesn't have to include the runtime dirs
+      --  and other directories that might contain source files.

       for F in Files'Range loop
          declare
@@ -1935,25 +1964,42 @@ package body Project_Explorers is
          begin
             S_Cursor := Find (S_Dirs, Dir.all);
             if S_Cursor = No_Element then
-               if Get_History
-                 (Get_History (Explorer.Kernel).all, Show_Hidden_Dirs)
-                 or else not Is_Hidden (Dir.all)
-               then
-                  Append
-                    (Explorer.Tree.Model,
-                     Iter    => N,
-                     Parent  => Node);
-                  Set_Directory_Node_Attributes
-                    (Explorer  => Explorer,
-                     Directory => Dir.all,
-                     Node      => N,
-                     Project   => Project,
-                     Node_Type => Directory_Node);
+               --  Was this directory already displayed in the tree ?
+
+               S_Cursor := Find (Old_Dirs, Dir.all);
+
+               if S_Cursor = No_Element then
+                  --  No, create it
+
+                  if Get_History
+                    (Get_History (Explorer.Kernel).all, Show_Hidden_Dirs)
+                    or else not Is_Hidden (Dir.all)
+                  then
+                     Append
+                       (Explorer.Tree.Model,
+                        Iter    => N,
+                        Parent  => Node);
+                     Set_Directory_Node_Attributes
+                       (Explorer  => Explorer,
+                        Directory => Dir.all,
+                        Node      => N,
+                        Project   => Project,
+                        Node_Type => Directory_Node);
+                     Set (Explorer.Tree.Model, N, Up_To_Date_Column, True);
+                     Include (S_Dirs, Dir.all, N);
+                  else
+                     N := Null_Iter;
+                  end if;
+
+               else
+                  --  Consider the directory as new, ie we need to keep it for
+                  --  the new representation of three
+                  N := Element (S_Cursor);
                   Set (Explorer.Tree.Model, N, Up_To_Date_Column, True);
                   Include (S_Dirs, Dir.all, N);
-               else
-                  N := Null_Iter;
+                  Delete (Old_Dirs, S_Cursor);
                end if;
+
             else
                N := Element (S_Cursor);
             end if;
@@ -1997,15 +2043,6 @@ package body Project_Explorers is
          Next (S_Cursor);
       end loop;

-      --  Store the list of valid source dirs, so that we can remove the old
-      --  ones
-
-      Clear (S_Dirs);
-      N := Children (Explorer.Tree.Model, Node);
-      for D in Dirs'Range loop
-         Include (S_Dirs, Name_As_Directory (Get_Name_String (Dirs (D))), N);
-      end loop;
-
       --  Remove directory nodes that no longer correspond to valid dirs.
       --  These are the empty directories, since we only create directories
       --  when we have files.
@@ -2016,42 +2053,40 @@ package body Project_Explorers is
          Next (Explorer.Tree.Model, N);

          if Get_Node_Type (Explorer.Tree.Model, N2) = Directory_Node then
-            if Find (S_Dirs, Get_Absolute_Name (Explorer.Tree.Model, N2)) =
+            if Find (Old_Dirs, Get_Absolute_Name (Explorer.Tree.Model, N2)) /=
               No_Element
             then
                Remove (Explorer.Tree.Model, N2);
-            else
-               Delete (S_Dirs, Get_Absolute_Name (Explorer.Tree.Model, N2));
             end if;
          end if;
       end loop;

       --  Add those source directories that contain no file

-      S_Cursor := First (S_Dirs);
-
-      while Has_Element (S_Cursor) loop
+      for D in Dirs'Range loop
          declare
-            Dir : constant String := Key (S_Cursor);
+            Dir : constant String :=
+              Name_As_Directory (Get_Name_String (Dirs (D)));
          begin
-            if Get_History
-              (Get_History (Explorer.Kernel).all, Show_Hidden_Dirs)
-              or else not Is_Hidden (Dir)
-            then
-               Append
-                 (Explorer.Tree.Model,
-                  Iter    => N,
-                  Parent  => Node);
-               Set_Directory_Node_Attributes
-                 (Explorer  => Explorer,
-                  Directory => Dir,
-                  Node      => N,
-                  Project   => Project,
-                  Node_Type => Directory_Node);
-               Set (Explorer.Tree.Model, N, Up_To_Date_Column, True);
+            if Find (S_Dirs, Dir) = No_Element then
+               if Get_History
+                 (Get_History (Explorer.Kernel).all, Show_Hidden_Dirs)
+                 or else not Is_Hidden (Dir)
+               then
+                  Append
+                    (Explorer.Tree.Model,
+                     Iter    => N,
+                     Parent  => Node);
+                  Set_Directory_Node_Attributes
+                    (Explorer  => Explorer,
+                     Directory => Dir,
+                     Node      => N,
+                     Project   => Project,
+                     Node_Type => Directory_Node);
+                  Set (Explorer.Tree.Model, N, Up_To_Date_Column, True);
+               end if;
             end if;
          end;
-         Next (S_Cursor);
       end loop;

       Add_Object_Directories (Explorer, Node, Project);
@@ -2112,7 +2147,7 @@ package body Project_Explorers is
             case Node_Type is
                when Project_Node | Modified_Project_Node =>
                   Update_Project_Node (Explorer, Files, Node);
-               when others         => null;
+               when others => null;
             end case;

          else
============================================================
--- prj_editor/src/project_explorers_common.adb	fc2d4bf44738a6902ea7ec160ad76b567bb51839
+++ prj_editor/src/project_explorers_common.adb	fe767165ed71cf46908e3a6ea439161375fc477f
@@ -20,9 +20,13 @@ with Ada.Calendar;              use Ada.
 with Ada.Containers;            use Ada.Containers;
 with Ada.Containers.Indefinite_Hashed_Maps;
 with Ada.Calendar;              use Ada.Calendar;
+
 with GNAT.Directory_Operations; use GNAT.Directory_Operations;
 with GNAT.Strings;              use GNAT.Strings;

+with GNATCOLL.Utils;            use GNATCOLL.Utils;
+with GNATCOLL.VFS;              use GNATCOLL.VFS;
+
 with Gdk.Pixbuf;                use Gdk.Pixbuf;
 with Gdk.Types.Keysyms;         use Gdk.Types.Keysyms;
 with Gtk.Enums;                 use Gtk.Enums;
@@ -44,8 +48,6 @@ with Namet;                     use Name
 with String_Utils;              use String_Utils;
 with Traces;                    use Traces;
 with Namet;                     use Namet;
-with GNATCOLL.Utils;            use GNATCOLL.Utils;
-with GNATCOLL.VFS;              use GNATCOLL.VFS;

 package body Project_Explorers_Common is

============================================================
--- prj_editor/src/project_explorers_files.adb	99f881ed4df6e28c554e4d4620df459090d1c99b
+++ prj_editor/src/project_explorers_files.adb	2dec7217b3b8481fa22d1597e8354bf39cfc7f71
@@ -27,7 +27,6 @@ with Glib;                       use Gli
 with GNATCOLL.VFS;               use GNATCOLL.VFS;

 with Glib;                       use Glib;
-with Glib.Convert;               use Glib.Convert;
 with Glib.Object;                use Glib.Object;
 with Glib.Values;                use Glib.Values;
 with Glib.Xml_Int;               use Glib.Xml_Int;
@@ -52,6 +51,7 @@ with Gtkada.Handlers;            use Gtk
 with Gtkada.MDI;                 use Gtkada.MDI;
 with Gtkada.Handlers;            use Gtkada.Handlers;

+with Filesystems;                use Filesystems;
 with GPS.Kernel.Contexts;        use GPS.Kernel.Contexts;
 with GPS.Kernel.Hooks;           use GPS.Kernel.Hooks;
 with GPS.Kernel.MDI;             use GPS.Kernel.MDI;
@@ -310,9 +310,9 @@ package body Project_Explorers_Files is
          Append (D.Explorer.File_Model, Iter, D.Base);

          Set (D.Explorer.File_Model, Iter, Absolute_Name_Column,
-              Locale_To_UTF8 (D.Norm_Dir.all));
+              Filesystems.Filename_To_UTF8 (D.Norm_Dir.all));
          Set (D.Explorer.File_Model, Iter, Base_Name_Column,
-              Locale_To_UTF8 (D.Norm_Dir.all));
+              Filesystems.Filename_To_UTF8 (D.Norm_Dir.all));
          Set (D.Explorer.File_Model, Iter, Node_Type_Column,
               Gint (Node_Types'Pos (Directory_Node)));

@@ -355,7 +355,7 @@ package body Project_Explorers_Files is
                         D.Norm_Dir.all & Name,
                         Direct_Only => False)
                      then
-                        Append (D.Dirs, Locale_To_UTF8 (Name));
+                        Append (D.Dirs, Filesystems.Filename_To_UTF8 (Name));
                      end if;

                   --  If the file belongs to the project hierarchy, we also
@@ -382,9 +382,9 @@ package body Project_Explorers_Files is
                   end if;

                elsif Is_Directory (D.Norm_Dir.all & Name) then
-                  Append (D.Dirs, Locale_To_UTF8 (Name));
+                  Append (D.Dirs, Filesystems.Filename_To_UTF8 (Name));
                else
-                  Append (D.Files, Locale_To_UTF8 (Name));
+                  Append (D.Files, Filesystems.Filename_To_UTF8 (Name));
                end if;
             end;

@@ -422,10 +422,10 @@ package body Project_Explorers_Files is
          begin
             Append (D.Explorer.File_Model, Iter, D.Base);
             Set (D.Explorer.File_Model, Iter, Absolute_Name_Column,
-                 Locale_To_UTF8
+                 Filesystems.Filename_To_UTF8
                  (D.Norm_Dir.all & Dir & Directory_Separator));
             Set (D.Explorer.File_Model, Iter, Base_Name_Column,
-                 Locale_To_UTF8 (Dir));
+                 Filesystems.Filename_To_UTF8 (Dir));
             Set (D.Explorer.File_Model, Iter, Node_Type_Column,
                  Gint (Node_Types'Pos (Directory_Node)));

============================================================
--- prj_editor/src/project_properties.adb	1a9ccbd6343c1eb797fc7f2d20ed3be63caa9bd8
+++ prj_editor/src/project_properties.adb	ff6c16218de874e8937284eb5b26772d7ccd050f
@@ -1,7 +1,7 @@
 -----------------------------------------------------------------------
 --                              G P S                                --
 --                                                                   --
---                     Copyright (C) 2002-2008, AdaCore              --
+--                 Copyright (C) 2002-2008, AdaCore                  --
 --                                                                   --
 -- GPS is free  software;  you can redistribute it and/or modify  it --
 -- under the terms of the GNU General Public License as published by --
@@ -23,8 +23,11 @@ with GNAT.OS_Lib;               use GNAT
 with GNAT.Case_Util;            use GNAT.Case_Util;
 with GNAT.Directory_Operations; use GNAT.Directory_Operations;
 with GNAT.OS_Lib;               use GNAT.OS_Lib;
+
 with GNATCOLL.Scripts;          use GNATCOLL.Scripts;
 with GNATCOLL.Utils;            use GNATCOLL.Utils;
+with GNATCOLL.VFS;              use GNATCOLL.VFS;
+
 with Gdk.Event;                 use Gdk.Event;

 with Glib;                      use Glib;
@@ -90,7 +93,6 @@ with Namet;
 with Scenario_Selectors;        use Scenario_Selectors;
 with Traces;                    use Traces;
 with Namet;
-with GNATCOLL.VFS;                       use GNATCOLL.VFS;
 with Wizards;                   use Wizards;

 package body Project_Properties is
@@ -240,7 +242,7 @@ package body Project_Properties is
    procedure Register_New_Attribute
      (Kernel    : access Kernel_Handle_Record'Class;
       Attr      : Attribute_Description_Access);
-   --  Register a new attribute in the project parser.
+   --  Register a new attribute in the project parser

    ------------------
    -- Wizard pages --
@@ -413,8 +415,8 @@ package body Project_Properties is
    --  Change the position of the current item in the list

    procedure Recursive_Directory_Changed
-     (Editor  : access Gtk_Widget_Record'Class;
-      Params  : Glib.Values.GValues);
+     (Editor : access Gtk_Widget_Record'Class;
+      Params : Glib.Values.GValues);
    --  Called when a directory is made recursive

    procedure Project_Path_Changed (Editor : access Gtk_Widget_Record'Class);
@@ -525,13 +527,12 @@ package body Project_Properties is
      (Kernel      : access Kernel_Handle_Record'Class;
       Project     : Project_Type;
       Attr        : Attribute_Description_Access;
-      Path_Widget : Gtk_Entry)
-      return Indexed_Attribute_Editor;
-   --  Create the widget used to edit an indexed attribute.
+      Path_Widget : Gtk_Entry) return Indexed_Attribute_Editor;
+   --  Create the widget used to edit an indexed attribute

    function Edit_Indexed_Attribute
-     (Editor       : access Gtk_Widget_Record'Class;
-      Event        : Gdk.Event.Gdk_Event) return Boolean;
+     (Editor : access Gtk_Widget_Record'Class;
+      Event  : Gdk.Event.Gdk_Event) return Boolean;
    --  Called when double-clicking on the value of an indexed attribute, and
    --  open a dialog to edit its value (that dialog contains one the standard
    --  widgets like combo boxes,... depending on the type of the attribute)
@@ -551,7 +552,7 @@ package body Project_Properties is
       Prj_Selector : Project_Selector;

       Pages              : Widget_Array_Access;
-      --  The pages that have been registered.
+      --  The pages that have been registered

       XML_Pages          : Wizard_Pages_Array_Access;

@@ -586,8 +587,8 @@ package body Project_Properties is
    --  Return the list of languages currently set in the editor

    procedure Toggle_Sensitive
-     (Check  : access Gtk_Widget_Record'Class;
-      Attr   : Attribute_Description_Access);
+     (Check : access Gtk_Widget_Record'Class;
+      Attr  : Attribute_Description_Access);
    --  Toggle the sensitivity state of an editor

    function Create_General_Page
@@ -620,13 +621,13 @@ package body Project_Properties is
    --  incomplete, and it might be dangereous to edit the properties.

    function Select_Files_Or_Directories
-     (Toplevel          : access Gtk_Window_Record'Class;
-      Project           : Project_Type;
-      Default           : String;
-      Project_Path      : String;
-      As_Directory      : Boolean;
-      Filter            : File_Filter;
-      Allow_Multiple    : Boolean := False) return GNATCOLL.VFS.File_Array;
+     (Toplevel       : access Gtk_Window_Record'Class;
+      Project        : Project_Type;
+      Default        : String;
+      Project_Path   : String;
+      As_Directory   : Boolean;
+      Filter         : File_Filter;
+      Allow_Multiple : Boolean := False) return GNATCOLL.VFS.File_Array;
    --  Open a dialog to select one or more file or directory names.
    --  Filter is used to select what kind of files should be shown to the user

@@ -642,8 +643,7 @@ package body Project_Properties is
       Attr          : Attribute_Description_Access;
       Index         : String := "";
       Default_Only  : Boolean := False;
-      Ignore_Editor : Boolean := False)
-      return GNAT.Strings.String_List;
+      Ignore_Editor : Boolean := False) return GNAT.Strings.String_List;
    --  Get the current value for the given attribute. This value is extracted
    --  from one of three sources, in that order:
    --    - Either the current editor for that attribute. This reflects the
@@ -660,10 +660,10 @@ package body Project_Properties is
    --  This implies Ignore_Editor

    function Attribute_Exists
-     (Attr               : Attribute_Description_Access;
-      Project            : Project_Type;
-      Attribute_Index    : String := "") return Boolean;
-   --  Return True if Attr was explicitly defined in Project.
+     (Attr            : Attribute_Description_Access;
+      Project         : Project_Type;
+      Attribute_Index : String := "") return Boolean;
+   --  Return True if Attr was explicitly defined in Project

    procedure Delete_Attribute_Value
      (Attr               : Attribute_Description_Access;
@@ -671,7 +671,7 @@ package body Project_Properties is
       Scenario_Variables : Scenario_Variable_Array;
       Project_Changed    : in out Boolean;
       Attribute_Index    : String := "");
-   --  Remove the declaration for Attr in Project.
+   --  Remove the declaration for Attr in Project

    function Find_Editor_Page_By_Name (Name : String) return Natural;
    --  Find the index in Properties_Module_ID.Pages of the page Name.
@@ -2873,7 +2873,7 @@ package body Project_Properties is
                when Filter_From_Project =>
                   Prj := Project;
                when Filter_From_Extended =>
-                  Prj := Parent_Project (Project);
+                  Prj := Extended_Project (Project);
                when others =>
                   Prj := Project;
             end case;
@@ -2893,7 +2893,7 @@ package body Project_Properties is

                --  If we had an extending project, look at the parent's sources
                --  as well
-               Prj := Parent_Project (Prj);
+               Prj := Extended_Project (Prj);
             end loop;

             Button := Add_Button (Dialog, Stock_Ok, Gtk_Response_OK);
@@ -2950,13 +2950,15 @@ package body Project_Properties is
                  (Parent            => Gtk_Window (Toplevel),
                   Base_Directory    => Create (Project_Path),
                   Default_Name      => "",
-                  Use_Native_Dialog => Use_Native_Dialogs.Get_Pref);
+                  Use_Native_Dialog => Use_Native_Dialogs.Get_Pref,
+                  Kind              => Open_File);
             else
                File := Select_File
                  (Parent            => Gtk_Window (Toplevel),
                   Base_Directory    => Create (Dir_Name (Default)),
                   Default_Name      => Base_Name (Default),
-                  Use_Native_Dialog => Use_Native_Dialogs.Get_Pref);
+                  Use_Native_Dialog => Use_Native_Dialogs.Get_Pref,
+                  Kind              => Open_File);
             end if;

             if File = GNATCOLL.VFS.No_File then
@@ -3145,10 +3147,11 @@ package body Project_Properties is
      (Editor  : access Gtk_Widget_Record'Class;
       Params  : Glib.Values.GValues)
    is
-      Ed   : constant File_Attribute_Editor := File_Attribute_Editor (Editor);
-      Path : constant String := Get_String (Nth (Params, 1));
-      Iter : constant Gtk_Tree_Iter :=
-        Get_Iter_From_String (Ed.Model, Path);
+      Ed       : constant File_Attribute_Editor :=
+                   File_Attribute_Editor (Editor);
+      Path     : constant String := Get_String (Nth (Params, 1));
+      Iter     : constant Gtk_Tree_Iter :=
+                   Get_Iter_From_String (Ed.Model, Path);
       Selected : constant Boolean := not Get_Boolean (Ed.Model, Iter, 1);
    begin
       Set (Ed.Model, Iter, 1, Selected);
@@ -3161,8 +3164,9 @@ package body Project_Properties is
    procedure Project_Path_Changed
      (Editor : access Gtk_Widget_Record'Class)
    is
-      Ed   : constant File_Attribute_Editor := File_Attribute_Editor (Editor);
-      Iter : Gtk_Tree_Iter;
+      Ed        : constant File_Attribute_Editor :=
+                    File_Attribute_Editor (Editor);
+      Iter      : Gtk_Tree_Iter;
       Directory : constant String := Get_Text (Ed.Path_Widget);
    begin
       Iter := Get_Iter_First (Ed.Model);
@@ -3189,15 +3193,15 @@ package body Project_Properties is
       Path_Widget     : Gtk_Entry;
       Is_List         : Boolean) return File_Attribute_Editor
    is
-      Editor   : File_Attribute_Editor;
-      Button   : Gtk_Button;
-      Scrolled : Gtk_Scrolled_Window;
-      Box      : Gtk_Box;
-      Text     : Gtk_Cell_Renderer_Text;
-      Toggle   : Gtk_Cell_Renderer_Toggle;
-      Col      : Gtk_Tree_View_Column;
-      Iter     : Gtk_Tree_Iter;
-      Arrow    : Gtk_Arrow;
+      Editor     : File_Attribute_Editor;
+      Button     : Gtk_Button;
+      Scrolled   : Gtk_Scrolled_Window;
+      Box        : Gtk_Box;
+      Text       : Gtk_Cell_Renderer_Text;
+      Toggle     : Gtk_Cell_Renderer_Toggle;
+      Col        : Gtk_Tree_View_Column;
+      Iter       : Gtk_Tree_Iter;
+      Arrow      : Gtk_Arrow;
       Col_Number : Gint;
       pragma Unreferenced (Col_Number);

@@ -3381,12 +3385,12 @@ package body Project_Properties is
       Attribute_Index : String;
       Project_Path    : String) return GNAT.Strings.String_List
    is
+      Attr   : constant Attribute_Type := Get_Attribute_Type_From_Description
+        (Description, Attribute_Index);
       Dialog : Gtk_Dialog;
       Button : Gtk_Widget;
       Ent    : Gtk_Entry;
       W      : List_Attribute_Editor;
-      Attr   : constant Attribute_Type := Get_Attribute_Type_From_Description
-        (Description, Attribute_Index);
    begin
       case Attr.Typ is
          when Attribute_As_String =>
@@ -3580,8 +3584,8 @@ package body Project_Properties is
      (Attr  : Attribute_Description_Access;
       Index : String) return Boolean
    is
-      Typ : constant Attribute_Type := Get_Attribute_Type_From_Description
-        (Attr, Index);
+      Typ : constant Attribute_Type :=
+              Get_Attribute_Type_From_Description (Attr, Index);
    begin
       case Typ.Typ is
          when Attribute_As_String    => return True;
@@ -3665,7 +3669,7 @@ package body Project_Properties is
    -----------------------

    overriding function Get_Value_As_List
-     (Editor : access File_Attribute_Editor_Record;
+     (Editor          : access File_Attribute_Editor_Record;
       Attribute_Index : String := "") return GNAT.Strings.String_List
    is
       pragma Unreferenced (Attribute_Index);
@@ -3747,11 +3751,12 @@ package body Project_Properties is
       Default_Only  : Boolean := False;
       Ignore_Editor : Boolean := False) return String
    is
+      Typ                   : constant Attribute_Type :=
+                                Get_Attribute_Type_From_Description
+                                  (Attr, Index);
       Empty_String          : aliased String := "";
       Default_Value         : GNAT.Strings.String_Access :=
                                 Empty_String'Unchecked_Access;
-      Typ : constant Attribute_Type := Get_Attribute_Type_From_Description
-        (Attr, Index);
       Lower_Attribute_Index : String := Index;
    begin
       if not Attr.Case_Sensitive_Index then
@@ -3792,6 +3797,7 @@ package body Project_Properties is

       if Default_Only then
          return Default_Value.all;
+
       else
          return Get_Attribute_Value
            (Project   => Project,
@@ -3807,14 +3813,13 @@ package body Project_Properties is
    -----------------------

    function Get_Current_Value
-     (Kernel  : access Kernel_Handle_Record'Class;
-      Pkg     : String;
-      Name    : String;
-      Index   : String := "")
-      return GNAT.Strings.String_List
+     (Kernel : access Kernel_Handle_Record'Class;
+      Pkg    : String;
+      Name   : String;
+      Index  : String := "") return GNAT.Strings.String_List
    is
       Attr : constant Attribute_Description_Access :=
-        Get_Attribute_Type_From_Name (Pkg, Name);
+               Get_Attribute_Type_From_Name (Pkg, Name);
    begin
       return Get_Current_Value
         (Kernel  => Kernel,
@@ -3833,8 +3838,7 @@ package body Project_Properties is
       Attr          : Attribute_Description_Access;
       Index         : String := "";
       Default_Only  : Boolean := False;
-      Ignore_Editor : Boolean := False)
-      return GNAT.Strings.String_List
+      Ignore_Editor : Boolean := False) return GNAT.Strings.String_List
    is
       Result : String_List_Access;

@@ -3855,15 +3859,18 @@ package body Project_Properties is
                Result := new GNAT.Strings.String_List (1 .. Tmp'Length + 1);
                Result (Tmp'Range) := Tmp.all;
                Unchecked_Free (Tmp);
+
             else
                Result := new GNAT.Strings.String_List (1 .. 1);
             end if;
+
             Result (Result'Last) := new String'(Value);
          end if;
       end Save_Value;

       Attr_Type             : Attribute_Type;
       Lower_Attribute_Index : String := Index;
+
    begin
       if not Attr.Case_Sensitive_Index then
          To_Lower (Lower_Attribute_Index);
@@ -3959,20 +3966,20 @@ package body Project_Properties is
    ----------------------------

    function Edit_Indexed_Attribute
-     (Editor       : access Gtk_Widget_Record'Class;
-      Event        : Gdk.Event.Gdk_Event) return Boolean
+     (Editor : access Gtk_Widget_Record'Class;
+      Event  : Gdk.Event.Gdk_Event) return Boolean
    is
-      Ed        : constant Indexed_Attribute_Editor :=
-                    Indexed_Attribute_Editor (Editor);
-      Path      : Gtk_Tree_Path;
-      Column    : Gtk_Tree_View_Column;
+      Ed             : constant Indexed_Attribute_Editor :=
+                         Indexed_Attribute_Editor (Editor);
+      Path           : Gtk_Tree_Path;
+      Column         : Gtk_Tree_View_Column;
       Cell_X, Cell_Y : Gint;
-      Row_Found : Boolean;
-      Iter      : Gtk_Tree_Iter;
-      Value_Ed  : Attribute_Editor;
-      Dialog    : Gtk_Dialog;
-      Button    : Gtk_Widget;
-      Typ       : Attribute_Type;
+      Row_Found      : Boolean;
+      Iter           : Gtk_Tree_Iter;
+      Value_Ed       : Attribute_Editor;
+      Dialog         : Gtk_Dialog;
+      Button         : Gtk_Widget;
+      Typ            : Attribute_Type;
    begin
       Get_Path_At_Pos
         (Ed.View, Gint (Get_X (Event)), Gint (Get_Y (Event)),
@@ -4094,24 +4101,23 @@ package body Project_Properties is
      (Kernel      : access Kernel_Handle_Record'Class;
       Project     : Project_Type;
       Attr        : Attribute_Description_Access;
-      Path_Widget : Gtk_Entry)
-      return Indexed_Attribute_Editor
+      Path_Widget : Gtk_Entry) return Indexed_Attribute_Editor
    is
       Index_Col     : constant := 0;
       Attribute_Col : constant := 1;
       Editable_Col  : constant := 2;

       use Gtk.Enums.String_List;
-      Ed       : Indexed_Attribute_Editor;
-      Text     : Gtk_Cell_Renderer_Text;
-      Col      : Gtk_Tree_View_Column;
-      Scrolled : Gtk_Scrolled_Window;
-      Col_Number : Gint;
+      Ed            : Indexed_Attribute_Editor;
+      Text          : Gtk_Cell_Renderer_Text;
+      Col           : Gtk_Tree_View_Column;
+      Scrolled      : Gtk_Scrolled_Window;
+      Col_Number    : Gint;
       pragma Unreferenced (Col_Number);
-      Index    : constant Attribute_Description_Access :=
-        Get_Attribute_Type_From_Name
-          (Pkg  => Attr.Index_Package.all,
-           Name => Attr.Index_Attribute.all);
+      Index         : constant Attribute_Description_Access :=
+                        Get_Attribute_Type_From_Name
+                          (Pkg  => Attr.Index_Package.all,
+                           Name => Attr.Index_Attribute.all);
       Current_Index : String_List_Access;

       procedure Value_Cb (Value : String; Selected : Boolean);
@@ -4235,17 +4241,20 @@ package body Project_Properties is

       Gtk_New (Col);
       Set_Resizable (Col, True);
+
       if Index.Label = null then
          Set_Title (Col, Index.Name.all);
       else
          Set_Title (Col, Index.Label.all);
       end if;
+
       Col_Number := Append_Column (Ed.View, Col);
       Pack_Start (Col, Text, True);
       Add_Attribute (Col, Text, "text", Index_Col);

       if Attr.Ordered_List then
          Set_Reorderable (Col, False);
+
       else
          Set_Sort_Column_Id (Col, Index_Col);
          Clicked (Col);
@@ -4254,16 +4263,17 @@ package body Project_Properties is

       Gtk_New (Col);
       Set_Resizable (Col, True);
+
       if Attr.Label /= null then
          Set_Title (Col, Attr.Label.all & (-" (Click to edit)"));
       else
          Set_Title (Col, -"(Click to edit)");
       end if;
+
       Col_Number := Append_Column (Ed.View, Col);
       Pack_Start (Col, Text, True);
       Add_Attribute (Col, Text, "text", Attribute_Col);
       Add_Attribute (Col, Text, "editable", Editable_Col);
---      Set_Sort_Column_Id (Col, Attribute_Col);

       Set_Editable_And_Callback (Ed.Model, Text, Attribute_Col);

@@ -4285,14 +4295,14 @@ package body Project_Properties is
       Expandable  : out Boolean;
       Context     : String)
    is
-      Label  : Gtk_Label;
-      Box    : Gtk_Box;
-      Vbox   : Gtk_Box;
-      Align  : Gtk_Alignment;
-      Event  : Gtk_Event_Box;
-      Check  : Gtk_Check_Button;
+      Label       : Gtk_Label;
+      Box         : Gtk_Box;
+      Vbox        : Gtk_Box;
+      Align       : Gtk_Alignment;
+      Event       : Gtk_Event_Box;
+      Check       : Gtk_Check_Button;
       First, Last : Natural;
-      Exists : Boolean := True;
+      Exists      : Boolean := True;
    begin
       --  Should the page be displayed ?
       if Attr.Hide_In /= null then
@@ -4329,7 +4339,7 @@ package body Project_Properties is
       if not Attr.Indexed
         and then Attr.Non_Index_Type.Typ = Attribute_As_Filename
         and then Attr.Non_Index_Type.Filter = Filter_From_Extended
-        and then Parent_Project (Project) = Projects.No_Project
+        and then Extended_Project (Project) = Projects.No_Project
       then
          Widget := null;
          Expandable := False;
@@ -4423,13 +4433,13 @@ package body Project_Properties is
    ----------------------

    procedure Toggle_Sensitive
-     (Check  : access Gtk_Widget_Record'Class;
-      Attr   : Attribute_Description_Access)
+     (Check : access Gtk_Widget_Record'Class;
+      Attr  : Attribute_Description_Access)
    is
       Active : constant Boolean := Get_Active (Gtk_Check_Button (Check));
-      Pkg_Start, Pkg_End, Name_Start, Index : Natural;
       Attr2  : Attribute_Description_Access;
       Page   : Attribute_Page;
+      Pkg_Start, Pkg_End, Name_Start, Index : Natural;
    begin
       if Attr.Editor /= null
         and then Active /= Is_Sensitive (Attr.Editor)
@@ -4497,17 +4507,17 @@ package body Project_Properties is
      (Editor  : access Properties_Editor_Record'Class;
       Project : Project_Type;
       Kernel  : access Kernel_Handle_Record'Class)
-  is
-      Label        : Gtk_Label;
-      Button       : Gtk_Widget;
-      Page         : Project_Editor_Page;
-      Box          : Gtk_Box;
-      XML_Page     : XML_Project_Wizard_Page_Access;
+   is
+      Label            : Gtk_Label;
+      Button           : Gtk_Widget;
+      Page             : Project_Editor_Page;
+      Box              : Gtk_Box;
+      XML_Page         : XML_Project_Wizard_Page_Access;
       General_Page_Box : Gtk_Box;
-      Main_Box     : Gtk_Paned;
-      Event        : Gtk_Event_Box;
-      General_Size : Gtk_Size_Group;
-      Tmp          : Wizard_Pages_Array_Access;
+      Main_Box         : Gtk_Paned;
+      Event            : Gtk_Event_Box;
+      General_Size     : Gtk_Size_Group;
+      Tmp              : Wizard_Pages_Array_Access;
    begin
       Gtk.Dialog.Initialize
         (Dialog => Editor,
@@ -4749,7 +4759,8 @@ package body Project_Properties is
       Nth_Page         : Integer;
       Context          : String) return Project_Wizard_Page
    is
-      Page : Attribute_Page renames Properties_Module_ID.Pages (Nth_Page);
+      Page         : Attribute_Page renames
+                       Properties_Module_ID.Pages (Nth_Page);
       Page_Box     : XML_Project_Wizard_Page_Access;
       Box          : Gtk_Box;
       Frame        : Gtk_Frame;
@@ -4886,13 +4897,14 @@ package body Project_Properties is
      (Notebook : access GObject_Record'Class;
       Editor   : GObject)
    is
-      Note  : constant Gtk_Notebook := Gtk_Notebook (Notebook);
-      Ed    : constant Properties_Editor := Properties_Editor (Editor);
-      Page  : constant Integer := Integer (Get_Current_Page (Note));
-      P     : Project_Editor_Page;
-      Flags : Selector_Flags;
+      Note                 : constant Gtk_Notebook := Gtk_Notebook (Notebook);
+      Ed                   : constant Properties_Editor :=
+                               Properties_Editor (Editor);
+      Page                 : constant Integer :=
+                               Integer (Get_Current_Page (Note));
       Pages_From_XML_Count : constant Integer := Ed.XML_Pages'Length;
-      --  Properties_Module_Id.Pages'Length
+      P                    : Project_Editor_Page;
+      Flags                : Selector_Flags;
    begin
       if Page >= Pages_From_XML_Count
         and then not Gtk.Object.In_Destruction_Is_Set (Ed)
@@ -4933,8 +4945,7 @@ package body Project_Properties is

    function Warning_On_View_Incomplete
      (Kernel  : access Kernel_Handle_Record'Class;
-      Project : Project_Type)
-      return Project_Edition_Type
+      Project : Project_Type) return Project_Edition_Type
    is
       D : Gtk_Dialog;
       B : Gtk_Widget;
============================================================
--- prj_editor/src/project_viewers.adb	416f5845011f19f6c752d88b1a8891a9a3ee16f8
+++ prj_editor/src/project_viewers.adb	bdc2e70a6b326b828420d1b6e9fcf15b991237ac
@@ -395,12 +395,15 @@ package body Project_Viewers is
          Col3  : Gint; Value3 : Gdk_Color);
       pragma Import (C, Internal, "ada_gtk_tree_store_set_ptr_ptr");

-      File_Name  : constant Virtual_File := Create
-        (Get_String (Viewer.Model, Iter, Absolute_File_Name_Column));
+      File_Name  : constant Virtual_File :=
+                     Create
+                       (Get_String
+                          (Viewer.Model, Iter, Absolute_File_Name_Column));
       Language   : constant String :=
-        Get_Language_From_File
-          (Language_Handler (Get_Language_Handler (Viewer.Kernel)),
-           File_Name);
+                     Get_Language_From_File
+                       (Language_Handler
+                          (Get_Language_Handler (Viewer.Kernel)),
+                        File_Name);
       Color      : Gdk_Color;
       Value      : Prj.Variable_Value;
       Is_Default : Boolean;
@@ -1694,10 +1697,10 @@ package body Project_Viewers is
    begin
       Prj_Editor_Module_ID := new Prj_Editor_Module_Id_Record;
       Register_Module
-        (Module                  => Module_ID (Prj_Editor_Module_ID),
-         Kernel                  => Kernel,
-         Module_Name             => Project_Editor_Module_Name,
-         Priority                => Default_Priority);
+        (Module      => Module_ID (Prj_Editor_Module_ID),
+         Kernel      => Kernel,
+         Module_Name => Project_Editor_Module_Name,
+         Priority    => Default_Priority);

       Register_Menu (Kernel, Project, null, Ref_Item => -"Edit",
                      Add_Before => False);
@@ -1723,7 +1726,7 @@ package body Project_Viewers is
          Add_Before => False);

       Gtk_New (Mitem);
-      Register_Menu (Kernel, Project, Mitem, Ref_Item => "Recent",
+      Register_Menu (Kernel, Project, Mitem, Ref_Item => -"Recent",
                      Add_Before => False);

       --  ??? Disabled for now, pending resolution of related problems
============================================================
--- prj_editor/src/scenario_views.adb	e36d060e258ead82f7cd2432686b86eb9b68dd16
+++ prj_editor/src/scenario_views.adb	91e8b880a6bfafcee8af07fe6e10ce3704bc2c2e
@@ -1,7 +1,7 @@
 -----------------------------------------------------------------------
 --                               GPS                                 --
 --                                                                   --
---                   Copyright (C) 2001-2008, AdaCore                --
+--                 Copyright (C) 2001-2008, AdaCore                  --
 --                                                                   --
 -- GPS is  free software;  you can redistribute it and/or modify  it --
 -- under the terms of the GNU General Public License as published by --
@@ -42,14 +42,14 @@ with Gtkada.MDI;          use Gtkada.MDI
 with Glib.Xml_Int;        use Glib.Xml_Int;
 with Gtkada.MDI;          use Gtkada.MDI;

-with Projects.Editor;    use Projects, Projects.Editor;
-with GPS.Kernel;         use GPS.Kernel;
-with GPS.Kernel.MDI;     use GPS.Kernel.MDI;
-with GPS.Kernel.Modules; use GPS.Kernel.Modules;
-with GPS.Kernel.Hooks;   use GPS.Kernel.Hooks;
-with GPS.Kernel.Project; use GPS.Kernel.Project;
-with Variable_Editors;   use Variable_Editors;
-with GPS.Intl;           use GPS.Intl;
+with Projects.Editor;     use Projects, Projects.Editor;
+with GPS.Kernel;          use GPS.Kernel;
+with GPS.Kernel.MDI;      use GPS.Kernel.MDI;
+with GPS.Kernel.Modules;  use GPS.Kernel.Modules;
+with GPS.Kernel.Hooks;    use GPS.Kernel.Hooks;
+with GPS.Kernel.Project;  use GPS.Kernel.Project;
+with Variable_Editors;    use Variable_Editors;
+with GPS.Intl;            use GPS.Intl;
 with String_List_Utils;

 with Traces;   use Traces;
@@ -86,7 +86,7 @@ package body Scenario_Views is
      (Kernel : access Kernel_Handle_Record'Class;
       List : access Gtk_List_Record'Class;
       Var  : Scenario_Variable);
-   --  Add all the possible values for type Typ into the List.
+   --  Add all the possible values for type Typ into the List

    type Variable_User_Data is record
       View : Scenario_View;
@@ -261,9 +261,9 @@ package body Scenario_Views is
       use String_List_Utils.String_List;

       Values : String_List_Utils.String_List.List :=
-        Enum_Values_Of (Var, Get_Registry (Kernel).all);
+                 Enum_Values_Of (Var, Get_Registry (Kernel).all);
       Iter   : String_List_Utils.String_List.List_Node :=
-        First (Values);
+                 First (Values);
       Item : Gtk_List_Item;
    begin
       while Iter /= String_List_Utils.String_List.Null_Node loop
@@ -328,7 +328,7 @@ package body Scenario_Views is
             Delete_Direct_References => False);
          Run_Hook (Data.View.Kernel, Variable_Changed_Hook);

-         --  Recompute the view so that the explorer is updated graphically.
+         --  Recompute the view so that the explorer is updated graphically
          Recompute_View (Data.View.Kernel);

          Trace (Me, "Delete_Variable: " & External_Reference_Of (Data.Var));
@@ -363,7 +363,7 @@ package body Scenario_Views is
          return;
       end if;

-      --  Remove all children, except the edit button.
+      --  Remove all children, except the edit button

       Child := Children (V.Table);
       Tmp := Widget_List.First (Child);
@@ -385,13 +385,14 @@ package body Scenario_Views is
       else
          declare
             Scenar_Var : constant Scenario_Variable_Array :=
-              Scenario_Variables (Kernel);
+                           Scenario_Variables (Kernel);
          begin
             if Scenar_Var'Length = 0 then
                Show_All (V.Empty_Label);
                Set_Child_Visible (V.Empty_Label, True);
                Set_USize (V.Empty_Event, -1, -1);
                Hide_All (V.Table);
+
             else
                Hide_All (V.Empty_Label);
                Set_Child_Visible (V.Empty_Label, False);
@@ -463,7 +464,8 @@ package body Scenario_Views is
       Child    : GPS_MDI_Child;
    begin
       Child := GPS_MDI_Child (Find_MDI_Child_By_Tag
-        (Get_MDI (Kernel), Scenario_View_Record'Tag));
+                              (Get_MDI (Kernel), Scenario_View_Record'Tag));
+
       if Child = null then
          Gtk_New (Scenario, Kernel);
          Gtk_New (Child, Scenario,
============================================================
--- share/library/debugger.py	02152d9aa7d794eab3f7a81966f33c155bed2e6c
+++ share/library/debugger.py	78c5c5c112aab6ca62274d69986760cd0c38ce93
@@ -30,6 +30,7 @@ from GPS import *
 ###########################################################################

 from GPS import *
+from gps_utils import *
 import text_utils, re, os.path

 Preference ("Plugins/debugger/save_autocont_br").create (
@@ -89,7 +90,11 @@ Contextual ("debug print as decimal").cr
 # Continuing till a specific line
 ####################################

+@interactive (name="continue till line", category="Debugger",
+              filter="Debugger active", key="control-b",
+              menu="/Debug/Continue to current line", after="Continue")
 def continue_till_line ():
+  """Continue executing the debuggee until it reaches the current editor line. If this line is never reached, the debugger will not stop"""
   context = current_context()
   try:
      debug = Debugger.get()
@@ -98,18 +103,6 @@ def continue_till_line ():
   except:
      pass  # No debugger active

-parse_xml ("""
-  <action name="continue till line" category="Debugger">
-    <filter id="Debugger active"/>
-    <shell lang="python">debugger.continue_till_line()</shell>
-    <description>Continue executing the debuggee until it reaches the current editor line. If this line is never reached, the debugger will not stop</description>
-  </action>
-  <menu action="continue till line" after="Continue">
-    <title>/Debug/Continue to current line</title>
-  </menu>
-  <key name="continue till line">control-b</key>
-""")
-
 ####################################
 # Breakpoint exceptions            #
 ####################################
============================================================
--- share/library/dispatching.py	38925dc9e4dda41dded5d120f1626fe9864d1cf9
+++ share/library/dispatching.py	ab956954cb95ed6339f701803b9aabc0c1068ee0
@@ -43,14 +43,15 @@ def highlight_entity_references (buffer,
 def highlight_entity_references (buffer, entity):
   """Highlight all dispatching calls to entity in buffer"""
   refs = entity.references (show_kind = True, in_file = buffer.file())
-  for r in refs:
-    if refs[r] == "dispatching call":
-       try:
-         loc = EditorLocation (buffer, r.line(), r.column())
-         buffer.apply_overlay (buffer.dispatch_overlay, loc, loc + len (entity.name()) - 1)
-       except:
-         # The xref location might no longer be valid, just ignore it
-         pass
+  if refs:
+    for r in refs:
+      if refs[r] == "dispatching call":
+         try:
+           loc = EditorLocation (buffer, r.line(), r.column())
+           buffer.apply_overlay (buffer.dispatch_overlay, loc, loc + len (entity.name()) - 1)
+         except:
+           # The xref location might no longer be valid, just ignore it
+           pass

 def highlight_file_idle ():
   """Process the next entity or file to highlight"""
============================================================
--- share/library/gnatr.xml	213d158ee72bdf1f009196d95fbb0e1dab5d6839
+++ share/library/gnatr.xml	8bd5f51679cb7a9ab00b945f8856fac7e075ea40
@@ -7,8 +7,14 @@
 -->

 <gnatr>
-   <action name="View types layout in file" output="gnatR" category="Builder" >
-      <external >gnatmake -f -gnatc -P%pp -gnatR -u %F</external>
+   <action name="View types layout in file" output="none" category="Builder" >
+      <external>gnatmake -f -gnatc -P%pp -gnatR -u %F</external>
+      <shell>base_name "%F"</shell>
+      <shell>dump_file "%2" "type_layout_%1"</shell>
+      <shell>Editor.edit "%1"</shell>
+      <shell>Editor.set_title "%2" "Type layout in %3"</shell>
+      <shell>Editor.set_writable "%3" FALSE</shell>
+      <shell>delete "%4"</shell>
       <filter id="Source editor" />
    </action>

@@ -18,5 +24,4 @@
          <Title>View types layout in file</Title>
       </menu>
    </Submenu>
-
 </gnatr>
============================================================
--- share/library/occurrences.py	3bc98a3482d12234b042f479a03e11eadab5cfe1
+++ share/library/occurrences.py	457f3d0e0623a6e1ff0b72696cd1806303718ffc
@@ -19,43 +19,26 @@ Locations window.

 
 ############################################################################
-## No user customization below this line
+## no user customization below this line
 ############################################################################

-menu_name = "/Navigate/Mark Occurrences in File"
-mark_action_name = "Mark occurrences"
-remove_action_name = "Remove marked occurrences"
-
 import GPS
+from gps_utils import *

-GPS.Preference ("Plugins/occurrences/color").create (
-  "Highlight color", "color",
-  """Color used to highlight matching occurrences.
-You must restart GPS to take changes into account""",
+GPS.Preference ("Plugins/occurrences/Color").create (
+  "highlight color", "color",
+  """color used to highlight matching occurrences.
+you must restart gps to take changes into account""",
   "lightblue")

 def on_gps_started (hook_name):
-  GPS.parse_xml ("""
-  <action name='""" + mark_action_name + """' category="Editor">
-     <filter id="Source editor" />
-     <description>Mark all the occurrences of the selected element in the current editor</description>
-     <shell lang="python" >occurrences.mark_selected()</shell>
-  </action>
-
-  <action name='""" + remove_action_name + """' category="Editor">
-     <filter id="Source editor" />
-     <description>Remove all highlightings done through Mark Occurrences</description>
-     <shell lang="python" >occurrences.unmark_selected()</shell>
-  </action>
-
-  <menu action='""" + mark_action_name + """'>
-     <title>""" + menu_name + """</title>
-  </menu>""")
-
   GPS.Editor.register_highlighting \
     ("dynamic occurrences", GPS.Preference ("Plugins/occurrences/color").get(), True)

+@interactive ("Editor", filter="Source editor", name="mark occurrences",
+              menu="/Navigate/Mark Occurrences In File")
 def mark_selected ():
+   """Mark all the occurrences of the selected element in the current editor"""
    buffer = GPS.EditorBuffer.get()
    selection = buffer.get_chars (buffer.selection_start(), buffer.selection_end() - 1)
    context=GPS.current_context()
@@ -68,8 +51,9 @@ def mark_selected ():
          GPS.Locations.add ("Local occurrences", m.file(), m.line(), m.column(),
               selection, highlight="dynamic occurrences", length=len(selection))

+@interactive ("Editor", filter="Source editor",
+              name="remove marked occurrences")
 def unmark_selected ():
    GPS.Locations.remove_category ("Local occurrences")

-
 GPS.Hook ("gps_started").add (on_gps_started)
============================================================
--- share/library/rectangles.py	a30685b0a1fceb465afd8c2c926ecb85e9f446c7
+++ share/library/rectangles.py	c409f93da0f6fd3c8a512ab2b70a359e24edbdda
@@ -3,6 +3,9 @@
    In particular, it is possible to select a rectangular area,
    cut it, and paste it elsewhere.

+   To perform a selection, use the standard selection mechanisms (e.g.
+   mouse+click selection, or keyboard shift+arrows).
+
    The highlighting of the selection itself is done on the whole
    lines, not on the rectangle itself, but the rectangle is the
    part between the column of the start of the selection, and the
============================================================
--- share/library/unicode.py	c665fd3e8c241d8153d78b4476ce8188b08a2d44
+++ share/library/unicode.py	83ef55f5464f29affc4495c74ca205c274e0142e
@@ -42,28 +42,19 @@ from GPS import *
 ############################################################################

 from GPS import *
+from gps_utils import *
 import unicodedata

-def on_gps_started (hook_name):
-   parse_xml ("""
-   <action name="Insert unicode" output="none" category="Editor">
-      <description>Insert any unicode character given its decimal or hexadecimal value, or its name</description>
-      <filter id="Source editor"/>
-      <shell lang="python">unicode.Unicode()</shell>
-   </action>
-   <action name="Describe unicode char" output="none" category="Editor">
-      <description>Describe the unicode character under the cursor (name, value,...)</description>
-      <filter id="Source editor" />
-      <shell lang="python">unicode.describe_char()</shell>
-   </action>
-   <menu action="Insert unicode" before="Insert File...">
-     <title>/Edit/Insert Unicode</title>
-   </menu>""")
-
 def findcommonstart(strlist):
   return strlist[0][:([min([x[0]==elem for elem in x]) \
                  for x in zip(*strlist)]+[0]).index(0)]

+@interactive (name="Insert unicode", category="Editor", filter="Source editor",
+              menu="/Edit/Insert Unicode", before="Insert File...")
+def insert ():
+  """Insert any unicode character given its decimal or hexadecimal value, or its name"""
+  Unicode ()
+
 class Unicode (CommandWindow):
    def __init__ (self):
       CommandWindow.__init__ (self, prompt="Character code:",
@@ -98,8 +89,10 @@ class Unicode (CommandWindow):
             chr = unicodedata.lookup (input)
          buffer.insert (buffer.current_view().cursor(), chr.encode('utf-8'))

+@interactive (name="Describe unicode char", category="Editor",
+              filter="Source editor")
 def describe_char (char = None):
-   """Describe the unicode character under the cursor"""
+   """Describe the unicode character under the cursor (name, value,...)"""
    if not char:
       char = EditorBuffer.get().current_view().cursor().get_char()
    uni = char.decode ("utf-8")
@@ -108,5 +101,3 @@ def describe_char (char = None):
    Console().write ("   Unicode: " + `ord (uni)` \
                     + " (U+" + hex (ord (uni))[2:] + ")\n")
    Console().write ("  Category: " + unicodedata.category (uni) + "\n")
-
-Hook ("gps_started").add (on_gps_started)
============================================================
--- share/plug-ins/Makefile.py	59619cdeb9af34757a29b5a2fd1b0bea97128971
+++ share/plug-ins/Makefile.py	748dc399697d76ddfc3209b4996ad6ea7f937ff2
@@ -10,8 +10,6 @@
                     attribute is optional. If unspecified, GPS will look for
                     either "Makefile" or "makefile" in the directory
                     containing the root project.
-                    Set this attribute to "<disabled>" to remove support for
-                    makefiles in this mode.

    This script defines the following new project attributes in the "ant"
    package of a .gpr file:
@@ -20,8 +18,6 @@
                     root project file (ie the one loaded in GPS). This
                     attribute is optional. If unspecified, GPS will look for
                     "build.xml" in the directory containing the root project.
-                    Set this attribute to "<disabled>" to remove support for
-                    ant in this mode.

    GPS will systematically compile the application by passing the scenario
    variables (see the menu /Tools/Views/Scenario). For instance, this
@@ -33,12 +29,6 @@
    These scenario variables are defined in the project file, and should have
    the same name as in the Makefile or the AntFile.

-   Any time a project is loaded or reloaded, GPS will update the /Build/Ant
-   and /Build/Makefile menus to add entries corresponding to the targets
-   available in the Makefile or AntFile.
-   You can conveniently set key shortcuts for these entries through the menu
-      /Edit/Key shortcuts
-
    By default, the name in the menu will be the name of the targets found in
    the build file.
    As a special case, when the comment is "IGNORE", as in:
@@ -61,12 +51,15 @@ from GPS import *
 from GPS import *

 # This is an XML model for make/gnumake
-Make_Model_Template = """
+Make_Model = """
 <target-model name="make" category="">
    <description>Build with make</description>
    <command-line>
       <arg>make</arg>
       <arg>%vars</arg>
+      <arg>-f</arg>
+      <arg>%attr(make'makefile,Makefile)</arg>
+      <arg>%T</arg>
    </command-line>
    <icon>gps-build-all</icon>
    <switches command="%(tool_name)s" columns="2" lines="2">
@@ -79,6 +72,21 @@ Make_Model_Template = """
            tip="Use N processes to carry out the compilations. On a multiprocessor machine compilations will occur in parallel" />
    </switches>
 </target-model>
+
+<target model="make" category="_Makefile" name="Make">
+    <in-toolbar>FALSE</in-toolbar>
+    <icon>gps-build-all</icon>
+    <launch-mode>MANUALLY</launch-mode>
+    <read-only>TRUE</read-only>
+    <target-type>make</target-type>
+    <command-line>
+       <arg>make</arg>
+       <arg>%vars</arg>
+       <arg>-f</arg>
+       <arg>%attr(make'makefile,Makefile)</arg>
+       <arg>%T</arg>
+    </command-line>
+</target>
 """

 # This is an XML model for ant
@@ -88,6 +96,9 @@ Ant_Model_Template = """
    <command-line>
       <arg>ant</arg>
       <arg>%vars(-D)</arg>
+       <arg>-buildfile</arg>
+       <arg>%attr(ant'antfile,build.xml)</arg>
+      <arg>%T</arg>
    </command-line>
    <icon>gps-build-all</icon>
    <switches command="%(tool_name)s" columns="2" lines="2">
@@ -97,71 +108,28 @@ Ant_Model_Template = """
      <check label="Project variables" switch="%vars"
            tip="Pass project variables to make" />
      <spin label="Multiprocessing" switch="-j" min="1" max="100" default="1"
-           tip="Use N processes to carry out the compilations. On a multiprocessor machine compilations will occur in parallel" />
+           tip="Use N processes to carry out the compilations. On a multiprocess
+or machine compilations will occur in parallel" />
    </switches>
 </target-model>
-"""

-# XML used to register new project attributes
-Project_Attributes="""
-  <project_attribute
-    name="makefile"
-    package="Make"
-    editor_section="Make"
-    description="Makefile to use for this project">
-    <string type="file"/>
-  </project_attribute>
-  <project_attribute
-    name="Make"
-    package="Make"
-    editor_section="Make"
-    description="Make command to use when parsing Makefile">
-    <string type="" default="make"/>
-  </project_attribute>
-  <project_attribute
-    name="Switches"
-    package="Make"
-    editor_section="Make"
-    description="Switches for the make command">
-    <string type="" default="-k"/>
-  </project_attribute>
-
-  <project_attribute
-    name="antfile"
-    package="Ant"
-    editor_section="Ant"
-    description="Ant build file