GnuCOBOL  2.0
A free COBOL compiler
screenio.c File Reference
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include "libcob.h"
#include "coblocal.h"
Include dependency graph for screenio.c:

Go to the source code of this file.

Data Structures

struct  cob_inp_struct
 

Macros

#define COB_LIB_EXPIMP
 
#define COB_INP_FLD_MAX   512U
 
#define COB_INP_SIZE   (COB_INP_FLD_MAX * sizeof(struct cob_inp_struct))
 
#define COB_CH_UL   ((const chtype)'_')
 
#define COB_CH_SP   ((const chtype)' ')
 
#define COB_CH_AS   ((const chtype)'*')
 
#define UPDATE_CLAUSE_FUNC(clause_name_upper, clause_name_lower)
 

Enumerations

enum  screen_statement { ACCEPT_STATEMENT, DISPLAY_STATEMENT }
 

Functions

static void cob_speaker_beep (void)
 
static void cob_beep (void)
 
static void cob_convert_key (int *keyp, const cob_u32_t field_accept)
 
static void get_line_column (cob_field *fline, cob_field *fcol, int *line, int *col)
 
static void raise_ec_on_invalid_line_or_col (const int line, const int column)
 
static void cob_move_cursor (const int line, const int column)
 
static void cob_move_to_beg_of_last_line (void)
 
static void cob_screen_attr (cob_field *fgc, cob_field *bgc, const int attr, const enum screen_statement stmt)
 
static void cob_screen_init (void)
 
static void cob_check_pos_status (const int fret)
 
static void raise_ec_on_truncation (const int item_size)
 
static void cob_addnstr (const char *data, const int size)
 
static void cob_addch (const chtype c)
 
static void cob_addch_no_trunc_check (const chtype c)
 
static void cob_addnch (const int n, const chtype c)
 
static int is_first_screen_item (cob_screen *s)
 
static cob_screenget_last_child (cob_screen *const s)
 
static cob_screenget_prev_screen_item (cob_screen *const s)
 
static void update_line (cob_screen *s, int *const count, int *const found_clause)
 
static void update_column (cob_screen *s, int *const count, int *const found_clause)
 
static size_t get_size (cob_screen *s)
 
static void get_screen_item_line_and_col (cob_screen *s, int *const line, int *const col)
 
static void cob_screen_puts (cob_screen *s, cob_field *f, const cob_u32_t is_input, const enum screen_statement stmt)
 
static COB_INLINE COB_A_INLINE int cob_field_is_numeric_or_numeric_edited (cob_field *field)
 
static int field_is_empty (cob_screen *s)
 
static int field_is_zero (cob_screen *s)
 
static int pic_has_zero_suppression (const char *pic)
 
static int get_num_int_digits_for_no_zero_sup (const char *pic)
 
static int field_is_zero_or_no_zero_suppression (cob_screen *s)
 
static int field_is_full (cob_screen *s)
 
static int satisfied_full_clause (cob_screen *s)
 
static int satisfied_required_clause (cob_screen *s)
 
static int valid_field_data (cob_field *field)
 
static void refresh_field (cob_screen *s)
 
static void format_field (cob_screen *s)
 
static int finalize_field_input (cob_screen *s)
 
static int finalize_all_fields (struct cob_inp_struct *sptr, const size_t total_idx)
 
static void cob_screen_get_all (const int initial_curs, const int gettimeout)
 
static int compare_yx (const void *m1, const void *m2)
 
static void cob_screen_moveyx (cob_screen *s)
 
static size_t cob_prep_input (cob_screen *s)
 
static void cob_screen_iterate (cob_screen *s)
 
static COB_INLINE COB_A_INLINE void set_default_line_column (const int is_screen, int *sline, int *scolumn)
 
static void pos_to_line_column (cob_field *pos, int *line, int *column)
 
static void extract_line_and_col_vals (const int is_screen, cob_field *line, cob_field *column, int *sline, int *scolumn)
 
static COB_INLINE COB_A_INLINE void init_cob_screen_if_needed (void)
 
static void screen_display (cob_screen *s, const int line, const int column)
 
static void screen_accept (cob_screen *s, const int line, const int column, cob_field *ftimeout)
 
static void field_display (cob_field *f, const int line, const int column, cob_field *fgc, cob_field *bgc, cob_field *fscroll, cob_field *size_is, const int fattr)
 
static void field_accept (cob_field *f, const int sline, const int scolumn, cob_field *fgc, cob_field *bgc, cob_field *fscroll, cob_field *ftimeout, cob_field *prompt, cob_field *size_is, const int fattr)
 
void cob_screen_display (cob_screen *s, cob_field *line, cob_field *column)
 
void cob_screen_accept (cob_screen *s, cob_field *line, cob_field *column, cob_field *ftimeout)
 
void cob_field_display (cob_field *f, cob_field *line, cob_field *column, cob_field *fgc, cob_field *bgc, cob_field *fscroll, cob_field *size_is, const int fattr)
 
void cob_field_accept (cob_field *f, cob_field *line, cob_field *column, cob_field *fgc, cob_field *bgc, cob_field *fscroll, cob_field *ftimeout, cob_field *prompt, cob_field *size_is, const int fattr)
 
void cob_screen_line_col (cob_field *f, const int l_or_c)
 
int cob_sys_clear_screen (void)
 
void cob_screen_set_mode (const cob_u32_t smode)
 
void cob_exit_screen (void)
 
int cob_sys_sound_bell (void)
 
void cob_accept_escape_key (cob_field *f)
 
int cob_sys_get_csr_pos (unsigned char *fld)
 
int cob_sys_get_scr_size (unsigned char *line, unsigned char *col)
 
void cob_init_screenio (cob_global *lptr, cob_settings *sptr)
 

Variables

static cob_globalcobglobptr
 
static cob_settingscobsetptr
 
static const cob_field_attr const_alpha_attr
 
static struct cob_inp_structcob_base_inp
 
static size_t totl_index
 
static size_t cob_has_color
 
static int global_return
 
static int cob_current_y
 
static int cob_current_x
 
static short fore_color
 
static short back_color
 
static int origin_y
 
static int origin_x
 

Macro Definition Documentation

#define COB_CH_AS   ((const chtype)'*')

Definition at line 88 of file screenio.c.

Referenced by cob_screen_get_all(), cob_screen_puts(), and field_accept().

#define COB_CH_SP   ((const chtype)' ')

Definition at line 87 of file screenio.c.

Referenced by cob_screen_get_all(), field_accept(), and field_display().

#define COB_CH_UL   ((const chtype)'_')

Definition at line 86 of file screenio.c.

Referenced by cob_screen_get_all(), cob_screen_puts(), and field_accept().

#define COB_INP_FLD_MAX   512U

Definition at line 82 of file screenio.c.

Referenced by cob_prep_input().

#define COB_INP_SIZE   (COB_INP_FLD_MAX * sizeof(struct cob_inp_struct))

Definition at line 84 of file screenio.c.

Referenced by screen_accept().

#define COB_LIB_EXPIMP

Definition at line 65 of file screenio.c.

#define UPDATE_CLAUSE_FUNC (   clause_name_upper,
  clause_name_lower 
)
Value:
static void \
update_##clause_name_lower (cob_screen *s, int * const count, \
int * const found_clause) \
{ \
if (s->attr & COB_SCREEN_##clause_name_upper##_PLUS) { \
*count += cob_get_int (s->clause_name_lower); \
} else if (s->attr & COB_SCREEN_##clause_name_upper##_MINUS) { \
*count -= cob_get_int (s->clause_name_lower); \
} else { \
*count += cob_get_int (s->clause_name_lower) - 1; \
*found_clause = 1; \
} \
}
int cob_get_int(cob_field *)
Definition: move.c:1626

Definition at line 717 of file screenio.c.

Enumeration Type Documentation

Enumerator
ACCEPT_STATEMENT 
DISPLAY_STATEMENT 

Definition at line 339 of file screenio.c.

Function Documentation

void cob_accept_escape_key ( cob_field f)

Definition at line 2524 of file screenio.c.

References COB_ACCEPT_STATUS, and cob_set_int().

2525 {
2527 }
#define COB_ACCEPT_STATUS
Definition: coblocal.h:187
void cob_set_int(cob_field *, const int)
Definition: move.c:1612

Here is the call graph for this function:

static void cob_addch ( const chtype  c)
static

Definition at line 649 of file screenio.c.

References raise_ec_on_truncation().

Referenced by cob_screen_get_all(), and field_accept().

650 {
652  addch (c);
653 }
static void raise_ec_on_truncation(const int item_size)
Definition: screenio.c:623

Here is the call graph for this function:

Here is the caller graph for this function:

static void cob_addch_no_trunc_check ( const chtype  c)
static

Definition at line 657 of file screenio.c.

Referenced by cob_addnch(), cob_screen_puts(), and field_accept().

658 {
659  addch (c);
660 }

Here is the caller graph for this function:

static void cob_addnch ( const int  n,
const chtype  c 
)
static

Definition at line 663 of file screenio.c.

References cob_addch_no_trunc_check(), and raise_ec_on_truncation().

Referenced by field_accept(), and field_display().

664 {
665  int count;
666 
668  for (count = 0; count < n; count++) {
670  }
671 }
static void raise_ec_on_truncation(const int item_size)
Definition: screenio.c:623
static void cob_addch_no_trunc_check(const chtype c)
Definition: screenio.c:657

Here is the call graph for this function:

Here is the caller graph for this function:

static void cob_addnstr ( const char *  data,
const int  size 
)
static

Definition at line 642 of file screenio.c.

References raise_ec_on_truncation().

Referenced by cob_screen_puts().

643 {
644  raise_ec_on_truncation (size);
645  addnstr (data, size);
646 }
static void raise_ec_on_truncation(const int item_size)
Definition: screenio.c:623

Here is the call graph for this function:

Here is the caller graph for this function:

static void cob_beep ( void  )
static

Definition at line 128 of file screenio.c.

References COB_BEEP_VALUE, and cob_speaker_beep().

Referenced by cob_screen_attr(), cob_screen_get_all(), cob_sys_sound_bell(), and field_accept().

129 {
130  switch (COB_BEEP_VALUE) {
131  case 1:
132  (void)flash ();
133  return;
134  case 2:
135  cob_speaker_beep ();
136  return;
137  case 9:
138  return;
139  default:
140  (void)beep ();
141  return;
142  }
143 }
static void cob_speaker_beep(void)
Definition: screenio.c:115
#define COB_BEEP_VALUE
Definition: coblocal.h:192

Here is the call graph for this function:

Here is the caller graph for this function:

static void cob_check_pos_status ( const int  fret)
static

Definition at line 578 of file screenio.c.

References COB_ACCEPT_STATUS, COB_EC_IMP_ACCEPT, COB_FIELD_IS_NUMERIC, COB_FIELD_TYPE, COB_MODULE_PTR, cob_set_exception(), cob_set_int(), COB_TYPE_NUMERIC_DISPLAY, cob_field::data, and cob_field::size.

Referenced by field_accept(), and screen_accept().

579 {
580  cob_field *f;
581  int sline;
582  int scolumn;
583  char datbuf[8];
584 
585  if (fret) {
587  }
588  COB_ACCEPT_STATUS = fret;
589  if (COB_MODULE_PTR->crt_status) {
590  if (COB_FIELD_IS_NUMERIC (COB_MODULE_PTR->crt_status)) {
591  cob_set_int (COB_MODULE_PTR->crt_status, fret);
592  } else {
593  sprintf(datbuf, "%4.4d", fret);
594  memcpy (COB_MODULE_PTR->crt_status->data, datbuf,
595  (size_t)4);
596  }
597  }
598  if (COB_MODULE_PTR->cursor_pos) {
599  getyx (stdscr, sline, scolumn);
600  f = COB_MODULE_PTR->cursor_pos;
601  if (COB_FIELD_IS_NUMERIC (f) &&
603  sline *= 1000;
604  sline += scolumn;
605  cob_set_int (f, sline);
606  } else {
607  if (f->size < 6) {
608  sline *= 100;
609  sline += scolumn;
610  sprintf(datbuf, "%4.4d", sline);
611  memcpy (f->data, datbuf, (size_t)4);
612  } else {
613  sline *= 1000;
614  sline += scolumn;
615  sprintf(datbuf, "%6.6d", sline);
616  memcpy (f->data, datbuf, (size_t)6);
617  }
618  }
619  }
620 }
#define COB_FIELD_IS_NUMERIC(f)
Definition: common.h:674
#define COB_FIELD_TYPE(f)
Definition: common.h:662
unsigned char * data
Definition: common.h:952
#define COB_ACCEPT_STATUS
Definition: coblocal.h:187
void cob_set_exception(const int id)
Definition: common.c:1212
#define COB_TYPE_NUMERIC_DISPLAY
Definition: common.h:607
void cob_set_int(cob_field *, const int)
Definition: move.c:1612
#define COB_MODULE_PTR
Definition: coblocal.h:185
size_t size
Definition: common.h:951

Here is the call graph for this function:

Here is the caller graph for this function:

static void cob_convert_key ( int *  keyp,
const cob_u32_t  field_accept 
)
static

Definition at line 146 of file screenio.c.

References COB_EXTENDED_STATUS, and COB_USE_ESC.

Referenced by cob_screen_get_all(), and field_accept().

147 {
148  /* Map key to KEY_xxx value */
149  switch (*keyp) {
150  case '\n':
151  case '\r':
152  case '\004':
153  case '\032':
154  *keyp = KEY_ENTER;
155  break;
156  case '\t':
157  *keyp = KEY_STAB;
158  break;
159  case '\b':
160  case 0177:
161  *keyp = KEY_BACKSPACE;
162  break;
163  case 01005:
164  *keyp = KEY_EOL; /* Alt-Delete */
165  break;
166  case 01040:
167  *keyp = KEY_CLOSE; /* Alt-left-arrow */
168  break;
169  case 01062:
170  *keyp = KEY_PREVIOUS; /* Alt-right-arrow */
171  break;
172 
173 #ifdef KEY_A1
174  /* A1, A3, C1, C3 must be present */
175  case KEY_A1:
176  *keyp = KEY_HOME;
177  break;
178  case KEY_A3:
179  *keyp = KEY_PPAGE;
180  break;
181  case KEY_C1:
182  *keyp = KEY_END;
183  break;
184  case KEY_C3:
185  *keyp = KEY_NPAGE;
186  break;
187  /* Any or all of A2, B1-3, C2 MAY be present */
188  /* Note B2 ignored */
189 #ifdef KEY_A2
190  case KEY_A2:
191  *keyp = KEY_UP;
192  break;
193 #endif
194 #ifdef KEY_B1
195  case KEY_B1:
196  *keyp = KEY_LEFT;
197  break;
198 #endif
199 #ifdef KEY_B3
200  case KEY_B3:
201  *keyp = KEY_RIGHT;
202  break;
203 #endif
204 #ifdef KEY_C2
205  case KEY_C2:
206  *keyp = KEY_DOWN;
207  break;
208 #endif
209 
210 #if defined(__PDCURSES__) && defined(PADSLASH)
211  case PADSLASH:
212  *keyp = '/';
213  break;
214  case PADSTAR:
215  *keyp = '*';
216  break;
217  case PADMINUS:
218  *keyp = '-';
219  break;
220  case PADPLUS:
221  *keyp = '+';
222  break;
223  case PADENTER:
224  *keyp = KEY_ENTER;
225  break;
226 #ifdef PAD0
227  case PAD0:
228  *keyp = KEY_IC;
229  break;
230  case PADSTOP:
231  *keyp = KEY_DC;
232  break;
233 #endif /* PAD0 */
234 #endif /* __PDCURSES__ */
235 #endif /* KEY_A1 */
236  default:
237  break;
238  }
239 
240  /* Check if key should be ignored */
241  switch (*keyp) {
242  /* 2012/08/30 removed to allow Tab key in extended Accept.
243  case KEY_STAB:
244  if (field_accept) {
245  *keyp = 0;
246  }
247  break;
248  */
249  case '\033':
250  if (!COB_EXTENDED_STATUS || !COB_USE_ESC) {
251  *keyp = 0;
252  }
253  break;
254  case KEY_PPAGE:
255  case KEY_NPAGE:
256  case KEY_PRINT:
257  if (!COB_EXTENDED_STATUS) {
258  *keyp = 0;
259  }
260  break;
261  case KEY_UP:
262  case KEY_DOWN:
264  *keyp = 0;
265  }
266  break;
267  default:
268  break;
269  }
270 }
#define COB_USE_ESC
Definition: coblocal.h:195
#define COB_EXTENDED_STATUS
Definition: coblocal.h:194
static void field_accept(cob_field *f, const int sline, const int scolumn, cob_field *fgc, cob_field *bgc, cob_field *fscroll, cob_field *ftimeout, cob_field *prompt, cob_field *size_is, const int fattr)
Definition: screenio.c:1769

