OpenCOBOL 1.1pre-rel
Functions
move.h File Reference
#include <libcob/common.h>
Include dependency graph for move.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void cob_move (cob_field *, cob_field *)
void cob_set_int (cob_field *, int)
int cob_get_int (cob_field *)

Function Documentation

int cob_get_int ( cob_field )

Definition at line 1304 of file move.c.

{
        int             n;
        cob_field       temp;
        cob_field_attr  attr;

        switch (COB_FIELD_TYPE (f)) {
        case COB_TYPE_NUMERIC_DISPLAY:
                return cob_display_get_int (f);
        case COB_TYPE_NUMERIC_BINARY:
                return (int)cob_binary_mget_int64 (f);
        case COB_TYPE_NUMERIC_PACKED:
                return cob_packed_get_int (f);
        default:
                COB_ATTR_INIT (COB_TYPE_NUMERIC_BINARY, 9, 0,
                                COB_FLAG_HAVE_SIGN, NULL);
                temp.size = 4;
                temp.data = (unsigned char *)&n;
                temp.attr = &attr;
                cob_move (f, &temp);
                return n;
        }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void cob_move ( cob_field ,
cob_field  
)

Definition at line 1023 of file move.c.

{
        if (COB_FIELD_TYPE (src) == COB_TYPE_ALPHANUMERIC_ALL) {
                cob_move_all (src, dst);
                return;
        }
        if (dst->size == 0) {
                return;
        }
        if (src->size == 0) {
                src = &cob_space;
        }

        /* non-elementary move */
        if (COB_FIELD_TYPE (src) == COB_TYPE_GROUP || COB_FIELD_TYPE (dst) == COB_TYPE_GROUP) {
                cob_move_alphanum_to_alphanum (src, dst);
                return;
        }

        /* elementary move */
        switch (COB_FIELD_TYPE (src)) {
        case COB_TYPE_NUMERIC_DISPLAY:
                switch (COB_FIELD_TYPE (dst)) {
                case COB_TYPE_NUMERIC_FLOAT:
                case COB_TYPE_NUMERIC_DOUBLE:
                        cob_move_display_to_fp (src, dst);
                        return;
                case COB_TYPE_NUMERIC_DISPLAY:
                        cob_move_display_to_display (src, dst);
                        return;
                case COB_TYPE_NUMERIC_PACKED:
                        cob_move_display_to_packed (src, dst);
                        return;
                case COB_TYPE_NUMERIC_BINARY:
                        cob_move_display_to_binary (src, dst);
                        return;
                case COB_TYPE_NUMERIC_EDITED:
                        cob_move_display_to_edited (src, dst);
                        return;
                case COB_TYPE_ALPHANUMERIC_EDITED:
                        if (COB_FIELD_SCALE(src) < 0 ||
                            COB_FIELD_SCALE(src) > COB_FIELD_DIGITS(src)) {
                                /* expand P's */
                                indirect_move (cob_move_display_to_display, src, dst,
                                              (size_t)cob_max_int ((int)COB_FIELD_DIGITS(src), (int)COB_FIELD_SCALE(src)),
                                              cob_max_int (0, (int)COB_FIELD_SCALE(src)));
                                return;
                        } else {
                                cob_move_alphanum_to_edited (src, dst);
                                return;
                        }
                default:
                        cob_move_display_to_alphanum (src, dst);
                        return;
                }

        case COB_TYPE_NUMERIC_PACKED:
                switch (COB_FIELD_TYPE (dst)) {
                case COB_TYPE_NUMERIC_DISPLAY:
                        cob_move_packed_to_display (src, dst);
                        return;
                default:
                        indirect_move (cob_move_packed_to_display, src, dst,
                                      COB_FIELD_DIGITS(src), COB_FIELD_SCALE(src));
                        return;
                }

        case COB_TYPE_NUMERIC_BINARY:
                switch (COB_FIELD_TYPE (dst)) {
                case COB_TYPE_NUMERIC_DISPLAY:
                        cob_move_binary_to_display (src, dst);
                        return;
                case COB_TYPE_NUMERIC_BINARY:
                case COB_TYPE_NUMERIC_PACKED:
                case COB_TYPE_NUMERIC_EDITED:
                case COB_TYPE_NUMERIC_FLOAT:
                case COB_TYPE_NUMERIC_DOUBLE:
                        indirect_move (cob_move_binary_to_display, src, dst,
                                      20, COB_FIELD_SCALE(src));
                        return;
                default:
                        indirect_move (cob_move_binary_to_display, src, dst,
                                      COB_FIELD_DIGITS(src), COB_FIELD_SCALE(src));
                        return;
                }

        case COB_TYPE_NUMERIC_EDITED:
                switch (COB_FIELD_TYPE (dst)) {
                case COB_TYPE_NUMERIC_DISPLAY:
                        cob_move_edited_to_display (src, dst);
                        return;
                case COB_TYPE_NUMERIC_PACKED:
                case COB_TYPE_NUMERIC_BINARY:
                case COB_TYPE_NUMERIC_EDITED:
                case COB_TYPE_NUMERIC_FLOAT:
                case COB_TYPE_NUMERIC_DOUBLE:
                        indirect_move (cob_move_edited_to_display, src, dst, 36, 18);
                        return;
                case COB_TYPE_ALPHANUMERIC_EDITED:
                        cob_move_alphanum_to_edited (src, dst);
                        return;
                default:
                        cob_move_alphanum_to_alphanum (src, dst);
                        return;
                }

        case COB_TYPE_NUMERIC_FLOAT:
        case COB_TYPE_NUMERIC_DOUBLE:
                indirect_move (cob_move_fp_to_display, src, dst, 40, 20);
                return;

        default:
                switch (COB_FIELD_TYPE (dst)) {
                case COB_TYPE_NUMERIC_DISPLAY:
                        cob_move_alphanum_to_display (src, dst);
                        return;
                case COB_TYPE_NUMERIC_PACKED:
                case COB_TYPE_NUMERIC_BINARY:
                case COB_TYPE_NUMERIC_EDITED:
                case COB_TYPE_NUMERIC_FLOAT:
                case COB_TYPE_NUMERIC_DOUBLE:
                        indirect_move (cob_move_alphanum_to_display, src, dst, 36, 18);
                        return;
                case COB_TYPE_ALPHANUMERIC_EDITED:
                        cob_move_alphanum_to_edited (src, dst);
                        return;
                default:
                        cob_move_alphanum_to_alphanum (src, dst);
                        return;
                }
        }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void cob_set_int ( cob_field ,
int   
)

Definition at line 1291 of file move.c.

{
        cob_field       temp;
        cob_field_attr  attr;

        COB_ATTR_INIT (COB_TYPE_NUMERIC_BINARY, 9, 0, COB_FLAG_HAVE_SIGN, NULL);
        temp.size = 4;
        temp.data = (unsigned char *)&n;
        temp.attr = &attr;
        cob_move (&temp, f);
}

Here is the call graph for this function:

Here is the caller graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines