Nim modules in this directory were closely derived from sources in Notcurses v3.0.9
and should be considered subject to the terms and conditions of its license.
Translating Notcurses' examples was not an end in itself; the process was iterative and the goal was to inform the high-level API of nim-notcurses
- wrap portions of Notcurses' raw C API so an upstream example could be ported from C to Nim
- implement portions of a higher-level API
- refactor ported example using the high-level API
- goto 1
Differences, if any, reflect how a .nim
example behaves compared to its .c
counterpart
Nim | C | Differences |
---|---|---|
cjkscroll.nim |
cjkscroll.c |
renders per character instead of per line, q quits |
cli1.nim |
cli2.c |
renders "Hello..." |
cli2.nim |
cli1.c |
reports inputs |
direct1.nim |
n/a |
|
direct_sgr.nim |
sgr-direct.c |
|
gradients.nim |
gradients.c |
|
multiselect.nim |
multiselect.c |
|
tui1.nim |
cli3.c |
renders "Hello...", q quits |
zalgo.nim |
zalgo.c |
Modules in examples/abi
demonstrate working with the wrapper for the raw C API instead of the high-level API. They match the behavior of their counterparts in their parent directory and, naturally, that involves borrowing some code from the internals of the high-level API or otherwise providing for equivalent behavior. For example, see examples/abi/cli2.nim
.
Boilerplate code is intentionally not captured in a helper module because doing so is beside the point. C-style invocation is used for Notcurses' facilities because it looks more natural, e.g. ncplane_putstr(stdn, s)
vs. stdn.ncplane_putstr(s)
.
Copyright 2019-2022 Nick Black
Copyright 2019-2021 Marek Habersack
Copyright 2020-2021 José Luis Cruz
Copyright 2020-2021 igo95862
Copyright 2021 Łukasz Drukała
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
The contents of src/fetch/ncart.c are extracted from Neofetch,
copyright 2015-2021 Dylan Araps under the MIT License:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in al
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.