Skip to content

STRUCTURE operation problem #14

@rburkey2005

Description

@rburkey2005

I haven't exhaustively tested STRUCTURE operations, but had occasion to compile some test code involving STRUCTURE's, and as long as I had done that already anyway I decided to run the resulting HALMAT in yaHALMAT, where it failed. Here's the test code:

    TEST: PROGRAM;
        STRUCTURE A:
            1 B INTEGER,
            1 C SCALAR,
            1 D,
                2 E INTEGER,
                2 F SCALAR;
        DECLARE A A-STRUCTURE;
        C = 55.3;
        E = 12;
        WRITE(6) C, E;
    CLOSE TEST;

What this should print out when run in yaHALMAT is something like

 5.5300000E+01              12

but what it actually prints out is

 0.0          0

Explanatory note: What this code tests is that under a certain narrow range of circumstances, it's allowed in HAL/S to refer to fields in a STRUCTURE simply by their field names — C and E in the above example — without having to use their full dotted references (A.C and A.D.E). If you instead use the less-confusing alternative test program that has the full dotted references,

    TEST: PROGRAM;
        STRUCTURE A:
            1 B INTEGER,
            1 C SCALAR,
            1 D,
                2 E INTEGER,
                2 F SCALAR;
        DECLARE A A-STRUCTURE;
        A.C = 55.3;
        A.D.E = 12;
        WRITE(6) A.C, A.D.E;
    CLOSE TEST;

the compiler produces the same HALMAT files, the same compiler reports, and of course, yaHALMAT prints out the same thing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions