GnuCOBOL  2.0
A free COBOL compiler
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
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:

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)'*')
 

Functions

static void cob_speaker_beep (void)
 
void cob_exit_screen (void)
 
void cob_field_display (cob_field *f, cob_field *line, cob_field *column, cob_field *fgc, cob_field *bgc, cob_field *fscroll, const int attr)
 
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, const int attr)
 
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_screen_line_col (cob_field *f, const int l_or_c)
 
void cob_screen_set_mode (const cob_u32_t smode)
 
int cob_sys_clear_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, runtime_env *runtimeptr)
 

Variables

static cob_globalcobglobptr
 
static cob_u32_t cob_legacy
 
static char * cob_legacy_env
 

Macro Definition Documentation

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

Function Documentation

void cob_accept_escape_key ( cob_field f)

References COB_ACCEPT_STATUS, and cob_set_int().

1777 {
1779 }
void cob_exit_screen ( void  )

Referenced by cob_runtime_error(), and cob_terminate_routines().

1682 {
1683 }
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,
const int  attr 
)

References COB_UNUSED.

Referenced by cob_accept().

1703 {
1704  COB_UNUSED (f);
1705  COB_UNUSED (line);
1706  COB_UNUSED (column);
1707  COB_UNUSED (fgc);
1708  COB_UNUSED (bgc);
1709  COB_UNUSED (fscroll);
1710  COB_UNUSED (ftimeout);
1711  COB_UNUSED (prompt);
1712  COB_UNUSED (attr);
1713 }
void cob_field_display ( cob_field f,
cob_field line,
cob_field column,
cob_field fgc,
cob_field bgc,
cob_field fscroll,
const int  attr 
)

References COB_UNUSED.

Referenced by cob_display().

1689 {
1690  COB_UNUSED (f);
1691  COB_UNUSED (line);
1692  COB_UNUSED (column);
1693  COB_UNUSED (fgc);
1694  COB_UNUSED (bgc);
1695  COB_UNUSED (fscroll);
1696  COB_UNUSED (attr);
1697 }
void cob_init_screenio ( cob_global lptr,
runtime_env runtimeptr 
)

References cob_check_env_true(), cob_legacy, runtime_env::cob_legacy, cob_legacy_env, runtime_env::cob_legacy_env, cob_save_env_value(), and NULL.

Referenced by cob_init().

1820 {
1821  char* s;
1822 
1823  /*
1824  * TODO: needs Documentation
1825  */
1826  if ((s = getenv ("COB_LEGACY")) != NULL) {
1827  if (cob_check_env_true(s)) {
1829 
1830  cob_legacy = 1U;
1831  }
1832  }
1833 
1834  cobglobptr = lptr;
1835  runtimeptr->cob_legacy_env = cob_legacy_env;
1836  runtimeptr->cob_legacy = &cob_legacy;
1837 }
void cob_screen_accept ( cob_screen s,
cob_field line,
cob_field column,
cob_field ftimeout 
)

References COB_UNUSED.

1726 {
1727  COB_UNUSED (s);
1728  COB_UNUSED (line);
1729  COB_UNUSED (column);
1730  COB_UNUSED (ftimeout);
1731 }
void cob_screen_display ( cob_screen s,
cob_field line,
cob_field column 
)

References COB_UNUSED.

1717 {
1718  COB_UNUSED (s);
1719  COB_UNUSED (line);
1720  COB_UNUSED (column);
1721 }
void cob_screen_line_col ( cob_field f,
const int  l_or_c 
)

References cob_set_int().

1735 {
1736  if (!l_or_c) {
1737  cob_set_int (f, 24);
1738  } else {
1739  cob_set_int (f, 80);
1740  }
1741 }
void cob_screen_set_mode ( const cob_u32_t  smode)

References COB_UNUSED.

Referenced by cob_sys_system().

1745 {
1746  COB_UNUSED (smode);
1747 }
static void cob_speaker_beep ( void  )
static

Referenced by cob_sys_sound_bell().

115 {
116  int fd;
117 
118  fd = fileno (stdout);
119  if (fd >= 0) {
120  (void)write (fd, "\a", (size_t)1);
121  }
122 }
int cob_sys_clear_screen ( void  )
1751 {
1752  return 0;
1753 }
int cob_sys_get_csr_pos ( unsigned char *  fld)

References COB_CHK_PARMS.

1783 {
1784 #ifdef COB_GEN_SCREENIO
1785  int cline;
1786  int ccol;
1787 #endif
1788 
1789  COB_CHK_PARMS (CBL_GET_CSR_POS, 1);
1790 
1791 #ifdef COB_GEN_SCREENIO
1792  getyx (stdscr, cline, ccol);
1793  fld[0] = (unsigned char)cline;
1794  fld[1] = (unsigned char)ccol;
1795 
1796 #else
1797  fld[0] = 1U;
1798  fld[1] = 1U;
1799 #endif
1800  return 0;
1801 }
int cob_sys_get_scr_size ( unsigned char *  line,
unsigned char *  col 
)

References COB_CHK_PARMS, COLS, and LINES.

1805 {
1806  COB_CHK_PARMS (CBL_GET_SCR_SIZE, 2);
1807 
1808 #ifdef COB_GEN_SCREENIO
1809  *line = (unsigned char)LINES;
1810  *col = (unsigned char)COLS;
1811 #else
1812  *line = 24U;
1813  *col = 80U;
1814 #endif
1815  return 0;
1816 }
int cob_sys_sound_bell ( void  )

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

1759 {
1760  if (COB_BEEP_VALUE == 9) {
1761  return 0;
1762  }
1763 #ifdef COB_GEN_SCREENIO
1765  COB_BEEP_VALUE != 2) {
1766  cob_screen_init ();
1767  }
1768  cob_beep ();
1769 #else
1770  cob_speaker_beep ();
1771 #endif
1772  return 0;
1773 }

Variable Documentation

cob_u32_t cob_legacy
static

Referenced by cob_init_screenio().

char* cob_legacy_env
static

Referenced by cob_init_screenio().

cob_global* cobglobptr
static