C-Menu 0.2.9
A User Interface Toolkit
Loading...
Searching...
No Matches
view_engine.c File Reference

The working part of View. More...

#include <common.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <regex.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <termios.h>
#include <time.h>
#include <unistd.h>
Include dependency graph for view_engine.c:

Go to the source code of this file.

Macros

#define get_next_char()
 read the next characater from the virtual file
#define get_prev_char()
 read the previous characater from the virtual file

Functions

int view_file (Init *init)
 Start view.
int view_cmd_processor (Init *init)
 Main Command Processing Loop for View.
int get_cmd_char (View *view, off_t *n)
 Get Command Character and Numeric Argument.
int get_cmd_arg (View *view, char *prompt)
 Get Command Argument from User Input.
void build_prompt (View *view)
 Build Prompt String.
void cat_file (View *view)
 Concatenate File to Standard Output.
void lp (char *PrintFile)
 Send File to Print Queue.
void go_to_mark (View *view, int c)
 Go to Mark.
void go_to_eof (View *view)
 Go to End of File.
int go_to_line (View *view, off_t line_idx)
 Go to Specific Line.
void go_to_percent (View *view, int percent)
 Go to Percent of File.
void go_to_position (View *view, off_t go_to_pos)
 Go to Specific File Position.
bool search (View *view, int *search_cmd, char *regex_pattern)
 Search for Regular Expression Pattern.
void next_page (View *view)
 Advance to Next Page.
void prev_page (View *view)
 display previous page
void resize_page (Init *init)
 Resize Viewing Page.
void scroll_down_n_lines (View *view, int n)
 Scroll N Lines.
void scroll_up_n_lines (View *view, int n)
 Scroll Up N Lines.
off_t get_next_line (View *view, off_t pos)
 Get Next Line from View->buf.
off_t get_prev_line (View *view, off_t pos)
 Get Previous Line from View->buf.
off_t get_pos_next_line (View *view, off_t pos)
 Get Position of Next Line.
off_t get_pos_prev_line (View *view, off_t pos)
 Get Position of Previous Line.
int fmt_line (View *view)
 Format Line for Display.
void display_line (View *view)
 Display Line on Padparam View *view data structure.
void view_display_page (View *view)
 Display Current Page.
void parse_ansi_str (char *ansi_str, attr_t *attr, int *cpx)
 Parse ANSI SGR Escape Sequence.
void view_display_help (Init *init)
 Display View Help File.
int display_prompt (View *view, char *s)
 Display Command Line Prompt.
void remove_file (View *view)
 Remove File.
int write_view_buffer (Init *init, bool f_strip_ansi)
 Write buffer contents to files.
bool enter_file_spec (Init *init, char *file_spec)
 use form to enter a file specification
int a_toi (char *, bool *)
 a safer alternative to atoi() for converting ASCII strings to integers.
void increment_ln (View *view)
 Increment Line Index and Update Line Table.
void initialize_line_table (View *view)
 Initialize Line Table.
int pad_refresh (View *view)
 Refresh Pad and Line Number Window.
void sync_ln (View *view)
 Synchronize Line Table with Current File Position.
void view_restore_wins ()

Variables

char prev_regex_pattern [MAXLEN]
FILE * dbgfp
char err_msg [MAXLEN]

Detailed Description

The working part of View.

Author
Bill Waller Copyright (c) 2025 MIT License billx.nosp@m.wall.nosp@m.er@gm.nosp@m.ail..nosp@m.com
Date
2026-02-09

Definition in file view_engine.c.

Function Documentation

◆ view_restore_wins()

void view_restore_wins ( )

Definition at line 1979 of file view_engine.c.

1979 {
1980 wnoutrefresh(view->ln_win);
1981 wrefresh(view->ln_win);
1982 wnoutrefresh(view->win);
1983 wrefresh(view->win);
1984}
View * view
Definition mem.c:48

References View::ln_win, view, and View::win.

Variable Documentation

◆ dbgfp

FILE* dbgfp

Definition at line 81 of file view_engine.c.

◆ err_msg

char err_msg[MAXLEN]

Definition at line 118 of file view_engine.c.

◆ prev_regex_pattern

char prev_regex_pattern[MAXLEN]

Definition at line 80 of file view_engine.c.

Referenced by view_cmd_processor().