1/*
2 * test5100 - 5100 series of the regress.cal test suite
3 *
4 * Copyright (C) 1999,2021  Ernest Bowen and Landon Curt Noll
5 *
6 * Primary author:  Ernest Bowen
7 *
8 * Calc is open software; you can redistribute it and/or modify it under
9 * the terms of the version 2.1 of the GNU Lesser General Public License
10 * as published by the Free Software Foundation.
11 *
12 * Calc is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU Lesser General
15 * Public License for more details.
16 *
17 * A copy of version 2.1 of the GNU Lesser General Public License is
18 * distributed with calc under the filename COPYING-LGPL.  You should have
19 * received a copy with calc; if not, write to Free Software Foundation, Inc.
20 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 * Under source code control:	1996/12/02 23:57:10
23 * File existed as early as:	1996
24 *
25 * Share and enjoy!  :-)	http://www.isthe.com/chongo/tech/comp/calc/
26 */
27
28
29defaultverbose = 1;	/* default verbose value */
30
31/*
32 * We test the new code generator declaration scope and order.
33 *
34 * In this function two static variables a5100 and b5100 are created,
35 * with zero value, when the definition is read.
36 *
37 * The variable a5100 is initialized with the value x if and when this
38 * function is first called with a positive even x. The variable b5100
39 * is similarly initialized if and when this function is first called positive
40 * odd x.
41 *
42 * Each time this function is called with positive integer x, a5100 or
43 * b5100 is incremented.
44 *
45 * Finally the values of the static variables are assigned to the global
46 * variables a5100 and b5100.
47 *
48 * Immediately after the last of several calls to this function
49 * a5100 = 0 if none of the x's have been positive even, otherwise
50 * a5100 = the first positive even x + the number of positive even x's,
51 * and b5100 = 0 if none of the x's have been positive odd, otherwise
52 * b5100 = the first positive odd x + the number of positive odd x's.
53 */
54define test5100(x)
55{
56	if (isint(x) && x > 0) {
57		if (iseven(x)) {
58			static a5100 = x;
59			a5100++;
60		} else {
61			static b5100 = x;
62			b5100++;
63		}
64	}
65	global a5100 = a5100, b5100 = b5100;
66}
67