Barry Schwartz avatar Barry Schwartz committed c0ec075

Some fixes in code augmentation.

Comments (0)

Files changed (1)

geomalg/markup_augment.pure

   else
     (xml::set_node_attr (parent_nodes!0) "blade-groups" (str blade_groups) $$
      xml::set_node_attr (parent_nodes!0) "bitmap-groups" (str bitmap_groups) $$
-     void [xml::set_node_attr (nodes!i) "slice-index" (str i) |
-           i = 0..#nodes - 1] $$
+     xml::set_node_attr (parent_nodes!0) "names-to-indices" (str names_to_indices) $$
+     xml::set_node_attr (parent_nodes!0) "indices-to-names" (str indices_to_names) $$
      my_root
        when
          parent_nodes = xml::select my_root "mvslices";
          basis_blade_count = get_basis_blade_count my_root;
          case last explicit_blade_groups of
            g = () if #g == basis_blade_count;
-           _ = (xml::add_last (parent_nodes!0)
+           _ = (xml::add_last (last parent_nodes)
                 (xml::element_text "mvslice" [] [] (str $ tuple blades)))
              when
                blades = [symb::basis_blade 1 i | i = 0..basis_blade_count - 1];
              end;
          end;
 
+         nodes = xml::select my_root "mvslices/mvslice";
+         void [xml::set_node_attr (nodes!i) "slice-index" (str i) |
+               i = 0..#nodes - 1];
+
          blade_groups = get_blade_groups my_root nodes;
          bitmap_groups = [sort (<) $ map multiblade::bitmap B | B = blade_groups];
+         names_to_indices =
+           [xml::node_attr n "name" => val (xml::node_attr n "slice-index") |
+            n = xml::select my_root "mvslices/mvslice[@name]"];
+         indices_to_names = [index=>name | name=>index = names_to_indices];
        end);
 
 get_mvslices_attribute attribute::string my_root = s
 
 get_mvslices_blade_groups = get_mvslices_augmentation "blade-groups";
 get_mvslices_bitmap_groups = get_mvslices_augmentation "bitmap-groups";
+get_mvslices_names_to_indices = get_mvslices_augmentation "names_to_indices";
+get_mvslices_indices_to_names = get_mvslices_augmentation "indices_to_names";
 
 register_augmenter ('augment_mvslices);
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.