/usr/include/xview/xv_c_types.h is in xviewg-dev 3.2p1.4-28.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | /* @(#)xv_c_types.h 1.9 93/06/28 SMI */
/*
* (c) Copyright 1989 Sun Microsystems, Inc. Sun design patents
* pending in the U.S. and foreign countries. See LEGAL NOTICE
* file for terms of the license.
*/
#ifndef XV_C_TYPES_H
#define XV_C_TYPES_H
#ifndef C_VARIETIES_H
#define C_VARIETIES_H
/*
* This file defines some macros that are used to make code
* portable between the major C dialects currently in use at
* Sun. As of 12/88, these include Sun C (a lot like K&R C),
* ANSI C, and C++.
*
* external functions:
* To declare an external function, invoke the EXTERN_FUNCTION
* macro; the macro's first parameter should be the function's
* return type and function name, and the second macro parameter
* should be the parenthesized list of function arguments (or an
* ellipsis - DOTDOTDOT macro should be used to indicate the
* ellipsis as explained later in this file - if the arguments are
* unspecified or of varying number or type, or the uppercase word
* "_VOID_" if the function takes no arguments). Some examples:
*
* EXTERN_FUNCTION( void printf, (char *, DOTDOTDOT) );
* EXTERN_FUNCTION( int fread, (char*, int, int, FILE*) );
* EXTERN_FUNCTION( int getpid, (_VOID_) );
* EXTERN_FUNCTION( int atoi, (CONST char *str) );
*
* Note that to be ANSI-C conformant, one should put "," at the end
* first argument of printf() declaration.
*
* structure tags:
* In order to handle cases where a structure tag has the same name
* as a type, the STRUCT_TAG macro makes the tag disappear in C++.
* An example (from <sys/types.h>):
*
* typedef struct STRUCT_TAG(fd_set) { ... } fd_set;
*
* enum bitfields:
* In K&R C as interpreted at UCB, bitfields may be declared to
* be of an enumerated type. Neither ANSI C nor C++ permit this,
* so the ENUM_BITFIELD macro replaces the enum declaration with
* "unsigned". An example (from <sunwindow/attr.h>):
*
* struct {
* ENUM_BITFIELD( Attr_pkg ) pkg : 8;
* unsigned ordinal : 8;
* ENUM_BITFIELD( Attr_list_type ) list_type : 8;
* ...
* };
*
* enum type specifier:
* In K&R C, it is OK to use "enum xyz" as return type but in C++,
* one should use "xyz". ENUM_TYPE macro is used to handle this.
*
* ENUM_TYPE(enum, xyz) (*func) (...);
*
* "struct s s;":
* C++ does not allow this sort of name conflict, since struct tags are
* in the same namespace as variables. In this case, we use the
* NAME_CONFLICT macro to prepend (for C++) an underscore to the
* variable (or struct member) name. E.g. from <pixrect/pixrect.h>:
*
* typedef struct pixrect {
* struct pixrectops *pr_ops;
* struct pr_size NAME_CONFLICT(pr_size);
* } Pixrect;
* #define pr_height NAME_CONFLICT(pr_size).y
* #define pr_width NAME_CONFLICT(pr_size).x
*
* Note that no spaces are allowed within the parentheses in the
* invocation of NAME_CONFLICT.
*
* Pointers to functions declared as struct members:
* Instead of getting picky about the types expected by struct
* members which are pointers to functions, we use DOTDOTDOT to
* tell C++ not to be so uptight:
*
* struct pixrectops {
* int (*pro_rop)( DOTDOTDOT );
* int (*pro_stencil)( DOTDOTDOT );
* int (*pro_batchrop)( DOTDOTDOT );
* . . .
* };
*
*/
/* Which type of C/C++ compiler are we using? */
#if defined(__cplusplus)
/*
* Definitions for C++ 2.0 and later require extern "C" { decl; }
*/
# define EXTERN_FUNCTION( rtn, args ) extern "C" { rtn args; }
# define STRUCT_TAG( tag_name ) /* the tag disappears */
# define ENUM_BITFIELD( enum_type ) unsigned
# define ENUM_TYPE( enum_sp, enum_ty ) enum_ty
#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
# define NAME_CONFLICT( name ) _##name
#else
# define NAME_CONFLICT( name ) _/**/name
#endif
# define DOTDOTDOT ...
# define _VOID_ /* anachronism */
# define CONST const
/*
* This is not necessary for 2.0 since 2.0 has corrected the void (*) () problem
*/
typedef void (*_PFV_)();
typedef int (*_PFI_)();
#elif defined(c_plusplus)
/*
* Definitions for C++ 1.2
*/
# define EXTERN_FUNCTION( rtn, args ) rtn args
# define STRUCT_TAG( tag_name ) /* the tag disappears */
# define ENUM_BITFIELD( enum_type ) unsigned
# define ENUM_TYPE( enum_sp, enum_ty ) enum_ty
# define NAME_CONFLICT( name ) _/**/name
# define DOTDOTDOT ...
# define _VOID_ /* anachronism */
# define CONST const
typedef void (*_PFV_)();
typedef int (*_PFI_)();
#elif defined(__STDC__)
/*
* Definitions for ANSI C
*/
# define EXTERN_FUNCTION( rtn, args ) rtn args
# define STRUCT_TAG( tag_name ) tag_name
# define ENUM_BITFIELD( enum_type ) unsigned
# define ENUM_TYPE( enum_sp, enum_ty ) enum_sp enum_ty
# define NAME_CONFLICT( name ) name
# define DOTDOTDOT ...
# define _VOID_ void
# define CONST
#else
/*
* Definitions for Sun/K&R C -- ignore function prototypes,
* but preserve tag names and enum bitfield declarations.
*/
# define EXTERN_FUNCTION( rtn, args ) rtn()
# define STRUCT_TAG( tag_name ) tag_name
# define ENUM_BITFIELD( enum_type ) enum_type
# define ENUM_TYPE( enum_sp, enum_ty ) enum_sp enum_ty
# define NAME_CONFLICT( name ) name
# define DOTDOTDOT
# define _VOID_
/* VOID is only used where it disappears anyway */
# define CONST
#endif /* Which type of C/C++ compiler are we using? */
#endif /* ~defined(C_VARIETIES_H) */
#endif /* defined(XV_C_TYPES_H) */
|