OpenCOBOL 1.1pre-rel
Classes | Defines | Functions
reserved.c File Reference
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "cobc.h"
#include "tree.h"
#include "parser.h"
Include dependency graph for reserved.c:

Go to the source code of this file.

Classes

struct  reserved

Defines

#define NUM_RESERVED_WORDS   sizeof (reserved_words) / sizeof (struct reserved)
#define NUM_INTRINSICS   sizeof(function_list) / sizeof(struct cb_intrinsic_table)

Functions

cb_tree lookup_system_name (const char *name)
int lookup_reserved_word (const char *name)
struct cb_intrinsic_tablelookup_intrinsic (const char *name, const int checkres)
void cb_list_reserved (void)
void cb_list_intrinsics (void)
void cb_list_mnemonics (void)
void cb_init_reserved (void)

Define Documentation

#define NUM_INTRINSICS   sizeof(function_list) / sizeof(struct cb_intrinsic_table)

Definition at line 878 of file reserved.c.

#define NUM_RESERVED_WORDS   sizeof (reserved_words) / sizeof (struct reserved)

Definition at line 615 of file reserved.c.


Function Documentation

void cb_init_reserved ( void  )

Definition at line 1019 of file reserved.c.

{
        int     i;

        /* build system-name table */
        for (i = 0; system_table[i].name != NULL; ++i) {
                system_table[i].node =
                  cb_build_system_name (system_table[i].category, system_table[i].token);
        }
}

Here is the call graph for this function:

void cb_list_intrinsics ( void  )

Definition at line 979 of file reserved.c.

{
        const char      *s;
        size_t          i;
        size_t          n;

        printf ("Intrinsic Function (Implemented Y/N)\n\n");
        for (i = 0; i < NUM_INTRINSICS; ++i) {
                n = strlen (function_list[i].name);
                switch (n / 8) {
                case 0:
                        s = "\t\t\t\t";
                        break;
                case 1:
                        s = "\t\t\t";
                        break;
                case 2:
                        s = "\t\t";
                        break;
                default:
                        s = "\t";
                        break;
                }
                printf ("%s%s(%s)\n", function_list[i].name, s,
                        function_list[i].implemented ? "Y" : "N");
        }
}
void cb_list_mnemonics ( void  )

Definition at line 1008 of file reserved.c.

{
        size_t          i;

        printf ("Mnemonic names\n\n");
        for (i = 0; system_table[i].name != NULL; ++i) {
                printf ("%s\n", system_table[i].name);
        }
}
void cb_list_reserved ( void  )

Definition at line 950 of file reserved.c.

{
        const char      *s;
        size_t  i;
        size_t  n;

        printf ("Reserved Words (Parsed Y/N)\n\n");
        for (i = 0; i < NUM_RESERVED_WORDS; ++i) {
                n = strlen (reserved_words[i].name);
                switch (n / 8) {
                case 0:
                        s = "\t\t\t\t";
                        break;
                case 1:
                        s = "\t\t\t";
                        break;
                case 2:
                        s = "\t\t";
                        break;
                default:
                        s = "\t";
                        break;
                }
                printf ("%s%s(%s)\n", reserved_words[i].name, s,
                        reserved_words[i].token != -1 ? "Y" : "N");
        }
}
struct cb_intrinsic_table* lookup_intrinsic ( const char *  name,
const int  checkres 
) [read]

Definition at line 929 of file reserved.c.

{
        struct cb_intrinsic_table       *cbp;
        struct noreserve                *noresptr;

        if (checkres) {
                for (noresptr = norestab; noresptr; noresptr = noresptr->next) {
                        if (strcasecmp (name, noresptr->noresword) == 0) {
                                return NULL;
                        }
                }
        }
        cbp = bsearch (name, function_list, NUM_INTRINSICS,
                        sizeof (struct cb_intrinsic_table), intrinsic_comp);
        if (cbp && cbp->implemented) {
                return cbp;
        }
        return NULL;
}

Here is the caller graph for this function:

int lookup_reserved_word ( const char *  name)

Definition at line 906 of file reserved.c.

{
        struct reserved *p;
        struct noreserve        *noresptr;

        p = bsearch (name, reserved_words, NUM_RESERVED_WORDS,
                        sizeof (struct reserved), reserve_comp);
        if (!p) {
                return 0;
        }
        for (noresptr = norestab; noresptr; noresptr = noresptr->next) {
                if (strcasecmp (name, noresptr->noresword) == 0) {
                        return 0;
                }
        }
        if (p->token != -1) {
                return p->token;
        }
        cb_error (_("'%s' reserved word, but not supported yet"), name);
        return 0;
}

Here is the call graph for this function:

cb_tree lookup_system_name ( const char *  name)

Definition at line 893 of file reserved.c.

{
        int     i;

        for (i = 0; system_table[i].name != NULL; ++i) {
                if (strcasecmp (name, system_table[i].name) == 0) {
                        return system_table[i].node;
                }
        }
        return cb_error_node;
}

Here is the caller graph for this function:


Variable Documentation

Definition at line 33 of file reserved.c.

const char* name

Definition at line 32 of file reserved.c.

Definition at line 35 of file reserved.c.

const int token

Definition at line 34 of file reserved.c.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines