modified: SpatialOmicsCoord.py
[GalaxyCodeBases.git] / c_cpp / etc / calc / have_offscl.c
blob3e48db0a0117cbcdfcd6d39c52fd08ad71caa2be
1 /*
2 * have_offscl - determine if we have a scalar off_t element
4 * Copyright (C) 1999 Landon Curt Noll
6 * Calc is open software; you can redistribute it and/or modify it under
7 * the terms of the version 2.1 of the GNU Lesser General Public License
8 * as published by the Free Software Foundation.
10 * Calc is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
13 * Public License for more details.
15 * A copy of version 2.1 of the GNU Lesser General Public License is
16 * distributed with calc under the filename COPYING-LGPL. You should have
17 * received a copy with calc; if not, write to Free Software Foundation, Inc.
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * @(#) $Revision: 30.2 $
21 * @(#) $Id: have_offscl.c,v 30.2 2008/04/15 21:17:57 chongo Exp $
22 * @(#) $Source: /usr/local/src/bin/calc/RCS/have_offscl.c,v $
24 * Under source code control: 1996/07/13 12:57:22
25 * File existed as early as: 1996
27 * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
28 * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
32 * usage:
33 * have_offscl
35 * On some systems, off_t is a scalar value on which one can perform
36 * arithmetic operations, assignments and comparisons. On some systems
37 * off_t is some sort of union or struct which must be converted into
38 * a ZVALUE in order to perform arithmetic operations, assignments and
39 * comparisons.
42 * This prog outputs several defines:
44 * HAVE_OFF_T_SCALAR
45 * defined ==> ok to perform arithmetic ops, = and comparisons
46 * undefined ==> convert to ZVALUE first
50 #include <stdio.h>
51 #include <sys/types.h>
52 #include <sys/stat.h>
54 int
55 main(void)
57 #if !defined(OFF_T_NON_SCALAR)
58 off_t value; /* an off_t to perform arithmatic on */
59 off_t value2; /* an off_t to perform arithmatic on */
62 * do some math opts on an off_t
64 value = (off_t)getpid();
65 value2 = (off_t)-1;
66 if (value > (off_t)1) {
67 --value;
69 #if !defined(_WIN32)
70 if (value <= (off_t)getppid()) {
71 --value;
73 #endif
74 if (value == value2) {
75 value += value2;
77 value <<= 1;
78 if (!value) {
79 printf("/* something for the off_t to do */\n");
83 * report off_t as a scalar
85 printf("#undef HAVE_OFF_T_SCALAR\n");
86 printf("#define HAVE_OFF_T_SCALAR /* off_t is a simple value */\n");
87 #else
88 printf("#undef HAVE_OFF_T_SCALAR /* off_t is not a simple value */\n");
89 #endif
90 /* exit(0); */
91 return 0;