Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/src/osh/host/osh_core.h # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / src / osh / host / osh_core.h` 59 lines ยท 2363 bytes Raw Blame History 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 /* 18 * osh_core.h -- loads the three OSC units of the shell core (lexer, parser, expander) and calls them through the 19 * checked entries (aien-architecture#158). The units borrow two slices per call: input bytes and the 11456-cell 20 * workspace. Native calls go through osc_native_call (refuses overlapping, NULL or misaligned slices), interpreter 21 * calls through osc_interp_run_prevalidated after osc_ir_slice_args_ok. Host code is scaffolding (ADR 0024). 22 */ 23 #ifndef OSH_CORE_H 24 #define OSH_CORE_H 25 #include 26 #include 27 28 #include "osc_cg.h" 29 #include "osc_ir.h" 30 #include "osc_native.h" 31 #include "osc_rt.h" 32 33 enum { OSH_U_LEX = 0, OSH_U_PARSE = 1, OSH_U_EXPAND = 2, OSH_U_COUNT = 3 }; 34 #define OSH_CORE_FAULT (~(uint64_t)0) /* a trap, or the checked entry refused the arguments */ 35 36 typedef struct { 37 OscUnit *U; 38 OscRt *RI, *RN; 39 OscCode code; 40 OscNative nm; 41 int fi; 42 } OshCoreUnit; 43 44 typedef struct { 45 OshCoreUnit u[OSH_U_COUNT]; 46 unsigned long calls_interp, calls_native, faults; 47 } OshCore; 48 49 /* Compile the three sources (lexer, parser, expander order). 0 ok, else -1 with a message in err. */ 50 int osh_core_init(OshCore *c, const char *const src[OSH_U_COUNT], const size_t len[OSH_U_COUNT], char *err, size_t errsz); 51 void osh_core_free(OshCore *c); 52 53 /* One entry call. native: 0 interpreter, 1 native AArch64. inp may be NULL when n == 0. wn = workspace cells. 54 * Returns the unit's status, or OSH_CORE_FAULT. */ 55 uint64_t osh_core_call(OshCore *c, int unit, int native, const uint8_t *inp, size_t n, uint64_t *w, size_t wn); 56 57 /* Printable name of a refusal code ("CMDSUB"), or NULL for a number that is not a named code. */ 58 const char *osh_code_name(unsigned code); 59 #endif