1
0

diplomacy: add RWXC permissions also to ResourceMappings

This commit is contained in:
Wesley W. Terpstra
2017-06-28 14:07:40 -07:00
parent 5436be54ff
commit bca3db0866
4 changed files with 12 additions and 10 deletions

View File

@ -118,14 +118,15 @@ trait CoreplexNetworkModule extends HasCoreplexParameters {
private def collect(path: List[String], value: ResourceValue): List[(String, ResourceAddress)] = {
value match {
case r: ResourceAddress => List((path(1), r))
case b: ResourceMapping => List((path(1), ResourceAddress(b.address, b.permissions)))
case ResourceMap(value, _) => value.toList.flatMap { case (key, seq) => seq.flatMap(r => collect(key :: path, r)) }
case _ => Nil
}
}
private val ranges = collect(Nil, outer.bindingTree).groupBy(_._2).toList.flatMap { case (key, seq) =>
AddressRange.fromSets(key.address).map { r => (r, key.r, key.w, key.x, key.c, seq.map(_._1)) }
AddressRange.fromSets(key.address).map { r => (r, key.permissions, seq.map(_._1)) }
}.sortBy(_._1)
private val json = ranges.map { case (range, r, w, x, c, names) =>
private val json = ranges.map { case (range, ResourcePermissions(r, w, x, c), names) =>
println(fmt.format(
range.base,
range.base+range.size,