🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.borland
Article #184

CASE in records

#184
From: Xy
Date: Tue, 30 May 2000 00:00
33 lines
1647 bytes
Hey all

Could someone please explain me these piece of code:

  tPolygonRec = Record
  ...
  ...
  Case Integer of  { Cases for the various polygon types }
      1 : (AB1, AB2, AB3 : UVCoord; Intensity : Byte);
      2 : (AB4, AB5, AB6 : UVCoord; I1, I2, I3 : Byte);
      3 : (AB7, AB8, AB9 : UVCoord);
      4 : (UV1, UV2, UV3 : UVCoord);
      5 : (AC1, AC2, AC3 : UVCoord; I_tensity : Byte);
      6 : (AC4, AC5, AC6 : UVCoord; I4, I5, I6 : Byte);
      7 : (AC7, AC8, AC9 : UVCoord; PT1, PT2, PT3 : UVCoord);
  End;

-or-

Type Register = Record
    Case Byte of
      0  : (w1, w2  : Word);
      1  : (b1, b2, b3, b4 : Byte);
  End;

(I copied these pieces of code from somebody elses sources)

What i don't understand is the 'CASE' statements in these records. Can
someone please explain to me how i use 'CASE' in records and why this is
useful??  Thnx in advance!

Grtnx
Xy
Technical Details
Message-ID: <3933FF8D.FFBE7575@vgrieken.demon.nl>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 108ebd,60a819bd5bee7e02,start
X-Google-Attributes: gid108ebd,public
X-Google-Thread: 111659,60a819bd5bee7e02,start
X-Google-Attributes: gid111659,public
From: Xy <xy@vgrieken.demon.nl>
Subject: CASE in records
Date: 2000/05/30
Message-ID: <3933FF8D.FFBE7575@vgrieken.demon.nl>
X-Deja-AN: 629097348
Content-Transfer-Encoding: 7bit
X-NNTP-Posting-Host: vgrieken.demon.nl:212.238.91.105
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: abuse@nl.demon.net
X-Trace: news.demon.nl 959709061 pluto:20792 NO-IDENT vgrieken.demon.nl:212.238.91.105
MIME-Version: 1.0
Newsgroups: comp.lang.pascal.borland,borland.public.turbopascal