Skip to content

Commit 5bc923f

Browse files
joa-quimseisman
andauthored
Export 4 gmt_conf_* (they were local). (#8512)
* Export 4 gmt_conf_* (they we local). Let the gmtlib_setparameter() function also change between CLASSIC & MODERN modes. * Rename SET_RUN_MODE to GMT_RUN_MODE * Update src/gmt_init.c Co-authored-by: Dongdong Tian <[email protected]> * Update src/gmt_init.c Co-authored-by: Dongdong Tian <[email protected]> --------- Co-authored-by: Dongdong Tian <[email protected]>
1 parent ccc94f6 commit 5bc923f

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

src/gmt_init.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6718,7 +6718,7 @@ GMT_LOCAL int gmtinit_get_language (struct GMT_CTRL *GMT) {
67186718
}
67196719

67206720
/*! . */
6721-
GMT_LOCAL void gmtinit_conf_classic_US (struct GMT_CTRL *GMT) {
6721+
EXTERN_MSC void gmtinit_conf_classic_US (struct GMT_CTRL *GMT) {
67226722
int i, case_val;
67236723
/* Update the settings to US where they differ from standard SI settings:
67246724
* Setting SI US
@@ -6759,7 +6759,7 @@ GMT_LOCAL void gmtinit_conf_classic_US (struct GMT_CTRL *GMT) {
67596759
}
67606760

67616761
/*! . */
6762-
GMT_LOCAL void gmtinit_conf_classic (struct GMT_CTRL *GMT) {
6762+
EXTERN_MSC void gmtinit_conf_classic (struct GMT_CTRL *GMT) {
67636763
int i, error = 0;
67646764
char path[PATH_MAX] = {""};
67656765
double const pt = 1.0/72.0; /* points to inch */
@@ -7274,13 +7274,13 @@ GMT_LOCAL void gmtinit_conf_modern_override (struct GMT_CTRL *GMT) {
72747274
GMT_Report (GMT->parent, GMT_MSG_ERROR, "Unrecognized value during gmtdefaults modern initialization.\n");}
72757275

72767276
/*! . */
7277-
GMT_LOCAL void gmtinit_conf_modern_US (struct GMT_CTRL *GMT) {
7277+
void gmtinit_conf_modern_US (struct GMT_CTRL *GMT) {
72787278
gmtinit_conf_classic_US (GMT); /* Override with US settings */
72797279
gmtinit_conf_modern_override (GMT);
72807280
}
72817281

72827282
/*! . */
7283-
GMT_LOCAL void gmtinit_conf_modern (struct GMT_CTRL *GMT) {
7283+
void gmtinit_conf_modern (struct GMT_CTRL *GMT) {
72847284
/* REPLACE WITH gmtinit_conf_modern when ready */
72857285
gmtinit_conf_classic (GMT);
72867286
gmtinit_conf_modern_override (GMT);
@@ -10930,6 +10930,14 @@ unsigned int gmtlib_setparameter (struct GMT_CTRL *GMT, const char *keyword, cha
1093010930
case_val = gmt_hash_lookup (GMT, keyword, keys_hashnode, GMT_N_KEYS, GMT_N_KEYS);
1093110931

1093210932
switch (case_val) {
10933+
case GMTCASE_GMT_RUN_MODE: /* Allow changing to/from CLASSIC/MODERN mode */
10934+
if (strcmp(value, "0") && strcmp(value, "1")) {
10935+
error = true;
10936+
GMT_Report (GMT->parent, GMT_MSG_ERROR, "Unrecognized value %s for SET_RUN_MODE\n", value);
10937+
break;
10938+
}
10939+
GMT->current.setting.run_mode = atoi(value);
10940+
break;
1093310941
/* FORMAT GROUP */
1093410942
case GMTCASE_INPUT_CLOCK_FORMAT:
1093510943
gmt_M_compat_translate ("FORMAT_CLOCK_IN");
@@ -12641,6 +12649,9 @@ char *gmtlib_getparameter (struct GMT_CTRL *GMT, const char *keyword) {
1264112649
case_val = gmt_hash_lookup (GMT, keyword, keys_hashnode, GMT_N_KEYS, GMT_N_KEYS);
1264212650

1264312651
switch (case_val) {
12652+
case GMTCASE_GMT_RUN_MODE: /* Gat the current running mode CLASSIC or MODERN */
12653+
sprintf (value, "%d", GMT->current.setting.run_mode);
12654+
break;
1264412655
/* FORMAT GROUP */
1264512656
case GMTCASE_INPUT_CLOCK_FORMAT:
1264612657
if (gmt_M_compat_check (GMT, 4)) /* GMT4: */

src/gmt_keywords.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ GMT_THEME # Group of GMT defaults to override
7878
GMT_TRIANGULATE # Triangulation algorithm
7979
GMT_VERBOSE # Verbosity level
8080
#-------------------------------------------------------
81+
GMT_RUN_MODE # To change between CLASSIC and MODERN mode. Used only by externals.
82+
#-------------------------------------------------------
8183
# IO Group: I/O settings
8284
#-------------------------------------------------------
8385
IO_COL_SEPARATOR # Column separator for output data records
@@ -175,4 +177,4 @@ TIME_REPORT # Controls time or elapsed run-time stamp in messages
175177
TIME_UNIT # Unit of time measurement
176178
TIME_SYSTEM # Shortcut to setting TIME_EPOCH/UNIT [does not go in gmt.conf]
177179
TIME_WEEK_START # Day a new week starts on
178-
TIME_Y2K_OFFSET_YEAR # For 2-digit years to separate 1900 and 2000 centuries
180+
TIME_Y2K_OFFSET_YEAR # For 2-digit years to separate 1900 and 2000 centuries

src/gmt_prototypes.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ EXTERN_MSC int gmt_get_V (char arg);
9292
EXTERN_MSC char gmt_set_V (int mode);
9393
EXTERN_MSC void gmt_conf_SI (struct GMT_CTRL *GMT);
9494
EXTERN_MSC void gmt_conf_US (struct GMT_CTRL *GMT);
95+
EXTERN_MSC void gmtinit_conf_modern_US (struct GMT_CTRL *GMT);
96+
EXTERN_MSC void gmtinit_conf_modern (struct GMT_CTRL *GMT);
97+
EXTERN_MSC void gmtinit_conf_classic_US (struct GMT_CTRL *GMT);
98+
EXTERN_MSC void gmtinit_conf_classic (struct GMT_CTRL *GMT);
9599
EXTERN_MSC int gmt_truncate_file (struct GMTAPI_CTRL *API, char *file, size_t size);
96100
EXTERN_MSC int gmt_set_current_panel (struct GMTAPI_CTRL *API, int fig, int row, int col, double gap[], char *label, unsigned int first);
97101
EXTERN_MSC int gmt_get_current_figure (struct GMTAPI_CTRL *API);

0 commit comments

Comments
 (0)