diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 24 |
1 files changed, 15 insertions, 9 deletions
@@ -2,7 +2,7 @@ term is a headless terminal core: the parser, screen ring, logical-line history store, write core, and viewport snapshots. It is a C11 library -with no dependency but libm. +with no dependency but libm and, on POSIX, the thread library (`-pthread`). | Path | Contents | | --- | --- | @@ -23,14 +23,16 @@ Pick one of these: sets the lowest instruction set, such as `-march=x86-64-v3`. - **Amalgamation**: run `tools/amalgamate.py . OUT`. It writes `OUT/term.c` and `OUT/term.h`. Compile `term.c` with any C11 compiler - and link libm. A Rust `build.rs` needs one + and link libm and the thread library: `cc -std=c11 -pthread -c term.c` + on POSIX. A Rust `build.rs` needs one `cc::Build::new().file("term.c").compile("term")`. - **Sources**: compile `src/*.c` and `src/osc/*.c` once, with `src` and - `include/term` on the include path. + `include/term` on the include path. Link the thread library too. -The library needs nothing else. The `*-amalgamation` tests run the term -tests against the generated `term.c`, and `term-cross-test` compiles it -for aarch64, macOS, and Windows. +The library needs nothing else. On Windows the writer lock is an SRWLOCK +from the system library, so it needs no extra link. The `*-amalgamation` +tests run the term tests against the generated `term.c`, and +`term-cross-test` compiles it for aarch64, macOS, and Windows. ### SIMD level @@ -50,8 +52,11 @@ no flags to get them: `simd.h` states the rules for a new kernel. -- `term.h` is the only header a host includes. It includes - `term_input.h` and `term_types.h`. It compiles as C11 and as C++. +- `term.h` is the only header a host includes. A host writes + `#include <term/term.h>`. The package adds only the include directory, + so `term.h` from another library, such as ncurses, is not shadowed. The + header includes `term_input.h` and `term_types.h`. It compiles as C11 + and as C++. - Every global symbol starts with `term_`. The library builds with hidden symbols, so a shared build exports only the `TERM_API` functions of `term.h`. `term-symbols-test` checks both. @@ -65,7 +70,8 @@ no flags to get them: A host wires the terminal in four places: 1. Create it with `term_new()`. Set `term_options.callbacks.reply` to - send replies to the program. + send replies to the program. Set `term_options.name` to the name + programs read with XTVERSION and XTGETTCAP. It defaults to `term`. 2. Feed program output with `term_feed()`. 3. Translate key and mouse events into `struct term_key_event` and `struct term_mouse_event`. Encode them with `term_input_encode_key()` |
