OpenCOBOL 1.1pre-rel
Classes | Defines | Functions | Variables
codegen.c File Reference
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <tarstamp.h>
#include "cobc.h"
#include "tree.h"
#include "libcob/system.def"
Include dependency graph for codegen.c:

Go to the source code of this file.

Classes

struct  label_list
struct  attr_list
struct  literal_list
struct  field_list
struct  call_list
struct  base_list
struct  local_list
struct  sort_list
struct  system_table

Defines

#define COB_USE_SETJMP   0
#define COB_MAX_SUBSCRIPTS   16
#define INITIALIZE_NONE   0
#define INITIALIZE_ONE   1
#define INITIALIZE_DEFAULT   2
#define INITIALIZE_COMPOUND   3
#define INITIALIZE_EXTERNAL   4
#define COB_SYSTEM_GEN(x, y, z)   { x, #z },

Functions

void codegen (struct cb_program *prog, int nested)

Variables

int has_external = 0

Define Documentation

#define COB_MAX_SUBSCRIPTS   16

Definition at line 36 of file codegen.c.

#define COB_SYSTEM_GEN (   x,
  y,
 
)    { x, #z },
#define COB_USE_SETJMP   0

Definition at line 35 of file codegen.c.

#define INITIALIZE_COMPOUND   3

Definition at line 41 of file codegen.c.

#define INITIALIZE_DEFAULT   2

Definition at line 40 of file codegen.c.

#define INITIALIZE_EXTERNAL   4

Definition at line 42 of file codegen.c.

#define INITIALIZE_NONE   0

Definition at line 38 of file codegen.c.

#define INITIALIZE_ONE   1

Definition at line 39 of file codegen.c.


Function Documentation

void codegen ( struct cb_program prog,
int  nested 
)

Definition at line 4683 of file codegen.c.

{
        int                     i;
        cb_tree                 l;
        struct attr_list        *j;
        struct literal_list     *m;
        struct field_list       *k;
        struct call_list        *clp;
        struct base_list        *blp;
        unsigned char           *s;
        struct cb_program       *cp;
        cb_tree                 l1;
        cb_tree                 l2;
        const char              *prevprog;
        time_t                  loctime;
        char                    locbuff[48];

        current_prog = prog;
        param_id = 0;
        stack_id = 0;
        num_cob_fields = 0;
        progid = 0;
        loop_counter = 0;
        output_indent_level = 0;
        last_line = 0;
        needs_exit_prog = 0;
        gen_custom = 0;
        call_cache = NULL;
        label_cache = NULL;
        local_cache = NULL;
        excp_current_program_id = prog->orig_source_name;
        excp_current_section = NULL;
        excp_current_paragraph = NULL;
        memset ((char *)i_counters, 0, sizeof (i_counters));

        output_target = yyout;

        if (!nested) {
                gen_ebcdic = 0;
                gen_ebcdic_ascii = 0;
                gen_full_ebcdic = 0;
                gen_native = 0;
                attr_cache = NULL;
                base_cache = NULL;
                literal_cache = NULL;
                field_cache = NULL;

                loctime = time (NULL);
                strftime (locbuff, sizeof(locbuff) - 1, "%b %d %Y %H:%M:%S %Z",
                        localtime (&loctime));
                output_header (output_target, locbuff);
                output_header (cb_storage_file, locbuff);
                for (cp = prog; cp; cp = cp->next_program) {
                        output_header (cp->local_storage_file, locbuff);
                }

                output_storage ("/* Frame stack declaration */\n");
                output_storage ("struct cob_frame {\n");
                output_storage ("\tint\tperform_through;\n");
#ifndef __GNUC__
                output_storage ("\tint\treturn_address;\n");
#elif   COB_USE_SETJMP
                output_storage ("\tjmp_buf\treturn_address;\n");
#else
                output_storage ("\tvoid\t*return_address;\n");
#endif
                output_storage ("};\n\n");
                output_storage ("/* Union for CALL statement */\n");
                output_storage ("union cob_call_union {\n");
                output_storage ("\tvoid *(*funcptr)();\n");
                output_storage ("\tint  (*funcint)();\n");
                output_storage ("\tvoid *func_void;\n");
                output_storage ("};\n");
                output_storage ("union cob_call_union\tcob_unifunc;\n\n");

                output ("#define  __USE_STRING_INLINES 1\n");
#ifdef  _XOPEN_SOURCE_EXTENDED
                output ("#ifndef        _XOPEN_SOURCE_EXTENDED\n");
                output ("#define  _XOPEN_SOURCE_EXTENDED 1\n");
                output ("#endif\n");
#endif
                output ("#include <stdio.h>\n");
                output ("#include <stdlib.h>\n");
                output ("#include <string.h>\n");
                output ("#include <math.h>\n");
#if     COB_USE_SETJMP
                output ("#include <setjmp.h>\n");
#endif
#ifdef  WORDS_BIGENDIAN
                output ("#define WORDS_BIGENDIAN 1\n");
#endif
#ifdef  HAVE_BUILTIN_EXPECT
                output ("#define HAVE_BUILTIN_EXPECT\n");
#endif
                if (optimize_flag) {
                        output ("#define COB_LOCAL_INLINE\n");
                }
                output ("#include <libcob.h>\n\n");

                output ("#define COB_SOURCE_FILE                \"%s\"\n", cb_source_file);
                output ("#define COB_PACKAGE_VERSION    \"%s\"\n", PACKAGE_VERSION);
                output ("#define COB_PATCH_LEVEL                %d\n\n", PATCH_LEVEL);
                output ("/* Global variables */\n");
                output ("#include \"%s\"\n\n", cb_storage_file_name);

                for (cp = prog; cp; cp = cp->next_program) {
                        if (cp->gen_decset) {
                                output("static void\n");
                                output("cob_decimal_set_int (cob_decimal *d, const int n)\n");
                                output("{\n");
                                output("        mpz_set_si (d->value, n);\n");
                                output("        d->scale = 0;\n");
                                output("}\n\n");
                                break;
                        }
                }
                for (cp = prog; cp; cp = cp->next_program) {
                        if (cp->gen_udecset) {
                                output("static void\n");
                                output("cob_decimal_set_uint (cob_decimal *d, const unsigned int n)\n");
                                output("{\n");
                                output("        mpz_set_ui (d->value, n);\n");
                                output("        d->scale = 0;\n");
                                output("}\n\n");
                                break;
                        }
                }
                for (cp = prog; cp; cp = cp->next_program) {
                        if (cp->gen_ptrmanip) {
                                output("static void\n");
                                output("cob_pointer_manip (cob_field *f1, cob_field *f2, size_t addsub)\n");
                                output("{\n");
                                output("        unsigned char   *tmptr;\n");
                                output("        memcpy (&tmptr, f1->data, sizeof(void *));\n");
                                output("        if (addsub) {\n");
                                output("                tmptr -= cob_get_int (f2);\n");
                                output("        } else {\n");
                                output("                tmptr += cob_get_int (f2);\n");
                                output("        }\n");
                                output("        memcpy (f1->data, &tmptr, sizeof(void *));\n");
                                output("}\n\n");
                                break;
                        }
                }
                output ("/* Function prototypes */\n\n");
                for (cp = prog; cp; cp = cp->next_program) {
                        /* Build parameter list */
                        for (l = cp->entry_list; l; l = CB_CHAIN (l)) {
                                for (l1 = CB_VALUE (l); l1; l1 = CB_CHAIN (l1)) {
                                        for (l2 = cp->parameter_list; l2; l2 = CB_CHAIN (l2)) {
                                                if (strcasecmp (cb_field (CB_VALUE (l1))->name,
                                                                cb_field (CB_VALUE (l2))->name) == 0) {
                                                        break;
                                                }
                                        }
                                        if (l2 == NULL) {
                                                cp->parameter_list = cb_list_add (cp->parameter_list, CB_VALUE (l1));
                                        }
                                }
                        }
                        if (cp->flag_main) {
                                output ("int %s ();\n", cp->program_id);
                        } else {
                                for (l = cp->entry_list; l; l = CB_CHAIN (l)) {
                                        output_entry_function (cp, l, cp->parameter_list, 0);
                                }
                        }
                        output ("static int %s_ (const int", cp->program_id);
                        if (!cp->flag_chained) {
                                for (l = cp->parameter_list; l; l = CB_CHAIN (l)) {
                                        output (", unsigned char *");
                                }
                        }
                        output (");\n");
                }
                output ("\n");
        }

        /* Class-names */
        if (!prog->nested_level && prog->class_name_list) {
                output ("/* Class names */\n");
                for (l = prog->class_name_list; l; l = CB_CHAIN (l)) {
                        output_class_name_definition (CB_CLASS_NAME (CB_VALUE (l)));
                }
        }

        /* Main function */
        if (prog->flag_main) {
                output_main_function (prog);
        }

        /* Functions */
        if (!nested) {
                output ("/* Functions */\n\n");
        }
        for (l = prog->entry_list; l; l = CB_CHAIN (l)) {
                output_entry_function (prog, l, prog->parameter_list, 1);
        }
        output_internal_function (prog, prog->parameter_list);

        if (!prog->next_program) {
                output ("/* End functions */\n\n");
        }

        if (gen_native || gen_full_ebcdic || gen_ebcdic_ascii || prog->alphabet_name_list) {
                (void)lookup_attr (COB_TYPE_ALPHANUMERIC, 0, 0, 0, NULL, 0);
        }

        output_target = cb_storage_file;

        /* Program local stuff */
        if (call_cache) {
                output_local ("\n/* Call pointers */\n");
                for (clp = call_cache; clp; clp = clp->next) {
                        output_local ("static union cob_call_union\tcall_%s = { NULL };\n", clp->callname);
                }
                output_local ("\n");
        }

        for (i = 0; i < COB_MAX_SUBSCRIPTS; i++) {
                if (i_counters[i]) {
                        output_local ("int\t\ti%d;\n", i);
                }
        }

        if (num_cob_fields) {
                output_local ("\n/* Local cob_field items */\n");
                for (i = 0; i < num_cob_fields; i++) {
                        output_local ("cob_field\tf%d;\n", i);
                }
                output_local ("\n");
        }

        /* Skip to next nested program */

        if (prog->next_program) {
                codegen (prog->next_program, 1);
                return;
        }

        /* Finalize the storage file */

        if (base_cache) {
                output_storage ("\n/* Storage */\n");
                base_cache = list_cache_sort (base_cache, &base_cache_cmp);
                prevprog = NULL;
                for (blp = base_cache; blp; blp = blp->next) {
                        if (blp->curr_prog != prevprog) {
                                prevprog = blp->curr_prog;
                                output_storage ("\n/* PROGRAM-ID : %s */\n", prevprog);
                        }
#ifdef HAVE_ATTRIBUTE_ALIGNED
                        output_storage ("static unsigned char %s%d[%d] __attribute__((aligned));",
#else
                        output_storage ("static unsigned char %s%d[%d];",
#endif
                                        CB_PREFIX_BASE, blp->f->id,
                                        blp->f->memory_size);
                        output_storage ("\t/* %s */\n", blp->f->name);
                }
                output_storage ("\n/* End of storage */\n\n");
        }

        if (attr_cache) {
                output_storage ("\n/* Attributes */\n\n");
                attr_cache = attr_list_reverse (attr_cache);
                for (j = attr_cache; j; j = j->next) {
                        output_storage ("static const cob_field_attr %s%d = ",
                                        CB_PREFIX_ATTR, j->id);
                        output_storage ("{%d, %d, %d, %d, ", j->type, j->digits,
                                        j->scale, j->flags);
                        if (j->pic) {
                                output_storage ("\"");
                                for (s = j->pic; *s; s += 5) {
                                        output_storage ("%c\\%03o\\%03o\\%03o\\%03o",
                                                s[0], s[1], s[2], s[3], s[4]);
                                }
                                output_storage ("\"");
                        } else {
                                output_storage ("NULL");
                        }
                        output_storage ("};\n");
                }
        }

        if (field_cache) {
                output_storage ("\n/* Fields */\n");
                field_cache = list_cache_sort (field_cache, &field_cache_cmp);
                prevprog = NULL;
                for (k = field_cache; k; k = k->next) {
                        if (k->curr_prog != prevprog) {
                                prevprog = k->curr_prog;
                                output_storage ("\n/* PROGRAM-ID : %s */\n", prevprog);
                        }
                        output ("static cob_field %s%d\t= ", CB_PREFIX_FIELD, k->f->id);
                        if (!k->f->flag_local && !k->f->flag_item_external) {
                                output_field (k->x);
                        } else {
                                output ("{");
                                output_size (k->x);
                                output (", NULL, ");
                                output_attr (k->x);
                                output ("}");
                        }
                        output (";\t/* %s */\n", k->f->name);
                }
                output_storage ("\n/* End of fields */\n\n");
        }
        if (literal_cache) {
                output_storage ("/* Constants */\n");
                literal_cache = literal_list_reverse (literal_cache);
                for (m = literal_cache; m; m = m->next) {
                        output ("static cob_field %s%d\t= ", CB_PREFIX_CONST, m->id);
                        output_field (m->x);
                        output (";\n");
                }
                output ("\n");
        }

        if (gen_ebcdic) {
                output_storage ("/* EBCDIC translate table */\n");
                output ("static const unsigned char\tcob_a2e[256] = {\n");
                if (alt_ebcdic) {
                        output ("\t0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F,\n");
                        output ("\t0x16, 0x05, 0x25, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,\n");
                        output ("\t0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26,\n");
                        output ("\t0x18, 0x19, 0x3F, 0x27, 0x1C, 0x1D, 0x1E, 0x1F,\n");
                        output ("\t0x40, 0x5A, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D,\n");
                        output ("\t0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61,\n");
                        output ("\t0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,\n");
                        output ("\t0xF8, 0xF9, 0x7A, 0x5E, 0x4C, 0x7E, 0x6E, 0x6F,\n");
                        output ("\t0x7C, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,\n");
                        output ("\t0xC8, 0xC9, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6,\n");
                        output ("\t0xD7, 0xD8, 0xD9, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6,\n");
                        output ("\t0xE7, 0xE8, 0xE9, 0xAD, 0xE0, 0xBD, 0x5F, 0x6D,\n");
                        output ("\t0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,\n");
                        output ("\t0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,\n");
                        output ("\t0x97, 0x98, 0x99, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,\n");
                        output ("\t0xA7, 0xA8, 0xA9, 0xC0, 0x6A, 0xD0, 0xA1, 0x07,\n");
                        output ("\t0x68, 0xDC, 0x51, 0x42, 0x43, 0x44, 0x47, 0x48,\n");
                        output ("\t0x52, 0x53, 0x54, 0x57, 0x56, 0x58, 0x63, 0x67,\n");
                        output ("\t0x71, 0x9C, 0x9E, 0xCB, 0xCC, 0xCD, 0xDB, 0xDD,\n");
                        output ("\t0xDF, 0xEC, 0xFC, 0xB0, 0xB1, 0xB2, 0x3E, 0xB4,\n");
                        output ("\t0x45, 0x55, 0xCE, 0xDE, 0x49, 0x69, 0x9A, 0x9B,\n");
                        output ("\t0xAB, 0x9F, 0xBA, 0xB8, 0xB7, 0xAA, 0x8A, 0x8B,\n");
                        output ("\t0xB6, 0xB5, 0x62, 0x4F, 0x64, 0x65, 0x66, 0x20,\n");
                        output ("\t0x21, 0x22, 0x70, 0x23, 0x72, 0x73, 0x74, 0xBE,\n");
                        output ("\t0x76, 0x77, 0x78, 0x80, 0x24, 0x15, 0x8C, 0x8D,\n");
                        output ("\t0x8E, 0x41, 0x06, 0x17, 0x28, 0x29, 0x9D, 0x2A,\n");
                        output ("\t0x2B, 0x2C, 0x09, 0x0A, 0xAC, 0x4A, 0xAE, 0xAF,\n");
                        output ("\t0x1B, 0x30, 0x31, 0xFA, 0x1A, 0x33, 0x34, 0x35,\n");
                        output ("\t0x36, 0x59, 0x08, 0x38, 0xBC, 0x39, 0xA0, 0xBF,\n");
                        output ("\t0xCA, 0x3A, 0xFE, 0x3B, 0x04, 0xCF, 0xDA, 0x14,\n");
                        output ("\t0xE1, 0x8F, 0x46, 0x75, 0xFD, 0xEB, 0xEE, 0xED,\n");
                        output ("\t0x90, 0xEF, 0xB3, 0xFB, 0xB9, 0xEA, 0xBB, 0xFF\n");
                } else {
                        /* MF */
                        output ("\t0x00, 0x01, 0x02, 0x03, 0x1D, 0x19, 0x1A, 0x1B,\n");
                        output ("\t0x0F, 0x04, 0x16, 0x06, 0x07, 0x08, 0x09, 0x0A,\n");
                        output ("\t0x0B, 0x0C, 0x0D, 0x0E, 0x1E, 0x1F, 0x1C, 0x17,\n");
                        output ("\t0x10, 0x11, 0x20, 0x18, 0x12, 0x13, 0x14, 0x15,\n");
                        output ("\t0x21, 0x27, 0x3A, 0x36, 0x28, 0x30, 0x26, 0x38,\n");
                        output ("\t0x24, 0x2A, 0x29, 0x25, 0x2F, 0x2C, 0x22, 0x2D,\n");
                        output ("\t0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A,\n");
                        output ("\t0x7B, 0x7C, 0x35, 0x2B, 0x23, 0x39, 0x32, 0x33,\n");
                        output ("\t0x37, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D,\n");
                        output ("\t0x5E, 0x5F, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66,\n");
                        output ("\t0x67, 0x68, 0x69, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F,\n");
                        output ("\t0x70, 0x71, 0x72, 0x7D, 0x6A, 0x7E, 0x7F, 0x31,\n");
                        output ("\t0x34, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41,\n");
                        output ("\t0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,\n");
                        output ("\t0x4A, 0x4B, 0x4C, 0x4E, 0x4F, 0x50, 0x51, 0x52,\n");
                        output ("\t0x53, 0x54, 0x55, 0x56, 0x2E, 0x60, 0x4D, 0x05,\n");
                        output ("\t0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,\n");
                        output ("\t0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F,\n");
                        output ("\t0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,\n");
                        output ("\t0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F,\n");
                        output ("\t0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7,\n");
                        output ("\t0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF,\n");
                        output ("\t0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7,\n");
                        output ("\t0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF,\n");
                        output ("\t0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,\n");
                        output ("\t0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,\n");
                        output ("\t0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7,\n");
                        output ("\t0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,\n");
                        output ("\t0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,\n");
                        output ("\t0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,\n");
                        output ("\t0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,\n");
                        output ("\t0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF\n");
                }
                output ("};\n");
                output_storage ("\n");
        }
        if (gen_full_ebcdic) {
                output ("static const unsigned char\tcob_ebcdic[256] = {\n");
                output ("\t0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F,\n");
                output ("\t0x16, 0x05, 0x25, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,\n");
                output ("\t0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26,\n");
                output ("\t0x18, 0x19, 0x3F, 0x27, 0x1C, 0x1D, 0x1E, 0x1F,\n");
                output ("\t0x40, 0x5A, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D,\n");
                output ("\t0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61,\n");
                output ("\t0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,\n");
                output ("\t0xF8, 0xF9, 0x7A, 0x5E, 0x4C, 0x7E, 0x6E, 0x6F,\n");
                output ("\t0x7C, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,\n");
                output ("\t0xC8, 0xC9, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6,\n");
                output ("\t0xD7, 0xD8, 0xD9, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6,\n");
                output ("\t0xE7, 0xE8, 0xE9, 0xAD, 0xE0, 0xBD, 0x5F, 0x6D,\n");
                output ("\t0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,\n");
                output ("\t0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,\n");
                output ("\t0x97, 0x98, 0x99, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6,\n");
                output ("\t0xA7, 0xA8, 0xA9, 0xC0, 0x6A, 0xD0, 0xA1, 0x07,\n");
                output ("\t0x68, 0xDC, 0x51, 0x42, 0x43, 0x44, 0x47, 0x48,\n");
                output ("\t0x52, 0x53, 0x54, 0x57, 0x56, 0x58, 0x63, 0x67,\n");
                output ("\t0x71, 0x9C, 0x9E, 0xCB, 0xCC, 0xCD, 0xDB, 0xDD,\n");
                output ("\t0xDF, 0xEC, 0xFC, 0xB0, 0xB1, 0xB2, 0x3E, 0xB4,\n");
                output ("\t0x45, 0x55, 0xCE, 0xDE, 0x49, 0x69, 0x9A, 0x9B,\n");
                output ("\t0xAB, 0x9F, 0xBA, 0xB8, 0xB7, 0xAA, 0x8A, 0x8B,\n");
                output ("\t0xB6, 0xB5, 0x62, 0x4F, 0x64, 0x65, 0x66, 0x20,\n");
                output ("\t0x21, 0x22, 0x70, 0x23, 0x72, 0x73, 0x74, 0xBE,\n");
                output ("\t0x76, 0x77, 0x78, 0x80, 0x24, 0x15, 0x8C, 0x8D,\n");
                output ("\t0x8E, 0x41, 0x06, 0x17, 0x28, 0x29, 0x9D, 0x2A,\n");
                output ("\t0x2B, 0x2C, 0x09, 0x0A, 0xAC, 0x4A, 0xAE, 0xAF,\n");
                output ("\t0x1B, 0x30, 0x31, 0xFA, 0x1A, 0x33, 0x34, 0x35,\n");
                output ("\t0x36, 0x59, 0x08, 0x38, 0xBC, 0x39, 0xA0, 0xBF,\n");
                output ("\t0xCA, 0x3A, 0xFE, 0x3B, 0x04, 0xCF, 0xDA, 0x14,\n");
                output ("\t0xE1, 0x8F, 0x46, 0x75, 0xFD, 0xEB, 0xEE, 0xED,\n");
                output ("\t0x90, 0xEF, 0xB3, 0xFB, 0xB9, 0xEA, 0xBB, 0xFF\n");
                output ("};\n");
                i = lookup_attr (COB_TYPE_ALPHANUMERIC, 0, 0, 0, NULL, 0);
                output
                    ("static cob_field f_ebcdic = { 256, (unsigned char *)cob_ebcdic, &%s%d };\n",
                     CB_PREFIX_ATTR, i);
                output_storage ("\n");
        }
        if (gen_ebcdic_ascii) {
                output ("static const unsigned char\tcob_ebcdic_ascii[256] = {\n");
                output ("\t0x00, 0x01, 0x02, 0x03, 0xEC, 0x09, 0xCA, 0x7F,\n");
                output ("\t0xE2, 0xD2, 0xD3, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,\n");
                output ("\t0x10, 0x11, 0x12, 0x13, 0xEF, 0xC5, 0x08, 0xCB,\n");
                output ("\t0x18, 0x19, 0xDC, 0xD8, 0x1C, 0x1D, 0x1E, 0x1F,\n");
                output ("\t0xB7, 0xB8, 0xB9, 0xBB, 0xC4, 0x0A, 0x17, 0x1B,\n");
                output ("\t0xCC, 0xCD, 0xCF, 0xD0, 0xD1, 0x05, 0x06, 0x07,\n");
                output ("\t0xD9, 0xDA, 0x16, 0xDD, 0xDE, 0xDF, 0xE0, 0x04,\n");
                output ("\t0xE3, 0xE5, 0xE9, 0xEB, 0x14, 0x15, 0x9E, 0x1A,\n");
                output ("\t0x20, 0xC9, 0x83, 0x84, 0x85, 0xA0, 0xF2, 0x86,\n");
                output ("\t0x87, 0xA4, 0xD5, 0x2E, 0x3C, 0x28, 0x2B, 0xB3,\n");
                output ("\t0x26, 0x82, 0x88, 0x89, 0x8A, 0xA1, 0x8C, 0x8B,\n");
                output ("\t0x8D, 0xE1, 0x21, 0x24, 0x2A, 0x29, 0x3B, 0x5E,\n");
                output ("\t0x2D, 0x2F, 0xB2, 0x8E, 0xB4, 0xB5, 0xB6, 0x8F,\n");
                output ("\t0x80, 0xA5, 0x7C, 0x2C, 0x25, 0x5F, 0x3E, 0x3F,\n");
                output ("\t0xBA, 0x90, 0xBC, 0xBD, 0xBE, 0xF3, 0xC0, 0xC1,\n");
                output ("\t0xC2, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22,\n");
                output ("\t0xC3, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,\n");
                output ("\t0x68, 0x69, 0xAE, 0xAF, 0xC6, 0xC7, 0xC8, 0xF1,\n");
                output ("\t0xF8, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70,\n");
                output ("\t0x71, 0x72, 0xA6, 0xA7, 0x91, 0xCE, 0x92, 0xA9,\n");
                output ("\t0xE6, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,\n");
                output ("\t0x79, 0x7A, 0xAD, 0xA8, 0xD4, 0x5B, 0xD6, 0xD7,\n");
                output ("\t0x9B, 0x9C, 0x9D, 0xFA, 0x9F, 0xB1, 0xB0, 0xAC,\n");
                output ("\t0xAB, 0xFC, 0xAA, 0xFE, 0xE4, 0x5D, 0xBF, 0xE7,\n");
                output ("\t0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,\n");
                output ("\t0x48, 0x49, 0xE8, 0x93, 0x94, 0x95, 0xA2, 0xED,\n");
                output ("\t0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,\n");
                output ("\t0x51, 0x52, 0xEE, 0x96, 0x81, 0x97, 0xA3, 0x98,\n");
                output ("\t0x5C, 0xF0, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,\n");
                output ("\t0x59, 0x5A, 0xFD, 0xF5, 0x99, 0xF7, 0xF6, 0xF9,\n");
                output ("\t0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,\n");
                output ("\t0x38, 0x39, 0xDB, 0xFB, 0x9A, 0xF4, 0xEA, 0xFF\n");
                output ("};\n");
                i = lookup_attr (COB_TYPE_ALPHANUMERIC, 0, 0, 0, NULL, 0);
                output
                    ("static cob_field f_ebcdic_ascii = { 256, (unsigned char *)cob_ebcdic_ascii, &%s%d };\n",
                     CB_PREFIX_ATTR, i);
                output_storage ("\n");
        }
        if (gen_native) {
                output ("static const unsigned char\tcob_native[256] = {\n");
                output ("\t0, 1, 2, 3, 4, 5, 6, 7,\n");
                output ("\t8, 9, 10, 11, 12, 13, 14, 15,\n");
                output ("\t16, 17, 18, 19, 20, 21, 22, 23,\n");
                output ("\t24, 25, 26, 27, 28, 29, 30, 31,\n");
                output ("\t32, 33, 34, 35, 36, 37, 38, 39,\n");
                output ("\t40, 41, 42, 43, 44, 45, 46, 47,\n");
                output ("\t48, 49, 50, 51, 52, 53, 54, 55,\n");
                output ("\t56, 57, 58, 59, 60, 61, 62, 63,\n");
                output ("\t64, 65, 66, 67, 68, 69, 70, 71,\n");
                output ("\t72, 73, 74, 75, 76, 77, 78, 79,\n");
                output ("\t80, 81, 82, 83, 84, 85, 86, 87,\n");
                output ("\t88, 89, 90, 91, 92, 93, 94, 95,\n");
                output ("\t96, 97, 98, 99, 100, 101, 102, 103,\n");
                output ("\t104, 105, 106, 107, 108, 109, 110, 111,\n");
                output ("\t112, 113, 114, 115, 116, 117, 118, 119,\n");
                output ("\t120, 121, 122, 123, 124, 125, 126, 127,\n");
                output ("\t128, 129, 130, 131, 132, 133, 134, 135,\n");
                output ("\t136, 137, 138, 139, 140, 141, 142, 143,\n");
                output ("\t144, 145, 146, 147, 148, 149, 150, 151,\n");
                output ("\t152, 153, 154, 155, 156, 157, 158, 159,\n");
                output ("\t160, 161, 162, 163, 164, 165, 166, 167,\n");
                output ("\t168, 169, 170, 171, 172, 173, 174, 175,\n");
                output ("\t176, 177, 178, 179, 180, 181, 182, 183,\n");
                output ("\t184, 185, 186, 187, 188, 189, 190, 191,\n");
                output ("\t192, 193, 194, 195, 196, 197, 198, 199,\n");
                output ("\t200, 201, 202, 203, 204, 205, 206, 207,\n");
                output ("\t208, 209, 210, 211, 212, 213, 214, 215,\n");
                output ("\t216, 217, 218, 219, 220, 221, 222, 223,\n");
                output ("\t224, 225, 226, 227, 228, 229, 230, 231,\n");
                output ("\t232, 233, 234, 235, 236, 237, 238, 239,\n");
                output ("\t240, 241, 242, 243, 244, 245, 246, 247,\n");
                output ("\t248, 249, 250, 251, 252, 253, 254, 255\n");
                output ("};\n");
                i = lookup_attr (COB_TYPE_ALPHANUMERIC, 0, 0, 0, NULL, 0);
                output
                    ("static cob_field f_native = { 256, (unsigned char *)cob_native, &%s%d };\n",
                     CB_PREFIX_ATTR, i);
                output_storage ("\n");
        }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

int has_external = 0

Definition at line 138 of file codegen.c.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines