Commits

Barry Schwartz committed 226a3b1

Let options, pure-options, fortran-options, etc., have values.

  • Participants
  • Parent commits c24b412

Comments (0)

Files changed (3)

File examples/c3ga.xml

 <!ENTITY free-bivector "e1⋀e2⋀ni, e2⋀e3⋀ni, e1⋀e3⋀ni">
 <!ENTITY translator "1, &free-vector;">
 ]>
-<geomalg pure-mv-symbol="mv"
-         pure-scalar="scalar"
-         pure-scalar-matrix="matrix"
-         pure-double-code="separate">
-
+<geomalg pure-options="double-code=separate,
+                       mv-symbol=mv,
+                       scalar=scalar,
+                       scalar-matrix=matrix"
+         fortran-options="scalar=c_double,
+                          mv-type=mv,
+                          mv-allocatable=false,
+                          mv-bindc=true">
+  
   <!-- If the basis is given a ‘metric’ attribute, this attribute
        specifies an orthonormal euclidean metric for the basis. -->
   <basis metric="euclidean"> &grade1; </basis>
 
   <template language="fortran" fortran-options="fortran-fold">
     module c3ga
+    use, intrinsic :: iso_c_binding
+    implicit none
+
     end module c3ga
   </template>
 

File geomalg/markup.pure

   end
   with
     adopt_opt opt_set opt::string =
-      if opt!0 == "-" then
-        delete opt_set (drop 1 opt)
+      if key!0 == "-" then
+        (if val == "" then
+           delete opt_set (drop 1 key)
+         else
+           delete opt_set (drop 1 (key=>val)))
       else
-        insert opt_set opt;
+        insert opt_set (key=>val)
+      when
+        parts = split "=" opt;
+        key,val =
+          case #parts of
+            1 = parts!0, "";
+            2 = tuple parts;
+            _ = #parts!0, join "=" (drop 1 parts);
+          end;
+      end;
   end;
 
 //-------------------------------------------------------------------------

File geomalg/operation_product.pure

       markup::search_toward_root (markup::output_name "pure") procedure_node;
     func = val func_name;
 
-    mv_symbol_name =
-      markup::search_toward_root (flip xml::node_attr "pure-mv-symbol") procedure_node;
-    mv_symbol = if stringp mv_symbol_name then
-                  val mv_symbol_name
-                else
-                  '::geomalg::symb::mv;     // FIXME: Do we want this?
-
-    scalar_type_name =
-      markup::search_toward_root (flip xml::node_attr "pure-scalar") procedure_node;
-    scalar_type = if stringp scalar_type_name then
-                    val scalar_type_name
-                  else
-                    '::real;                // FIXME: Do we want this?
-
-    matrix_type_name =
-      markup::search_toward_root (flip xml::node_attr "pure-scalar-matrix") procedure_node;
-    matrix_type = if stringp matrix_type_name then
-                    val matrix_type_name
-                  else
-                    '::matrix;
-
     convert_constant_name =
       markup::search_toward_root (flip xml::node_attr "pure-convert-constant") procedure_node;
     convert_constant = if stringp convert_constant_name then
                        else
                          id;
 
-    double_code_string =
-      markup::search_toward_root (flip xml::node_attr "pure-double-code") procedure_node;
-    double_code_separate = stringp double_code_string && double_code_string == "separate";
-
+    mv_symbol = catch (cst ('::geomalg::symb::mv)) (val (opts!"mv-symbol"));
+    scalar_type = catch (cst ('::real)) (val (opts!"scalar"));
+    matrix_type = catch (cst ('::matrix)) (val (opts!"scalar-matrix"));
+    double_code_separate = catch (cst false) (opts!"double-code" == "separate");
     exclude_scalar = member opts "exclude-scalar";
 
     scalar_scalar = xml::select procedure_node "case[@arg0=0][@arg1=0]";