terminal access function
zig 0.13.0
TESTING
look at the bottom of the testing page
os linux
Normally should work POSIX
the termcurs library, does what ncurse does (hopefully).
it manages the interface between the terminal and the user.
as does the 5250 of the OS400 with PC sauce.
Panel, window, field, grid, menu etc.
this can be used with a terminal with some editing eg: F10 etc. for convenience.
the easiest way is to make your own terminal with libvte of which I provide an example in the src-c folder.
this produces very lightweight programs for doing utilities or intensive typing for business management.
Currently everything is not operational and the goal is to make a screen generator to simplify development, considering that this is only secondary and that the heart of the problem is the program itself and not the interface.
** I use the gencurs program to thoroughly test the termcurs lib.
**
Thank you
a little more : XYAMAN
Resumption of the project https://github.com/xyaman/mibu
Thank you
https://zig.news/
https://zig.news/lhp/want-to-create-a-tui-application-the-basics-of-uncooked-terminal-io-17gm
thank you for your valuable explanations David Vanderson
https://zig.news/david_vanderson
Structure the complex build
https://zig.news/xq/zig-build-explained-part-3-1ima
inspiration
https://www.openmymind.net/Regular-Expressions-in-Zig/
extra..., to follow and have a history
https://github.com/kissy24/zig-logger/
In the example, some errors are introduced such as the mail, all of this is voluntary and allows you to see the default interaction of the input control.
Field | Regex | Text | Type |
---|---|---|---|
TEXT_FREE | Y | Y | Free |
TEXT_FULL | Y | Y | Letter Digit Char-special |
ALPHA | Y | Y | Letter |
ALPHA_UPPER | Y | Y | Letter |
ALPHA_NUMERIC | Y | Y | Letter Digit espace - |
ALPHA_NUMERICT_UPPER | Y | Y | Letter Digit espace - |
PASSWORD | N | Y | Letter Digit and normaliz char-special |
YES_NO | N | Y | 'y' or 'Y' / 'o' or 'O' |
UDIGIT | N | Y | Digit unsigned |
DIGIT | N | Y | Digit signed |
UDECIMAL | N | Y | Decimal unsigned |
DECIMAL | N | Y | Decimal signed |
DATE_ISO | DEFAULT | Y | YYYY/MM/DD |
DATE_FR | DEFAULT | Y | DD/MM/YYYY |
DATE_US | DEFAULT | Y | MM/DD/YYYY |
TELEPHONE | Y OR DEFAULT | Y | +(033) 6 00 01 00 02 |
MAIL_ISO | DEFAULT | Y | normalize mail regex |
SWITCH | N | N / BOOL | CTRUE CFALSE |
FUNC | N | y | dynamic function call |
TASK | N | y | dynamic function call ex: control |
CALL | N | y | **dynamic call exter |
MOUSE
Type | up | down | left | Middle | right | X/Y |
---|---|---|---|---|---|---|
Menu | Y | Y | Y | Y | Y | N |
GRID | Y | Y | Y | Y | Y | N |
FIELD | Y | Y | Y | Y | Y | N |
getKEY | Y | Y | Y | Y | Y | Y |
FIELD
KEY | text |
---|---|
MOUSE | mouse array reference |
escape | Restores the original area |
ctrl-H | Show help |
ctrl-P | exec program extern |
home | Position at start of area |
end | Position at end of area |
right | Position + 1 of area |
tab | Position + 1 of area |
left | Position - 1 of area |
shift tab | Position - 1 of area |
bacspace | Position -1 of area and delete char |
bacspace | Position of area and delete char |
insert | Position of area change cursor |
enter | Control valide update origine next field |
up | Control valide update origine prior field |
down | Control valide update origine next field |
char | Treatment of the character of the area |
fcun | Interactive function linked to the input area. |
task | Task executed after input in the zone. |
call | Interactive function exec program extern |
GRID
KEY | text |
---|---|
MOUSE | active |
escape | return key |
F12 | return key |
enter | return ligne |
up | prior ligne |
down | next ligne |
pageUp | prior page |
pageDown | next page |
return | Arg |
COMBO
KEY | text |
---|---|
CellPos | Position start display |
MOUSE | active |
escape | return key |
enter | return field |
up | prior ligne |
down | next ligne |
pageUp | prior page |
pageDown | next page |
---Organization-project------------------------------------------
→ folder deps: Filing of files zig including reference sources
→ folder library: zig source files
→ folder src_c: C/C++ source files
→ folder src_zig: ZIG-lang source files
→ folder lib: src xx.H source files regex.h
→ build: build+source-name ex: buildexemple
→ makefile
--peculiarity-------------------------------------------------
test alt-ctrl ctrshift... etc for
But it is no longer transportable. another way is to use IOCTL but again, there is a good chance of being forced to use root.
Anyway, to make management applications or Terminal type tools are more than enough.
ctrl or alt combinations plus Fn(1..24) TAB Backspace home end insert delete pageup pagedown enter escape alt ctrl left rigth up down altgr mouse
and the utf8 keyboard is a lot.
--styling-------------------------------------------------
make it compatible as close as possible to IBM 400 ex:
ex: pub const AtrLabel : stl.ZONATRB = .{
.styled=[_]i32{@enumToInt(stl.Style.styleBright),
@enumToInt(stl.Style.styleItalic),
@enumToInt(stl.Style.notstyle),
@enumToInt(stl.Style.notstyle)},
.backgr = stl.BackgroundColor.bgBlack,
.backBright = false,
.foregr = stl.ForegroundColor.fgGreen,
.foreBright = true
};
-------Current treatments------------------------------------
→ forms.zig
→ fram / panel / label /button / Menu / Grid / Combo / dynamic function Exec ** OK
→ Preparation of "Field" processing as well as keyboard input.
Please wait, if there are bugs everything is not fixed.
-------TESTING------------------------------------
→ Use the gtk Term.c terminal, it's much simpler terminals ex: exf4-terminal
-------To write and think--------------------------------
→ inspiration <br />
---------------------------------------------------------
| for information|
→ 2023-02-28
Hello, it is now possible to use a terminal without leaving a trace, I added in "curse" the "reset" function,
on the other hand, i included in the cls function the underlying cleanup of the terminal, i put here the terminal start function for, you help ( xfce4-terminal --hide-menubar --hide-scrollbar --hide -toolbar --geometry="158x42" --font="DejaVu Sans Mono 12" just add -e ./...program
→ 2023-02-28
Applications no longer need lib-GTK VTE
in general to debug well, to use the console, it is advisable to deactivate preferences F10 and ALT... ,
then compile with SMALL and to ensure violation of ALT-F4 use the cpp program gtk-vte an example is there.
But in terminal mode the application is viable (to do with the commit data-base)
→ 2023-02-05 Doc version 0.11.1 "view use TermCurs"
READ-DOCS
les news:
→ 2024-01-04
LINUX
Should it work with MAC?
TRADUCTOR chatgpt
Hello, there are very significant changes, why?
Firstly, for better memory management.
Greater coherence.
All modules have their own allocators.
Avoiding back-and-forth between modules.
"CURSED" (named in memory of "NCURSEW"):
Encompasses everything needed for writing to a terminal, including reading keyboard codes, mouse management, cursor handling, UTF8 work. I may introduce the "termios" concept for META codes. I took advantage of the restructuring to bring clarification.
"FORMS":
Includes management for:
LABEL - BUTTON - LINEV - LINEH - FIELD - FRAME - PANEL
Works with a matrix corresponding to the terminal surface so that the window can be restored. The FORMS allocator is designed for Fields and panel initialization. FORMS no longer includes GRID management, which is autonomous, nor MENU, which is autonomous
"GRID":
Functions similarly to forms, allowing the display and retrieval of arguments either from a database or working as a combo. It is autonomous, but you must consider that it should be included in your Panel, as it positions itself within the terminal window.
"MENU":
Operates like GRID but is much simplified; the returned argument is usize.which doesn't work with the matrix but directly with the terminal.
"UTILS": (various tools and functions)
Contains various functions to manage the control needs of FIELD or STRING management ([] u8 const).
The Example program demonstrates how to manage and use these functions. A tip: the first Panel can serve as the definition of the terminal window.
"MATCH": (regex libc)
"LOGGER":
Allows for a written record of variables or waypoints.
"CALLPGM": Executes in Zig mode, manages the call and the wait.
"INFO"
Display attributes are in CURSED, e.g., term.ZONATRB, the CURSOR type.
REFTYP is in Forms and Grid.
CTRUE/CFALSE are in Forms and Grid.
CADRE is in Forms and Grid.
LINE is in Forms.
"CURSED" and "UTILS" are being called within "Forms", "Grid" and "Menu"
"MATCH" are being called within "Forms"
→ 2024-01-05
I tested with two versions, 0.11.0 and 0.12.0-dev. Everything works fine except in mdlFile.zig:
// 0.11.0 active
const iter_dir = try std.fs.cwd().openIterableDir(vdir, .{});
// 0.12.0
// const iter_dir = std.fs.cwd().openDir(vdir, .{.iterate = true}) catch unreachable;
By default, 0.11.0 is active. I'm providing both build files, and there are significant differences, but the principle remains the same. All of this is to let you know that I am preparing for the migration to avoid any unexpected issues.
→ 2024-02-01
**Significant modification due to the addition of the callPgm function (module.zig).**
.Exec to the program associated with the Field zone. CTRL+P
.Look at the example: Exemple.zig, the execve function in the source /deps/callpgm.zig.
.Several corrections: handling of Fields within the Panel function, plus a few message associations...
.Addition to the Field structure: progcall zone [] const u8, setCall, and getCall functions.
→ 2024-02-02
.correction mineur
------------------------------------------------------------------
→ 2024-02-10
The 'exemple' folder demonstrates how to use a shared library in your project that may contain multiple programs.
→ 2024-02-14
Correction of the "rstpanel" function.
Correction of "label.name" (memory issue).
Possibility of adding the program name to an input field.
Correct alignment in the Json backup files.
I am progressing slowly (many tests). I have even considered directly addressing the memory.
→ 2024-03-25
update version 0.12.0-dev.3429.
Inclusion of modules callPgmPid, zmmap only v0.12
Addition of the updateField function from mdlForms
Minor correction in ioCombo, the cursor wasn't moving up
In cursed, the handling of IOCTL has changed with the new Zig version
I've left the lines for downgrading, with 2 or 3 exceptions.(cursed)
Afterwards, I will only work with version 0.12.dev.
test : "./Gen" for Gencurs
I'm still mulling over my design for the table generator.
→ 2024-04-23
new version zig 0.12.0 stable
Adding the 'mdlGrid' function.
- Alt-G: Create GRID definition
- Alt-C: Create text columns
- Alt-R: Remove GRID
- Alt-W: Tools menu (View GRID, View Cell, Order Cell, Remove Cell)
I'm making progress, and I'm going to create the JSON.
→ 2024-06-29
new version zig 0.13.0 stable
Implementation of the lib "library" removal of "deps"
I'm making progress, this MENU
→ 2024-07-03
a curse/forms shell