omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / src / osh / host / osh_codes.c
| 1 | /* SPDX-License-Identifier: Apache-2.0 |
| 2 | * Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | /* osh_codes.c -- names of the refusal codes (OSH_PLATFORM_ABI.md section 5.3, plus the local 236, 246 to 250). */ |
| 18 | #include "osh_core.h" |
| 19 | |
| 20 | const char *osh_code_name(unsigned code) |
| 21 | { |
| 22 | static const char *const t[] = { |
| 23 | [201] = "CAP_LINE", [202] = "CAP_TOKENS", [203] = "CAP_CMDS", [204] = "CAP_PIPELINES", [205] = "CAP_PIPE_LEN", |
| 24 | [206] = "CAP_WORDS", [207] = "CAP_ASSIGNS", [208] = "CAP_REDIRS", [209] = "CAP_FIELDS", [210] = "CAP_OUT", |
| 25 | [211] = "CAP_VALUE", [212] = "CAP_VARREQ", [213] = "WORKSPACE_SIZE", [214] = "ABI_MAGIC", [215] = "ABI_VERSION", |
| 26 | [216] = "ABI_LENGTH", [217] = "ABI_RESERVED", [218] = "REQ_FIELD", [220] = "NUL_BYTE", [221] = "BACKTICK", |
| 27 | [222] = "GLOB", [223] = "TILDE", [224] = "PARAM_OP", [225] = "SPECIAL_PARAM", [226] = "CMDSUB", |
| 28 | [227] = "BACKGROUND", [228] = "SUBSHELL", [229] = "HEREDOC", [230] = "CASEEND", [231] = "REDIR_OTHER", |
| 29 | [232] = "FD_RANGE", [233] = "IF_COMPOUND", [234] = "LOOP", [235] = "CASE", [236] = "GROUP", |
| 30 | [237] = "FUNCTION", [238] = "NEGATION", [239] = "UNSUPPORTED_BUILTIN", [240] = "IFS_ASSIGN", |
| 31 | [241] = "SYNTAX_EMPTY_CMD", [242] = "SYNTAX_REDIR_TARGET", [243] = "AMBIGUOUS_REDIRECT", [244] = "VALUE_NUL", |
| 32 | [245] = "VALUE_GLOB", [246] = "BRACE_EXPANSION", [247] = "POSITIONAL_RANGE", [248] = "SYNTAX_EOF", [249] = "APPEND_ASSIGN", [250] = "FD_VARIABLE", |
| 33 | }; |
| 34 | if (code >= sizeof t / sizeof t[0]) return NULL; |
| 35 | return t[code]; |
| 36 | } |