Here is the caller graph for this function:

void cob_exit_screen ( void  )

Definition at line 2401 of file screenio.c.

References COB_ACCEPT_STATUS, cob_free(), cob_move_to_beg_of_last_line(), __cob_global::cob_screen_initialized, and NULL.

Referenced by cob_runtime_error(), and cob_terminate_routines().

2402 {
2403  if (!cobglobptr) {
2404  return;
2405  }
2408  clear ();
2410  delwin (stdscr);
2411  endwin ();
2412 #ifdef HAVE_CURSES_FREEALL
2413  _nc_freeall ();
2414 #endif
2415  if (cob_base_inp) {
2417  cob_base_inp = NULL;
2418  }
2419  }
2420  COB_ACCEPT_STATUS = 0;
2421 }
void cob_free(void *mptr)
Definition: common.c:1284
static struct cob_inp_struct * cob_base_inp
Definition: screenio.c:100
static void cob_move_to_beg_of_last_line(void)
Definition: screenio.c:327
#define COB_ACCEPT_STATUS
Definition: coblocal.h:187
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
unsigned int cob_screen_initialized
Definition: common.h:1208
static cob_global * cobglobptr
Definition: screenio.c:92

Here is the call graph for this function:

Here is the caller graph for this function:

void cob_field_accept ( cob_field f,
cob_field line,
cob_field column,
cob_field fgc,
cob_field bgc,
cob_field fscroll,
cob_field ftimeout,
cob_field prompt,
cob_field size_is,
const int  fattr 
)

Definition at line 2353 of file screenio.c.

References extract_line_and_col_vals(), and field_accept().

Referenced by cob_accept(), and GCic_().

2357 {
2358  int sline;
2359  int scolumn;
2360 
2361  extract_line_and_col_vals (0, line, column, &sline, &scolumn);
2362  field_accept (f, sline, scolumn, fgc, bgc, fscroll, ftimeout, prompt, size_is, fattr);
2363 }
static void extract_line_and_col_vals(const int is_screen, cob_field *line, cob_field *column, int *sline, int *scolumn)
Definition: screenio.c:1564
static void field_accept(cob_field *f, const int sline, const int scolumn, cob_field *fgc, cob_field *bgc, cob_field *fscroll, cob_field *ftimeout, cob_field *prompt, cob_field *size_is, const int fattr)
Definition: screenio.c:1769

Here is the call graph for this function:

Here is the caller graph for this function:

void cob_field_display ( cob_field f,
cob_field line,
cob_field column,
cob_field fgc,
cob_field bgc,
cob_field fscroll,
cob_field size_is,
const int  fattr 
)

Definition at line 2341 of file screenio.c.

References extract_line_and_col_vals(), and field_display().

Referenced by cob_display().

2344 {
2345  int sline;
2346  int scolumn;
2347 
2348  extract_line_and_col_vals (0, line, column, &sline, &scolumn);
2349  field_display (f, sline, scolumn, fgc, bgc, fscroll, size_is, fattr);
2350 }
static void field_display(cob_field *f, const int line, const int column, cob_field *fgc, cob_field *bgc, cob_field *fscroll, cob_field *size_is, const int fattr)
Definition: screenio.c:1700
static void extract_line_and_col_vals(const int is_screen, cob_field *line, cob_field *column, int *sline, int *scolumn)
Definition: screenio.c:1564

Here is the call graph for this function:

Here is the caller graph for this function:

static COB_INLINE COB_A_INLINE int cob_field_is_numeric_or_numeric_edited ( cob_field field)
static

Definition at line 847 of file screenio.c.

References COB_FIELD_IS_NUMERIC, COB_FIELD_TYPE, and COB_TYPE_NUMERIC_EDITED.

Referenced by cob_screen_get_all(), field_accept(), finalize_field_input(), and satisfied_required_clause().

