pck.ads 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. -- Copyright 2020-2022 Free Software Foundation, Inc.
  2. --
  3. -- This program is free software; you can redistribute it and/or modify
  4. -- it under the terms of the GNU General Public License as published by
  5. -- the Free Software Foundation; either version 3 of the License, or
  6. -- (at your option) any later version.
  7. --
  8. -- This program is distributed in the hope that it will be useful,
  9. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. -- GNU General Public License for more details.
  12. --
  13. -- You should have received a copy of the GNU General Public License
  14. -- along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. package Pck is
  16. type Rec_Type (C : Character := 'd') is record
  17. case C is
  18. when Character'First => X_First : Integer;
  19. when Character'Val (127) => X_127 : Integer;
  20. when Character'Val (128) => X_128 : Integer;
  21. when Character'Last => X_Last : Integer;
  22. when others => null;
  23. end case;
  24. end record;
  25. type Second_Type (I : Integer) is record
  26. One: Integer;
  27. case I is
  28. when -5 .. 5 =>
  29. X : Integer;
  30. when others =>
  31. Y : Integer;
  32. end case;
  33. end record;
  34. type Nested_And_Variable (One, Two: Integer) is record
  35. Str : String (1 .. One);
  36. case One is
  37. when 0 =>
  38. null;
  39. when others =>
  40. OneValue : Integer;
  41. Str2 : String (1 .. Two);
  42. case Two is
  43. when 0 =>
  44. null;
  45. when others =>
  46. TwoValue : Integer;
  47. end case;
  48. end case;
  49. end record;
  50. end Pck;