#!/usr/bin/env perl
use strict;
my @dirs = ('../../ccsm_utils/Tools/per5lib', '../../ccsm_utils/Tools/perl5lib/Build');
unshift @INC, @dirs;
require XML::Lite;
use lib "../../ccsm_utils/Tools/perl5lib";
my $image_dir = "./images";
print <<"END_of_Start";
CESM Component Models Namelist Definitions
Search or Browse env_build.xml variables
This page contains the complete list of xml variables in env_build.xml.
These variables are locked after \$CASE.build is called.
They are grouped by categories designed to aid browsing. Clicking on the name
of a variable will display descriptive information. If search terms
are entered in the text box below, the list will be condensed to
contain only matched variables.
Found standard names matching query:
END_of_Start
my ($file) = "../../ccsm_utils/Case.template/config_definition.xml";
my $xml = XML::Lite->new( $file );
my $root = $xml->root_element();
# Check for valid root node
my $name = $root->get_name();
$name eq "config_definition" or die
"file $file is not a config definitions file\n";
# Print table for env_build.xml
my @groups = ("build_macros",
"build_def",
"build_component_cam",
"build_component_cice",
"build_component_clm",
"build_component_pop2",
"build_status",
"build_derived",
"build_grid",
);
my %cat_headings = ('build_macros' => 'Macro Generation Settings (used by cesm_setup)',
'build_def' => 'Build Control Settings (used by $CASE.build)',
'build_component_cam' => 'CAM build-time settings',
'build_component_clm' => 'CLM build-time settings',
'build_component_cice' => 'CICE build-time settings',
'build_component_pop2' => 'POP2 build-time settings',
'build_status' => 'Build Status (For Documentation Only: DO NOT EDIT)',
'build_derived' => 'Build Derived Directories (DO NOT EDIT)',
'build_grid' => 'Model Grid Specification (Experts Only: in general DO NOT EDIT)',
);
foreach my $group (@groups) {
print_start_table($group, $cat_headings{$group});
my @e = $xml->elements_by_name( "entry" );
my %a = ();
while ( my $e = shift @e ) {
%a = $e->get_attributes();
my $var = $a{'id'};
my $doc = $a{'sdesc'};
if ($a{'ldesc'}) {
$doc = "$doc . $a{'ldesc'}";
}
my $valid_values = $a{'valid_values'};
if ($valid_values ne "") {
$doc = $doc . "\nValid Values: $valid_values ";
}
my $grp = $a{'group'};
$grp =~ m/([^_]*)_(.*)/;
$grp = "env_$1.xml";
if (($grp eq "env_build.xml") && ($a{'group'} eq "$group")) {
print_row($var, $doc, $grp, $valid_values);
}
}
print_end_table();
}
# Finish
print <<"END_of_html";
END_of_html
#--------------------------------------------------------------------------------------------
sub print_start_table {
my $category = shift;
my $hdr = shift;
print <<"START_table";
$hdr
Variable Name
File Name
START_table
}
#--------------------------------------------------------------------------------------------
sub print_row {
my $name = shift;
my $doc = shift;
my $grp = shift;
print <<"END_of_row";