From c62c4d360642935bb501559ef93eb2dbedc07a19 Mon Sep 17 00:00:00 2001 From: JKRT Date: Thu, 12 Nov 2026 13:10:08 +0100 Subject: [PATCH 1/2] --stack MB: the stack of the layout (256 MB) Also an option of the library. Depth 10000 overflows with --stack 8; depth 100000 works with --stack 1024. Assisted-by: Claude Opus 5.5 --- README.md | 2 ++ src/capi.rs | 7 ++++--- src/cli.rs | 46 ++++++++++++++++++++++++++++++++++++++++++++-- src/main.rs | 9 +-------- src/program.rs | 14 ++++++++++++-- src/stack.rs | 23 +++++++++++++---------- 6 files changed, 76 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index cc99afe..5d0f6bd 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,8 @@ One file without -o, -i or -n: the result is printed. -o, --output FILE write the result to FILE (one input file) --stdin FILE read the text of FILE from the standard input (FILE need not exist; its place finds the libraries next to it) + --stack MB stack of the layout in MB (256); a level of nesting in the + model takes about 3 KB -i, --in-place change the input files -n, --dry-run report only, write nothing -c, --class NAME lay out only this class or package (may be repeated) diff --git a/src/capi.rs b/src/capi.rs index f99eee1..d83199b 100644 --- a/src/capi.rs +++ b/src/capi.rs @@ -8,10 +8,10 @@ //! Mirrors `juliac/libmocoal.jl` of ModelicaComponentAutolayout.jl. use std::ffi::{CStr, CString, c_char}; +use std::panic::{AssertUnwindSafe, catch_unwind}; use std::sync::Mutex; use crate::cli::layout_text; -use crate::stack::on_large_stack; /// The message of the last `mocoal_layout`. static MESSAGE: Mutex> = Mutex::new(None); @@ -66,8 +66,9 @@ pub unsafe extern "C" fn mocoal_layout( let args = unsafe { (c_text(text), c_text(file_name), c_text(options)) }; let result = match args { (Ok(text), Ok(file_name), Ok(options)) => { - // No panic may cross the interface; deep nesting needs more stack than the caller's thread may have. - on_large_stack(|| layout(text, file_name, options)).unwrap_or_else(|_| Err(INTERNAL_ERROR.to_owned())) + // No panic may cross the interface. `layout_text` lays out on a large stack. + catch_unwind(AssertUnwindSafe(|| layout(text, file_name, options))) + .unwrap_or_else(|_| Err(INTERNAL_ERROR.to_owned())) } (Err(e), _, _) | (_, Err(e), _) | (_, _, Err(e)) => Err(e), }; diff --git a/src/cli.rs b/src/cli.rs index 186b736..05e24dd 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -12,6 +12,7 @@ use crate::api::layout_string; use crate::numbers::parse_float; use crate::options::Options; use crate::source::lookup::{is_dir, is_file, join_path}; +use crate::stack::{MAX_STACK_MB, STACK_MB, on_large_stack}; pub const USAGE_TEXT: &str = "usage: mocoal [options] file.mo|directory ... mocoal [options] --stdin file.mo @@ -22,6 +23,8 @@ One file without -o, -i or -n: the result is printed. -o, --output FILE write the result to FILE (one input file) --stdin FILE read the text of FILE from the standard input (FILE need not exist; its place finds the libraries next to it) + --stack MB stack of the layout in MB (256); a level of nesting in the + model takes about 3 KB -i, --in-place change the input files -n, --dry-run report only, write nothing -c, --class NAME lay out only this class or package (may be repeated) @@ -41,13 +44,15 @@ One file without -o, -i or -n: the result is printed. "; /// A parsed command line. -#[derive(Clone, Debug, Default)] +#[derive(Clone, Debug)] pub struct CommandLine { pub opts: Options, pub inputs: Vec, pub output: String, /// With `--stdin`: the name of the file whose text is read from the standard input. pub stdin: String, + /// The stack of the layout thread in MB. + pub stack_mb: usize, pub in_place: bool, pub dry_run: bool, pub quiet: bool, @@ -56,6 +61,24 @@ pub struct CommandLine { pub version: bool, } +impl Default for CommandLine { + fn default() -> Self { + Self { + opts: Options::default(), + inputs: Vec::new(), + output: String::new(), + stdin: String::new(), + stack_mb: STACK_MB, + in_place: false, + dry_run: false, + quiet: false, + svg_dir: String::new(), + help: false, + version: false, + } + } +} + impl CommandLine { /// Set the option `name` that takes the value `value`. fn set_value_option(&mut self, name: &str, value: &str) -> Result<(), String> { @@ -63,6 +86,13 @@ impl CommandLine { match name { "-o" | "--output" => self.output = value.to_owned(), "--stdin" => self.stdin = value.to_owned(), + "--stack" => { + self.stack_mb = value + .parse() + .ok() + .filter(|mb| (1..=MAX_STACK_MB).contains(mb)) + .ok_or_else(|| format!("--stack: expected MB from 1 to {MAX_STACK_MB}: {value}"))? + } "-c" | "--class" => o.classes.push(value.to_owned()), "-L" | "--library" => o.libraries.push(value.to_owned()), "--layout" => o.layout = value.to_owned(), @@ -111,6 +141,7 @@ fn takes_value(name: &str) -> bool { name, "-o" | "--output" | "--stdin" + | "--stack" | "-c" | "--class" | "-L" @@ -214,7 +245,9 @@ pub fn layout_text(text: &str, file_name: &str, options: &str) -> Result<(String { return Err(format!("only layout options are allowed here: {options}")); } - let res = layout_string(text, file_name, &cl.opts)?; + // Deep nesting in a model needs more stack than the caller's thread may have. + let res = on_large_stack(cl.stack_mb, || layout_string(text, file_name, &cl.opts)) + .unwrap_or_else(|_| Err("internal error, no layout".to_owned()))?; Ok((res.text, res.warnings.join("\n"))) } @@ -276,6 +309,15 @@ mod tests { "/a b/M.mo" ); assert!(layout_text("model M end M;", "M.mo", "--stdin M.mo").is_err()); + assert_eq!(parse_arguments(&[]).unwrap().stack_mb, 256); + assert_eq!(parse_arguments(&words("--stack=1024")).unwrap().stack_mb, 1024); + for bad in ["0", "x", "65537"] { + assert_eq!( + parse_arguments(&words(&format!("--stack {bad}"))).unwrap_err(), + format!("--stack: expected MB from 1 to 65536: {bad}") + ); + } + assert!(layout_text("model M end M;", "M.mo", "--stack 512").is_ok()); assert_eq!( parse_arguments(&words("--scale")).unwrap_err(), "--scale: a value is missing" diff --git a/src/main.rs b/src/main.rs index fdcfce6..8987b4f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,12 +13,5 @@ fn main() -> ExitCode { .skip(1) .map(|a| a.to_string_lossy().into_owned()) .collect(); - // Deep nesting in a model needs more stack than the main thread has. - match mocoal::stack::on_large_stack(|| mocoal::program::run(&args)) { - Ok(status) => ExitCode::from(status), - Err(_) => { - eprintln!("mocoal: internal error"); - ExitCode::from(1) - } - } + ExitCode::from(mocoal::program::run(&args)) } diff --git a/src/program.rs b/src/program.rs index e1bc2eb..4b1f4df 100644 --- a/src/program.rs +++ b/src/program.rs @@ -15,6 +15,7 @@ use std::panic::{AssertUnwindSafe, catch_unwind}; use crate::api::{VERSION, layout_file_in, layout_string_in, write_text}; use crate::cli::{CommandLine, USAGE_TEXT, modelica_files, parse_arguments, svg_file_name}; use crate::source::lookup::{Library, file_path, is_dir, is_file, join_path}; +use crate::stack::on_large_stack; fn say(s: &str) { eprintln!("{s}"); @@ -116,8 +117,17 @@ pub fn run(args: &[String]) -> u8 { println!("mocoal {VERSION}"); return 0; } + // Deep nesting in a model needs more stack than the main thread has. + on_large_stack(cl.stack_mb, || run_command(&cl)).unwrap_or_else(|_| { + say("mocoal: internal error"); + 1 + }) +} + +/// The files or the standard input of the command line `cl`. +fn run_command(cl: &CommandLine) -> u8 { if !cl.stdin.is_empty() { - return run_stdin(&cl); + return run_stdin(cl); } if cl.inputs.is_empty() { eprint!("{USAGE_TEXT}"); @@ -156,7 +166,7 @@ pub fn run(args: &[String]) -> u8 { let mut changed = 0; let mut pending = Pending::new(); for file in &files { - let (ok, ch) = run_file(&cl, &mut lib, file, None, several, &mut pending); + let (ok, ch) = run_file(cl, &mut lib, file, None, several, &mut pending); failed += usize::from(!ok); changed += usize::from(ch); } diff --git a/src/stack.rs b/src/stack.rs index 27a28dc..daed4d0 100644 --- a/src/stack.rs +++ b/src/stack.rs @@ -15,12 +15,15 @@ use std::panic::{AssertUnwindSafe, catch_unwind}; use std::sync::Mutex; use std::thread; -/// 256 MB: about 80000 levels. Only the part that is used takes memory. -pub const STACK_SIZE: usize = 256 << 20; +/// 256 MB: about 80000 levels. Only the part that is used takes memory. `--stack MB` sets another. +pub const STACK_MB: usize = 256; -/// `f()` on a thread with a stack of `STACK_SIZE`. `Err` when `f` panics. Without such a thread +/// The largest `--stack`: 64 GB. +pub const MAX_STACK_MB: usize = 64 << 10; + +/// `f()` on a thread with a stack of `mb` MB. `Err` when `f` panics. Without such a thread /// (a limit on memory), `f()` runs on the current thread. -pub fn on_large_stack(f: impl FnOnce() -> T + Send) -> Result> { +pub fn on_large_stack(mb: usize, f: impl FnOnce() -> T + Send) -> Result> { // The thread takes `f` from here; when there is no thread, `f` is still here. let slot = Mutex::new(Some(f)); let take = || slot.lock().unwrap_or_else(|e| e.into_inner()).take(); @@ -29,7 +32,7 @@ pub fn on_large_stack(f: impl FnOnce() -> T + Send) -> Result u8 { panic!("test") }).is_err(); + let value = on_large_stack(STACK_MB, || 7).ok(); + let panic = on_large_stack(STACK_MB, || -> u8 { panic!("test") }).is_err(); NO_THREAD.set(false); assert_eq!(value, Some(7)); assert!(panic); @@ -96,7 +99,7 @@ mod tests { #[test] fn a_panic_is_an_error() { - assert!(on_large_stack(|| -> u8 { panic!("test") }).is_err()); - assert_eq!(on_large_stack(|| 7).ok(), Some(7)); + assert!(on_large_stack(STACK_MB, || -> u8 { panic!("test") }).is_err()); + assert_eq!(on_large_stack(STACK_MB, || 7).ok(), Some(7)); } } From 00bd2f546f1a57b09b27d05c68f6059608195549 Mon Sep 17 00:00:00 2001 From: JKRT Date: Thu, 12 Nov 2026 13:14:25 +0100 Subject: [PATCH 2/2] Name OSMC-PL 1.8 before AGPL v3 Assisted-by: Claude Opus 5.5 --- Cargo.toml | 2 +- LICENSE.md | 12 ++++++------ README.md | 2 +- build.rs | 4 ++-- interface/INTERFACE.md | 2 +- interface/test_lib.c | 4 ++-- src/api.rs | 4 ++-- src/capi.rs | 4 ++-- src/cli.rs | 4 ++-- src/layout.rs | 4 ++-- src/layout/diagram.rs | 4 ++-- src/layout/ends.rs | 4 ++-- src/layout/extract.rs | 4 ++-- src/layout/grid.rs | 4 ++-- src/layout/layered.rs | 4 ++-- src/layout/placement.rs | 4 ++-- src/layout/routing.rs | 4 ++-- src/layout/spring.rs | 4 ++-- src/lib.rs | 4 ++-- src/main.rs | 4 ++-- src/numbers.rs | 4 ++-- src/options.rs | 4 ++-- src/program.rs | 4 ++-- src/source.rs | 4 ++-- src/source/absyn.rs | 4 ++-- src/source/lookup.rs | 4 ++-- src/source/resolve.rs | 4 ++-- src/source/tokens.rs | 4 ++-- src/stack.rs | 4 ++-- src/tests.rs | 4 ++-- src/write.rs | 4 ++-- src/write/annotate.rs | 4 ++-- src/write/graphics.rs | 4 ++-- src/write/svg.rs | 4 ++-- 34 files changed, 69 insertions(+), 69 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 11f6f34..687244c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "mocoal" version = "0.1.0" edition = "2024" authors = ["John Tinnerholm "] -license = "AGPL-3.0-only OR LicenseRef-OSMC-PL-1.8" +license = "LicenseRef-OSMC-PL-1.8 OR AGPL-3.0-only" description = "Gives the components of a Modelica model a Placement and its connections a Line" publish = false diff --git a/LICENSE.md b/LICENSE.md index 582c042..2423d7b 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -4,13 +4,13 @@ mocoal-rs Copyright (c) 2026 Open Source Modelica Consortium (OSMC) -It is provided under the terms of the GNU Affero General Public License version 3 (AGPL v3) or -the OSMC Public License (OSMC-PL) version 1.8, according to the recipient's choice: +It is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or the GNU Affero +General Public License version 3 (AGPL v3), according to the recipient's choice: -- **AGPL v3:** the full text is in [COPYING](COPYING), and at - https://www.gnu.org/licenses/agpl-3.0.html. - **OSMC-PL 1.8:** the full text is in [OSMC-License.txt](OSMC-License.txt), as distributed with OpenModelica (https://github.com/OpenModelica/OpenModelica). +- **AGPL v3:** the full text is in [COPYING](COPYING), and at + https://www.gnu.org/licenses/agpl-3.0.html. This program is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH IN THE BY @@ -92,7 +92,7 @@ Not in this repository; the build fetches them. - The parser of OpenModelica: the crates `openmodelica_ast`, `openmodelica_error`, `openmodelica_wasi`, `metamodelica` and `metamodelica_derive` - (https://github.com/OpenModelica/OpenModelica, `OMCompiler/Compiler/OpenModelica.rs`), AGPL v3 - or OSMC-PL 1.8. `scripts/fetch-omc.sh` fetches them at the commit in `omc/COMMIT`. + (https://github.com/OpenModelica/OpenModelica, `OMCompiler/Compiler/OpenModelica.rs`), OSMC-PL + 1.8 or AGPL v3. `scripts/fetch-omc.sh` fetches them at the commit in `omc/COMMIT`. - Crates from crates.io, at the versions in `Cargo.lock`, each under MIT, Apache-2.0 or a licence as permissive: `cargo metadata --format-version 1` lists the licence of each. diff --git a/README.md b/README.md index 5d0f6bd..c6db413 100644 --- a/README.md +++ b/README.md @@ -294,4 +294,4 @@ to crates.io (`publish = false`). ## Licence -AGPL v3 or OSMC-PL 1.8, according to the recipient's choice. See [LICENSE.md](LICENSE.md). +OSMC-PL 1.8 or AGPL v3, according to the recipient's choice. See [LICENSE.md](LICENSE.md). diff --git a/build.rs b/build.rs index f985770..c65d552 100644 --- a/build.rs +++ b/build.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. fn main() { println!("cargo::rerun-if-changed=build.rs"); diff --git a/interface/INTERFACE.md b/interface/INTERFACE.md index 79ba48b..a856942 100644 --- a/interface/INTERFACE.md +++ b/interface/INTERFACE.md @@ -160,7 +160,7 @@ Not part of the interface; what a caller of this implementation (Rust) has to kn `internal error, no layout`. - Time: Modelica Standard Library 4.1.0, 2552 files, 1.1 to 1.5 s for all of them with the program `mocoal`. -- Licence: AGPL v3 or OSMC-PL 1.8, according to the recipient's choice. +- Licence: OSMC-PL 1.8 or AGPL v3, according to the recipient's choice. ## Test diff --git a/interface/test_lib.c b/interface/test_lib.c index 7c13ee3..eb5575f 100644 --- a/interface/test_lib.c +++ b/interface/test_lib.c @@ -2,8 +2,8 @@ This file is part of ModelicaComponentAutolayout.jl. Copyright (c) 2026 Open Source Modelica Consortium (OSMC) -This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. */ /* Test of the shared library libmocoal: test_lib MODEL.mo (see check.sh). */ diff --git a/src/api.rs b/src/api.rs index 1227935..7c75ded 100644 --- a/src/api.rs +++ b/src/api.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! The layout of the classes of a source text: parse, extract the diagrams, place, route, and //! write the annotations back. diff --git a/src/capi.rs b/src/capi.rs index d83199b..e4d4e1d 100644 --- a/src/capi.rs +++ b/src/capi.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! The C interface of the shared library `libmocoal`, as INTERFACE.md gives it. //! Mirrors `juliac/libmocoal.jl` of ModelicaComponentAutolayout.jl. diff --git a/src/cli.rs b/src/cli.rs index 05e24dd..83a010c 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! The command line of `mocoal`, and the entry of the shared library, which takes its options as //! the same command-line text. diff --git a/src/layout.rs b/src/layout.rs index ccc0ced..7413bc1 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! The layout: the diagram of a model, the placement of its components and the routing of its lines. diff --git a/src/layout/diagram.rs b/src/layout/diagram.rs index 0a8570c..937ecbf 100644 --- a/src/layout/diagram.rs +++ b/src/layout/diagram.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! The diagram of one class: nodes (components and the class's own connectors), their ports, and //! links (connect equations). Placement and routing work on this, independent of the syntax tree. diff --git a/src/layout/ends.rs b/src/layout/ends.rs index dfe7071..7e5fa37 100644 --- a/src/layout/ends.rs +++ b/src/layout/ends.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! The ends of the links: where a line meets a node, and on which side it leaves it. //! Links that meet in a connector form a net. diff --git a/src/layout/extract.rs b/src/layout/extract.rs index dde31be..a46c5c4 100644 --- a/src/layout/extract.rs +++ b/src/layout/extract.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! From a parsed class to its diagram: nodes from the component declarations, links from the //! connect equations, and the tokens at which the annotations are written back. diff --git a/src/layout/grid.rs b/src/layout/grid.rs index d146936..7a055f8 100644 --- a/src/layout/grid.rs +++ b/src/layout/grid.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! The routing grid: the lines on which connection lines may run, the nodes as obstacles, and the //! record of which net uses which piece of the grid. diff --git a/src/layout/layered.rs b/src/layout/layered.rs index 7a30d55..cf434ef 100644 --- a/src/layout/layered.rs +++ b/src/layout/layered.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! Layered placement of one connected group of nodes: the signal flows from layer to layer. //! diff --git a/src/layout/placement.rs b/src/layout/placement.rs index 3d536d8..8e50496 100644 --- a/src/layout/placement.rs +++ b/src/layout/placement.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! Placement of the nodes of a diagram. //! diff --git a/src/layout/routing.rs b/src/layout/routing.rs index 5902e1e..514573b 100644 --- a/src/layout/routing.rs +++ b/src/layout/routing.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! Routing of the connection lines. //! diff --git a/src/layout/spring.rs b/src/layout/spring.rs index 95463dc..99a2044 100644 --- a/src/layout/spring.rs +++ b/src/layout/spring.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! Spring placement of one connected group of nodes. //! diff --git a/src/lib.rs b/src/lib.rs index fd452ff..3cd07d1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! Gives the components of a Modelica model a `Placement` and its connections a `Line`. diff --git a/src/main.rs b/src/main.rs index 8987b4f..c522db7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! The standalone program `mocoal`. diff --git a/src/numbers.rs b/src/numbers.rs index 2f17243..bf0db6c 100644 --- a/src/numbers.rs +++ b/src/numbers.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! Number functions that Julia has built in, written out here so that both implementations //! compute the same coordinates: `sind`, `cosd` (after Julia's `base/special/trig.jl`), the order diff --git a/src/options.rs b/src/options.rs index 7c1a24c..3735458 100644 --- a/src/options.rs +++ b/src/options.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! The options of a layout. Mirrors `src/options.jl` of ModelicaComponentAutolayout.jl. diff --git a/src/program.rs b/src/program.rs index 4b1f4df..0a2f27a 100644 --- a/src/program.rs +++ b/src/program.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! The program `mocoal`. The result goes to the standard output, everything else to the standard //! error. The exit status is 0, 1 when a file could not be laid out, or 2 for a command line diff --git a/src/source.rs b/src/source.rs index 8d462e0..910c9d7 100644 --- a/src/source.rs +++ b/src/source.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! Reading Modelica: the Absyn tree, the source text, and the classes of the libraries. diff --git a/src/source/absyn.rs b/src/source/absyn.rs index ea73f3c..a42d4cd 100644 --- a/src/source/absyn.rs +++ b/src/source/absyn.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! Helpers for the Absyn tree: paths, modifiers, and the numbers in annotations. //! Mirrors `src/absyn.jl` of ModelicaComponentAutolayout.jl. diff --git a/src/source/lookup.rs b/src/source/lookup.rs index 83a6ff0..b2b465c 100644 --- a/src/source/lookup.rs +++ b/src/source/lookup.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! Class lookup: the classes of the input, and library classes read from disk on demand. //! diff --git a/src/source/resolve.rs b/src/source/resolve.rs index 4c44346..719c7af 100644 --- a/src/source/resolve.rs +++ b/src/source/resolve.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! Name lookup, and the facts the layout reads from a resolved class. //! Mirrors `src/resolve.jl` of ModelicaComponentAutolayout.jl. diff --git a/src/source/tokens.rs b/src/source/tokens.rs index fd53940..0cc6974 100644 --- a/src/source/tokens.rs +++ b/src/source/tokens.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! The token stream of a source file, and text edits addressed by tokens. //! diff --git a/src/stack.rs b/src/stack.rs index daed4d0..493a0c2 100644 --- a/src/stack.rs +++ b/src/stack.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! A thread with a large stack for the layout. The parser descends recursively: each level of //! nesting in a model (parentheses, packages) takes about 3 KB of stack in a release build, so an diff --git a/src/tests.rs b/src/tests.rs index 5a6367c..52c5279 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! The layouts of the models in `test/models`, which use the parts in `test/library`. //! diff --git a/src/write.rs b/src/write.rs index 62e6b2c..927b924 100644 --- a/src/write.rs +++ b/src/write.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! Writing the result: annotations into the source text, and SVG pictures. diff --git a/src/write/annotate.rs b/src/write/annotate.rs index 24daf51..0d230e9 100644 --- a/src/write/annotate.rs +++ b/src/write/annotate.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! Writing a diagram back into the source: `Placement` for the components, `Line` for the connect //! equations, and the diagram's extent in the class annotation. Every change is an `Edit` of the diff --git a/src/write/graphics.rs b/src/write/graphics.rs index 8eee7a8..e69fbf5 100644 --- a/src/write/graphics.rs +++ b/src/write/graphics.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! The shapes of a class's Diagram layer, `Diagram(graphics={...})`: frames, texts, arrows and //! junction markers drawn around the components. They were placed for the old layout, so a new diff --git a/src/write/svg.rs b/src/write/svg.rs index 11d37dd..132ab0d 100644 --- a/src/write/svg.rs +++ b/src/write/svg.rs @@ -1,8 +1,8 @@ // This file is part of mocoal-rs. // Copyright (c) 2026 Open Source Modelica Consortium (OSMC) // -// This program is provided under the terms of the GNU AGPL version 3 license or the OSMC Public -// License (OSMC-PL) version 1.8, according to the recipient's choice. See LICENSE.md. +// This program is provided under the terms of the OSMC Public License (OSMC-PL) version 1.8 or +// the GNU AGPL version 3 license, according to the recipient's choice. See LICENSE.md. //! An SVG preview of a diagram: boxes with names for the components, dots for their connectors, //! and the connection lines. It shows the layout, not the icons.