848 {
849  return (COB_FIELD_IS_NUMERIC (field)
851 }
#define COB_FIELD_IS_NUMERIC(f)
Definition: common.h:674
#define COB_FIELD_TYPE(f)
Definition: common.h:662
#define COB_TYPE_NUMERIC_EDITED
Definition: common.h:619

Here is the caller graph for this function:

void cob_init_screenio ( cob_global lptr,
cob_settings sptr 
)

Definition at line 2567 of file screenio.c.

Referenced by cob_init().

2568 {
2569  cobglobptr = lptr;
2570  cobsetptr = sptr;
2571 }
static cob_settings * cobsetptr
Definition: screenio.c:93
static cob_global * cobglobptr
Definition: screenio.c:92

Here is the caller graph for this function:

static void cob_move_cursor ( const int  line,
const int  column 
)
static

Definition at line 317 of file screenio.c.

References raise_ec_on_invalid_line_or_col().

Referenced by cob_screen_attr(), cob_screen_get_all(), cob_screen_moveyx(), cob_screen_puts(), field_accept(), field_display(), refresh_field(), screen_accept(), and screen_display().

318 {
319  int status = move (line, column);
320 
321  if (status == ERR) {
323  }
324 }
static void raise_ec_on_invalid_line_or_col(const int line, const int column)
Definition: screenio.c:302
if fold fold static computed alternate extra correct stack on syntax debugging line
Definition: flag.def:90

Here is the call graph for this function:

Here is the caller graph for this function:

static void cob_move_to_beg_of_last_line ( void  )
static

Definition at line 327 of file screenio.c.

References COB_UNUSED.

Referenced by cob_exit_screen().

328 {
329  int max_y;
330  int max_x;
331 
332  COB_UNUSED (max_x);
333 
334  getmaxyx (stdscr, max_y, max_x);
335  /* We don't need to check for exceptions here; it will always be fine */
336  move (max_y, 0);
337 }
#define COB_UNUSED(z)
Definition: common.h:535

Here is the caller graph for this function:

static size_t cob_prep_input ( cob_screen s)
static

Definition at line 1442 of file screenio.c.

References ACCEPT_STATEMENT, __cob_screen::attr, __cob_screen::backg, __cob_screen::child, cob_current_x, cob_current_y, COB_INP_FLD_MAX, __cob_settings::cob_legacy, cob_screen_attr(), COB_SCREEN_INPUT, cob_screen_moveyx(), cob_screen_puts(), COB_SCREEN_TYPE_ATTRIBUTE, COB_SCREEN_TYPE_FIELD, COB_SCREEN_TYPE_GROUP, COB_SCREEN_TYPE_VALUE, __cob_screen::field, __cob_screen::foreg, __cob_screen::next, __cob_screen::occurs, cob_inp_struct::scr, cob_inp_struct::this_x, cob_inp_struct::this_y, totl_index, __cob_screen::type, and __cob_screen::value.

Referenced by screen_accept().

1443 {
1444  struct cob_inp_struct *sptr;
1445  int n;
1446 
1447  switch (s->type) {
1448  case COB_SCREEN_TYPE_GROUP:
1449  cob_screen_moveyx (s);
1450  for (s = s->child; s; s = s->next) {
1451  cob_prep_input (s);
1452  }
1453  break;
1454  case COB_SCREEN_TYPE_FIELD:
1457  if (s->attr & COB_SCREEN_INPUT) {
1458  if (totl_index >= COB_INP_FLD_MAX) {
1459  return 1;
1460  }
1461  sptr = cob_base_inp + totl_index;
1462  sptr->scr = s;
1463  sptr->this_y = cob_current_y;
1464  sptr->this_x = cob_current_x;
1465  totl_index++;
1466  }
1467  break;
1468  case COB_SCREEN_TYPE_VALUE:
1471  if (s->occurs) {
1472  for (n = 1; n < s->occurs; ++n) {
1475  }
1476  }
1477  break;
1479 #if 0 /* RXWRXW - Attr */
1480  cob_screen_attr (s->foreg, s->backg, s->attr);
1481 #endif
1482  break;
1483  default:
1484  break;
1485  }
1486  return 0;
1487 }
static size_t cob_prep_input(cob_screen *s)
Definition: screenio.c:1442
#define COB_SCREEN_TYPE_VALUE
Definition: common.h:929
static struct cob_inp_struct * cob_base_inp
Definition: screenio.c:100
#define COB_SCREEN_TYPE_FIELD
Definition: common.h:928
unsigned int cob_legacy
Definition: coblocal.h:243
#define COB_INP_FLD_MAX
Definition: screenio.c:82
struct __cob_screen * next
Definition: common.h:1028
static int cob_current_y
Definition: screenio.c:104
int occurs
Definition: common.h:1040
cob_field * foreg
Definition: common.h:1036
static size_t totl_index
Definition: screenio.c:101
static void cob_screen_attr(cob_field *fgc, cob_field *bgc, const int attr, const enum screen_statement stmt)
Definition: screenio.c:345
cob_field * backg
Definition: common.h:1037
cob_field * value
Definition: common.h:1033
#define COB_SCREEN_TYPE_ATTRIBUTE
Definition: common.h:930
static int cob_current_x
Definition: screenio.c:105
static void cob_screen_puts(cob_screen *s, cob_field *f, const cob_u32_t is_input, const enum screen_statement stmt)
Definition: screenio.c:800
cob_field * field
Definition: common.h:1032
struct __cob_screen * child
Definition: common.h:1030
static cob_settings * cobsetptr
Definition: screenio.c:93
#define COB_SCREEN_TYPE_GROUP
Definition: common.h:927
cob_screen * scr
Definition: screenio.c:75
#define COB_SCREEN_INPUT
Definition: common.h:916
static void cob_screen_moveyx(cob_screen *s)
Definition: screenio.c:1391

Here is the call graph for this function:

Here is the caller graph for this function:

void cob_screen_accept ( cob_screen s,
cob_field line,
cob_field column,
cob_field ftimeout 
)

Definition at line 2330 of file screenio.c.

References extract_line_and_col_vals(), and screen_accept().

Referenced by GCic_().

2332 {
2333  int sline;
2334  int scolumn;
2335 
2336  extract_line_and_col_vals (1, line, column, &sline, &scolumn);
2337  screen_accept (s, sline, scolumn, ftimeout);
2338 }
static void screen_accept(cob_screen *s, const int line, const int column, cob_field *ftimeout)
Definition: screenio.c:1604
static void extract_line_and_col_vals(const int is_screen, cob_field *line, cob_field *column, int *sline, int *scolumn)
Definition: screenio.c:1564

Here is the call graph for this function:

Here is the caller graph for this function:

static void cob_screen_attr ( cob_field fgc,
cob_field bgc,
const int  attr,
const enum screen_statement  stmt 
)
static

Definition at line 345 of file screenio.c.

References back_color, cob_beep(), cob_get_int(), cob_has_color, cob_move_cursor(), COB_SCREEN_BELL, COB_SCREEN_BLACK, COB_SCREEN_BLANK_LINE, COB_SCREEN_BLANK_SCREEN, COB_SCREEN_BLINK, COB_SCREEN_BLUE, COB_SCREEN_CYAN, COB_SCREEN_ERASE_EOL, COB_SCREEN_ERASE_EOS, COB_SCREEN_GREEN, COB_SCREEN_HIGHLIGHT, COB_SCREEN_LOWLIGHT, COB_SCREEN_MAGENTA, COB_SCREEN_RED, COB_SCREEN_REVERSE, COB_SCREEN_UNDERLINE, COB_SCREEN_WHITE, COB_SCREEN_YELLOW, DISPLAY_STATEMENT, fore_color, line, and NULL.

Referenced by cob_prep_input(), cob_screen_get_all(), cob_screen_iterate(), cob_screen_puts(), field_accept(), and field_display().

347 {
348  int i;
349  int styles = 0;
350  int line;
351  int column;
352  short fgcolor;
353  short bgcolor;
354  short fgdef;
355  short bgdef;
356 
357  attrset (A_NORMAL);
358  if (attr & COB_SCREEN_BELL) {
359  cob_beep ();
360  }
361  if (attr & COB_SCREEN_REVERSE) {
362  styles |= A_REVERSE;
363  }
364  if (attr & COB_SCREEN_HIGHLIGHT) {
365  styles |= A_BOLD;
366  }
367  if (attr & COB_SCREEN_LOWLIGHT) {
368  styles |= A_DIM;
369  }
370  if (attr & COB_SCREEN_BLINK) {
371  styles |= A_BLINK;
372  }
373  if (attr & COB_SCREEN_UNDERLINE) {
374  styles |= A_UNDERLINE;
375  }
376  if (styles) {
377  attron (styles);
378  }
379  if (cob_has_color) {
380  fgcolor = fore_color;
381  bgcolor = back_color;
382  if (fgc) {
383  switch (cob_get_int (fgc)) {
384  case COB_SCREEN_BLACK:
385  fgcolor = COLOR_BLACK;
386  break;
387  case COB_SCREEN_BLUE:
388  fgcolor = COLOR_BLUE;
389  break;
390  case COB_SCREEN_GREEN:
391  fgcolor = COLOR_GREEN;
392  break;
393  case COB_SCREEN_CYAN:
394  fgcolor = COLOR_CYAN;
395  break;
396  case COB_SCREEN_RED:
397  fgcolor = COLOR_RED;
398  break;
399  case COB_SCREEN_MAGENTA:
400  fgcolor = COLOR_MAGENTA;
401  break;
402  case COB_SCREEN_YELLOW:
403  fgcolor = COLOR_YELLOW;
404  break;
405  case COB_SCREEN_WHITE:
406  fgcolor = COLOR_WHITE;
407  break;
408  default:
409  break;
410  }
411  }
412  if (bgc) {
413  switch (cob_get_int (bgc)) {
414  case COB_SCREEN_BLACK:
415  bgcolor = COLOR_BLACK;
416  break;
417  case COB_SCREEN_BLUE:
418  bgcolor = COLOR_BLUE;
419  break;
420  case COB_SCREEN_GREEN:
421  bgcolor = COLOR_GREEN;
422  break;
423  case COB_SCREEN_CYAN:
424  bgcolor = COLOR_CYAN;
425  break;
426  case COB_SCREEN_RED:
427  bgcolor = COLOR_RED;
428  break;
429  case COB_SCREEN_MAGENTA:
430  bgcolor = COLOR_MAGENTA;
431  break;
432  case COB_SCREEN_YELLOW:
433  bgcolor = COLOR_YELLOW;
434  break;
435  case COB_SCREEN_WHITE:
436  bgcolor = COLOR_WHITE;
437  break;
438  default:
439  break;
440  }
441  }
442  for (i = 0; i < (int)COLOR_PAIRS; i++) {
443  pair_content ((short)i, &fgdef, &bgdef);
444  if (fgdef == fgcolor && bgdef == bgcolor) {
445  break;
446  }
447  if (fgdef == 0 && bgdef == 0) {
448  init_pair ((short)i, fgcolor, bgcolor);
449  break;
450  }
451  }
452  if (i != (int)COLOR_PAIRS) {
453 #ifdef HAVE_COLOR_SET
454  color_set ((short)COLOR_PAIR(i), NULL);
455 #else
456  attrset (COLOR_PAIR(i));
457 #endif
458  bkgdset (COLOR_PAIR(i));
459  } else {
460  if (!styles) {
461  attrset (A_NORMAL);
462  }
463  }
464  }
465  /* BLANK SCREEN colors the whole screen. */
466  if (attr & COB_SCREEN_BLANK_SCREEN) {
467  getyx (stdscr, line, column);
468  clear ();
469  cob_move_cursor (line, column);
470  }
471 
472  if (stmt == DISPLAY_STATEMENT) {
473  /* BLANK LINE colors the whole line. */
474  if (attr & COB_SCREEN_BLANK_LINE) {
475  getyx (stdscr, line, column);
476  cob_move_cursor (line, 0);
477  clrtoeol ();
478  cob_move_cursor (line, column);
479  }
480  if (attr & COB_SCREEN_ERASE_EOL) {
481  clrtoeol ();
482  }
483  if (attr & COB_SCREEN_ERASE_EOS) {
484  clrtobot ();
485  }
486  }
487 }
#define COB_SCREEN_BLINK
Definition: common.h:903
static size_t cob_has_color
Definition: screenio.c:102
#define COB_SCREEN_BELL
Definition: common.h:900
static void cob_move_cursor(const int line, const int column)
Definition: screenio.c:317
#define COB_SCREEN_YELLOW
Definition: common.h:892
#define COB_SCREEN_BLUE
Definition: common.h:887
#define COB_SCREEN_BLACK
Definition: common.h:886
static void cob_beep(void)
Definition: screenio.c:128
int cob_get_int(cob_field *)
Definition: move.c:1626
#define COB_SCREEN_ERASE_EOL
Definition: common.h:904
#define COB_SCREEN_UNDERLINE
Definition: common.h:912
static short back_color
Definition: screenio.c:107
#define COB_SCREEN_REVERSE
Definition: common.h:910
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
#define COB_SCREEN_WHITE
Definition: common.h:893
#define COB_SCREEN_LOWLIGHT
Definition: common.h:908
#define COB_SCREEN_MAGENTA
Definition: common.h:891
static short fore_color
Definition: screenio.c:106
#define COB_SCREEN_CYAN
Definition: common.h:889
#define COB_SCREEN_BLANK_LINE
Definition: common.h:901
#define COB_SCREEN_HIGHLIGHT
Definition: common.h:907
#define COB_SCREEN_GREEN
Definition: common.h:888
#define COB_SCREEN_ERASE_EOS
Definition: common.h:905
if fold fold static computed alternate extra correct stack on syntax debugging line
Definition: flag.def:90
#define COB_SCREEN_RED
Definition: common.h:890
#define COB_SCREEN_BLANK_SCREEN
Definition: common.h:902

Here is the call graph for this function:

Here is the caller graph for this function:

void cob_screen_display ( cob_screen s,
cob_field line,
cob_field column 
)

Definition at line 2321 of file screenio.c.

References extract_line_and_col_vals(), and screen_display().

Referenced by GCic_().

2322 {
2323  int sline;
2324  int scolumn;
2325 
2326  extract_line_and_col_vals (1, line, column, &sline, &scolumn);
2327  screen_display (s, sline, scolumn);
2328 }
static void extract_line_and_col_vals(const int is_screen, cob_field *line, cob_field *column, int *sline, int *scolumn)
Definition: screenio.c:1564
static void screen_display(cob_screen *s, const int line, const int column)
Definition: screenio.c:1591

Here is the call graph for this function:

Here is the caller graph for this function:

static void cob_screen_get_all ( const int  initial_curs,
const int  gettimeout 
)
static

Definition at line 1085 of file screenio.c.

References ACCEPT_STATEMENT, __cob_screen::attr, __cob_screen::backg, cob_addch(), cob_base_inp, cob_beep(), COB_CH_AS, COB_CH_SP, COB_CH_UL, cob_convert_key(), cob_field_is_numeric_or_numeric_edited(), cob_move_cursor(), cob_screen_attr(), COB_SCREEN_AUTO, COB_SCREEN_LOWER, COB_SCREEN_NO_ECHO, COB_SCREEN_SECURE, COB_SCREEN_UPPER, cob_field::data, cob_inp_struct::down_index, __cob_screen::field, finalize_all_fields(), finalize_field_input(), __cob_screen::foreg, global_return, __cob_screen::prompt, cob_inp_struct::scr, cob_field::size, cob_inp_struct::this_x, cob_inp_struct::this_y, totl_index, and cob_inp_struct::up_index.

Referenced by screen_accept().

1086 {
1087  size_t curr_index = (size_t)initial_curs;
1088  struct cob_inp_struct *sptr = cob_base_inp + curr_index;
1089  cob_screen *s = sptr->scr;
1090  unsigned char *p = s->field->data;
1091  int keyp;
1092  int sline = sptr->this_y;
1093  int scolumn = sptr->this_x;
1094  int cline;
1095  int ccolumn;
1096  int rightpos = scolumn + (int)s->field->size - 1;
1097  int ateof = 0;
1098  int gotbacksp = 0;
1099  int ungetched = 0;
1100  chtype promptchar;
1101 
1102  cob_move_cursor (sline, scolumn);
1104 
1105  for (; ;) {
1106  if (s->prompt) {
1107  promptchar = s->prompt->data[0];
1108  } else {
1109  promptchar = COB_CH_UL;
1110  }
1111 
1112  refresh ();
1113  errno = 0;
1114  timeout (gettimeout);
1115  keyp = getch ();
1116 
1117  if (keyp == ERR) {
1118  global_return = 8001;
1119  goto screen_return;
1120  }
1121  if (keyp > KEY_F0 && keyp < KEY_F(65)) {
1122  global_return = 1000 + keyp - KEY_F0;
1123  goto screen_return;
1124  }
1125 
1126  cob_convert_key (&keyp, 0);
1127  if (keyp <= 0) {
1128  (void)flushinp ();
1129  cob_beep ();
1130  continue;
1131  }
1132 
1133  getyx (stdscr, cline, ccolumn);
1134 
1135  switch (keyp) {
1136  case KEY_ENTER:
1138  cob_beep ();
1139  continue;
1140  }
1141  goto screen_return;
1142  case KEY_PPAGE:
1143  global_return = 2001;
1144  goto screen_return;
1145  case KEY_NPAGE:
1146  global_return = 2002;
1147  goto screen_return;
1148  case KEY_PRINT:
1149  global_return = 2006;
1150  goto screen_return;
1151  case '\033':
1152  global_return = 2005;
1153  goto screen_return;
1154  case KEY_STAB:
1156 
1157  if (curr_index < totl_index - 1) {
1158  curr_index++;
1159  } else {
1160  curr_index = 0;
1161  }
1162  sptr = cob_base_inp + curr_index;
1163  s = sptr->scr;
1164  sline = sptr->this_y;
1165  scolumn = sptr->this_x;
1166  ateof = 0;
1167  gotbacksp = 0;
1168  rightpos = scolumn + (int)s->field->size - 1;
1169  p = s->field->data;
1170  cob_move_cursor (sline, scolumn);
1171  cob_screen_attr (s->foreg, s->backg, s->attr,
1173  continue;
1174  case KEY_BTAB:
1176 
1177  if (curr_index > 0) {
1178  curr_index--;
1179  } else {
1180  curr_index = totl_index - 1;
1181  }
1182  sptr = cob_base_inp + curr_index;
1183  s = sptr->scr;
1184  sline = sptr->this_y;
1185  scolumn = sptr->this_x;
1186  ateof = 0;
1187  gotbacksp = 0;
1188  rightpos = scolumn + (int)s->field->size - 1;
1189  if (ungetched) {
1190  ungetched = 0;
1191  p = s->field->data + rightpos;
1192  cob_move_cursor (sline, rightpos);
1193  } else {
1194  p = s->field->data;
1195  cob_move_cursor (sline, scolumn);
1196  }
1197  cob_screen_attr (s->foreg, s->backg, s->attr,
1199  continue;
1200  case KEY_UP:
1202 
1203  curr_index = sptr->up_index;
1204  sptr = cob_base_inp + curr_index;
1205  s = sptr->scr;
1206  sline = sptr->this_y;
1207  scolumn = sptr->this_x;
1208  ateof = 0;
1209  gotbacksp = 0;
1210  rightpos = scolumn + (int)s->field->size - 1;
1211  p = s->field->data;
1212  cob_move_cursor (sline, scolumn);
1213  cob_screen_attr (s->foreg, s->backg, s->attr,
1215  continue;
1216  case KEY_DOWN:
1218 
1219  curr_index = sptr->down_index;
1220  sptr = cob_base_inp + curr_index;
1221  s = sptr->scr;
1222  sline = sptr->this_y;
1223  scolumn = sptr->this_x;
1224  ateof = 0;
1225  gotbacksp = 0;
1226  rightpos = scolumn + (int)s->field->size - 1;
1227  p = s->field->data;
1228  cob_move_cursor (sline, scolumn);
1229  cob_screen_attr (s->foreg, s->backg, s->attr,
1231  continue;
1232  case KEY_HOME:
1234 
1235  curr_index = 0;
1236  sptr = cob_base_inp;
1237  s = sptr->scr;
1238  sline = sptr->this_y;
1239  scolumn = sptr->this_x;
1240  ateof = 0;
1241  gotbacksp = 0;
1242  rightpos = scolumn + (int)s->field->size - 1;
1243  p = s->field->data;
1244  cob_move_cursor (sline, scolumn);
1245  cob_screen_attr (s->foreg, s->backg, s->attr,
1247  continue;
1248  case KEY_END:
1250 
1251  curr_index = totl_index - 1;
1252  sptr = cob_base_inp + curr_index;
1253  s = sptr->scr;
1254  sline = sptr->this_y;
1255  scolumn = sptr->this_x;
1256  ateof = 0;
1257  gotbacksp = 0;
1258  rightpos = scolumn + (int)s->field->size - 1;
1259  p = s->field->data;
1260  cob_move_cursor (sline, scolumn);
1261  cob_screen_attr (s->foreg, s->backg, s->attr,
1263  continue;
1264  case KEY_BACKSPACE:
1265  if (ccolumn > scolumn) {
1266  if (gotbacksp || ccolumn != rightpos) {
1267  ccolumn--;
1268  } else {
1269  ateof = 0;
1270  }
1271  gotbacksp = 1;
1272  cob_move_cursor (cline, ccolumn);
1273  if (s->attr & COB_SCREEN_SECURE) {
1274  cob_addch (COB_CH_AS);
1275  } else {
1276  cob_addch (promptchar);
1277  }
1278  cob_move_cursor (cline, ccolumn);
1279  p = s->field->data + ccolumn - scolumn;
1280  *p = ' ';
1281  } else {
1282  ungetched = 1;
1283  gotbacksp = 0;
1284  ungetch (KEY_BACKSPACE);
1285  ungetch (KEY_BTAB);
1286  }
1287  continue;
1288  case KEY_LEFT:
1289  gotbacksp = 0;
1290  if (ccolumn > scolumn) {
1291  ccolumn--;
1292  cob_move_cursor (cline, ccolumn);
1293  p = s->field->data + ccolumn - scolumn;
1294  } else {
1295  ungetched = 1;
1296  ungetch (KEY_BTAB);
1297  }
1298  continue;
1299  case KEY_RIGHT:
1300  gotbacksp = 0;
1301  if (ccolumn < rightpos) {
1302  ccolumn++;
1303  cob_move_cursor (cline, ccolumn);
1304  p = s->field->data + ccolumn - scolumn;
1305  } else {
1306  ungetch ('\t');
1307  }
1308  continue;
1309  default:
1310  break;
1311  }
1312 
1313  if (keyp > 037 && keyp < (int)A_CHARTEXT) {
1315  if (keyp < '0' || keyp > '9') {
1316  cob_beep ();
1317  continue;
1318  }
1319  }
1320  gotbacksp = 0;
1321  if (s->attr & COB_SCREEN_UPPER) {
1322  if (islower (keyp)) {
1323  keyp = toupper (keyp);
1324  }
1325  } else if (s->attr & COB_SCREEN_LOWER) {
1326  if (isupper (keyp)) {
1327  keyp = tolower (keyp);
1328  }
1329  }
1330 
1331  *p = (unsigned char) keyp;
1332 
1333  if (s->attr & COB_SCREEN_SECURE) {
1334  cob_addch (COB_CH_AS);
1335  } else if (s->attr & COB_SCREEN_NO_ECHO) {
1336  cob_addch (COB_CH_SP);
1337  } else {
1338  cob_addch ((const chtype)keyp);
1339  }
1340  if (ccolumn == rightpos) {
1341  if (s->attr & COB_SCREEN_AUTO) {
1342  if (curr_index == totl_index - 1) {
1343  goto screen_return;
1344  } else {
1345  ungetch ('\t');
1346  }
1347  }
1348  cob_move_cursor (cline, ccolumn);
1349  if (ateof) {
1350  cob_beep ();
1351  } else {
1352  ateof = 1;
1353  }
1354  } else {
1355  p++;
1356  }
1357  continue;
1358  }
1359  gotbacksp = 0;
1360  (void)flushinp ();
1361  cob_beep ();
1362  }
1363 screen_return:
1364  refresh ();
1365 }
size_t up_index
Definition: screenio.c:76
static COB_INLINE COB_A_INLINE int cob_field_is_numeric_or_numeric_edited(cob_field *field)
Definition: screenio.c:847
static struct cob_inp_struct * cob_base_inp
Definition: screenio.c:100
static void cob_move_cursor(const int line, const int column)
Definition: screenio.c:317
#define COB_SCREEN_NO_ECHO
Definition: common.h:919
static int global_return
Definition: screenio.c:103
static void cob_addch(const chtype c)
Definition: screenio.c:649
unsigned char * data
Definition: common.h:952
cob_field * foreg
Definition: common.h:1036
static void cob_beep(void)
Definition: screenio.c:128
static size_t totl_index
Definition: screenio.c:101
static void cob_screen_attr(cob_field *fgc, cob_field *bgc, const int attr, const enum screen_statement stmt)
Definition: screenio.c:345
#define COB_CH_AS
Definition: screenio.c:88
cob_field * backg
Definition: common.h:1037
cob_field * prompt
Definition: common.h:1038
#define COB_CH_UL
Definition: screenio.c:86
size_t down_index
Definition: screenio.c:77
#define COB_SCREEN_LOWER
Definition: common.h:924
static int finalize_all_fields(struct cob_inp_struct *sptr, const size_t total_idx)
Definition: screenio.c:1071
cob_field * field
Definition: common.h:1032
#define COB_SCREEN_SECURE
Definition: common.h:911
size_t size
Definition: common.h:951
static void cob_convert_key(int *keyp, const cob_u32_t field_accept)
Definition: screenio.c:146
static int finalize_field_input(cob_screen *s)
Definition: screenio.c:1053
cob_screen * scr
Definition: screenio.c:75
#define COB_SCREEN_AUTO
Definition: common.h:899
#define COB_CH_SP
Definition: screenio.c:87
#define COB_SCREEN_UPPER
Definition: common.h:923

Here is the call graph for this function:

Here is the caller graph for this function:

static void cob_screen_init ( void  )
static

Definition at line 490 of file screenio.c.

References _, back_color, cob_current_x, cob_current_y, cob_has_color, __cob_global::cob_locale, __cob_global::cob_locale_ctype, __cob_global::cob_locale_orig, COB_MAX_X_COORD, COB_MAX_Y_COORD, cob_runtime_error(), __cob_global::cob_screen_initialized, cob_stop_run(), fore_color, global_return, NULL, and totl_index.

Referenced by cob_sys_sound_bell(), and init_cob_screen_if_needed().

491 {
492 
493 #ifdef HAVE_LIBPDCURSES
494  size_t i;
495 #endif
496 
498  return;
499  }
500 
501  cob_base_inp = NULL;
502  totl_index = 0;
503  cob_has_color = 0;
504  global_return = 0;
505  cob_current_y = 0;
506  cob_current_x = 0;
507  fore_color = 0;
508  back_color = 0;
509 
510  fflush (stdout);
511  fflush (stderr);
512 
513 #if 0 /* RXWRXW sigtin */
514 #ifndef _WIN32
515  /* If the process is backgrounded (running non interactively), */
516  /* SIGTTIN or SIGTOU is emitted. If not caught, turns into a SIGSTP */
517 #ifdef SIGTTIN
518  signal(SIGTTIN, SIG_IGN);
519 #endif
520 #ifdef SIGTTOU
521  signal(SIGTTOU, SIG_IGN);
522 #endif
523 #endif
524 #endif
525 
526 #if 0 /* RXWRXW - setlocale */
527 #ifdef HAVE_SETLOCALE
529  setlocale (LC_ALL, cobglobptr->cob_locale_orig);
530  }
532  setlocale (LC_CTYPE, cobglobptr->cob_locale_ctype);
533  }
534 #endif
535 #endif
536 
537  if (!initscr ()) {
538  cob_runtime_error (_("Failed to initialize curses"));
539  cob_stop_run (1);
540  }
542 #ifdef HAVE_USE_LEGACY_CODING
543  use_legacy_coding (2);
544 #endif
545 
546 #if 0 /* RXWRXW - setlocale */
547 #ifdef HAVE_SETLOCALE
548  if (cobglobptr->cob_locale) {
549  setlocale (LC_ALL, cobglobptr->cob_locale);
550  setlocale (LC_CTYPE, "C");
551  }
552 #endif
553 #endif
554 
555  cbreak ();
556  keypad (stdscr, 1);
557  nonl ();
558  noecho ();
559  if (has_colors ()) {
560  start_color ();
561  pair_content ((short)0, &fore_color, &back_color);
562  if (COLOR_PAIRS) {
563 #ifdef HAVE_LIBPDCURSES
564  /* pdcurses sets ALL pairs to default fg/bg */
565  /* IMHO a bug. */
566  for (i = 1; i < (size_t)COLOR_PAIRS; ++i) {
567  init_pair ((short)i, 0, 0);
568  }
569 #endif
570  cob_has_color = 1;
571  }
572  }
573  attrset (A_NORMAL);
574  getmaxyx (stdscr, COB_MAX_Y_COORD, COB_MAX_X_COORD);
575 }
static size_t cob_has_color
Definition: screenio.c:102
#define COB_MAX_X_COORD
Definition: coblocal.h:189
static struct cob_inp_struct * cob_base_inp
Definition: screenio.c:100
static int global_return
Definition: screenio.c:103
static int cob_current_y
Definition: screenio.c:104
static size_t totl_index
Definition: screenio.c:101
void cob_runtime_error(const char *,...) COB_A_FORMAT12
Definition: common.c:1543
static short back_color
Definition: screenio.c:107
#define _(s)
Definition: cobcrun.c:59
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
static int cob_current_x
Definition: screenio.c:105
static short fore_color
Definition: screenio.c:106
unsigned int cob_screen_initialized
Definition: common.h:1208
char * cob_locale_orig
Definition: common.h:1195
char * cob_locale
Definition: common.h:1194
static cob_global * cobglobptr
Definition: screenio.c:92
#define COB_MAX_Y_COORD
Definition: coblocal.h:188
char * cob_locale_ctype
Definition: common.h:1196
void cob_stop_run(const int status)
Definition: common.c:1524

Here is the call graph for this function:

Here is the caller graph for this function:

static void cob_screen_iterate ( cob_screen s)
static

Definition at line 1490 of file screenio.c.

References __cob_screen::attr, __cob_screen::backg, __cob_screen::child, cob_screen_attr(), cob_screen_moveyx(), cob_screen_puts(), COB_SCREEN_TYPE_ATTRIBUTE, COB_SCREEN_TYPE_FIELD, COB_SCREEN_TYPE_GROUP, COB_SCREEN_TYPE_VALUE, DISPLAY_STATEMENT, __cob_screen::field, __cob_screen::foreg, __cob_screen::next, __cob_screen::occurs, __cob_screen::type, and __cob_screen::value.

Referenced by screen_display().

1491 {
1492  int n;
1493 
1494  switch (s->type) {
1495  case COB_SCREEN_TYPE_GROUP:
1496  cob_screen_moveyx (s);
1497  for (s = s->child; s; s = s->next) {
1498  cob_screen_iterate (s);
1499  }
1500  break;
1501  case COB_SCREEN_TYPE_FIELD:
1503  break;
1504  case COB_SCREEN_TYPE_VALUE:
1506  if (s->occurs) {
1507  for (n = 1; n < s->occurs; ++n) {
1508  cob_screen_puts (s, s->value, 0,
1510  }
1511  }
1512  break;
1514  cob_screen_attr (s->foreg, s->backg, s->attr,
1516  break;
1517  default:
1518  break;
1519  }
1520 }
#define COB_SCREEN_TYPE_VALUE
Definition: common.h:929
#define COB_SCREEN_TYPE_FIELD
Definition: common.h:928
struct __cob_screen * next
Definition: common.h:1028
int occurs
Definition: common.h:1040
cob_field * foreg
Definition: common.h:1036
static void cob_screen_attr(cob_field *fgc, cob_field *bgc, const int attr, const enum screen_statement stmt)
Definition: screenio.c:345
cob_field * backg
Definition: common.h:1037
static void cob_screen_iterate(cob_screen *s)
Definition: screenio.c:1490
cob_field * value
Definition: common.h:1033
#define COB_SCREEN_TYPE_ATTRIBUTE
Definition: common.h:930
static void cob_screen_puts(cob_screen *s, cob_field *f, const cob_u32_t is_input, const enum screen_statement stmt)
Definition: screenio.c:800
cob_field * field
Definition: common.h:1032
struct __cob_screen * child
Definition: common.h:1030
#define COB_SCREEN_TYPE_GROUP
Definition: common.h:927
static void cob_screen_moveyx(cob_screen *s)
Definition: screenio.c:1391

Here is the call graph for this function:

Here is the caller graph for this function:

void cob_screen_line_col ( cob_field f,
const int  l_or_c 
)

Definition at line 2366 of file screenio.c.

References cob_set_int(), COLS, init_cob_screen_if_needed(), and LINES.

2367 {
2369  if (!l_or_c) {
2370  cob_set_int (f, (int)LINES);
2371  } else {
2372  cob_set_int (f, (int)COLS);
2373  }
2374 }
Definition: parser.c:1409
Definition: parser.c:1598
void cob_set_int(cob_field *, const int)
Definition: move.c:1612
static COB_INLINE COB_A_INLINE void init_cob_screen_if_needed(void)
Definition: screenio.c:1583

Here is the call graph for this function:

static void cob_screen_moveyx ( cob_screen s)
static

Definition at line 1391 of file screenio.c.

References __cob_screen::attr, cob_current_x, cob_current_y, cob_get_int(), cob_move_cursor(), COB_SCREEN_COLUMN_MINUS, COB_SCREEN_COLUMN_PLUS, COB_SCREEN_LINE_MINUS, COB_SCREEN_LINE_PLUS, __cob_screen::column, line, __cob_screen::line, origin_x, and origin_y.

Referenced by cob_prep_input(), and cob_screen_iterate().

1392 {
1393  int y;
1394  int x;
1395  int line;
1396  int column;
1397 
1398  if (s->line || s->column ||
1401  getyx (stdscr, y, x);
1402 #if 1 /* RXWRXW - Column adjust */
1403  if (x > 0) {
1404  x--;
1405  }
1406 #endif
1407  if (!s->line) {
1408  line = y;
1409  } else {
1410  line = origin_y + cob_get_int (s->line);
1411  if (line < 0) {
1412  line = y;
1413  }
1414  }
1415  if (!s->column) {
1416  column = x;
1417  } else {
1418  column = origin_x + cob_get_int (s->column);
1419  if (column < 0) {
1420  column = x;
1421  }
1422  }
1423  if (s->attr & COB_SCREEN_LINE_PLUS) {
1424  line = y + line;
1425  } else if (s->attr & COB_SCREEN_LINE_MINUS) {
1426  line = y - line;
1427  }
1428  if (s->attr & COB_SCREEN_COLUMN_PLUS) {
1429  column = x + column;
1430  } else if (s->attr & COB_SCREEN_COLUMN_MINUS) {
1431  column = x - column;
1432  }
1433 
1434  cob_move_cursor (line, column);
1435  refresh ();
1436  cob_current_y = line;
1437  cob_current_x = column;
1438  }
1439 }
static int origin_x
Definition: screenio.c:109
static void cob_move_cursor(const int line, const int column)
Definition: screenio.c:317
cob_field * column
Definition: common.h:1035
#define COB_SCREEN_COLUMN_PLUS
Definition: common.h:897
#define COB_SCREEN_LINE_MINUS
Definition: common.h:896
static int cob_current_y
Definition: screenio.c:104
int cob_get_int(cob_field *)
Definition: move.c:1626
static int cob_current_x
Definition: screenio.c:105
#define COB_SCREEN_LINE_PLUS
Definition: common.h:895
if fold fold static computed alternate extra correct stack on syntax debugging line
Definition: flag.def:90
static int origin_y
Definition: screenio.c:108
cob_field * line
Definition: common.h:1034
#define COB_SCREEN_COLUMN_MINUS
Definition: common.h:898

Here is the call graph for this function:

Here is the caller graph for this function:

static void cob_screen_puts ( cob_screen s,
cob_field f,
const cob_u32_t  is_input,
const enum screen_statement  stmt 
)
static

Definition at line 800 of file screenio.c.

References __cob_screen::attr, __cob_screen::backg, cob_addch_no_trunc_check(), cob_addnstr(), COB_CH_AS, COB_CH_UL, cob_current_x, cob_current_y, cob_move_cursor(), cob_screen_attr(), COB_SCREEN_INPUT, COB_SCREEN_SECURE, cob_field::data, __cob_screen::foreg, get_screen_item_line_and_col(), line, __cob_screen::prompt, raise_ec_on_truncation(), and cob_field::size.

Referenced by cob_prep_input(), cob_screen_iterate(), and refresh_field().

802 {
803  unsigned char *p;
804  size_t size;
805  int line;
806  int column;
807  chtype promptchar;
808 
809  get_screen_item_line_and_col (s, &line, &column);
810 
811  /* Move to specified position */
812  cob_move_cursor (line, column);
814  cob_current_x = column;
815 #if 0 /* RXWRXW - Attr */
816  cob_screen_attr (s->foreg, s->backg, s->attr);
817 #endif
818  if (s->attr & COB_SCREEN_INPUT) {
819  cob_screen_attr (s->foreg, s->backg, s->attr, stmt);
820  if (s->prompt) {
821  promptchar = s->prompt->data[0];
822  } else {
823  promptchar = COB_CH_UL;
824  }
825  p = f->data;
827  for (size = 0; size < f->size; size++, p++) {
828  if (s->attr & COB_SCREEN_SECURE) {
830  } else if (*p <= ' ') {
831  cob_addch_no_trunc_check (promptchar);
832  } else {
833  cob_addch_no_trunc_check ((const chtype)*p);
834  }
835  }
836  } else if (!is_input) {
837  cob_screen_attr (s->foreg, s->backg, s->attr, stmt);
838  cob_addnstr ((char *)f->data, (int)f->size);
839  } else {
840  column += (int)f->size;
841  cob_move_cursor (line, column);
842  }
843  refresh ();
844 }
static void cob_move_cursor(const int line, const int column)
Definition: screenio.c:317
static void get_screen_item_line_and_col(cob_screen *s, int *const line, int *const col)
Definition: screenio.c:748
unsigned char * data
Definition: common.h:952
static int cob_current_y
Definition: screenio.c:104
cob_field * foreg
Definition: common.h:1036
static void cob_screen_attr(cob_field *fgc, cob_field *bgc, const int attr, const enum screen_statement stmt)
Definition: screenio.c:345
#define COB_CH_AS
Definition: screenio.c:88
cob_field * backg
Definition: common.h:1037
cob_field * prompt
Definition: common.h:1038
#define COB_CH_UL
Definition: screenio.c:86
static int cob_current_x
Definition: screenio.c:105
#define COB_SCREEN_SECURE
Definition: common.h:911
if fold fold static computed alternate extra correct stack on syntax debugging line
Definition: flag.def:90
size_t size
Definition: common.h:951
static void raise_ec_on_truncation(const int item_size)
Definition: screenio.c:623
static void cob_addch_no_trunc_check(const chtype c)
Definition: screenio.c:657
static void cob_addnstr(const char *data, const int size)
Definition: screenio.c:642
#define COB_SCREEN_INPUT
Definition: common.h:916

Here is the call graph for this function:

Here is the caller graph for this function:

void cob_screen_set_mode ( const cob_u32_t  smode)

Definition at line 2388 of file screenio.c.

Referenced by cob_sys_system().

2389 {
2390  if (!smode) {
2391  refresh ();
2392  def_prog_mode ();
2393  endwin ();
2394  } else {
2395  reset_prog_mode ();
2396  refresh ();
2397  }
2398 }

Here is the caller graph for this function:

static void cob_speaker_beep ( void  )
static

Definition at line 115 of file screenio.c.

Referenced by cob_beep(), and cob_sys_sound_bell().

116 {
117  int fd;
118 
119  fd = fileno (stdout);
120  if (fd >= 0) {
121  (void)write (fd, "\a", (size_t)1);
122  }
123 }

Here is the caller graph for this function:

int cob_sys_clear_screen ( void  )

Definition at line 2377 of file screenio.c.

References cob_current_x, cob_current_y, and init_cob_screen_if_needed().

Referenced by GCic_().

2378 {
2380  clear ();
2381  refresh ();
2382  cob_current_y = 0;
2383  cob_current_x = 0;
2384  return 0;
2385 }
static int cob_current_y
Definition: screenio.c:104
static int cob_current_x
Definition: screenio.c:105
static COB_INLINE COB_A_INLINE void init_cob_screen_if_needed(void)
Definition: screenio.c:1583

Here is the call graph for this function:

Here is the caller graph for this function:

int cob_sys_get_csr_pos ( unsigned char *  fld)

Definition at line 2530 of file screenio.c.

References COB_CHK_PARMS.

2531 {
2532 #ifdef COB_GEN_SCREENIO
2533  int cline;
2534  int ccol;
2535 #endif
2536 
2537  COB_CHK_PARMS (CBL_GET_CSR_POS, 1);
2538 
2539 #ifdef COB_GEN_SCREENIO
2540  getyx (stdscr, cline, ccol);
2541  fld[0] = (unsigned char)cline;
2542  fld[1] = (unsigned char)ccol;
2543 
2544 #else
2545  fld[0] = 1U;
2546  fld[1] = 1U;
2547 #endif
2548  return 0;
2549 }
#define COB_CHK_PARMS(x, z)
Definition: coblocal.h:167
int cob_sys_get_scr_size ( unsigned char *  line,
unsigned char *  col 
)

Definition at line 2552 of file screenio.c.

References COB_CHK_PARMS, COLS, and LINES.

2553 {
2554  COB_CHK_PARMS (CBL_GET_SCR_SIZE, 2);
2555 
2556 #ifdef COB_GEN_SCREENIO
2557  *line = (unsigned char)LINES;
2558  *col = (unsigned char)COLS;
2559 #else
2560  *line = 24U;
2561  *col = 80U;
2562 #endif
2563  return 0;
2564 }
#define COB_CHK_PARMS(x, z)
Definition: coblocal.h:167
Definition: parser.c:1409
Definition: parser.c:1598
if fold fold static computed alternate extra correct stack on syntax debugging line
Definition: flag.def:90
int cob_sys_sound_bell ( void  )

Definition at line 2506 of file screenio.c.

References cob_beep(), COB_BEEP_VALUE, cob_screen_init(), __cob_global::cob_screen_initialized, and cob_speaker_beep().

2507 {
2508  if (COB_BEEP_VALUE == 9) {
2509  return 0;
2510  }
2511 #ifdef COB_GEN_SCREENIO
2513  COB_BEEP_VALUE != 2) {
2514  cob_screen_init ();
2515  }
2516  cob_beep ();
2517 #else
2518  cob_speaker_beep ();
2519 #endif
2520  return 0;
2521 }
static void cob_screen_init(void)
Definition: screenio.c:490
static void cob_speaker_beep(void)
Definition: screenio.c:115
static void cob_beep(void)
Definition: screenio.c:128
unsigned int cob_screen_initialized
Definition: common.h:1208
#define COB_BEEP_VALUE
Definition: coblocal.h:192
static cob_global * cobglobptr
Definition: screenio.c:92

Here is the call graph for this function:

static int compare_yx ( const void *  m1,
const void *  m2 
)
static

Definition at line 1368 of file screenio.c.

References cob_inp_struct::this_x, and cob_inp_struct::this_y.

Referenced by screen_accept().

1369 {
1370  const struct cob_inp_struct *s1;
1371  const struct cob_inp_struct *s2;
1372 
1373  s1 = m1;
1374  s2 = m2;
1375  if (s1->this_y < s2->this_y) {
1376  return -1;
1377  }
1378  if (s1->this_y > s2->this_y) {
1379  return 1;
1380  }
1381  if (s1->this_x < s2->this_x) {
1382  return -1;
1383  }
1384  if (s1->this_x > s2->this_x) {
1385  return 1;
1386  }
1387  return 0;
1388 }

Here is the caller graph for this function:

static void extract_line_and_col_vals ( const int  is_screen,
cob_field line,
cob_field column,
int *  sline,
int *  scolumn 
)
static

Definition at line 1564 of file screenio.c.

References get_line_column(), NULL, pos_to_line_column(), and set_default_line_column().

Referenced by cob_field_accept(), cob_field_display(), cob_screen_accept(), and cob_screen_display().

1566 {
1567  if (column == NULL) {
1568  if (line == NULL) {
1569  set_default_line_column (is_screen, sline, scolumn);
1570  } else {
1571  /*
1572  line actually contains both the line and field
1573  numbers.
1574  */
1575  pos_to_line_column (line, sline, scolumn);
1576  }
1577  } else {
1578  get_line_column (line, column, sline, scolumn);
1579  }
1580 }
static void pos_to_line_column(cob_field *pos, int *line, int *column)
Definition: screenio.c:1540
static void get_line_column(cob_field *fline, cob_field *fcol, int *line, int *col)
Definition: screenio.c:273
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
static COB_INLINE COB_A_INLINE void set_default_line_column(const int is_screen, int *sline, int *scolumn)
Definition: screenio.c:1523

Here is the call graph for this function:

Here is the caller graph for this function:

static void field_accept ( cob_field f,
const int  sline,
const int  scolumn,
cob_field fgc,
cob_field bgc,
cob_field fscroll,
cob_field ftimeout,
cob_field prompt,
cob_field size_is,
const int  fattr 
)
static

Definition at line 1769 of file screenio.c.

References ACCEPT_STATEMENT, cob_field::attr, cob_addch(), cob_addch_no_trunc_check(), cob_addnch(), cob_beep(), COB_CH_AS, COB_CH_SP, COB_CH_UL, cob_check_pos_status(), cob_convert_key(), __cob_global::cob_exception_code, COB_FIELD_IS_NUMERIC, cob_field_is_numeric_or_numeric_edited(), cob_get_int(), __cob_settings::cob_insert_mode, COB_MEDIUM_MAX, cob_move(), cob_move_cursor(), cob_screen_attr(), COB_SCREEN_AUTO, COB_SCREEN_LOWER, COB_SCREEN_NO_ECHO, COB_SCREEN_PROMPT, COB_SCREEN_SCROLL_DOWN, COB_SCREEN_SECURE, COB_SCREEN_UPDATE, COB_SCREEN_UPPER, cob_set_int(), COB_TERM_BUFF, COB_TIMEOUT_SCALE, const_alpha_attr, cob_field::data, init_cob_screen_if_needed(), NULL, origin_x, origin_y, raise_ec_on_truncation(), cob_field::size, and unlikely.

Referenced by cob_field_accept().

1772 {
1773  unsigned char *p;
1774  unsigned char *p2;
1775  size_t count;
1776  int keyp;
1777  int fret;
1778  int cline;
1779  int ccolumn;
1780  int rightpos;
1781  int ateof;
1782  int move_char; /* data shift character */
1783  int prompt_char; /* prompt character */
1784  int gettimeout;
1785  chtype promptchar;
1786  int ssize_is = 0; /* WITH SIZE IS */
1787  int size_accept = 0; /* final size to accept */
1788  cob_field temp;
1789 #if 0 /* RXWRXW - Screen update */
1790  cob_field char_temp;
1791  unsigned char space_buff[4];
1792 #endif
1793 
1794  memset (COB_TERM_BUFF, ' ', (size_t)COB_MEDIUM_MAX);
1795  temp.data = COB_TERM_BUFF;
1796  temp.attr = &const_alpha_attr;
1797 #if 0 /* RXWRXW - Screen update */
1798  char_temp.data = space_buff;
1799  char_temp.attr = &const_alpha_attr;
1800  char_temp.size = 1;
1801  space_buff[0] = ' ';
1802  space_buff[1] = 0;
1803 #endif
1804 
1805  origin_y = 0;
1806  origin_x = 0;
1807 
1808  /* Set the default prompt character */
1809  if (prompt) {
1810  promptchar = prompt->data[0];
1811  } else {
1812  promptchar = COB_CH_UL;
1813  }
1815 
1816  if (ftimeout) {
1817  gettimeout = cob_get_int (ftimeout) * COB_TIMEOUT_SCALE;
1818  if (gettimeout >= 0 && gettimeout < 500) {
1819  gettimeout = 500;
1820  }
1821  } else {
1822  gettimeout = -1;
1823  }
1824 
1825  if (fscroll) {
1826  keyp = cob_get_int (fscroll);
1827  if (fattr & COB_SCREEN_SCROLL_DOWN) {
1828  keyp = -keyp;
1829  }
1830  scrollok (stdscr, 1);
1831  scrl (keyp);
1832  scrollok (stdscr, 0);
1833  refresh ();
1834  }
1836 
1837  cob_move_cursor (sline, scolumn);
1838 
1839  cob_screen_attr (fgc, bgc, fattr, ACCEPT_STATEMENT);
1840 
1841  if (f) {
1842  /* Field size to accept */
1843  size_accept = (int)f->size;
1844  /* WITH SIZE IS */
1845  if (size_is) {
1846  ssize_is = cob_get_int (size_is);
1847  /* Use WITH SIZE IS when less than field size */
1848  if (ssize_is > 0 && ssize_is < (int)f->size) {
1849  size_accept = ssize_is;
1850  }
1851  }
1852 
1853  p = COB_TERM_BUFF;
1854  temp.size = size_accept;
1855  if (fattr & COB_SCREEN_UPDATE) {
1856  cob_move (f, &temp);
1857  }
1858  /* SIZE IS greater than field, blank out trailing screen */
1859  if (ssize_is > (int)f->size) {
1860  cob_addnch (ssize_is, COB_CH_SP);
1861  cob_move_cursor (sline, scolumn);
1862  }
1863  raise_ec_on_truncation (size_accept);
1864  for (count = 0; count < size_accept; count++) {
1865  if (fattr & COB_SCREEN_SECURE) {
1867  } else if (fattr & COB_SCREEN_NO_ECHO) {
1869  } else if (fattr & COB_SCREEN_UPDATE) {
1870  fret = *p++;
1871  cob_addch_no_trunc_check ((const chtype)fret);
1872  } else if (COB_FIELD_IS_NUMERIC (f)) {
1874  } else if (fattr & COB_SCREEN_PROMPT) {
1875  cob_addch_no_trunc_check (promptchar);
1876  } else {
1878  }
1879  }
1880  cob_move_cursor (sline, scolumn);
1881 #if 0 /* RXWRXW - Screen update */
1882  if (!(fattr & COB_SCREEN_UPDATE)) {
1884  cob_set_int (f, 0);
1885  } else {
1886  cob_move (&char_temp, f);
1887  }
1888  }
1889 #endif
1890  rightpos = scolumn + size_accept - 1;
1891  p = COB_TERM_BUFF;
1892  } else {
1893  rightpos = 0;
1894  p = NULL;
1895  }
1896  fret = 0;
1897  ateof = 0;
1898  count = 0;
1899 
1900  /* Get characters from keyboard, processing each one. */
1901  for (; ;) {
1902  /* Get current line, column. */
1903  getyx (stdscr, cline, ccolumn);
1904  /* Trailing prompts. */
1905  if (fattr & COB_SCREEN_NO_ECHO) {
1906  prompt_char = COB_CH_SP;
1907  } else if (f && COB_FIELD_IS_NUMERIC (f)) {
1908  prompt_char = '0';
1909  } else if (fattr & COB_SCREEN_PROMPT) {
1910  prompt_char = promptchar;
1911  } else {
1912  prompt_char = COB_CH_SP;
1913  }
1914  for (count = rightpos; count > scolumn - 1; count--) {
1915  /* Get character */
1916  p2 = COB_TERM_BUFF + count - scolumn;
1917  move_char = *p2;
1918  /* Field prompts. */
1919  if (COB_FIELD_IS_NUMERIC (f)) {
1920  /* Numeric prompt zeros. */
1921  if (move_char == '0') {
1922  cob_move_cursor (cline, count);
1923  cob_addch (prompt_char);
1924  } else {
1925  /* Switch to remove prompts from within field. */
1926  if (fattr & COB_SCREEN_NO_ECHO) {
1927  prompt_char = COB_CH_SP;
1928  } else if (fattr & COB_SCREEN_SECURE) {
1929  prompt_char = COB_CH_AS;
1930  } else {
1931  prompt_char = '0';
1932  }
1933  }
1934  } else {
1935  /* Alpha prompts. */
1936  if (move_char == ' ') {
1937  cob_move_cursor (cline, count);
1938  cob_addch (prompt_char);
1939  } else {
1940  /* Switch to remove prompts from within field. */
1941  if (fattr & COB_SCREEN_NO_ECHO) {
1942  prompt_char = COB_CH_SP;
1943  } else if (fattr & COB_SCREEN_SECURE) {
1944  prompt_char = COB_CH_AS;
1945  } else {
1946  prompt_char = COB_CH_SP;
1947  }
1948  }
1949  }
1950  }
1951  /* Cursor to current column. */
1952  cob_move_cursor (cline, ccolumn);
1953  /* Refresh screen. */
1954  refresh ();
1955  errno = 0;
1956  timeout (gettimeout);
1957 
1958  /* Get a character. */
1959  keyp = getch ();
1960 
1961  /* Key error. */
1962  if (keyp == ERR) {
1963  fret = 8001;
1964  goto field_return;
1965  }
1966  /* Return function keys F1 through F64 */
1967  if (keyp > KEY_F0 && keyp < KEY_F(65)) {
1968  fret = 1000 + keyp - KEY_F0;
1969  goto field_return;
1970  }
1971 
1972  cob_convert_key (&keyp, 1U);
1973  if (keyp <= 0) {
1974  (void)flushinp ();
1975  cob_beep ();
1976  continue;
1977  }
1978 
1979  /* Return special keys */
1980  switch (keyp) {
1981  case KEY_ENTER:
1982  /* Enter. */
1983  goto field_return;
1984  case KEY_PPAGE:
1985  /* Page up. */
1986  fret = 2001;
1987  goto field_return;
1988  case KEY_NPAGE:
1989  /* Page down. */
1990  fret = 2002;
1991  goto field_return;
1992  case KEY_UP:
1993  /* Up arrow. */
1994  fret = 2003;
1995  goto field_return;
1996  case KEY_DOWN:
1997  /* Down arrow. */
1998  fret = 2004;
1999  goto field_return;
2000  case KEY_PRINT:
2001  /* Print key. */
2002  /* pdcurses not returning this ? */
2003  fret = 2006;
2004  goto field_return;
2005  case 033:
2006  /* Escape key. */
2007  fret = 2005;
2008  goto field_return;
2009  case KEY_STAB:
2010  /* Tab key. */
2011  fret = 2007;
2012  goto field_return;
2013  case KEY_BTAB:
2014  /* Shift-Tab key, Back tab. */
2015  fret = 2008;
2016  goto field_return;
2017  default:
2018  break;
2019  }
2020 
2021  /* extension: ACCEPT OMITTED */
2022  if (unlikely(!f)) {
2023  (void)flushinp ();
2024  cob_beep ();
2025  continue;
2026  }
2027 
2028  /* Positioning keys */
2029  switch (keyp) {
2030  case KEY_BACKSPACE:
2031  /* Backspace key. */
2032  if (ccolumn > scolumn) {
2033  /* Shift remainder left with cursor. */
2034  for (count = ccolumn; count < rightpos + 1; count++) {
2035  /* Get character. */
2036  p2 = COB_TERM_BUFF + count - scolumn ;
2037  move_char = *p2;
2038  /* Move the character left. */
2039  p2 = COB_TERM_BUFF + count - scolumn - 1;
2040  *p2 = move_char;
2041  /* Update screen with moved character. */
2042  cob_move_cursor (cline, count - 1);
2043  if (fattr & COB_SCREEN_NO_ECHO) {
2044  cob_addch (COB_CH_SP);
2045  } else if (fattr & COB_SCREEN_SECURE) {
2046  cob_addch (COB_CH_AS);
2047  } else {
2048  cob_addch (move_char);
2049  }
2050  }
2051  /* Put space as the right most character. */
2052  p2 = COB_TERM_BUFF + size_accept - 1;
2053  if (fattr & COB_SCREEN_NO_ECHO) {
2054  *p2 = COB_CH_SP;
2055  } else if (COB_FIELD_IS_NUMERIC (f)) {
2056  *p2 = '0';
2057  } else {
2058  *p2 = COB_CH_SP;
2059  }
2060  /* Move cursor left one from current. */
2061  ccolumn--;
2062  cob_move_cursor (cline, ccolumn);
2063  p--;
2064  }
2065  ateof = 0;
2066  continue;
2067  case KEY_HOME:
2068  /* Home key, cursor to start of characters. */
2069  /* Prepare for empty field. */
2070  ccolumn = rightpos;
2071  move_char = ' ';
2072  /* Find non-blank from left. */
2073  for (count = scolumn; count <= rightpos; count++) {
2074  /* Get character. */
2075  p2 = COB_TERM_BUFF + count - scolumn;
2076  move_char = *p2;
2077  /* Non blank stop. */
2078  if (move_char != ' ') {
2079  ccolumn = count;
2080  break;
2081  }
2082  }
2083  cob_move_cursor (cline, ccolumn);
2084  p = COB_TERM_BUFF + ccolumn - scolumn;
2085  ateof = 0;
2086  continue;
2087  case 01026:
2088  /* Alt-Home key, cursor to start of field. */
2089  cob_move_cursor (sline, scolumn);
2090  p = COB_TERM_BUFF;
2091  ateof = 0;
2092  continue;
2093  case KEY_END:
2094  /* End key, cursor to end of characters. */
2095  /* Prepare for empty field. */
2096  ccolumn = scolumn;
2097  move_char = ' ';
2098  /* Find non blank from right. */
2099  for (count = rightpos; count >= scolumn; count--) {
2100  /* Get character. */
2101  p2 = COB_TERM_BUFF + count - scolumn;
2102  move_char = *p2;
2103  /* Non blank stop. */
2104  if (move_char != ' ') {
2105  ccolumn = count;
2106  break;
2107  }
2108  }
2109  /* Cursor to first blank after. */
2110  if (move_char != ' ' && ccolumn != rightpos) {
2111  ccolumn++;
2112  }
2113  cob_move_cursor (cline, ccolumn);
2114  p = COB_TERM_BUFF + ccolumn - scolumn;
2115  ateof = 0;
2116  continue;
2117  case 01021:
2118  /* Alt-End key, cursor to end of size of field */
2119  cob_move_cursor (sline, rightpos);
2120  p = COB_TERM_BUFF + size_accept - 1;
2121  ateof = 0;
2122  continue;
2123  case KEY_LEFT:
2124  case KEY_CLOSE:
2125  /* Left-arrow KEY_LEFT auto-skip. */
2126  /* Alt-left-arrow KEY_CLOSE no auto-skip. */
2127  if (ccolumn > scolumn) {
2128  ccolumn--;
2129  cob_move_cursor (cline, ccolumn);
2130  p = COB_TERM_BUFF + ccolumn - scolumn;
2131  continue;
2132  }
2133  /* End of field, auto-skip, return left-arrow. */
2134  if (fattr & COB_SCREEN_AUTO && keyp == KEY_LEFT) {
2135  fret = 2009;
2136  goto field_return;
2137  }
2138  cob_beep ();
2139  continue;
2140  case KEY_RIGHT:
2141  case KEY_PREVIOUS:
2142  /* Right-arrow KEY_RIGHT auto-skip. */
2143  /* Alt-right-arrow KEY_PREVIOUS no auto-skip. */
2144  if (ccolumn < rightpos) {
2145  ccolumn++;
2146  cob_move_cursor (cline, ccolumn);
2147  p = COB_TERM_BUFF + ccolumn - scolumn;
2148  continue;
2149  }
2150  /* End of field, auto-skip, return right-arrow. */
2151  if (fattr & COB_SCREEN_AUTO && keyp == KEY_RIGHT) {
2152  fret = 2010;
2153  goto field_return;
2154  }
2155  cob_beep ();
2156  continue;
2157  case KEY_IC:
2158  /* Insert key toggle. */
2159  /* If off turn on, if on turn off. */
2160  if (cobsetptr->cob_insert_mode == 0) {
2161  cobsetptr->cob_insert_mode = 1; /* on */
2162  /* to do, needs vertical bar cursor */
2163  /* this doesn't seem to work */
2164  count = curs_set(1);
2165  } else {
2166  cobsetptr->cob_insert_mode = 0; /* off */
2167  /* to do, needs square cursor */
2168  /* this doesn't seem to work */
2169  count = curs_set(2);
2170  }
2171  continue;
2172  case KEY_DC:
2173  /* Delete key. */
2174  /* Delete character, move remainder left. */
2175  for (count = ccolumn; count < rightpos; count++) {
2176  /* Get character one position to right. */
2177  p2 = COB_TERM_BUFF + count - scolumn + 1;
2178  move_char = *p2;
2179  /* Move the character left. */
2180  p2 = COB_TERM_BUFF + count - scolumn;
2181  *p2 = move_char;
2182  /* Update screen with moved character. */
2183  cob_move_cursor (cline, count);
2184  if (fattr & COB_SCREEN_NO_ECHO) {
2185  cob_addch (COB_CH_SP);
2186  } else if (fattr & COB_SCREEN_SECURE) {
2187  cob_addch (COB_CH_AS);
2188  } else {
2189  cob_addch (move_char);
2190  }
2191  }
2192  /* Put space as the right most character. */
2193  p2 = COB_TERM_BUFF + size_accept - 1;
2194  if (fattr & COB_SCREEN_NO_ECHO) {
2195  *p2 = COB_CH_SP;
2196  } else if (COB_FIELD_IS_NUMERIC (f)) {
2197  *p2 = '0';
2198  } else {
2199  *p2 = COB_CH_SP;
2200  }
2201  /* Put cursor back to original position. */
2202  cob_move_cursor (cline, ccolumn);
2203  continue;
2204  case KEY_EOL:
2205  /* Alt-Delete key, erase cursor to end of field. */
2206  for (count = ccolumn; count <= rightpos; count++) {
2207  /* Character position. */
2208  p2 = COB_TERM_BUFF + count - scolumn;
2209  /* Blank character. */
2210  if (fattr & COB_FIELD_IS_NUMERIC (f)) {
2211  move_char = '0';
2212  } else {
2213  move_char = COB_CH_SP;
2214  }
2215  *p2 = move_char;
2216  /* Update screen with blank character. */
2217  cob_move_cursor (cline, count);
2218  if (fattr & COB_SCREEN_NO_ECHO) {
2219  cob_addch (COB_CH_SP);
2220  } else if (fattr & COB_SCREEN_SECURE) {
2221  cob_addch (COB_CH_AS);
2222  } else {
2223  cob_addch (move_char);
2224  }
2225  }
2226  /* Put cursor back to original position. */
2227  cob_move_cursor (cline, ccolumn);
2228  continue;
2229  default:
2230  break;
2231  }
2232 
2233  /* Printable character. */
2234  if (keyp > '\037' && keyp < (int)A_CHARTEXT) {
2235  /* Numeric field check. */
2237  if (keyp < '0' || keyp > '9') {
2238  cob_beep ();
2239  continue;
2240  }
2241  }
2242  if (fattr & COB_SCREEN_UPPER) {
2243  if (islower (keyp)) {
2244  keyp = toupper (keyp);
2245  }
2246  } else if (fattr & COB_SCREEN_LOWER) {
2247  if (isupper (keyp)) {
2248  keyp = tolower (keyp);
2249  }
2250  }
2251  /* Insert character. */
2252  if (cobsetptr->cob_insert_mode == 1) {
2253  /* Move remainder to the right. */
2254  for (count = rightpos; count > ccolumn - 1; count--) {
2255  /* Get character */
2256  p2 = COB_TERM_BUFF + count - scolumn - 1;
2257  move_char = *p2;
2258  /* Move character one right. */
2259  p2 = COB_TERM_BUFF + count - scolumn;
2260  *p2 = move_char;
2261  /* Update screen with moved character. */
2262  if (count > scolumn) {
2263  cob_move_cursor (cline, count);
2264  if (move_char != ' ') {
2265  if (fattr & COB_SCREEN_NO_ECHO) {
2266  cob_addch (COB_CH_SP);
2267  } else if (fattr & COB_SCREEN_SECURE) {
2268  cob_addch (COB_CH_AS);
2269  } else {
2270  cob_addch (move_char);
2271  }
2272  }
2273  }
2274  }
2275  cob_move_cursor (cline, ccolumn);
2276  }
2277  *p = (unsigned char)keyp;
2278  count = 1;
2279  /* Display character or '*' if secure. */
2280  if (fattr & COB_SCREEN_SECURE) {
2281  cob_addch (COB_CH_AS);
2282  } else if (fattr & COB_SCREEN_NO_ECHO) {
2283  cob_addch (COB_CH_SP);
2284  } else {
2285  cob_addch ((const chtype)keyp);
2286  }
2287  if (ccolumn == rightpos) {
2288  /* Auto-skip at end of field. */
2289  if (fattr & COB_SCREEN_AUTO) {
2290  break;
2291  }
2292  cob_move_cursor (cline, ccolumn);
2293  if (ateof) {
2294  cob_beep ();
2295  } else {
2296  ateof = 1;
2297  }
2298  } else {
2299  p++;
2300  }
2301  continue;
2302  }
2303  (void)flushinp ();
2304  cob_beep ();
2305  }
2306 field_return:
2307  if (f) {
2308  cob_move_cursor (sline, rightpos + 1);
2309  }
2310  refresh ();
2311  cob_check_pos_status (fret);
2312  if (!f) {
2313  return;
2314  }
2315  cob_move (&temp, f);
2316 }
#define COB_SCREEN_SCROLL_DOWN
Definition: common.h:917
static COB_INLINE COB_A_INLINE int cob_field_is_numeric_or_numeric_edited(cob_field *field)
Definition: screenio.c:847
int cob_insert_mode
Definition: coblocal.h:249
#define COB_TERM_BUFF
Definition: coblocal.h:186
static int origin_x
Definition: screenio.c:109
#define COB_FIELD_IS_NUMERIC(f)
Definition: common.h:674
void cob_move(cob_field *, cob_field *)
Definition: move.c:1170
static void cob_move_cursor(const int line, const int column)
Definition: screenio.c:317
#define COB_SCREEN_NO_ECHO
Definition: common.h:919
static void cob_check_pos_status(const int fret)
Definition: screenio.c:578
static void cob_addch(const chtype c)
Definition: screenio.c:649
unsigned char * data
Definition: common.h:952
static void cob_beep(void)
Definition: screenio.c:128
int cob_get_int(cob_field *)
Definition: move.c:1626
#define COB_TIMEOUT_SCALE
Definition: coblocal.h:193
static void cob_screen_attr(cob_field *fgc, cob_field *bgc, const int attr, const enum screen_statement stmt)
Definition: screenio.c:345
#define unlikely(x)
Definition: common.h:437
#define COB_CH_AS
Definition: screenio.c:88
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
#define COB_CH_UL
Definition: screenio.c:86
#define COB_SCREEN_LOWER
Definition: common.h:924
void cob_set_int(cob_field *, const int)
Definition: move.c:1612
#define COB_SCREEN_SECURE
Definition: common.h:911
#define COB_SCREEN_PROMPT
Definition: common.h:914
static const cob_field_attr const_alpha_attr
Definition: screenio.c:98
static cob_settings * cobsetptr
Definition: screenio.c:93
size_t size
Definition: common.h:951
static void raise_ec_on_truncation(const int item_size)
Definition: screenio.c:623
static int origin_y
Definition: screenio.c:108
static void cob_addch_no_trunc_check(const chtype c)
Definition: screenio.c:657
const cob_field_attr * attr
Definition: common.h:953
#define COB_SCREEN_UPDATE
Definition: common.h:915
static void cob_convert_key(int *keyp, const cob_u32_t field_accept)
Definition: screenio.c:146
int cob_exception_code
Definition: common.h:1203
#define COB_SCREEN_AUTO
Definition: common.h:899
static cob_global * cobglobptr
Definition: screenio.c:92
#define COB_CH_SP
Definition: screenio.c:87
static COB_INLINE COB_A_INLINE void init_cob_screen_if_needed(void)
Definition: screenio.c:1583
#define COB_SCREEN_UPPER
Definition: common.h:923
#define COB_MEDIUM_MAX
Definition: common.h:549
static void cob_addnch(const int n, const chtype c)
Definition: screenio.c:663

Here is the call graph for this function:

Here is the caller graph for this function:

static void field_display ( cob_field f,
const int  line,
const int  column,
cob_field fgc,
cob_field bgc,
cob_field fscroll,
cob_field size_is,
const int  fattr 
)
static

Definition at line 1700 of file screenio.c.

References cob_field::attr, cob_addnch(), COB_CH_SP, cob_fatal_error(), COB_FERROR_CODEGEN, cob_get_int(), cob_move_cursor(), cob_screen_attr(), COB_SCREEN_EMULATE_NL, COB_SCREEN_NO_DISP, COB_SCREEN_SCROLL_DOWN, COB_TYPE_ALPHANUMERIC_ALL, cob_field::data, DISPLAY_STATEMENT, init_cob_screen_if_needed(), line, LINES, origin_x, origin_y, cob_field::size, cob_field_attr::type, and unlikely.

Referenced by cob_field_display().

1703 {
1704  int sline;
1705  int scolumn;
1706  int ssize_is = 0; /* WITH SIZE IS */
1707  int size_display; /* final size to display */
1708  char fig_const; /* figurative constant character */
1709 
1710  if (unlikely(!f)) {
1712  }
1713 
1715 
1716  origin_y = 0;
1717  origin_x = 0;
1718 
1719  /* Field size to display */
1720  size_display = (int)f->size;
1721  /* WITH SIZE IS */
1722  if (size_is) {
1723  ssize_is = cob_get_int (size_is);
1724  /* Use WITH SIZE IS when less than field size */
1725  if (ssize_is > 0 && ssize_is < (int)f->size) {
1726  size_display = ssize_is;
1727  }
1728  }
1729 
1730  if (fscroll) {
1731  sline = cob_get_int (fscroll);
1732  if (fattr & COB_SCREEN_SCROLL_DOWN) {
1733  sline = -sline;
1734  }
1735  scrollok (stdscr, 1);
1736  scrl (sline);
1737  scrollok (stdscr, 0);
1738  refresh ();
1739  }
1740 
1741  sline = line;
1742  scolumn = column;
1743  cob_move_cursor (sline, scolumn);
1744 
1745  cob_screen_attr (fgc, bgc, fattr, DISPLAY_STATEMENT);
1746  if (!(fattr & COB_SCREEN_NO_DISP)) {
1747  /* figurative constant and WITH SIZE repeats the character */
1748  if ((size_is)
1750  && (int)f->size == 1) {
1751  fig_const = f->data[0];
1752  cob_addnch (ssize_is, fig_const);
1753  } else {
1754  addnstr ((char *)f->data, size_display);
1755  /* WITH SIZE larger than field displays trailing spaces */
1756  cob_addnch (ssize_is - f->size, COB_CH_SP);
1757  }
1758  }
1759  if (fattr & COB_SCREEN_EMULATE_NL) {
1760  if (++sline >= LINES) {
1761  sline = 0;
1762  }
1763  cob_move_cursor (sline, 0);
1764  }
1765  refresh ();
1766 }
#define COB_SCREEN_SCROLL_DOWN
Definition: common.h:917
#define COB_FERROR_CODEGEN
Definition: common.h:693
static int origin_x
Definition: screenio.c:109
static void cob_move_cursor(const int line, const int column)
Definition: screenio.c:317
unsigned char * data
Definition: common.h:952
int cob_get_int(cob_field *)
Definition: move.c:1626
void cob_fatal_error(const int fatal_error)
Definition: common.c:1601
#define COB_SCREEN_EMULATE_NL
Definition: common.h:922
static void cob_screen_attr(cob_field *fgc, cob_field *bgc, const int attr, const enum screen_statement stmt)
Definition: screenio.c:345
#define unlikely(x)
Definition: common.h:437
Definition: parser.c:1598
#define COB_TYPE_ALPHANUMERIC_ALL
Definition: common.h:622
if fold fold static computed alternate extra correct stack on syntax debugging line
Definition: flag.def:90
size_t size
Definition: common.h:951
static int origin_y
Definition: screenio.c:108
#define COB_SCREEN_NO_DISP
Definition: common.h:921
const cob_field_attr * attr
Definition: common.h:953
unsigned short type
Definition: common.h:941
#define COB_CH_SP
Definition: screenio.c:87
static COB_INLINE COB_A_INLINE void init_cob_screen_if_needed(void)
Definition: screenio.c:1583
static void cob_addnch(const int n, const chtype c)
Definition: screenio.c:663

Here is the call graph for this function:

Here is the caller graph for this function:

static int field_is_empty ( cob_screen s)
static

Definition at line 854 of file screenio.c.

References cob_field::data, __cob_screen::field, and cob_field::size.

Referenced by satisfied_full_clause(), and satisfied_required_clause().

855 {
856  unsigned char *data = s->field->data;
857  size_t size = s->field->size;
858  size_t i;
859 
860  for (i = 0; i < size; ++i) {
861  if (!isspace (data[i])) {
862  return 0;
863  }
864  }
865 
866  return 1;
867 }
unsigned char * data
Definition: common.h:952
cob_field * field
Definition: common.h:1032
size_t size
Definition: common.h:951

Here is the caller graph for this function:

static int field_is_full ( cob_screen s)
static

Definition at line 962 of file screenio.c.

References cob_field::data, __cob_screen::field, and cob_field::size.

Referenced by satisfied_full_clause().

963 {
964  unsigned char *data = s->field->data;
965  size_t size = s->field->size;
966 
967  /* Per the standard, only the first and last chars need be non-space. */
968  return !isspace (*data) && !isspace (*(data + size - 1));
969 }
unsigned char * data
Definition: common.h:952
cob_field * field
Definition: common.h:1032
size_t size
Definition: common.h:951

Here is the caller graph for this function:

static int field_is_zero ( cob_screen s)
static

Definition at line 870 of file screenio.c.

References COB_MODULE_PTR, cob_field::data, __cob_screen::field, and cob_field::size.

Referenced by field_is_zero_or_no_zero_suppression(), satisfied_full_clause(), and satisfied_required_clause().

871 {
872  unsigned char *data = s->field->data;
873  size_t size = s->field->size;
874  size_t i;
875  unsigned char decimal_point = COB_MODULE_PTR->decimal_point;
876 
877  for (i = 0; i < size; ++i) {
878  if (!(isspace (data[i]) || data[i] == '0'
879  || data[i] == decimal_point)) {
880  return 0;
881  }
882  }
883 
884  return 1;
885 }
unsigned char * data
Definition: common.h:952
cob_field * field
Definition: common.h:1032
#define COB_MODULE_PTR
Definition: coblocal.h:185
size_t size
Definition: common.h:951

Here is the caller graph for this function:

static int field_is_zero_or_no_zero_suppression ( cob_screen s)
static

Definition at line 928 of file screenio.c.

References COB_FIELD_DATA, COB_FIELD_PIC, COB_FIELD_SIZE, __cob_screen::field, field_is_zero(), get_num_int_digits_for_no_zero_sup(), and pic_has_zero_suppression().

Referenced by satisfied_full_clause().

929 {
930  const char *pic = COB_FIELD_PIC (s->field);
931  int i;
932  size_t size = COB_FIELD_SIZE (s->field);
933  unsigned char *data = COB_FIELD_DATA (s->field);
934  int num_integer_digits;
935  int num_digits_seen = 0;
936 
937  if (field_is_zero (s) || !pic_has_zero_suppression (pic)) {
938  return 1;
939  }
940 
941  num_integer_digits = get_num_int_digits_for_no_zero_sup (pic);
942 
943  /*
944  Verify there are sufficient non-zero digits before a decimal
945  point/the end to fill the integer part of the field.
946  */
947  for (i = 0; i < size; ++i) {
948  if (isdigit (data[i])) {
949  if (data[i] != '0' || num_digits_seen != 0) {
950  ++num_digits_seen;
951  }
952  } else if (!isspace (data[i]) && num_digits_seen != 0) {
953  break;
954  }
955  }
956 
957  return num_digits_seen >= num_integer_digits;
958 }
#define COB_FIELD_DATA(f)
Definition: common.h:668
static int pic_has_zero_suppression(const char *pic)
Definition: screenio.c:888
static int field_is_zero(cob_screen *s)
Definition: screenio.c:870
cob_field * field
Definition: common.h:1032
#define COB_FIELD_PIC(f)
Definition: common.h:666
static int get_num_int_digits_for_no_zero_sup(const char *pic)
Definition: screenio.c:906
#define COB_FIELD_SIZE(f)
Definition: common.h:671

Here is the call graph for this function:

Here is the caller graph for this function:

static int finalize_all_fields ( struct cob_inp_struct sptr,
const size_t  total_idx 
)
static

Definition at line 1071 of file screenio.c.

References finalize_field_input(), and cob_inp_struct::scr.

Referenced by cob_screen_get_all().

1072 {
1073  const struct cob_inp_struct *end = sptr + total_idx;
1074 
1075  for (; sptr < end; ++sptr) {
1076  if (finalize_field_input (sptr->scr)) {
1077  return 1;
1078  }
1079  }
1080 
1081  return 0;
1082 }
static int finalize_field_input(cob_screen *s)
Definition: screenio.c:1053
cob_screen * scr
Definition: screenio.c:75

Here is the call graph for this function:

Here is the caller graph for this function:

static int finalize_field_input ( cob_screen s)
static

Definition at line 1053 of file screenio.c.

References cob_field_is_numeric_or_numeric_edited(), __cob_screen::field, format_field(), satisfied_full_clause(), satisfied_required_clause(), and valid_field_data().

Referenced by cob_screen_get_all(), and finalize_all_fields().

1054 {
1055  /* Only numeric types need to be validated and formatted. */
1057  if (!valid_field_data (s->field)) {
1058  return 1;
1059  }
1060  format_field (s);
1061  }
1062 
1064  return 1;
1065  }
1066 
1067  return 0;
1068 }
static COB_INLINE COB_A_INLINE int cob_field_is_numeric_or_numeric_edited(cob_field *field)
Definition: screenio.c:847
static int satisfied_full_clause(cob_screen *s)
Definition: screenio.c:972
static int satisfied_required_clause(cob_screen *s)
Definition: screenio.c:988
static void format_field(cob_screen *s)
Definition: screenio.c:1025
static int valid_field_data(cob_field *field)
Definition: screenio.c:1002
cob_field * field
Definition: common.h:1032

