OpenCOBOL 1.1pre-rel
Data Structures | Defines | Typedefs | Functions | Variables
screenio.h File Reference
#include <libcob/common.h>
Include dependency graph for screenio.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  __cob_screen

Defines

#define COB_SCREEN_BLACK   0
#define COB_SCREEN_BLUE   1
#define COB_SCREEN_GREEN   2
#define COB_SCREEN_CYAN   3
#define COB_SCREEN_RED   4
#define COB_SCREEN_MAGENTA   5
#define COB_SCREEN_YELLOW   6
#define COB_SCREEN_WHITE   7
#define COB_SCREEN_LINE_PLUS   0x00000001
#define COB_SCREEN_LINE_MINUS   0x00000002
#define COB_SCREEN_COLUMN_PLUS   0x00000004
#define COB_SCREEN_COLUMN_MINUS   0x00000008
#define COB_SCREEN_AUTO   0x00000010
#define COB_SCREEN_BELL   0x00000020
#define COB_SCREEN_BLANK_LINE   0x00000040
#define COB_SCREEN_BLANK_SCREEN   0x00000080
#define COB_SCREEN_BLINK   0x00000100
#define COB_SCREEN_ERASE_EOL   0x00000200
#define COB_SCREEN_ERASE_EOS   0x00000400
#define COB_SCREEN_FULL   0x00000800
#define COB_SCREEN_HIGHLIGHT   0x00001000
#define COB_SCREEN_LOWLIGHT   0x00002000
#define COB_SCREEN_REQUIRED   0x00004000
#define COB_SCREEN_REVERSE   0x00008000
#define COB_SCREEN_SECURE   0x00010000
#define COB_SCREEN_UNDERLINE   0x00020000
#define COB_SCREEN_OVERLINE   0x00040000
#define COB_SCREEN_PROMPT   0x00080000
#define COB_SCREEN_UPDATE   0x00100000
#define COB_SCREEN_INPUT   0x00200000
#define COB_SCREEN_SCROLL_DOWN   0x00400000
#define COB_SCREEN_TYPE_GROUP   0
#define COB_SCREEN_TYPE_FIELD   1
#define COB_SCREEN_TYPE_VALUE   2
#define COB_SCREEN_TYPE_ATTRIBUTE   3

Typedefs

typedef struct __cob_screen cob_screen

Functions

void cob_screen_line_col (cob_field *, const int)
void cob_screen_display (cob_screen *, cob_field *, cob_field *)
void cob_screen_accept (cob_screen *, cob_field *, cob_field *)
void cob_field_display (cob_field *, cob_field *, cob_field *, cob_field *, cob_field *, cob_field *, const int)
void cob_field_accept (cob_field *, cob_field *, cob_field *, cob_field *, cob_field *, cob_field *, const int)

Variables

DLL_EXPIMP int cob_screen_mode

Define Documentation

#define COB_SCREEN_AUTO   0x00000010

Definition at line 40 of file screenio.h.

#define COB_SCREEN_BELL   0x00000020

Definition at line 41 of file screenio.h.

#define COB_SCREEN_BLACK   0

Definition at line 26 of file screenio.h.

#define COB_SCREEN_BLANK_LINE   0x00000040

Definition at line 42 of file screenio.h.

#define COB_SCREEN_BLANK_SCREEN   0x00000080

Definition at line 43 of file screenio.h.

#define COB_SCREEN_BLINK   0x00000100

Definition at line 44 of file screenio.h.

#define COB_SCREEN_BLUE   1

Definition at line 27 of file screenio.h.

#define COB_SCREEN_COLUMN_MINUS   0x00000008

Definition at line 38 of file screenio.h.

#define COB_SCREEN_COLUMN_PLUS   0x00000004

Definition at line 37 of file screenio.h.

#define COB_SCREEN_CYAN   3

Definition at line 29 of file screenio.h.

#define COB_SCREEN_ERASE_EOL   0x00000200

Definition at line 45 of file screenio.h.

#define COB_SCREEN_ERASE_EOS   0x00000400

