-
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
-
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;