Hackfix and re-enable strtoull and wcstoull, see bug #3798.
[sdcc.git] / sdcc-extra / historygraphs / dhrystone-stm8 / dhry_2.c
blob64579c1174804dc0f282538dabd94eea330a7e52
1 /*
2 ****************************************************************************
4 * "DHRYSTONE" Benchmark Program
5 * -----------------------------
6 *
7 * Version: C, Version 2.1
8 *
9 * File: dhry_2.c (part 3 of 3)
11 * Date: May 25, 1988
13 * Author: Reinhold P. Weicker
15 ****************************************************************************
18 #include "dhry.h"
20 #ifndef REG
21 #define REG
22 /* REG becomes defined as empty */
23 /* i.e. no register variables */
24 #endif
26 extern int Int_Glob;
27 extern char Ch_1_Glob;
30 void Proc_6 (Enumeration Enum_Val_Par, Enumeration *Enum_Ref_Par)
31 /*********************************/
32 /* executed once */
33 /* Enum_Val_Par == Ident_3, Enum_Ref_Par becomes Ident_2 */
35 *Enum_Ref_Par = Enum_Val_Par;
36 if (! Func_3 (Enum_Val_Par))
37 /* then, not executed */
38 *Enum_Ref_Par = Ident_4;
39 switch (Enum_Val_Par)
41 case Ident_1:
42 *Enum_Ref_Par = Ident_1;
43 break;
44 case Ident_2:
45 if (Int_Glob > 100)
46 /* then */
47 *Enum_Ref_Par = Ident_1;
48 else *Enum_Ref_Par = Ident_4;
49 break;
50 case Ident_3: /* executed */
51 *Enum_Ref_Par = Ident_2;
52 break;
53 case Ident_4: break;
54 case Ident_5:
55 *Enum_Ref_Par = Ident_3;
56 break;
57 } /* switch */
58 } /* Proc_6 */
61 void Proc_7 (One_Fifty Int_1_Par_Val, One_Fifty Int_2_Par_Val, One_Fifty *Int_Par_Ref)
62 /**********************************************/
63 /* executed three times */
64 /* first call: Int_1_Par_Val == 2, Int_2_Par_Val == 3, */
65 /* Int_Par_Ref becomes 7 */
66 /* second call: Int_1_Par_Val == 10, Int_2_Par_Val == 5, */
67 /* Int_Par_Ref becomes 17 */
68 /* third call: Int_1_Par_Val == 6, Int_2_Par_Val == 10, */
69 /* Int_Par_Ref becomes 18 */
71 One_Fifty Int_Loc;
73 Int_Loc = Int_1_Par_Val + 2;
74 *Int_Par_Ref = Int_2_Par_Val + Int_Loc;
75 } /* Proc_7 */
78 void Proc_8 (Arr_1_Dim Arr_1_Par_Ref, Arr_2_Dim Arr_2_Par_Ref, int Int_1_Par_Val, int Int_2_Par_Val)
79 /*********************************************************************/
80 /* executed once */
81 /* Int_Par_Val_1 == 3 */
82 /* Int_Par_Val_2 == 7 */
84 REG One_Fifty Int_Index;
85 REG One_Fifty Int_Loc;
87 Int_Loc = Int_1_Par_Val + 5;
88 Arr_1_Par_Ref [Int_Loc] = Int_2_Par_Val;
89 Arr_1_Par_Ref [Int_Loc+1] = Arr_1_Par_Ref [Int_Loc];
90 Arr_1_Par_Ref [Int_Loc+30] = Int_Loc;
91 for (Int_Index = Int_Loc; Int_Index <= Int_Loc+1; ++Int_Index)
92 Arr_2_Par_Ref [Int_Loc] [Int_Index] = Int_Loc;
93 Arr_2_Par_Ref [Int_Loc] [Int_Loc-1] += 1;
94 Arr_2_Par_Ref [Int_Loc+20] [Int_Loc] = Arr_1_Par_Ref [Int_Loc];
95 Int_Glob = 5;
96 } /* Proc_8 */
99 Enumeration Func_1 (Capital_Letter Ch_1_Par_Val, Capital_Letter Ch_2_Par_Val)
100 /*************************************************/
101 /* executed three times */
102 /* first call: Ch_1_Par_Val == 'H', Ch_2_Par_Val == 'R' */
103 /* second call: Ch_1_Par_Val == 'A', Ch_2_Par_Val == 'C' */
104 /* third call: Ch_1_Par_Val == 'B', Ch_2_Par_Val == 'C' */
107 Capital_Letter Ch_1_Loc;
108 Capital_Letter Ch_2_Loc;
110 Ch_1_Loc = Ch_1_Par_Val;
111 Ch_2_Loc = Ch_1_Loc;
112 if (Ch_2_Loc != Ch_2_Par_Val)
113 /* then, executed */
114 return (Ident_1);
115 else /* not executed */
117 Ch_1_Glob = Ch_1_Loc;
118 return (Ident_2);
120 } /* Func_1 */
123 Boolean Func_2 (Str_30 Str_1_Par_Ref, Str_30 Str_2_Par_Ref)
124 /*************************************************/
125 /* executed once */
126 /* Str_1_Par_Ref == "DHRYSTONE PROGRAM, 1'ST STRING" */
127 /* Str_2_Par_Ref == "DHRYSTONE PROGRAM, 2'ND STRING" */
130 REG One_Thirty Int_Loc;
131 Capital_Letter Ch_Loc;
133 Int_Loc = 2;
134 while (Int_Loc <= 2) /* loop body executed once */
135 if (Func_1 (Str_1_Par_Ref[Int_Loc],
136 Str_2_Par_Ref[Int_Loc+1]) == Ident_1)
137 /* then, executed */
139 Ch_Loc = 'A';
140 Int_Loc += 1;
141 } /* if, while */
142 if (Ch_Loc >= 'W' && Ch_Loc < 'Z')
143 /* then, not executed */
144 Int_Loc = 7;
145 if (Ch_Loc == 'R')
146 /* then, not executed */
147 return (true);
148 else /* executed */
150 if (strcmp (Str_1_Par_Ref, Str_2_Par_Ref) > 0)
151 /* then, not executed */
153 Int_Loc += 7;
154 Int_Glob = Int_Loc;
155 return (true);
157 else /* executed */
158 return (false);
159 } /* if Ch_Loc */
160 } /* Func_2 */
163 Boolean Func_3 (Enumeration Enum_Par_Val)
164 /***************************/
165 /* executed once */
166 /* Enum_Par_Val == Ident_3 */
168 Enumeration Enum_Loc;
170 Enum_Loc = Enum_Par_Val;
171 if (Enum_Loc == Ident_3)
172 /* then, executed */
173 return (true);
174 else /* not executed */
175 return (false);
176 } /* Func_3 */