Skip to content

Commit 04024a6

Browse files
committed
When running the 'parse' tool, provide Registry file as command-line argument
The 'parse' tool for generating code based on a Registry file can either read the Registry from stdin or from a file whose name is supplied as a command-line argument. This tool assumes that if its command-line argument count is 2, then the argument is a Registry filename (the argument count is 1 if no command-line arguments are given). Since future development will add processing for an arbitrary number of command-line arguments to the parse tool, deciding whether to read the Registry from stdin based on the argument count is not a viable strategy, so with this commit, each core's Makefile now passes a filename as the only argument to the parse tool, and the parse tool itself has been modified to require a command-line argument.
1 parent f084b36 commit 04024a6

8 files changed

Lines changed: 12 additions & 11 deletions

File tree

src/core_atmosphere/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ core_input_gen:
3030

3131
gen_includes: core_reg
3232
(if [ ! -d inc ]; then mkdir -p inc; fi) # To generate *.inc files
33-
(cd inc; $(REG_PARSE) < ../Registry_processed.xml )
33+
(cd inc; $(REG_PARSE) ../Registry_processed.xml )
3434

3535
post_build:
3636
if [ ! -e $(ROOT_DIR)/default_inputs ]; then mkdir $(ROOT_DIR)/default_inputs; fi

src/core_init_atmosphere/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ core_input_gen:
4141
gen_includes:
4242
$(CPP) $(CPPFLAGS) $(CPPINCLUDES) Registry.xml > Registry_processed.xml
4343
(if [ ! -d inc ]; then mkdir -p inc; fi) # To generate *.inc files
44-
(cd inc; $(REG_PARSE) < ../Registry_processed.xml )
44+
(cd inc; $(REG_PARSE) ../Registry_processed.xml )
4545

4646
post_build:
4747
if [ ! -e $(ROOT_DIR)/default_inputs ]; then mkdir $(ROOT_DIR)/default_inputs; fi

src/core_landice/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ core_reg:
3131
gen_includes:
3232
$(CPP) $(CPPFLAGS) $(CPPINCLUDES) Registry.xml > Registry_processed.xml
3333
(if [ ! -d inc ]; then mkdir -p inc; fi) # To generate *.inc files
34-
(cd inc; $(REG_PARSE) < ../Registry_processed.xml )
34+
(cd inc; $(REG_PARSE) ../Registry_processed.xml )
3535

3636
post_build:
3737
if [ ! -e $(ROOT_DIR)/default_inputs ]; then mkdir $(ROOT_DIR)/default_inputs; fi

src/core_ocean/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ core_input_gen:
3131
gen_includes:
3232
$(CPP) $(CPPFLAGS) $(CPPINCLUDES) Registry.xml > Registry_processed.xml
3333
(if [ ! -d inc ]; then mkdir -p inc; fi) # To generate *.inc files
34-
(cd inc; $(REG_PARSE) < ../Registry_processed.xml )
34+
(cd inc; $(REG_PARSE) ../Registry_processed.xml )
3535

3636
post_build:
3737
if [ ! -e $(ROOT_DIR)/default_inputs ]; then mkdir $(ROOT_DIR)/default_inputs; fi

src/core_seaice/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ core_seaice: column_package shared analysis_members model_forward
99
gen_includes:
1010
$(CPP) $(CPPFLAGS) $(CPPINCLUDES) Registry.xml > Registry_processed.xml
1111
(if [ ! -d inc ]; then mkdir -p inc; fi) # To generate *.inc files
12-
(cd inc; $(REG_PARSE) < ../Registry_processed.xml )
12+
(cd inc; $(REG_PARSE) ../Registry_processed.xml )
1313

1414
core_input_gen:
1515
if [ ! -e default_inputs ]; then mkdir default_inputs; fi

src/core_sw/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ core_input_gen:
2121
gen_includes:
2222
$(CPP) $(CPPFLAGS) $(CPPINCLUDES) Registry.xml > Registry_processed.xml
2323
(if [ ! -d inc ]; then mkdir -p inc; fi) # To generate *.inc files
24-
(cd inc; $(REG_PARSE) < ../Registry_processed.xml )
24+
(cd inc; $(REG_PARSE) ../Registry_processed.xml )
2525

2626
post_build:
2727
if [ ! -e $(ROOT_DIR)/default_inputs ]; then mkdir $(ROOT_DIR)/default_inputs; fi

src/core_test/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ core_input_gen:
2828
gen_includes:
2929
$(CPP) $(CPPFLAGS) $(CPPINCLUDES) Registry.xml > Registry_processed.xml
3030
(if [ ! -d inc ]; then mkdir -p inc; fi) # To generate *.inc files
31-
(cd inc; $(REG_PARSE) < ../Registry_processed.xml )
31+
(cd inc; $(REG_PARSE) ../Registry_processed.xml )
3232

3333
post_build:
3434
if [ ! -e $(ROOT_DIR)/default_inputs ]; then mkdir $(ROOT_DIR)/default_inputs; fi

src/tools/registry/parse.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ int main(int argc, char ** argv)/*{{{*/
3333
struct package * pkgs;
3434
int err;
3535

36-
if (argc != 2) {
37-
fprintf(stderr,"Reading registry file from standard input\n");
38-
regfile = stdin;
36+
if (argc < 2) {
37+
fprintf(stderr,"\nUsage: %s <Registry file>\n\n", argv[0]);
38+
return 1;
3939
}
40-
else if (!(regfile = fopen(argv[1], "r"))) {
40+
41+
if (!(regfile = fopen(argv[1], "r"))) {
4142
fprintf(stderr,"\nError: Could not open file %s for reading.\n\n", argv[1]);
4243
return 1;
4344
}

0 commit comments

Comments
 (0)