Here is the call graph for this function:

Here is the caller graph for this function:

static void format_field ( cob_screen s)
static

Definition at line 1025 of file screenio.c.

References cob_field::attr, COB_FIELD_INIT, COB_FIELD_IS_NUMERIC, cob_free(), cob_intr_numval(), cob_intr_numval_c(), cob_malloc(), cob_move(), COB_TYPE_NUMERIC_EDITED, cob_field::data, __cob_screen::field, NULL, refresh_field(), cob_field::size, and cob_field_attr::type.

Referenced by cob_intr_formatted_time(), and finalize_field_input().

1026 {
1027  cob_field field;
1028  size_t size = s->field->size;
1029  unsigned char *data;
1030 
1031  /*
1032  We copy the data into another field and move it back to format the
1033  numeric data neatly, rather than re-implement that logic here. We
1034  assume the data is valid.
1035  */
1036  data = cob_malloc (size);
1037  memcpy (data, s->field->data, size);
1038  COB_FIELD_INIT (size, data, s->field->attr);
1039 
1040  if (COB_FIELD_IS_NUMERIC (s->field)) {
1041  cob_move (cob_intr_numval (&field), s->field);
1042  } else if (field.attr->type == COB_TYPE_NUMERIC_EDITED) {
1043  cob_move (cob_intr_numval_c (&field, NULL), s->field);
1044  }
1045 
1046  cob_free (data);
1047 
1048  refresh_field (s);
1049 }
void cob_free(void *mptr)
Definition: common.c:1284
#define COB_FIELD_IS_NUMERIC(f)
Definition: common.h:674
void cob_move(cob_field *, cob_field *)
Definition: move.c:1170
unsigned char * data
Definition: common.h:952
#define COB_FIELD_INIT(x, y, z)
Definition: coblocal.h:144
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
cob_field * field
Definition: common.h:1032
cob_field * cob_intr_numval(cob_field *)
Definition: intrinsic.c:4584
size_t size
Definition: common.h:951
const cob_field_attr * attr
Definition: common.h:953
void * cob_malloc(const size_t size)
Definition: common.c:1250
cob_field * cob_intr_numval_c(cob_field *, cob_field *)
Definition: intrinsic.c:4590
unsigned short type
Definition: common.h:941
static void refresh_field(cob_screen *s)
Definition: screenio.c:1014
#define COB_TYPE_NUMERIC_EDITED
Definition: common.h:619

