You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/CHANGELOG.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,12 +31,14 @@ sections to include in release notes:
31
31
- Build docs and push to gh-pages (#41)
32
32
- events.out file for agronomic event handling (#57)
33
33
- Utility `tools/trim_first_chars.sh` to trim the first n characters from every row in a file, useful for updating old input files to remove location column
34
-
- Expanded smoke test cases to better cover SIPNET modeling options (#109)
34
+
- Expanded smoke test cases to better cover SIPNET modeling options (#109, #114)
35
+
- Converted all compile-time switches not removed or hard-coded to be on into switches to run-time options (#114)
35
36
36
37
### Fixed
37
38
38
39
- Fixed OOM issue when reading bad data (#38, #45)
39
40
- Event order checks no longer only compare to first record (#74, #77)
41
+
- Fixed long-standing bug wherein microbePulseEff was not set to 0 when MICROBES was off (#114)
40
42
41
43
### Changed
42
44
@@ -52,6 +54,7 @@ sections to include in release notes:
52
54
- Removed obsolete run types senstest and montecarlo and associated code (#69, #76)
53
55
- Removed obsolete estimate program and associated code (#70, #82)
54
56
- Removed multi-site support; in particular, output files no longer have a location column (#92)
57
+
- Removed or hard-codes 'on' many compile time switches (#114)
Copy file name to clipboardExpand all lines: docs/developer-guide/cli-options.md
+91-10Lines changed: 91 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ When adding a new command-line option, you will need to add a corresponding memb
11
11
12
12
## Important Notes
13
13
14
-
**A note on naming:**
14
+
### Naming
15
15
16
16
Each command-line option must have a corresponding entry in the `Context` struct. SIPNET uses a mapping system to
17
17
link the command-line option (e.g. `print_header`) to its `Context` member (in this case, `printHeader`).
@@ -21,11 +21,12 @@ The mapping is created using the `nameToKey` function in `common/context.c` that
21
21
- removes all non-alphanumeric characters.
22
22
- converts alpha characters to lowercase.
23
23
24
-
For the mapping to work, the option name (e.g., `print_header`) and `Context` member name (in this case, `printHeader`) must generate the same key (e.g. `print_header` and `printHeader` both generate `printheader`).
24
+
For the mapping to work, the option name (e.g., `print_header`) and `Context` member name (in this case,
25
+
`printHeader`) must generate the same key (e.g. `print_header` and `printHeader` both generate `printheader`).
25
26
26
27
Each key must be unique across the `Context` member names.
27
28
28
-
**A note on precedence:**
29
+
### Precedence
29
30
30
31
SIPNET options can be specified in either (or both) a config file or a command-line option. Command-line options are
31
32
have precedence over config file options.
@@ -35,6 +36,8 @@ This means that:
35
36
- Options must be set via the macros `CREATE_INT_CONTEXT`/`CREATE_CHAR_CONTEXT` when they are created.
36
37
- The functions `updateIntContext`/`updateCharContext` must be used when updating a value.
37
38
39
+
See the Function/Macro Reference at the end for more information.
40
+
38
41
## Steps to Add Each Type of Option
39
42
40
43
For each type of option, the steps are similar:
@@ -97,6 +100,11 @@ Here are the steps to add a string-valued option:
97
100
2. Update `parseCLIArgs()`... [details TBD]
98
101
3. Update `usage()` to document the new option in the help text
99
102
103
+
### Long-Form Only Options
104
+
105
+
When adding to the `long_options` struct in step 3(i), give an int value as the last element of the the new
106
+
struct. This is the index that should be used in the `parseCLIArgs()` switch statement for handling the new
107
+
option. The int value must be unique among the other case labels.
100
108
101
109
## Additional Steps [TBD]
102
110
@@ -111,10 +119,83 @@ Here are the steps to add a string-valued option:
111
119
- Add tests for both the new option and its negation (if applicable) in [TBD].
112
120
- Anything to here to make sure this works in `sipnet.in`[TBD]?
113
121
114
-
## Long-Form Only Options
115
-
116
-
[TBD: fold this in above? This isn't that complicated; let's see if anything changes in the next round]
117
-
118
-
When adding to the `long_options` struct in step 3(i), give an int value as the last element of the the new
119
-
struct. This is the index that should be used in the `parseCLIArgs()` switch statement for handling the new
120
-
option. The int value must be unique among the other case labels.
122
+
## Function/Macro Reference
123
+
124
+
When adding a new CLI option, these functions and macros should be used to create and update
125
+
the corresponding fields in the `Context` struct.
126
+
127
+
### `CREATE_INT_CONTEXT`
128
+
129
+
This macro is used to initialize the `Context` field as well as create the necessary
130
+
metadata information for integer-based arguments, both flag and not.
131
+
This macro is used in the `initContext` function in `src/common/context.c`.
132
+
133
+
Syntax:
134
+
```c
135
+
CREATE_INT_CONTEXT(name, printName, value, flag)
136
+
```
137
+
Arguments:
138
+
-`name`: the exact name (no quotes) of the `Context` struct member used in `Context.h`
139
+
-`printName`: the name used for this option when printing via `--dump-config`
140
+
-`value`: the default integer value for this option; the defined values `ARG_ON` and `ARG_OFF` can be used for flag options
141
+
-`flag`: `FLAG_YES` or `FLAG_NO` to indicate whether this is a flag option
0 commit comments