1 /* 2 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana 3 * University Research and Technology 4 * Corporation. All rights reserved. 5 * Copyright (c) 2004-2005 The University of Tennessee and The University 6 * of Tennessee Research Foundation. All rights 7 * reserved. 8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, 9 * University of Stuttgart. All rights reserved. 10 * Copyright (c) 2004-2005 The Regents of the University of California. 11 * All rights reserved. 12 * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. 13 * $COPYRIGHT$ 14 * 15 * Additional copyrights may follow 16 * 17 * $HEADER$ 18 */ 19 20 /** @file */ 21 22 #ifndef PMIX_UTIL_KEYVAL_PARSE_H 23 #define PMIX_UTIL_KEYVAL_PARSE_H 24 25 #include <src/include/pmix_config.h> 26 27 BEGIN_C_DECLS 28 29 PMIX_EXPORT extern int pmix_util_keyval_parse_lineno; 30 31 /** 32 * Callback triggered for each key = value pair 33 * 34 * Callback triggered from pmix_util_keyval_parse for each key = value 35 * pair. Both key and value will be pointers into static buffers. 36 * The buffers must not be free()ed and contents may be overwritten 37 * immediately after the callback returns. 38 */ 39 typedef void (*pmix_keyval_parse_fn_t)(const char *key, const char *value); 40 41 /** 42 * Parse \c filename, made up of key = value pairs. 43 * 44 * Parse \c filename, made up of key = value pairs. For each line 45 * that appears to contain a key = value pair, \c callback will be 46 * called exactly once. In a multithreaded context, calls to 47 * pmix_util_keyval_parse() will serialize multiple calls. 48 */ 49 PMIX_EXPORT int pmix_util_keyval_parse(const char *filename, 50 pmix_keyval_parse_fn_t callback); 51 52 PMIX_EXPORT int pmix_util_keyval_parse_init(void); 53 54 PMIX_EXPORT int pmix_util_keyval_parse_finalize(void); 55 56 PMIX_EXPORT int pmix_util_keyval_save_internal_envars(pmix_keyval_parse_fn_t callback); 57 58 END_C_DECLS 59 60 #endif