Definition at line 46 of file screenio.h.

#define COB_SCREEN_FULL   0x00000800

Definition at line 47 of file screenio.h.

#define COB_SCREEN_GREEN   2

Definition at line 28 of file screenio.h.

#define COB_SCREEN_HIGHLIGHT   0x00001000

Definition at line 48 of file screenio.h.

#define COB_SCREEN_INPUT   0x00200000

Definition at line 57 of file screenio.h.

#define COB_SCREEN_LINE_MINUS   0x00000002

Definition at line 36 of file screenio.h.

#define COB_SCREEN_LINE_PLUS   0x00000001

Definition at line 35 of file screenio.h.

#define COB_SCREEN_LOWLIGHT   0x00002000

Definition at line 49 of file screenio.h.

#define COB_SCREEN_MAGENTA   5

Definition at line 31 of file screenio.h.

#define COB_SCREEN_OVERLINE   0x00040000

Definition at line 54 of file screenio.h.

#define COB_SCREEN_PROMPT   0x00080000

Definition at line 55 of file screenio.h.

#define COB_SCREEN_RED   4

Definition at line 30 of file screenio.h.

#define COB_SCREEN_REQUIRED   0x00004000

Definition at line 50 of file screenio.h.

#define COB_SCREEN_REVERSE   0x00008000

Definition at line 51 of file screenio.h.

#define COB_SCREEN_SCROLL_DOWN   0x00400000

Definition at line 58 of file screenio.h.

#define COB_SCREEN_SECURE   0x00010000

Definition at line 52 of file screenio.h.

#define COB_SCREEN_TYPE_ATTRIBUTE   3

Definition at line 63 of file screenio.h.

#define COB_SCREEN_TYPE_FIELD   1

Definition at line 61 of file screenio.h.

#define COB_SCREEN_TYPE_GROUP   0

Definition at line 60 of file screenio.h.

#define COB_SCREEN_TYPE_VALUE   2

Definition at line 62 of file screenio.h.

#define COB_SCREEN_UNDERLINE   0x00020000

Definition at line 53 of file screenio.h.

#define COB_SCREEN_UPDATE   0x00100000

Definition at line 56 of file screenio.h.

#define COB_SCREEN_WHITE   7

Definition at line 33 of file screenio.h.

#define COB_SCREEN_YELLOW   6

Definition at line 32 of file screenio.h.


Typedef Documentation

typedef struct __cob_screen cob_screen

Definition at line 65 of file screenio.h.


Function Documentation

void cob_field_accept ( cob_field ,
cob_field ,
cob_field ,
cob_field ,
cob_field ,
cob_field ,
const int   
)

Definition at line 855 of file screenio.c.