Here is the call graph for this function:

Here is the caller graph for this function:

static cob_screen* get_last_child ( cob_screen *const  s)
static

Definition at line 687 of file screenio.c.

References __cob_screen::child, and __cob_screen::next.

Referenced by get_prev_screen_item().

688 {
689  cob_screen *child;
690 
691  for (child = s->child; child->next; child = child->next);
692 
693  if (child->child) {
694  return get_last_child (child);
695  } else {
696  return child;
697  }
698 }
static cob_screen * get_last_child(cob_screen *const s)
Definition: screenio.c:687
struct __cob_screen * next
Definition: common.h:1028
struct __cob_screen * child
Definition: common.h:1030

Here is the caller graph for this function:

static void get_line_column ( cob_field fline,
cob_field fcol,
int *  line,
int *  col 
)
static

Definition at line 273 of file screenio.c.

References cob_get_int(), and NULL.

Referenced by extract_line_and_col_vals().

274 {
275  int line_val;
276  int col_val;
277 
278  if (fline == NULL) {
279  *line = 0;
280  } else {
281  line_val = cob_get_int (fline) - 1;
282  if (line_val < 0) {
283  line_val = 0;
284  }
285 
286  *line = line_val;
287  }
288 
289  if (fcol == NULL) {
290  *col = 0;
291  } else {
292  col_val = cob_get_int (fcol) - 1;
293  if (col_val < 0) {
294  col_val = 0;
295  }
296 
297  *col = col_val;
298  }
299 }
int cob_get_int(cob_field *)
Definition: move.c:1626
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
if fold fold static computed alternate extra correct stack on syntax debugging line
Definition: flag.def:90

