From 9c527074ff42a619aa4a542f24f4db52f0413fc8 Mon Sep 17 00:00:00 2001 From: jthorn Date: Sat, 13 Apr 2002 18:13:24 +0000 Subject: 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 --- src/maple/codegen2.maple | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'src') 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; -- cgit v1.2.3