|
C-Menu 0.2.9
A User Interface Toolkit
|
Parses Form Descriptions, Handles User Input, and Integrates with External Commands for Calculations and Data Processing. More...
Functions | |
| int | init_form (Init *init, int argc, char **argv, int begy, int begx) |
| Initialize form data structure and parse description file. | |
| int | form_engine (Init *init) |
| Form main processing loop. | |
| int | form_post (Init *init) |
| Handle post-processing after field entry, allowing user to edit data, execute a provider command, or write data to an output file. | |
| int | form_process (Init *init) |
| Handle integration with a getter program which will provide field data. | |
| int | field_navigator (Form *form) |
| Handle user input for field entry, allowing navigation between fields and looping until an exit action is selected. | |
| unsigned int | form_display_screen (Init *init) |
| Display the form on the screen, including text elements and fields, and set up the form window based on the form configuration. | |
| void | form_display_fields (Form *form) |
| Display form fields on the screen, populating field values and formatting them according to the form configuration. | |
| int | form_parse_desc (Form *form) |
| Parse the form description file to populate the Form data structure with field definitions, text elements, and other configuration specified in the description file. | |
| int | form_read_data (Form *form) |
| Read initial data for form fields from a specified input source, such as a file or standard input, and populate the form fields with the data. | |
| int | form_exec_cmd (Form *form) |
| Execute a provider command specified in the form description file, passing form field values as arguments, and optionally redirecting output to a file. | |
| int | form_write (Form *form) |
| Write form field values to a specified output destination, such as a file or standard output, based on the form configuration and user input. | |
| int | form_desc_error (int in_line_num, char *in_buf, char *em) |
| Handle errors encountered while parsing the form description file, providing detailed error messages that include the file name, line number, and the specific error encountered. | |
Parses Form Descriptions, Handles User Input, and Integrates with External Commands for Calculations and Data Processing.
| int field_navigator | ( | Form * | form | ) |
Handle user input for field entry, allowing navigation between fields and looping until an exit action is selected.
| form | A pointer to the Form structure containing form data and state. |
Definition at line 400 of file form_engine.c.
References cmd_key, Form::f_process, Form::fcnt, Form::fidx, field_editor(), P_ACCEPT, P_CALC, P_CANCEL, and P_HELP.
Referenced by form_engine().
| int form_desc_error | ( | int | in_line_num, |
| char * | in_buf, | ||
| char * | em ) |
Handle errors encountered while parsing the form description file, providing detailed error messages that include the file name, line number, and the specific error encountered.
| in_line_num | The line number in the description file where the error occurred. |
| in_buf | The content of the line that caused the error, for context. |
| em | A specific error message describing the nature of the error. |
Definition at line 876 of file form_engine.c.
References display_error(), em0, em1, em2, form, Form::mapp_spec, ssnprintf(), and strnz__cpy().
Referenced by form_parse_desc().
| void form_display_fields | ( | Form * | form | ) |
Display form fields on the screen, populating field values and formatting them according to the form configuration.
| form | A pointer to the Form structure containing form data and state. |
Definition at line 510 of file form_engine.c.
References Form::chyron, Field::col, Form::cols, compile_chyron(), display_chyron(), Field::display_s, Form::fcnt, Form::field, Form::fill_char, Field::filler_s, form_display_field_n(), Chyron::l, Field::len, Form::lines, new_chyron(), set_chyron_key(), strnfill(), strnz(), and Form::win.
Referenced by form_display_screen(), and form_process().
| unsigned int form_display_screen | ( | Init * | init | ) |
Display the form on the screen, including text elements and fields, and set up the form window based on the form configuration.
| init | A pointer to the Init structure containing form data and state. |
Definition at line 460 of file form_engine.c.
References Form::begx, Form::begy, Form::box, Text::col, Form::cols, Form::dcnt, Form::fcnt, Form::field, form, Init::form, form_display_fields(), Field::line, Text::line, Form::lines, Perror(), Text::str, strnz(), strnz__cat(), strnz__cpy(), Form::text, Form::title, Form::win, win_box, win_new(), win_ptr, and win_win.
Referenced by form_engine().
| int form_engine | ( | Init * | init | ) |
Form main processing loop.
| init | A pointer to the Init structure containing form data and state. |
Definition at line 114 of file form_engine.c.
References Form::begx, Init::begx, Form::begy, Init::begy, Init::cols, destroy_argv(), eargc, Form::f_calculate, Form::f_help_spec, Form::f_out_spec, Form::f_process, Form::f_query, Form::f_receiver_cmd, Form::fidx, field_navigator(), form, Init::form, form_display_screen(), form_exec_cmd(), form_parse_desc(), form_post(), form_process(), form_read_data(), form_write(), Form::help_spec, Init::lines, Init::mapp_help, Form::out_spec, P_ACCEPT, P_CANCEL, P_CONTINUE, P_END, P_HELP, Perror(), popup_view(), Form::receiver_cmd, strnz__cat(), strnz__cpy(), and Init::title.
Referenced by init_form().
| int form_exec_cmd | ( | Form * | form | ) |
Execute a provider command specified in the form description file, passing form field values as arguments, and optionally redirecting output to a file.
| form | A pointer to the Form structure containing form data and state. |
Definition at line 804 of file form_engine.c.
References Field::accept_s, Form::f_out_spec, Form::f_process, Form::fcnt, Form::field, Form::out_spec, Form::receiver_cmd, shell(), strnz__cat(), and strnz__cpy().
Referenced by form_engine().
| int form_parse_desc | ( | Form * | form | ) |
Parse the form description file to populate the Form data structure with field definitions, text elements, and other configuration specified in the description file.
| form | A pointer to the Form structure containing form data and state. |
Definition at line 536 of file form_engine.c.
References abend(), Field::col, Text::col, Form::cols, Form::dcnt, Form::didx, display_error(), em0, em1, em2, Form::f_calculate, Form::f_process, Form::f_query, Form::fcnt, Field::ff, FF_INVALID, ff_tbl, Form::fidx, Form::field, form_desc_error(), Form::help_spec, Field::len, Text::len, Field::line, Text::line, Form::mapp_spec, Form::receiver_cmd, ssnprintf(), Text::str, str_to_lower(), strnz__cat(), strnz__cpy(), Form::text, Form::title, and trim().
Referenced by form_engine().
| int form_post | ( | Init * | init | ) |
Handle post-processing after field entry, allowing user to edit data, execute a provider command, or write data to an output file.
| init | A pointer to the Init structure containing form data and state. |
Definition at line 194 of file form_engine.c.
References Form::chyron, click_x, click_y, compile_chyron(), display_chyron(), form, Init::form, is_set_chyron_key(), Chyron::l, Form::lines, P_ACCEPT, P_CANCEL, P_CONTINUE, P_HELP, set_chyron_key(), unset_chyron_key(), Form::win, and xwgetch().
Referenced by form_engine().
| int form_process | ( | Init * | init | ) |
Handle integration with a getter program which will provide field data.
| init | A pointer to the Init structure containing form data and state. |
This function provides integration with getter programs. The requirements are:
The sequence of operations is as follows: 1. The 'C', 'Q', or 'G' option causes Form to pause and display anKEY_F(5) Calculate, Query, or Getter. option on the chyron.
This function forks and executes the getter executable as a child process, creates a pipe to read the output from the provider command, reads the output, and updates the Form fields.
Definition at line 278 of file form_engine.c.
References Field::accept_s, base_name(), Form::chyron, click_x, click_y, compile_chyron(), cp_reverse_highlight, destroy_argv(), display_chyron(), display_error(), eargc, em0, em1, em2, Form::f_calculate, Form::f_in_pipe, Form::f_out_spec, Form::f_process, Form::f_provider_cmd, Form::f_query, Form::fcnt, Form::field, form, Init::form, form_display_fields(), form_read_data(), form_write(), Form::in_fp, is_set_chyron_key(), Chyron::l, Form::lines, P_ACCEPT, P_CANCEL, P_CONTINUE, P_HELP, Perror(), Form::provider_cmd, set_chyron_key(), set_chyron_key_cp(), ssnprintf(), str_to_args(), strnz__cat(), strnz__cpy(), unset_chyron_key(), wait_timeout, waitpid_with_timeout(), Form::win, and xwgetch().
Referenced by form_engine().
| int form_read_data | ( | Form * | form | ) |
Read initial data for form fields from a specified input source, such as a file or standard input, and populate the form fields with the data.
| form | A pointer to the Form structure containing form data and state. |
Definition at line 761 of file form_engine.c.
References cmd_key, display_error(), em0, em1, em2, Form::f_in_pipe, Form::f_in_spec, Form::fidx, form_fmt_field(), Form::in_fp, Form::in_spec, strnz__cat(), and strnz__cpy().
Referenced by form_engine(), and form_process().
| int form_write | ( | Form * | form | ) |
Write form field values to a specified output destination, such as a file or standard output, based on the form configuration and user input.
| form | A pointer to the Form structure containing form data and state. |
Definition at line 825 of file form_engine.c.
References Field::accept_s, display_error(), em0, em1, em2, Form::f_out_pipe, Form::f_out_spec, Form::fcnt, Form::field, Form::out_fd, Form::out_fp, Form::out_spec, ssnprintf(), strnz__cat(), and strnz__cpy().
Referenced by form_engine(), and form_process().
| int init_form | ( | Init * | init, |
| int | argc, | ||
| char ** | argv, | ||
| int | begy, | ||
| int | begx ) |
Initialize form data structure and parse description file.
| init | A pointer to the Init structure containing form data and state. |
| argc | The number of command line arguments passed to the form. |
| argv | The array of command line arguments passed to the form. |
| begy | The y-coordinate for the top-left corner of the form window. |
| begx | The x-coordinate for the top-left corner of the form window. |
Definition at line 59 of file form_engine.c.
References Form::begx, Form::begy, Form::chyron, destroy_chyron(), destroy_form(), Form::f_in_pipe, Form::f_in_spec, Form::f_mapp_spec, form, Init::form, form_engine(), Form::in_spec, Form::mapp_spec, new_form(), Perror(), strnz__cat(), strnz__cpy(), Form::title, Form::win, and win_del().
Referenced by main(), and popup_form().