dw2-fixed-point.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* Copyright 2016-2022 Free Software Foundation, Inc.
  2. This file is part of GDB.
  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. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  13. #include <stdint.h>
  14. /* Simulate an Ada variable declared inside package Pck as follow:
  15. type FP1_Type is delta 0.1 range -1.0 .. +1.0;
  16. FP1_Var : FP1_Type := 0.25; */
  17. int8_t pck__fp1_var = 4;
  18. /* Simulate an Ada variable declared inside package Pck as follow:
  19. type FP1_Type is delta 0.1 range -1.0 .. +1.0;
  20. FP1_Var2 : FP1_Type := 0.50;
  21. Basically, the same as FP1_Var, but with a different value. */
  22. int8_t pck__fp1_var2 = 8;
  23. /* Simulate an Ada variable declared inside package Pck as follow:
  24. type FP2_Type is delta 0.01 digits 14;
  25. FP2_Var : FP2_Type := -0.01; */
  26. int32_t pck__fp2_var = -1;
  27. /* Simulate an Ada variable declared inside package Pck as follow:
  28. type FP3_Type is delta 0.1 range 0.0 .. 1.0 with Small => 0.1/3.0;
  29. FP3_Var : FP3_Type := 0.1; */
  30. int8_t pck__fp3_var = 3;
  31. /* Simulate an Ada variable declared inside package Pck as follow:
  32. type FP1_Type is delta 0.1 range -1.0 .. +1.0;
  33. FP1_Var : FP1_Type := 1.0; */
  34. int8_t pck__fp1_range_var = 16;
  35. int
  36. main (void)
  37. {
  38. pck__fp1_var++;
  39. pck__fp1_var2++;
  40. pck__fp2_var++;
  41. pck__fp3_var++;
  42. pck__fp1_range_var++;
  43. return 0;
  44. }