[1] | 1 | %{ |
---|
| 2 | /* $Id: drmaa_attrib.gperf 1409 2008-09-25 08:59:45Z lukasz $ */ |
---|
| 3 | /* |
---|
| 4 | * FedStage DRMAA utilities library |
---|
| 5 | * Copyright (C) 2006-2008 FedStage Systems |
---|
| 6 | * |
---|
| 7 | * This program is free software: you can redistribute it and/or modify |
---|
| 8 | * it under the terms of the GNU General Public License as published by |
---|
| 9 | * the Free Software Foundation, either version 3 of the License, or |
---|
| 10 | * (at your option) any later version. |
---|
| 11 | * |
---|
| 12 | * This program is distributed in the hope that it will be useful, |
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 15 | * GNU General Public License for more details. |
---|
| 16 | * |
---|
| 17 | * You should have received a copy of the GNU General Public License |
---|
| 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
| 19 | */ |
---|
| 20 | #ifdef HAVE_CONFIG_H |
---|
| 21 | # include <config.h> |
---|
| 22 | #endif |
---|
| 23 | |
---|
| 24 | #include <drmaa_utils/common.h> |
---|
| 25 | #include <drmaa_utils/drmaa_attrib.h> |
---|
| 26 | #include <drmaa_utils/template.h> |
---|
| 27 | |
---|
| 28 | #ifndef lint |
---|
| 29 | static char rcsid[] |
---|
| 30 | # ifdef __GNUC__ |
---|
| 31 | __attribute__ ((unused)) |
---|
| 32 | # endif |
---|
| 33 | = "$Id: drmaa_attrib.gperf 1409 2008-09-25 08:59:45Z lukasz $"; |
---|
| 34 | #endif |
---|
| 35 | |
---|
| 36 | extern const fsd_attribute_t drmaa_attributes[]; |
---|
| 37 | #define t(code) \ |
---|
| 38 | ( & drmaa_attributes[ code ] ) |
---|
| 39 | |
---|
| 40 | %} |
---|
| 41 | |
---|
| 42 | %language=ANSI-C |
---|
| 43 | %includes |
---|
| 44 | %readonly-tables |
---|
| 45 | %pic |
---|
| 46 | %define lookup-function-name drmaa_attrib_lookup |
---|
| 47 | %struct-type |
---|
| 48 | struct drmaa_attrib { int name; const fsd_attribute_t *attr; } |
---|
| 49 | |
---|
| 50 | %% |
---|
| 51 | drmaa_remote_command, t(DRMAA_ATTR_REMOTE_COMMAND) |
---|
| 52 | drmaa_v_argv, t(DRMAA_ATTR_ARGS) |
---|
| 53 | drmaa_js_state, t(DRMAA_ATTR_JOB_SUBMISSION_STATE) |
---|
| 54 | drmaa_v_env, t(DRMAA_ATTR_JOB_ENVIRONMENT) |
---|
| 55 | drmaa_wd, t(DRMAA_ATTR_WORKING_DIRECTORY) |
---|
| 56 | drmaa_job_category, t(DRMAA_ATTR_JOB_CATEGORY) |
---|
| 57 | drmaa_native_specification, t(DRMAA_ATTR_NATIVE_SPECIFICATION) |
---|
| 58 | drmaa_v_email, t(DRMAA_ATTR_EMAIL) |
---|
| 59 | drmaa_block_email, t(DRMAA_ATTR_BLOCK_EMAIL) |
---|
| 60 | drmaa_start_time, t(DRMAA_ATTR_START_TIME) |
---|
| 61 | drmaa_job_name, t(DRMAA_ATTR_JOB_NAME) |
---|
| 62 | drmaa_input_path, t(DRMAA_ATTR_INPUT_PATH) |
---|
| 63 | drmaa_output_path, t(DRMAA_ATTR_OUTPUT_PATH) |
---|
| 64 | drmaa_error_path, t(DRMAA_ATTR_ERROR_PATH) |
---|
| 65 | drmaa_join_files, t(DRMAA_ATTR_JOIN_FILES) |
---|
| 66 | drmaa_transfer_files, t(DRMAA_ATTR_TRANSFER_FILES) |
---|
| 67 | drmaa_deadline_time, t(DRMAA_ATTR_DEADLINE_TIME) |
---|
| 68 | drmaa_wct_hlimit, t(DRMAA_ATTR_HARD_WALL_CLOCK_TIME_LIMIT) |
---|
| 69 | drmaa_wct_slimit, t(DRMAA_ATTR_SOFT_WALL_CLOCK_TIME_LIMIT) |
---|
| 70 | drmaa_duration_hlimit, t(DRMAA_ATTR_HARD_RUN_DURATION_LIMIT) |
---|
| 71 | drmaa_duration_slimit, t(DRMAA_ATTR_SOFT_RUN_DURATION_LIMIT) |
---|
| 72 | %% |
---|
| 73 | |
---|
| 74 | #undef t |
---|
| 75 | |
---|
| 76 | static const fsd_attribute_t * |
---|
| 77 | drmaa_template_by_name( const fsd_template_t *self, const char *name ) |
---|
| 78 | { |
---|
| 79 | const struct drmaa_attrib *found; |
---|
| 80 | found = drmaa_attrib_lookup( name, strlen(name) ); |
---|
| 81 | if( found != NULL ) |
---|
| 82 | return found->attr; |
---|
| 83 | else |
---|
| 84 | fsd_exc_raise_fmt( |
---|
| 85 | FSD_ERRNO_INVALID_ARGUMENT, |
---|
| 86 | "invalid DRMAA attribute name: %s", name |
---|
| 87 | ); |
---|
| 88 | } |
---|
| 89 | |
---|
| 90 | |
---|
| 91 | static const fsd_attribute_t * |
---|
| 92 | drmaa_template_by_code( const fsd_template_t *self, int code ) |
---|
| 93 | { |
---|
| 94 | if( 0 <= code && code < DRMAA_N_ATTRIBUTES ) |
---|
| 95 | return & drmaa_attributes[ code ]; |
---|
| 96 | else |
---|
| 97 | fsd_exc_raise_fmt( |
---|
| 98 | FSD_ERRNO_INVALID_ARGUMENT, |
---|
| 99 | "invalid attribute code: %d", code |
---|
| 100 | ); |
---|
| 101 | } |
---|
| 102 | |
---|
| 103 | |
---|
| 104 | fsd_template_t * |
---|
| 105 | drmaa_template_new(void) |
---|
| 106 | { |
---|
| 107 | return fsd_template_new( |
---|
| 108 | drmaa_template_by_name, |
---|
| 109 | drmaa_template_by_code, |
---|
| 110 | DRMAA_N_ATTRIBUTES |
---|
| 111 | ); |
---|
| 112 | } |
---|
| 113 | |
---|
| 114 | |
---|
| 115 | const fsd_attribute_t drmaa_attributes[ DRMAA_N_ATTRIBUTES ] = { |
---|
| 116 | { "drmaa_remote_command", DRMAA_ATTR_REMOTE_COMMAND, false }, |
---|
| 117 | { "drmaa_v_argv", DRMAA_ATTR_ARGS, true }, |
---|
| 118 | { "drmaa_js_state", DRMAA_ATTR_JOB_SUBMISSION_STATE, false }, |
---|
| 119 | { "drmaa_v_env", DRMAA_ATTR_JOB_ENVIRONMENT, true }, |
---|
| 120 | { "drmaa_wd", DRMAA_ATTR_WORKING_DIRECTORY, false }, |
---|
| 121 | { "drmaa_job_category", DRMAA_ATTR_JOB_CATEGORY, false }, |
---|
| 122 | { "drmaa_native_specification", DRMAA_ATTR_NATIVE_SPECIFICATION, false }, |
---|
| 123 | { "drmaa_v_email", DRMAA_ATTR_EMAIL, true }, |
---|
| 124 | { "drmaa_block_email", DRMAA_ATTR_BLOCK_EMAIL, false }, |
---|
| 125 | { "drmaa_start_time", DRMAA_ATTR_START_TIME, false }, |
---|
| 126 | { "drmaa_job_name", DRMAA_ATTR_JOB_NAME, false }, |
---|
| 127 | { "drmaa_input_path", DRMAA_ATTR_INPUT_PATH, false }, |
---|
| 128 | { "drmaa_output_path", DRMAA_ATTR_OUTPUT_PATH, false }, |
---|
| 129 | { "drmaa_error_path", DRMAA_ATTR_ERROR_PATH, false }, |
---|
| 130 | { "drmaa_join_files", DRMAA_ATTR_JOIN_FILES, false }, |
---|
| 131 | { "drmaa_transfer_files", DRMAA_ATTR_TRANSFER_FILES, false }, |
---|
| 132 | { "drmaa_deadline_time", DRMAA_ATTR_DEADLINE_TIME, false }, |
---|
| 133 | { "drmaa_wct_hlimit", DRMAA_ATTR_HARD_WALL_CLOCK_TIME_LIMIT, false }, |
---|
| 134 | { "drmaa_wct_slimit", DRMAA_ATTR_SOFT_WALL_CLOCK_TIME_LIMIT, false }, |
---|
| 135 | { "drmaa_duration_hlimit", DRMAA_ATTR_HARD_RUN_DURATION_LIMIT, false }, |
---|
| 136 | { "drmaa_duration_slimit", DRMAA_ATTR_SOFT_RUN_DURATION_LIMIT, false } |
---|
| 137 | }; |
---|
| 138 | |
---|
| 139 | /* vim: set ft=c: */ |
---|