[settings] possibility to exclude targets

This commit is contained in:
Felix Ruess
2015-04-13 21:58:59 +02:00
parent ddf074342e
commit 5102c466c5
2 changed files with 14 additions and 3 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
<!DOCTYPE settings SYSTEM "../settings.dtd">
<settings target="ap|nps">
<settings target="!sim">
<dl_settings>
<dl_settings NAME="body2imu">
<dl_setting MAX="90" MIN="-90" STEP="0.5" VAR="imu.body_to_imu.eulers_f.phi" shortname="b2i phi" module="subsystems/imu" param="IMU_BODY_TO_IMU_PHI" unit="rad" alt_unit="deg" handler="SetBodyToImuPhi"/>
+13 -2
View File
@@ -276,6 +276,17 @@ let parse_rc_mode = fun xml ->
let parse_rc_modes = fun xml ->
List.iter parse_rc_mode (Xml.children xml)
(*
Check if target t is marked as supported in the targets string.
The targets string is a pipe delimited list of supported targets, e.g. "ap|nps"
To specifiy a list with unsupported targets, prefix with !
e.g. "!sim|nps" to mark support for all targets except sim and nps.
*)
let supports_target = fun t targets ->
if (String.get targets 0) = '!' then
not (Str.string_match (Str.regexp (".*"^t^".*")) targets 0)
else
Str.string_match (Str.regexp (".*"^t^".*")) targets 0
let join_xml_files = fun xml_files ->
let dl_settings = ref []
@@ -302,7 +313,7 @@ let join_xml_files = fun xml_files ->
if List.exists (fun n ->
if Xml.tag n = "makefile" then begin
let t = ExtXml.attrib_or_default n "target" Env.default_module_targets in
Str.string_match (Str.regexp (".*"^target^".*")) t 0
supports_target target t
end
else false
) (Xml.children xml)
@@ -313,7 +324,7 @@ let join_xml_files = fun xml_files ->
(* if the top <settings> node has a target attribute,
only add if matches current target *)
let t = ExtXml.attrib_or_default xml "target" "" in
if t = "" || Str.string_match (Str.regexp (".*"^target^".*")) t 0 then
if t = "" || (supports_target target t) then
[xml]
else
[]