diff inst/import_meshfunction_type.m @ 261:f22588ae37af

Improve template meshfunction implementation * inst/import_meshfunction_type.m: provide to the auxiliary functions a type name and a valid identifier * inst/private/generate_mf_*.m: add space before closing angle bracket to avoid parse errors
author Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
date Thu, 07 Aug 2014 11:13:54 +0200
parents 1e2a9be8083a
children 61830a4f9ab9
line wrap: on
line diff
--- a/inst/import_meshfunction_type.m	Wed Aug 06 19:52:03 2014 +0200
+++ b/inst/import_meshfunction_type.m	Thu Aug 07 11:13:54 2014 +0200
@@ -16,6 +16,7 @@
 ## -*- texinfo -*-
 ## @deftypefn {Function File} {} import_meshfunction_type (@var{typename})
 ## Add a wrapper for dolfin::MeshFunction <@var{typename}>
+## @seealso {MeshFunction}
 ## @end deftypefn
 
 function import_meshfunction_type (typename)
@@ -27,28 +28,29 @@
       error ("import_meshfunction_type: first argument is not a valid string");
     endif
 
-    # Ensure that the typename does not contain whitespace
     typename = strtrim (typename);
-    typename = strjoin (strsplit (typename), "");
+
+    # Ensure that the label does not contain whitespace or symbols
+    label = genvarname (strjoin (strsplit (typename), ""));
 
     if (! check_mf_files (typename))
       n = length (mfilename ("fullpath")) - length (mfilename());
       path = strtrunc(mfilename ("fullpath"), n);
 
       private = fullfile (path, "include/");
-      output = generate_mf_header (typename);
-      output += generate_mf_constructor (typename);
-      output += generate_mf_save (typename);
-      output += generate_mf_makefile (typename, private);
+      output = generate_mf_header (typename, label);
+      output += generate_mf_constructor (label);
+      output += generate_mf_save (typename, label);
+      output += generate_mf_makefile (label, private);
       if (output != 0)
         error ("compilation failed");
       else
-        [output, textfile] = system (["make -f Makefile_", typename, " all"]);
+        [output, textfile] = system (["make -f Makefile_", label, " all"]);
         if (output != 0)
           display (text);
           error ("compilation failed");
         endif
-        [output, textfile] = system (["make -f Makefile_", typename, " clean"]);
+        [output, textfile] = system (["make -f Makefile_", label, " clean"]);
         if (output != 0)
           display (text);
           error ("compilation failed");