{
        unsigned char   *p;
        size_t          count;
        int             keyp;
        int             fret;
        int             sline;
        int             scolumn;
        int             cline;
        int             ccolumn;
        int             rightpos;
        int             ateof;
        int             gotbacksp;

        if (!cob_screen_initialized) {
                cob_screen_init ();
        }

        if (scroll) {
                keyp = cob_get_int (scroll);
                if (attr & COB_SCREEN_SCROLL_DOWN) {
                        keyp = -keyp;
                }
                scrollok (stdscr, 1);
                scrl (keyp);
                scrollok (stdscr, 0);
                refresh ();
        }
        cob_exception_code = 0;
        get_line_column (line, column, &sline, &scolumn);
        move (sline, scolumn);
        cob_screen_attr (fgc, bgc, attr);
        p = f->data;
        for (count = 0; count < f->size; count++) {
                if (attr & COB_SCREEN_SECURE) {
                        addch ('*');
                } else if (attr & COB_SCREEN_UPDATE) {
                        fret = *p++;
                        addch ((unsigned int)fret);
                } else if (attr & COB_SCREEN_PROMPT) {
                        addch ('_');
                } else {
                        addch (' ');
                }
        }
        move (sline, scolumn);
        if (!(attr & COB_SCREEN_UPDATE)) {
                if (COB_FIELD_IS_NUMERIC (f)) {
                        cob_move (&cob_zero, f);
                } else {
                        memset (f->data, ' ', f->size);
                }
        }

        fret = 0;
        ateof = 0;
        gotbacksp = 0;
        rightpos = scolumn + f->size - 1;
        p = f->data;
        for (; ;) {
                refresh ();
                keyp = getch ();
                if (keyp == KEY_ENTER || keyp == '\n') {
                        break;
                }
                if (keyp > KEY_F0 && keyp < KEY_F(65)) {
                        fret = 1000 + keyp - KEY_F0;
                        break;
                }
                if (cob_extended_status) {
                        if (keyp == KEY_PPAGE) {
                                fret = 2001;
                                break;
                        }
                        if (keyp == KEY_NPAGE) {
                                fret = 2002;
                                break;
                        }
                        if (keyp == KEY_UP) {
                                fret = 2003;
                                break;
                        }
                        if (keyp == KEY_DOWN) {
                                fret = 2004;
                                break;
                        }
                        if (keyp == KEY_PRINT) {
                                fret = 2006;
                                break;
                        }
                        if (cob_use_esc) {
                                if (keyp == 033) {
                                        fret = 2005;
                                        break;
                                }
                        }
                }
                getyx (stdscr, cline, ccolumn);
                if (keyp == KEY_BACKSPACE || keyp == ('H' & 037) ||
                    keyp == 0177) {
                        if (ccolumn > scolumn) {
                                if (gotbacksp || ccolumn != rightpos) {
                                        ccolumn--;
                                } else {
                                        ateof = 0;
                                }
                                gotbacksp = 1;
                                move (cline, ccolumn);
                                if (attr & COB_SCREEN_SECURE) {
                                        addch ('*');
                                } else {
                                        addch ('_');
                                }
                                move (cline, ccolumn);
                                p = f->data + ccolumn - scolumn;
                                *p = ' ';
                                continue;
                        }
                }
                if (keyp == KEY_HOME) {
                        move (sline, scolumn);
                        p = f->data;
                        ateof = 0;
                        gotbacksp = 0;
                        continue;
                }
                if (keyp == KEY_END) {
                        move (sline, rightpos);
                        p = f->data + f->size - 1;
                        ateof = 0;
                        gotbacksp = 0;
                        continue;
                }
                if (keyp == KEY_LEFT) {
                        if (ccolumn > scolumn) {
                                ccolumn--;
                                move (cline, ccolumn);
                                p = f->data + ccolumn - scolumn;
                                continue;
                        }
                        gotbacksp = 0;
                }
                if (keyp == KEY_RIGHT) {
                        if (ccolumn < rightpos) {
                                ccolumn++;
                                move (cline, ccolumn);
                                p = f->data + ccolumn - scolumn;
                                continue;
                        }
                        gotbacksp = 0;
                }
                if (keyp > 037 && keyp < (int)A_CHARTEXT) {
                        if (COB_FIELD_IS_NUMERIC (f)) {
                                if (keyp < '0' || keyp > '9') {
                                        beep ();
                                        continue;
                                }
                        }
                        gotbacksp = 0;
                        *p = keyp;
                        if (attr & COB_SCREEN_SECURE) {
                                addch ('*');
                        } else {
                                addch ((unsigned int)keyp);
                        }
                        if (ccolumn == rightpos) {
                                if (attr & COB_SCREEN_AUTO) {
                                        break;
                                }
                                move (cline, ccolumn);
                                if (ateof) {
                                        beep ();
                                } else {
                                        ateof = 1;
                                }
                        } else {
                                p++;
                        }
                        continue;
                }
                gotbacksp = 0;
                beep ();
        }
        cob_check_pos_status (fret);
        refresh ();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void cob_field_display ( cob_field ,
cob_field ,
cob_field ,
cob_field ,
cob_field ,
cob_field ,
const int   
)

Definition at line 826 of file screenio.c.

{
        int sline;
        int scolumn;

        if (!cob_screen_initialized) {
                cob_screen_init ();
        }

        if (scroll) {
                sline = cob_get_int (scroll);
                if (attr & COB_SCREEN_SCROLL_DOWN) {
                        sline = -sline;
                }
                scrollok (stdscr, 1);
                scrl (sline);
                scrollok (stdscr, 0);
                refresh ();
        }
        get_line_column (line, column, &sline, &scolumn);
        move (sline, scolumn);
        cob_screen_attr (fgc, bgc, attr);
        addnstr ((char *)f->data, (int)f->size);
        refresh ();
}

Here is the call graph for this function:

void cob_screen_accept ( cob_screen ,
cob_field ,
cob_field  
)

Definition at line 759 of file screenio.c.

{
        struct cob_inp_struct   *sptr;
        struct cob_inp_struct   *sptr2;
        size_t                  idx;
        size_t                  n;
        size_t                  posu;
        size_t                  posd;
        size_t                  prevy;
        size_t                  firsty;
        int                     starty;

        if (!cob_screen_initialized) {
                cob_screen_init ();
        }
        if (!cob_base_inp) {
                cob_base_inp = cob_malloc (COB_INP_SIZE);
        } else {
                memset (cob_base_inp, 0, COB_INP_SIZE);
        }
        cob_exception_code = 0;
        cob_current_y = 0;
        cob_current_x = 0;
        totl_index = 0;
        move (0, 0);
        cob_prep_input (s);
        /* No input fields is an error */
        if (!totl_index) {
                cob_check_pos_status (8000);
                return;
        }
        qsort (cob_base_inp, totl_index, sizeof(struct cob_inp_struct), compare_yx);
        sptr = cob_base_inp;
        starty = sptr->this_y;
        posu = 0;
        posd = 0;
        prevy = 0;
        firsty = 0;
        /* Set up array for Cursor UP/DOWN */
        for (n = 0; n < totl_index; n++) {
                sptr = cob_base_inp + n;
                if (sptr->this_y > starty) {
                        if (!firsty) {
                                firsty = n;
                        }
                        starty = sptr->this_y;
                        sptr2 = cob_base_inp + posd;
                        for (idx = posd; idx < n; idx++, sptr2++) {
                                sptr2->down_index = n;
                        }
                        posu = prevy;
                        prevy = n;
                        posd = n;
                }
                sptr->up_index = posu;
        }
        sptr = cob_base_inp;
        for (n = 0; n < firsty; n++, sptr++) {
                sptr->up_index = posd;
        }
        curr_index = 0;
        global_return = 0;
        cob_screen_get_all ();
        cob_check_pos_status (global_return);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void cob_screen_display ( cob_screen ,
cob_field ,
cob_field  
)

Definition at line 726 of file screenio.c.

{
        int     n;

        if (!cob_screen_initialized) {
                cob_screen_init ();
        }

        switch (s->type) {
        case COB_SCREEN_TYPE_GROUP:
                for (s = s->child; s; s = s->next) {
                        cob_screen_display (s, line, column);
                }
                break;
        case COB_SCREEN_TYPE_FIELD:
                cob_screen_puts (s, s->field);
                break;
        case COB_SCREEN_TYPE_VALUE:
                cob_screen_puts (s, s->value);
                if (s->occurs) {
                        for (n = 1; n < s->occurs; ++n) {
                                cob_screen_puts (s, s->value);
                        }
                }
                break;
        case COB_SCREEN_TYPE_ATTRIBUTE:
                cob_screen_attr (s->foreg, s->backg, s->attr);
                break;
        }
        refresh ();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void cob_screen_line_col ( cob_field ,
const int   
)

Definition at line 1045 of file screenio.c.

{
        if (!cob_screen_initialized) {
                cob_screen_init ();
        }
        if (!l_or_c) {
                cob_set_int (f, (int)LINES);
        } else {
                cob_set_int (f, (int)COLS);
        }
}

Here is the call graph for this function:


Variable Documentation

DLL_EXPIMP int cob_screen_mode

Definition at line 52 of file screenio.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines