Skip to content

AS400JPLPC/zig_TermCurs

Repository files navigation

zig_TermCurs

terminal access function
zig 0.14.DEV

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

thank you for your valuable explanations Sam Atman https://github.com/mnemnion/mvzr/

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 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
func 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
→  build: build+source-name ex: buildexemple
→  makefile


LIBRARY



--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..36) 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 MVZR pur zig)

"LOGGER":
Allows for a written record of variables or waypoints.

"CALLPGM": Executes in Zig mode, manages the call and the wait.

→ PANEL
Adding the 'mdlPanel' function.

  • F2 : view panel
  • F6 : Choix panel for update
  • F9 : Create Panel
  • F11 : Update Panel
  • F12 : return

→ FORMS
Adding the 'mdlForms' function.

  • F1 : help
  • F11 : update and return
  • F12 : return
  • Alt-T: Create Title
  • Alt-L: Create Label
  • Alt-F: Create Field
  • Alt-G: View Grid
  • Alt-U: Update Field
  • Alt-H: Creat Line Horizontal
  • Alt-V: Creat Line Vertical
  • Alt-W: Tools menu (View , Order , Remove )

→ GRID
Adding the 'mdlGrid' function.

  • F1 : help
  • F11 : update and return
  • F12 : return
  • 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)

→ MENU
Added MENU definition function you have to understand the menu option as a fixed combo with constant values

  • F1 : help
  • F11 : update and return
  • F12 : return
  • Alt-M: Create MENU definition
  • Alt-C: Create / UPDATE text columns
  • Alt-V: View MENU
  • Alt-D: Remove MENU
  • Alt-H: display higth MENU
  • Alt-L: display low MENU
  • Alt-X: Fixed display work menu
  • Alt-R: Fefresh terminal

→ Gensrc
Added Gensrc definition Programme

  • Folder : choix du model
  • Control : list control
  • List : List of the DSPF nomencalature
  • Link-Combo : combo assignment CtrlV validation
  • SrcMenu : output srs-lst
  • SrcForms : output srs-lst
  • Clear *all : Cleaning arraylist buffers
  • Exit : Exit




→ 2024-11-20 15:40

  • update library CURSED -> Modification of keyboard key retrieval for a terminal in a more functional way.
  • update module MDLFILE -> Improved sorting algorithm integrated, with the ability to add a file attribute.
  • I am currently testing source code generation, and sometimes I question my code, particularly the way I approach the matrix.

→ 2024-11-23 15:40

  • update MOUSE -> click Left Middle = none click Right Enter for MENU and GRID
  • new module -> Gensrc SrcMenu SrcForms générate source main
  • I am currently testing source code generation, and sometimes I question my code, particularly the way I approach the matrix.
  • update ENV-WORK
  • update MenuDEV.sh new MenuTEST.sh
  • First test Gensrc - srcforms - srcMenu
  • folder OUT-ZIG to test
  • use for test only folder(repertoire)

    → 2024-11-26 20:28
    Please refer to the files in the directory: dspf/repertoire/.
    You will notice that function keys are assigned, such as F9 for adding a record and F11 for updating a record; these are standard industrial practices recommended in management.
    You can compare the output source with the SRC program.

I recommend using the GENSRC program (C/C++) that emulates a clean terminal and allows for debugging.
You can see the source generation of formsrc and formtest, which has been reworked.

Keep in mind that the generation is a skeleton; I am trying to reduce the repetitive overhead of programming so we can focus on the requested functionality.
I haven't finished yet; I still need to make changes, for example, the GRID SFLD, which is a grid with data, etc.


------------------------------------------------------------------

Now that the entire designer allows for saving and restoring the code, this has allowed me to test my functions, and especially to take a little tour of the Zig language. I opted for working and writing with maximum use of the Zig language, so I don't use addressing or hex code; everything is in Zig.

PAUSE

In the current state, one could very well use JSON files and encapsulate them in the program, and why not make the forms in the project dynamic... I did this on the AS400.