Giter Site home page Giter Site logo

zig_termcurs's Introduction

zig_TermCurs

terminal access function
zig 0.12.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 bersion 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.

zig_termcurs's People

Contributors

as400jplpc avatar

Stargazers

 avatar  avatar

Watchers

 avatar

zig_termcurs's Issues

Historique

→ 2023-05-22 changed regex processing, discontinued use of GO, and introduced regex.zig (https://github.com/tiehuis/zig-regex)

→ 2023-05-22 add function match (match.zig) updating controls in forms with regex
→ 2023-05-22 add function isMatch regex.h libc updating controls in forms with regex
→ 2023-05-22 controls conform standard
→ 2023-05-22 ex: https://stackoverflow.com/questions/201323/how-can-i-validate-an-email-address-using-a-regular-expression
→ 2023-05-22 chapitre RFC 6532 updates 5322 to allow and include full, clean UTF-8.

2023-08-1 I am preparing for the version change in order to take advantage of advancements and modify the code if necessary. My experience, you have to review the "FOR" loop the "ENUM" and "BUILD" functions what I did

2023-08-1 Studies of memory cleaning and various functions 0.11
2023-08-1 Add func Grid ioGridKey (parm,parm, button KEY return) for management grid to grid ex: modlObjet fn Order

2023-08-1 Adjustment for 0.11 test A lot of changes since version 0.10.1

2023-08-1 look at the build has changed a lot.
2023-08-1 Gencurs modlPanel OK
2023-08-1 Gencurs modlObjet testing "label define - order remove" OK
2023-08-1 modlObjet alt-T Title alt-L Label alt-w Menu(order/remove)
2023-08-1 modlObjet ESC abord ctrl-V valide F11 write all Objet for Panel ... F12 abord and return


2023-08-1 Changing and reorganizing the code:
new "grid.zig"

    the "forms.zig" no longer includes grid management

        I reviewed the initialization of the panel and grid

            with create mode to better manage memory and make memory allocation more consistent

                [ziggit](https://ziggit.dev/t/philosophical-question-about-memory/1343)

                    testing memoory
                        [zulipchat](https://zig-lang.zulipchat.com/#narrow/stream/346105-FR-General/topic/.E2.9C.94.20Debeuger)


                        2023-08-4 Watch the build version zig 0.11.0 new formula to generate documentation

                        2023-08-09 small update project due to version change
                        2023-08-09 modlObjet alt-F start of field processing
                        2023-08-09 Json studies to encapsulate the generation (IN/OUT)

                        2023-08-12 After a big discussion, setting up the wrestling
                        2023-08-12 Pause: preparing JSON this will help me control the values... more settings
                        2023-08-14 Installation of a logger I modified the logger and redirected to a file, it can also be used for recording other than errors or for monitoring data, diagrams test [zig_demoJson](https://github.com/AS400JPLPC/zig_demoJson)


                        2023-08-21 First Json test, now I will refine, it's too hot break.

reprise du projet

I had to buy a PC In the meantime I changed publisher etc...* 2023-11-15 add module mdlSjson (save file)

  • 2023-11-15 add module mdlRjson (restore file)

    2023-11-15 add module mdlFile (manager file)
    2023-11-15 in the "mdlObjet" module have little reordered and deleted
    2023-11-15 A “dspf” folder groups JSON files : Label Field
    2023-11-15 The software runs in a terminal
    2023-11-15 A small change F10 became F11 for convenience with the terminal

→ 2023-11-22 update Forms mdlObjet mdlSjon mdlRjson
→ 2023-11-22 harmonization function line vertical & horizontalharmomisation procedur
→ 2023-11-22 test Json save restor gencurs

→ 2023-11-29 restructuring:
new source ./deps/menu.zig deletion in forms.zig of menu processing change mdlObject name -> mdlForms
→ 2023-11-29 Still testing, mdlPanel update, mdlForms due to reorganization
→ 2023-11-29 Gencurs update preparation Grid/Menu generation

2023-12-28 I just made my first 'COMPTIME,' I finally understood what it's for and how to approach it. Introduction to comptime rstPanel example pnl; rstPanel(grd.GRID,Xcombo, pfmt001); example: restore(type grid, gridX, panelX) This function restores the part of the panel that was hidden by the grid.
2023-12-18 I removed the dependencies on forms(panel) for the menu and grid.
2023-12-28 (forms- grid - menu) They are deeply modified to make them independent.
2023-12-28 Corrections in mdlPanel F10 -> F11. Corrections in mdlFile Minor correction
2023-12-28 I take my time because I have heart problems (fatigue with medications), and I am still studying to understand and grasp the ZIG-LANG language. (I am 72 years old.)
2023-12-29

[a] Cursed: a background module that manages terminal access. It has been revised to enhance smoothness; I've explored other modules on the web that delve into the issue and have provided me with certain ideas.
[b] The Grid and Menu modules are completely independent of Forms.
[c] The utils (tools) module has been simplified and includes its own ArenaAllocator.
[d] Huge work on memory management; the Example program serves as a model.
[e] For your information, I initially thought it was the double buffer causing the program to bloat. After conducting a real test, I encountered the same issue. I removed some entanglements and reconsidered the allocation mode. The user-facing functions remain unchanged; there's just a deinitUstr function in place of deinitUtils.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.