pascal and C equivilent

This is a discussion on pascal and C equivilent within the Tech Board forums, part of the Community Boards category; Hi would anyone know pascal and how to change a packed record in to C. Here is a sample: - ...

  1. #1
    Registered User
    Join Date
    Nov 2004
    Posts
    1

    pascal and C equivilent

    Hi would anyone know pascal and how to change a packed record
    in to C.

    Here is a sample: -

    fct=(lit,opr,lod,sto,cal,int,jmp,jpc);

    packed record
    f: fct;
    end

    with i do (*if i is an integer -instruction- *)
    case f of
    lit : begin
    (*the rest is just a case structure*)
    .................

    tried looking on the web there is nothing on there which makes sence.
    not sure what this means above though.
    the code i am trying to convert is from http://www.246.dk/pl0.html
    if you look right at the bottom where it says writeln('Start PL/0');
    that is what i am trying to convert, done most of it but just not sure on what this part is doing.

    Some help would be very apreciated. thankyou
    Paul

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,659
    You can probably ignore the packed aspect, if you're not writing the record itself to the file.

    After that, its
    Code:
    typedef enum {
      lit,
      opr,
      /* etc */
    } op_t;
    typedef struct {
      op_t   f;
      int l;
      int a;
    } instruction_t;

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21