Here is the call graph for this function:

Here is the caller graph for this function:

static int get_num_int_digits_for_no_zero_sup ( const char *  pic)
static

Definition at line 906 of file screenio.c.

References COB_MODULE_PTR.

Referenced by field_is_zero_or_no_zero_suppression().

907 {
908  int i;
909  int *times_repeated;
910  int num_digits = 0;
911  char numeric_separator = COB_MODULE_PTR->numeric_separator;
912 
913  for (i = 0; pic[i] != '\0'; i += 5) {
914  if (pic[i] == '9' || pic[i] == 'Z' || pic[i] == '*') {
915  times_repeated = (int *) (pic + i + 1);
916  num_digits += *times_repeated;
917  } else if (!(pic[i] == numeric_separator
918  || pic[i] == 'B' || pic[i] == '0' || pic[i] == '/')
919  && num_digits != 0) {
920  break;
921  }
922  }
923 
924  return num_digits;
925 }
#define COB_MODULE_PTR
Definition: coblocal.h:185

Here is the caller graph for this function:

static cob_screen* get_prev_screen_item ( cob_screen *const  s)
static

Definition at line 701 of file screenio.c.

References __cob_screen::child, get_last_child(), NULL, __cob_screen::parent, and __cob_screen::prev.

Referenced by get_screen_item_line_and_col().

702 {
703  if (s->prev) {
704  if (s->prev->child) {
705  return get_last_child (s->prev);
706  } else {
707  return s->prev;
708  }
709  } else if (s->parent) {
710  return s->parent;
711  } else {
712  return NULL;
713  }
714 }
static cob_screen * get_last_child(cob_screen *const s)
Definition: screenio.c:687
struct __cob_screen * prev
Definition: common.h:1029
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
struct __cob_screen * child
Definition: common.h:1030
struct __cob_screen * parent
Definition: common.h:1031

Here is the call graph for this function:

Here is the caller graph for this function:

static void get_screen_item_line_and_col ( cob_screen s,
int *const  line,
int *const  col 
)
static

Definition at line 748 of file screenio.c.

References __cob_screen::child, __cob_screen::column, get_prev_screen_item(), get_size(), is_first_screen_item(), __cob_screen::line, origin_x, origin_y, update_column(), and update_line().

Referenced by cob_screen_puts().

750 {
751  int found_line = 0;
752  int found_col = 0;
753  int is_screen_to_display = 1;
754  int is_parent;
755 
756  *line = 0;
757  *col = 0;
758 
759  for (; s; s = get_prev_screen_item (s)) {
760  if (s->line) {
761  if (!found_line) {
762  update_line (s, line, &found_line);
763  }
764 
765  if (!s->column) {
766  found_col = 1;
767  }
768  }
769 
770  if (!found_col) {
771  is_parent = !!s->child;
772 
773  if (!is_screen_to_display && !is_parent) {
774  *col += get_size (s) - 1;
775  }
776 
777  if (s->column) {
778  update_column (s, col, &found_col);
779  }
780 
781  if (!s->column && !is_parent && !is_first_screen_item (s)) {
782  /*
783  Note that parents are excluded; the standard
784  assumes COL + 1, unless otherwise specified,
785  on all screen items. This seems silly on group
786  items, hence why this non-standard extension.
787  */
788  ++(*col);
789  }
790  }
791 
792  is_screen_to_display = 0;
793  }
794 
795  *line += origin_y;
796  *col += origin_x;
797 }
static size_t get_size(cob_screen *s)
Definition: screenio.c:738
static int origin_x
Definition: screenio.c:109
cob_field * column
Definition: common.h:1035
static cob_screen * get_prev_screen_item(cob_screen *const s)
Definition: screenio.c:701
struct __cob_screen * child
Definition: common.h:1030
static void update_line(cob_screen *s, int *const count, int *const found_clause)
Definition: screenio.c:732
if fold fold static computed alternate extra correct stack on syntax debugging line
Definition: flag.def:90
static int origin_y
Definition: screenio.c:108
cob_field * line
Definition: common.h:1034
static void update_column(cob_screen *s, int *const count, int *const found_clause)
Definition: screenio.c:733
static int is_first_screen_item(cob_screen *s)
Definition: screenio.c:674

Here is the call graph for this function:

Here is the caller graph for this function:

static size_t get_size ( cob_screen s)
static

Definition at line 738 of file screenio.c.

References __cob_screen::field, cob_field::size, and __cob_screen::value.

Referenced by get_screen_item_line_and_col().

739 {
740  if (s->field) {
741  return s->field->size;
742  } else { /* s->value */
743  return s->value->size;
744  }
745 
746 }
cob_field * value
Definition: common.h:1033
cob_field * field
Definition: common.h:1032
size_t size
Definition: common.h:951

Here is the caller graph for this function:

static COB_INLINE COB_A_INLINE void init_cob_screen_if_needed ( void  )
static

Definition at line 1583 of file screenio.c.

References cob_screen_init(), and __cob_global::cob_screen_initialized.

Referenced by cob_screen_line_col(), cob_sys_clear_screen(), field_accept(), field_display(), screen_accept(), and screen_display().

1584 {
1586  cob_screen_init ();
1587  }
1588 }
static void cob_screen_init(void)
Definition: screenio.c:490
unsigned int cob_screen_initialized
Definition: common.h:1208
static cob_global * cobglobptr
Definition: screenio.c:92

Here is the call graph for this function:

Here is the caller graph for this function:

static int is_first_screen_item ( cob_screen s)
static

Definition at line 674 of file screenio.c.

References __cob_screen::parent, and __cob_screen::prev.

Referenced by get_screen_item_line_and_col().

675 {
676  do {
677  if (s->prev) {
678  return 0;
679  }
680  s = s->parent;
681  } while (s);
682 
683  return 1;
684 }
struct __cob_screen * prev
Definition: common.h:1029
struct __cob_screen * parent
Definition: common.h:1031

Here is the caller graph for this function:

static int pic_has_zero_suppression ( const char *  pic)
static

Definition at line 888 of file screenio.c.

Referenced by field_is_zero_or_no_zero_suppression().

889 {
890  int i;
891 
892  for (i = 0; pic[i] != '\0'; i += 5) {
893  /*
894  NB: + and - are floating-insertion editing characters, not
895  zero-suppression ones.
896  */
897  if (pic[i] == 'Z' || pic[i] == '*') {
898  return 1;
899  }
900  }
901 
902  return 0;
903 }

Here is the caller graph for this function:

static void pos_to_line_column ( cob_field pos,
int *  line,
int *  column 
)
static

Definition at line 1540 of file screenio.c.

References cob_get_int(), and cob_field::size.

Referenced by extract_line_and_col_vals().

