111
|
1 /*
|
|
2 -- CXB30130.C
|
|
3 --
|
|
4 -- Grant of Unlimited Rights
|
|
5 --
|
|
6 -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
|
|
7 -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
|
|
8 -- unlimited rights in the software and documentation contained herein.
|
|
9 -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
|
|
10 -- this public release, the Government intends to confer upon all
|
|
11 -- recipients unlimited rights equal to those held by the Government.
|
|
12 -- These rights include rights to use, duplicate, release or disclose the
|
|
13 -- released technical data and computer software in whole or in part, in
|
|
14 -- any manner and for any purpose whatsoever, and to have or permit others
|
|
15 -- to do so.
|
|
16 --
|
|
17 -- DISCLAIMER
|
|
18 --
|
|
19 -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
|
|
20 -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
|
|
21 -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
|
|
22 -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
|
|
23 -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
|
|
24 -- PARTICULAR PURPOSE OF SAID MATERIAL.
|
|
25 --*
|
|
26 --
|
|
27 -- FUNCTION NAME: CXB30130 ("square_it")
|
|
28 --
|
|
29 -- FUNCTION DESCRIPTION:
|
|
30 -- This C function returns the square of num1 through the function
|
|
31 -- name, and returns the square of parameters num2, num3, and num4
|
|
32 -- through the argument list (modifying the objects pointed to by
|
|
33 -- the parameters).
|
|
34 --
|
|
35 -- INPUTS:
|
|
36 -- This function requires that four parameters be passed to it.
|
|
37 -- The types of these parameters are, in order: int, pointer to short,
|
|
38 -- pointer to float, and pointer to double.
|
|
39 --
|
|
40 -- PROCESSING:
|
|
41 -- The function will calculate the square of the int parameter (num1),
|
|
42 -- and return this value as the function result through the function
|
|
43 -- name. The function will also calculate the square of the values
|
|
44 -- pointed to by the remaining three parameters (num2, num3, num4),
|
|
45 -- and will modify the referenced memory locations to contain the
|
|
46 -- squared values.
|
|
47 --
|
|
48 -- OUTPUTS:
|
|
49 -- The square of num1 is returned through function name.
|
|
50 -- Parameters num2-num4 now point to values that are the squared results
|
|
51 -- of the originally referenced values (i.e., the original values are
|
|
52 -- modified as a result of this function).
|
|
53 --
|
|
54 -- CHANGE HISTORY:
|
|
55 -- 12 Oct 95 SAIC Initial prerelease version.
|
|
56 --
|
|
57 --!
|
|
58 */
|
|
59
|
|
60 int CXB30130 (int num1, short* num2, float* num3, double* num4)
|
|
61
|
|
62 /* NOTE: The above function definition should be accepted by an ANSI-C */
|
|
63 /* compiler. Older C compilers may reject it; they may, however */
|
|
64 /* accept the following five lines. An implementation may comment */
|
|
65 /* out the above function definition and uncomment the following */
|
|
66 /* one. Otherwise, an implementation must provide the necessary */
|
|
67 /* modifications to this C code to satisfy the function */
|
|
68 /* requirements (see Function Description). */
|
|
69 /* */
|
|
70 /* int CXB30130 (num1, num2, num3, num4) */
|
|
71 /* int num1; */
|
|
72 /* short* num2; */
|
|
73 /* float* num3; */
|
|
74 /* double* num4; */
|
|
75 /* */
|
|
76
|
|
77 {
|
|
78 int return_value = 0;
|
|
79
|
|
80 return_value = num1 * num1;
|
|
81 *num2 = *num2 * *num2; /* Return square of these parameters through */
|
|
82 *num3 = *num3 * *num3; /* the parameter list. */
|
|
83 *num4 = *num4 * *num4;
|
|
84
|
|
85 return (return_value); /* Return square of num1 through function name */
|
|
86 }
|