aboutsummaryrefslogtreecommitdiff
path: root/src/maple
diff options
context:
space:
mode:
authorjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2002-04-13 18:13:24 +0000
committerjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2002-04-13 18:13:24 +0000
commit9c527074ff42a619aa4a542f24f4db52f0413fc8 (patch)
treeb378f8633e7904eb7c7bc33142737af12073fcc5 /src/maple
parent6546309f2a2a8586ea4ef5c6e8a23e0caff209bd (diff)
generated C code now declares temp names 10 to a line for better readability
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@517 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src/maple')
-rw-r--r--src/maple/codegen2.maple32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/maple/codegen2.maple b/src/maple/codegen2.maple
index 5ffe7ac..29592cf 100644
--- a/src/maple/codegen2.maple
+++ b/src/maple/codegen2.maple
@@ -597,7 +597,7 @@ end;
################################################################################
#
-# This function prints a C declaration for a list of names.
+# This function prints C declarations for a list of names.
#
# Argument:
# name_list = A list of the names.
@@ -608,20 +608,24 @@ print_name_list_dcl :=
proc( name_list::list({name,string}),
name_type::string,
file_name::string )
-local blanks, separator_string;
+local nn;
-# a sequence of blanks with the same length as name_type
-seq(" ", i=1..length(name_type));
+nn := nops(name_list);
-# string to separate names
-separator_string := cat(",\n", %, " ");
-
-map(convert, name_list, string);
-ListTools[Join](%, separator_string);
-cat(op(%));
+# print up to 10 declarations on one line
+if (nn <= 10)
+ then
+ map(convert, name_list, string);
+ ListTools[Join](%, ", ");
+ cat(op(%));
+ fprintf(file_name,
+ "%s %s;\n",
+ name_type, %);
+ NULL;
+ return;
+fi;
-fprintf(file_name,
- "%s %s;\n",
- name_type, %);
-NULL;
+# recurse for larger numbers of declarations
+print_name_list_dcl([op(1..10, name_list)], name_type, file_name);
+print_name_list_dcl([op(11..nn, name_list)], name_type, file_name);
end proc;