1541 {
1542  int pos_val = cob_get_int (pos);
1543  int max_line_column;
1544 
1545  if (pos->size < 4) {
1546  *line = pos_val - 1;
1547  *column = 0;
1548  return;
1549  }
1550 
1551  if (pos->size == 4) {
1552  max_line_column = 100;
1553  } else if (pos->size == 6) {
1554  max_line_column = 1000;
1555  } else {
1556  /* Throw an exception? EC-SCREEN-IMP-LINE-VAR-LENGTH? */
1557  max_line_column = 1; /* set to some value that don't chrash */
1558  }
1559  *line = (pos_val / max_line_column) - 1;
1560  *column = (pos_val % max_line_column) - 1;
1561 }
int cob_get_int(cob_field *)
Definition: move.c:1626
if fold fold static computed alternate extra correct stack on syntax debugging line
Definition: flag.def:90
size_t size
Definition: common.h:951

Here is the call graph for this function:

Here is the caller graph for this function:

static void raise_ec_on_invalid_line_or_col ( const int  line,
const int  column 
)
static

Definition at line 302 of file screenio.c.

References COB_EC_SCREEN_LINE_NUMBER, COB_EC_SCREEN_STARTING_COLUMN, and cob_set_exception().

Referenced by cob_move_cursor().

303 {
304  int max_y;
305  int max_x;
306 
307  getmaxyx (stdscr, max_y, max_x);
308  if (line < 0 || line >= max_y) {
310  }
311  if (column < 0 || column >= max_x) {
313  }
314 }
void cob_set_exception(const int id)
Definition: common.c:1212

Here is the call graph for this function:

Here is the caller graph for this function:

static void raise_ec_on_truncation ( const int  item_size)
static

Definition at line 623 of file screenio.c.

References COB_EC_SCREEN_ITEM_TRUNCATED, cob_set_exception(), and COB_UNUSED.

Referenced by cob_addch(), cob_addnch(), cob_addnstr(), cob_screen_puts(), and field_accept().

624 {
625  int y;
626  int x;
627  int max_y;
628  int max_x;
629 
630  COB_UNUSED (y);
631  COB_UNUSED (max_y);
632 
633  getyx (stdscr, y, x);
634  getmaxyx (stdscr, max_y, max_x);
635 
636  if (x + item_size - 1 > max_x) {
638  }
639 }
void cob_set_exception(const int id)
Definition: common.c:1212
#define COB_UNUSED(z)
Definition: common.h:535

Here is the call graph for this function:

Here is the caller graph for this function:

static void refresh_field ( cob_screen s)
static

Definition at line 1014 of file screenio.c.

References ACCEPT_STATEMENT, __cob_settings::cob_legacy, cob_move_cursor(), cob_screen_puts(), and __cob_screen::field.

Referenced by format_field().

1015 {
1016  int y;
1017  int x;
1018 
1019  getyx (stdscr, y, x);
1021  cob_move_cursor (y, x);
1022 }
unsigned int cob_legacy
Definition: coblocal.h:243
static void cob_move_cursor(const int line, const int column)
Definition: screenio.c:317
static void cob_screen_puts(cob_screen *s, cob_field *f, const cob_u32_t is_input, const enum screen_statement stmt)
Definition: screenio.c:800
cob_field * field
Definition: common.h:1032
static cob_settings * cobsetptr
Definition: screenio.c:93

Here is the call graph for this function:

Here is the caller graph for this function:

static int satisfied_full_clause ( cob_screen s)
static

Definition at line 972 of file screenio.c.

References __cob_screen::attr, COB_FIELD_IS_NUMERIC, COB_FIELD_TYPE, COB_SCREEN_FULL, COB_TYPE_NUMERIC_EDITED, __cob_screen::field, field_is_empty(), field_is_full(), field_is_zero(), and field_is_zero_or_no_zero_suppression().

Referenced by finalize_field_input().

973 {
974  if (!(s->attr & COB_SCREEN_FULL)) {
975  return 1;
976  }
977 
978  if (COB_FIELD_IS_NUMERIC (s->field)) {
979  return !field_is_zero (s);
980  } else if (COB_FIELD_TYPE (s->field) == COB_TYPE_NUMERIC_EDITED) {
982  } else { /* field is alphanumeric */
983  return field_is_full (s) || field_is_empty (s);
984  }
985 }
#define COB_FIELD_IS_NUMERIC(f)
Definition: common.h:674
#define COB_FIELD_TYPE(f)
Definition: common.h:662
#define COB_SCREEN_FULL
Definition: common.h:906
static int field_is_empty(cob_screen *s)
Definition: screenio.c:854
static int field_is_zero(cob_screen *s)
Definition: screenio.c:870
cob_field * field
Definition: common.h:1032
static int field_is_full(cob_screen *s)
Definition: screenio.c:962
#define COB_TYPE_NUMERIC_EDITED
Definition: common.h:619
static int field_is_zero_or_no_zero_suppression(cob_screen *s)
Definition: screenio.c:928

Here is the call graph for this function:

Here is the caller graph for this function:

static int satisfied_required_clause ( cob_screen s)
static

Definition at line 988 of file screenio.c.

References __cob_screen::attr, cob_field_is_numeric_or_numeric_edited(), COB_SCREEN_REQUIRED, __cob_screen::field, field_is_empty(), and field_is_zero().

Referenced by finalize_field_input().

989 {
990  if (!(s->attr & COB_SCREEN_REQUIRED)) {
991  return 1;
992  }
993 
995  return !field_is_zero (s);
996  } else { /* field is alphanumeric */
997  return !field_is_empty (s);
998  }
999 }
static COB_INLINE COB_A_INLINE int cob_field_is_numeric_or_numeric_edited(cob_field *field)
Definition: screenio.c:847
static int field_is_empty(cob_screen *s)
Definition: screenio.c:854
static int field_is_zero(cob_screen *s)
Definition: screenio.c:870
cob_field * field
Definition: common.h:1032
#define COB_SCREEN_REQUIRED
Definition: common.h:909

Here is the call graph for this function:

Here is the caller graph for this function:

static void screen_accept ( cob_screen s,
const int  line,
const int  column,
cob_field ftimeout 
)
static

Definition at line 1604 of file screenio.c.

References __cob_screen::attr, cob_base_inp, cob_check_pos_status(), cob_current_x, cob_current_y, __cob_global::cob_exception_code, cob_get_int(), COB_INP_SIZE, cob_malloc(), cob_move_cursor(), cob_prep_input(), cob_screen_get_all(), COB_SCREEN_INITIAL, COB_TIMEOUT_SCALE, compare_yx(), cob_inp_struct::down_index, global_return, init_cob_screen_if_needed(), line, origin_x, origin_y, cob_inp_struct::scr, cob_inp_struct::this_y, totl_index, and cob_inp_struct::up_index.

Referenced by cob_screen_accept().

1606 {
1607  struct cob_inp_struct *sptr;
1608  struct cob_inp_struct *sptr2;
1609  size_t idx;
1610  size_t n;
1611  size_t posu;
1612  size_t posd;
1613  size_t prevy;
1614  size_t firsty;
1615  int starty;
1616  int initial_curs;
1617  int gettimeout;
1618 
1620  if (!cob_base_inp) {
1622  } else {
1623  memset (cob_base_inp, 0, COB_INP_SIZE);
1624  }
1626  cob_current_y = 0;
1627  cob_current_x = 0;
1628  totl_index = 0;
1629  origin_y = line;
1630  origin_x = column;
1631 
1632  cob_move_cursor (line, column);
1633 
1634  /* Prepare input fields */
1635  if (cob_prep_input (s)) {
1636  cob_check_pos_status (9001);
1637  return;
1638  }
1639 
1640  /* No input field is an error */
1641  if (!totl_index) {
1642  cob_check_pos_status (8000);
1643  return;
1644  }
1645 
1646  if (ftimeout) {
1647  gettimeout = cob_get_int (ftimeout) * COB_TIMEOUT_SCALE;
1648  if (gettimeout >= 0 && gettimeout < 500) {
1649  gettimeout = 500;
1650  }
1651  } else {
1652  gettimeout = -1;
1653  }
1654 
1655  /* Sort input fields on line, column */
1656  qsort (cob_base_inp, totl_index,
1657  sizeof(struct cob_inp_struct), compare_yx);
1658 
1659  posu = 0;
1660  posd = 0;
1661  prevy = 0;
1662  firsty = 0;
1663  sptr = cob_base_inp;
1664  starty = sptr->this_y;
1665  initial_curs = -1;
1666  /* Set up array for Cursor UP/DOWN */
1667  for (n = 0; n < totl_index; n++) {
1668  sptr = cob_base_inp + n;
1669  if ((sptr->scr->attr & COB_SCREEN_INITIAL) && initial_curs < 0) {
1670  initial_curs = (int)n;
1671  }
1672  if (sptr->this_y > starty) {
1673  if (!firsty) {
1674  firsty = n;
1675  }
1676  starty = sptr->this_y;
1677  sptr2 = cob_base_inp + posd;
1678  for (idx = posd; idx < n; idx++, sptr2++) {
1679  sptr2->down_index = n;
1680  }
1681  posu = prevy;
1682  prevy = n;
1683  posd = n;
1684  }
1685  sptr->up_index = posu;
1686  }
1687  sptr = cob_base_inp;
1688  for (n = 0; n < firsty; n++, sptr++) {
1689  sptr->up_index = posd;
1690  }
1691  global_return = 0;
1692  if (initial_curs < 0) {
1693  initial_curs = 0;
1694  }
1695  cob_screen_get_all (initial_curs, gettimeout);
1697 }
size_t up_index
Definition: screenio.c:76
static size_t cob_prep_input(cob_screen *s)
Definition: screenio.c:1442
static struct cob_inp_struct * cob_base_inp
Definition: screenio.c:100
static int origin_x
Definition: screenio.c:109
static void cob_move_cursor(const int line, const int column)
Definition: screenio.c:317
static int global_return
Definition: screenio.c:103
static void cob_check_pos_status(const int fret)
Definition: screenio.c:578
static int cob_current_y
Definition: screenio.c:104
int cob_get_int(cob_field *)
Definition: move.c:1626
#define COB_INP_SIZE
Definition: screenio.c:84
static size_t totl_index
Definition: screenio.c:101
#define COB_TIMEOUT_SCALE
Definition: coblocal.h:193
static void cob_screen_get_all(const int initial_curs, const int gettimeout)
Definition: screenio.c:1085
static int compare_yx(const void *m1, const void *m2)
Definition: screenio.c:1368
size_t down_index
Definition: screenio.c:77
static int cob_current_x
Definition: screenio.c:105
#define COB_SCREEN_INITIAL
Definition: common.h:918
if fold fold static computed alternate extra correct stack on syntax debugging line
Definition: flag.def:90
static int origin_y
Definition: screenio.c:108
void * cob_malloc(const size_t size)
Definition: common.c:1250
int cob_exception_code
Definition: common.h:1203
cob_screen * scr
Definition: screenio.c:75
static cob_global * cobglobptr
Definition: screenio.c:92
static COB_INLINE COB_A_INLINE void init_cob_screen_if_needed(void)
Definition: screenio.c:1583

Here is the call graph for this function:

Here is the caller graph for this function:

static void screen_display ( cob_screen s,
const int  line,
const int  column 
)
static

Definition at line 1591 of file screenio.c.

References cob_move_cursor(), cob_screen_iterate(), init_cob_screen_if_needed(), line, origin_x, and origin_y.

Referenced by cob_screen_display(), and yyparse().

1592 {
1594 
1595  origin_y = line;
1596  origin_x = column;
1597 
1598  cob_move_cursor (line, column);
1599  cob_screen_iterate (s);
1600  refresh ();
1601 }
static int origin_x
Definition: screenio.c:109
static void cob_move_cursor(const int line, const int column)
Definition: screenio.c:317
static void cob_screen_iterate(cob_screen *s)
Definition: screenio.c:1490
if fold fold static computed alternate extra correct stack on syntax debugging line
Definition: flag.def:90
static int origin_y
Definition: screenio.c:108
static COB_INLINE COB_A_INLINE void init_cob_screen_if_needed(void)
Definition: screenio.c:1583

Here is the call graph for this function:

Here is the caller graph for this function:

static COB_INLINE COB_A_INLINE void set_default_line_column ( const int  is_screen,
int *  sline,
int *  scolumn 
)
static

Definition at line 1523 of file screenio.c.

Referenced by extract_line_and_col_vals().

1524 {
1525  if (is_screen) {
1526  *sline = 0;
1527  *scolumn = 0;
1528  } else {
1529  getyx (stdscr, *sline, *scolumn);
1530  if (*sline < 0) {
1531  *sline = 0;
1532  }
1533  if (*scolumn < 0) {
1534  *scolumn = 0;
1535  }
1536  }
1537 }

Here is the caller graph for this function:

static void update_column ( cob_screen s,
int *const  count,
int *const  found_clause 
)
static

Definition at line 733 of file screenio.c.

Referenced by get_screen_item_line_and_col().

739 {

Here is the caller graph for this function:

static void update_line ( cob_screen s,
int *const  count,
int *const  found_clause 
)
static

Definition at line 732 of file screenio.c.

Referenced by get_screen_item_line_and_col().

739 {

Here is the caller graph for this function:

static int valid_field_data ( cob_field field)
static

Definition at line 1002 of file screenio.c.

References cob_field::attr, cob_check_numval(), COB_FIELD_IS_NUMERIC, COB_TYPE_NUMERIC_EDITED, NULL, and cob_field_attr::type.

Referenced by finalize_field_input().

1003 {
1004  if (COB_FIELD_IS_NUMERIC (field)) {
1005  return cob_check_numval (field, NULL, 0, 0) == 0;
1006  } else if (field->attr->type == COB_TYPE_NUMERIC_EDITED) {
1007  return cob_check_numval (field, NULL, 1, 0) == 0;
1008  } else {
1009  return 1;
1010  }
1011 }
#define COB_FIELD_IS_NUMERIC(f)
Definition: common.h:674
EC ARGUMENT EC EC BOUND EC BOUND EC BOUND EC BOUND TABLE EC DATA EC DATA EC DATA PTR NULL
Definition: exception.def:95
int cob_check_numval(const cob_field *, const cob_field *, const int, const int)
Definition: intrinsic.c:3132
const cob_field_attr * attr
Definition: common.h:953
unsigned short type
Definition: common.h:941
#define COB_TYPE_NUMERIC_EDITED
Definition: common.h:619

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

short back_color
static

Definition at line 107 of file screenio.c.

Referenced by cob_screen_attr(), and cob_screen_init().

struct cob_inp_struct* cob_base_inp
static

Definition at line 100 of file screenio.c.

Referenced by cob_screen_get_all(), and screen_accept().

int cob_current_x
static
int cob_current_y
static
size_t cob_has_color
static

Definition at line 102 of file screenio.c.

Referenced by cob_screen_attr(), and cob_screen_init().

cob_global* cobglobptr
static

Definition at line 92 of file screenio.c.

cob_settings* cobsetptr
static

Definition at line 93 of file screenio.c.

const cob_field_attr const_alpha_attr
static
Initial value:
=
{COB_TYPE_ALPHANUMERIC, 0, 0, 0, ((void*)0) }
#define COB_TYPE_ALPHANUMERIC
Definition: common.h:621

Definition at line 98 of file screenio.c.

Referenced by field_accept().

short fore_color
static

Definition at line 106 of file screenio.c.

Referenced by cob_screen_attr(), and cob_screen_init().

int global_return
static

Definition at line 103 of file screenio.c.

Referenced by cob_screen_get_all(), cob_screen_init(), and screen_accept().

size_t totl_index
static

Definition at line 101 of file screenio.c.

Referenced by cob_prep_input(), cob_screen_get_all(), cob_screen_init(), and screen_accept().