[fpc-pascal] Boolean case statement

Terry Kemp tkemp at klc.net.nz
Tue Dec 5 22:36:43 CET 2006


Hi All

how do you do a case statement on a record of booleans e.g...

Type
 EngModeRec = Record
  ManualOp: Boolean;
  LeakTest: Boolean;
  DrainFlush: Boolean;
 end;

var
 EngMode: EngModeRec;

I want to have...

 Case True of 
  EngMode.ManualOp: ManualOpRun;
  EngMode.LeakTest: LeakTestRun;
  EngMode.DrainFlush: DrainFlushRun;
 end; 

but of course this wont work :(

Thanks Terry

errors...
Running tool: Build Arm

Target OS: Linux for ARM
Compiling mflow.pp
2 68/832 Kb Used
Compiling mrun.pp
Compiling mgldec.pp
100 4.039/4.736 Kb Used
Assembling mgldec
Compiling mstages.pp
100 4.158/4.864 Kb Used
Compiling mglproc.pp
100 5.166/5.920 Kb Used
200 5.417/6.336 Kb Used
300 5.712/6.560 Kb Used
Assembling mglproc
200 5.418/6.720 Kb Used
300 5.598/6.848 Kb Used
400 5.783/6.912 Kb Used
500 5.954/7.008 Kb Used
600 6.163/7.168 Kb Used
Assembling mstages
100 7.653/9.120 Kb Used
200 8.105/9.472 Kb Used
mrun.pp(289,19) Error: Constant Expression expected
mrun.pp(290,19) Error: Constant Expression expected
mrun.pp(290,19) Error: duplicate case label
mrun.pp(291,21) Error: Constant Expression expected
mrun.pp(291,21) Error: duplicate case label
300 8.383/9.472 Kb Used
mrun.pp(384) Fatal: There were 5 errors compiling module, stopping
mrun.pp(6,6) Fatal: Compilation aborted

Exited: 256





More information about the fpc-pascal mailing list