Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:47:25

0001 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
0002 /*
0003  * Copyright (c) 2007-2008 Cisco Systems, Inc.  All rights reserved.
0004  * Copyright (c) 2015-2020 Intel, Inc.  All rights reserved.
0005  * Copyright (c) 2015      Research Organization for Information Science
0006  *                         and Technology (RIST). All rights reserved.
0007  * Copyright (c) 2021-2022 Nanook Consulting.  All rights reserved.
0008  * $COPYRIGHT$
0009  *
0010  * Additional copyrights may follow
0011  *
0012  * $HEADER$
0013  */
0014 
0015 /**
0016  * @file
0017  *
0018  * This interface is for regex support. This is a multi-select framework.
0019  *
0020  * Available plugins may be defined at runtime via the typical MCA parameter
0021  * syntax.
0022  */
0023 
0024 #ifndef PMIX_PREG_H
0025 #define PMIX_PREG_H
0026 
0027 #include "src/include/pmix_config.h"
0028 
0029 #include "src/mca/base/pmix_mca_base_framework.h"
0030 #include "src/mca/base/pmix_mca_base_var.h"
0031 #include "src/mca/bfrops/bfrops_types.h"
0032 #include "src/mca/mca.h"
0033 
0034 #include "src/mca/preg/preg_types.h"
0035 
0036 BEGIN_C_DECLS
0037 
0038 /******    MODULE DEFINITION    ******/
0039 
0040 #define PMIX_MAX_NODE_PREFIX 50
0041 
0042 /* given a semicolon-separated list of input values, generate
0043  * a regex that can be passed down to a client for parsing.
0044  * The caller is responsible for free'ing the resulting
0045  * string
0046  *
0047  * If values have leading zero's, then that is preserved.
0048  * Example:
0049  *
0050  * Input: odin009;odin010;odin011;odin012;odin017;odin018;thor176
0051  *
0052  * Output:
0053  *     "foo:odin[009-012,017-018],thor176"
0054  *
0055  * Note that the "foo" at the beginning of the regex indicates
0056  * that the "foo" regex component is to be used to parse the
0057  * provided regex.
0058  */
0059 typedef pmix_status_t (*pmix_preg_base_module_generate_node_regex_fn_t)(const char *input,
0060                                                                         char **regex);
0061 
0062 /* The input is expected to consist of a comma-separated list
0063  * of ranges. Thus, an input of:
0064  *     "1-4;2-5;8,10,11,12;6,7,9"
0065  * would generate a regex of
0066  *     "[pmix:2x(3);8,10-12;6-7,9]"
0067  *
0068  * Note that the "pmix" at the beginning of each regex indicates
0069  * that the PMIx native parser is to be used by the client for
0070  * parsing the provided regex. Other parsers may be supported - see
0071  * the pmix_client.h header for a list.
0072  */
0073 typedef pmix_status_t (*pmix_preg_base_module_generate_ppn_fn_t)(const char *input, char **ppn);
0074 
0075 typedef pmix_status_t (*pmix_preg_base_module_parse_nodes_fn_t)(const char *regexp, char ***names);
0076 
0077 typedef pmix_status_t (*pmix_preg_base_module_parse_procs_fn_t)(const char *regexp, char ***procs);
0078 
0079 typedef pmix_status_t (*pmix_preg_base_module_copy_fn_t)(char **dest, size_t *len,
0080                                                          const char *input);
0081 
0082 typedef pmix_status_t (*pmix_preg_base_module_pack_fn_t)(pmix_buffer_t *buffer, const char *regex);
0083 
0084 typedef pmix_status_t (*pmix_preg_base_module_unpack_fn_t)(pmix_buffer_t *buffer, char **regex);
0085 
0086 typedef pmix_status_t (*pmix_preg_base_module_release_fn_t)(char *regexp);
0087 
0088 /**
0089  * Base structure for a PREG module
0090  */
0091 typedef struct {
0092     char *name;
0093     pmix_preg_base_module_generate_node_regex_fn_t generate_node_regex;
0094     pmix_preg_base_module_generate_ppn_fn_t generate_ppn;
0095     pmix_preg_base_module_parse_nodes_fn_t parse_nodes;
0096     pmix_preg_base_module_parse_procs_fn_t parse_procs;
0097     pmix_preg_base_module_copy_fn_t copy;
0098     pmix_preg_base_module_pack_fn_t pack;
0099     pmix_preg_base_module_unpack_fn_t unpack;
0100     pmix_preg_base_module_release_fn_t release;
0101 } pmix_preg_module_t;
0102 
0103 /* we just use the standard component definition */
0104 
0105 PMIX_EXPORT extern pmix_preg_module_t pmix_preg;
0106 
0107 /*
0108  * Macro for use in components that are of type preg
0109  */
0110 #define PMIX_PREG_BASE_VERSION_1_0_0 PMIX_MCA_BASE_VERSION_1_0_0("preg", 1, 0, 0)
0111 
0112 END_C_DECLS
0113 
0114 #endif