/* * Copyright (c) 2012-2020 by the GMT Team (https://www.generic-mapping-tools.org/team.html) * See LICENSE.TXT file for copying and redistribution conditions. */ /* gmt_@SHARED_LIB_NAME@_glue.c populates the external array of this shared lib with * module parameters such as name, group, purpose and keys strings. * This file also contains the following convenience functions to * display all module purposes, list their names, or return keys or group: * * int @SHARED_LIB_NAME@_module_show_all (void *API); * int @SHARED_LIB_NAME@_module_list_all (void *API); * int @SHARED_LIB_NAME@_module_classic_all (void *API); * * These functions may be called by gmt --help and gmt --show-modules * * Developers of external APIs for accessing GMT modules will use this * function indirectly via GMT_Encode_Options to retrieve option keys * needed for module arg processing: * * const char *@SHARED_LIB_NAME@_module_keys (void *API, char *candidate); * const char *@SHARED_LIB_NAME@_module_group (void *API, char *candidate); * * All functions are exported by the shared library so that gmt can call these * functions by name to learn about the library. */ #include "gmt.h" /* Sorted array with information for all GMT _@SHARED_LIB_NAME@_ modules */ static struct GMT_MODULEINFO modules[] = { #include "gmt_@SHARED_LIB_NAME@_moduleinfo.h" {NULL, NULL, NULL, NULL, NULL} /* last element == NULL detects end of array */ }; /* Pretty print all shared module names and their purposes for gmt --help */ EXTERN_MSC int @SHARED_LIB_NAME@_module_show_all (void *API) { return (GMT_Show_ModuleInfo (API, modules, "@SHARED_LIB_PURPOSE@", GMT_MODULE_HELP)); } /* Produce single list on stdout of all shared module names for gmt --show-modules */ EXTERN_MSC int @SHARED_LIB_NAME@_module_list_all (void *API) { return (GMT_Show_ModuleInfo (API, modules, NULL, GMT_MODULE_SHOW_MODERN)); } /* Produce single list on stdout of all shared module names for gmt --show-classic [i.e., classic mode names] */ EXTERN_MSC int @SHARED_LIB_NAME@_module_classic_all (void *API) { return (GMT_Show_ModuleInfo (API, modules, NULL, GMT_MODULE_SHOW_CLASSIC)); } /* Lookup module id by name, return option keys pointer (for external API developers) */ EXTERN_MSC const char *@SHARED_LIB_NAME@_module_keys (void *API, char *candidate) { return (GMT_Get_ModuleInfo (API, modules, candidate, GMT_MODULE_KEYS)); } /* Lookup module id by name, return group char name (for external API developers) */ EXTERN_MSC const char *@SHARED_LIB_NAME@_module_group (void *API, char *candidate) { return (GMT_Get_ModuleInfo (API, modules, candidate, GMT_MODULE_GROUP)); }