/usr/include/ncarg/nio/nioc.h is in libncarg-dev 6.1.2-7.
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 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 | /*
* $Id: nioc.h,v 1.3 2009-07-17 00:47:34 dbrown Exp $
*/
/************************************************************************
* *
* Copyright (C) 2000 *
* University Corporation for Atmospheric Research *
* All Rights Reserved *
* *
* NCAR View V3.00alpha *
* *
* This file is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
* by the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This software is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this software; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA. *
* *
************************************************************************/
#ifndef _ncarg_c_
#define _ncarg_c_
#include <stdio.h>
#include <sys/types.h>
#include "nioNgSizeT.h"
/*
* Fortran function macro. This macro needs to surround any "C" reference
* to a function that is written in fortran or is written in "C" to be
* Fortran callable.
*/
#define APPEND_UNDERSCORE 1
#define NO_APPEND_UNDERSCORE 2
#define CAPS_NO_APPEND_UNDERSCORE 3
/* NGCALLF */
#ifdef FORTRAN_CALLING_METHOD
#if FORTRAN_CALLING_METHOD == APPEND_UNDERSCORE
#define NGCALLF(reg,caps) reg##_
#elif FORTRAN_CALLING_METHOD == NO_APPEND_UNDERSCORE
#define NGCALLF(reg,caps) reg
#elif FORTRAN_CALLING_METHOD == CAPS_NO_APPEND_UNDERSCORE
#define NGCALLF(reg,caps) caps
#else
#define NGCALLF(reg,caps) reg##_
#endif
#else
#define NGCALLF(reg,caps) reg##_
#endif /* NGCALLF */
/*
* The Absoft ProFortran compiler munges common block names
* differently than the way it handles Fortran subroutine names,
* so here is where we deal with this.
*/
#ifndef NGCALLC
#if defined(AbsoftProFortran)
#define NGCALLC(reg,caps) _C##caps
#else
#define NGCALLC NGCALLF
#endif /* AbsoftProFortran else ... */
#endif /* NGCALLC */
typedef char *NcargString;
#ifdef UNICOS
#include <fortran.h>
#define NGstring _fcd
#define NGCstrToFstr(cstr,len) ((cstr)?_cptofcd((char *)cstr,len):_cptofcd("",0))
#define NGFstrToCstr(fstr) (_fcdtocp(fstr))
#define NGFlgclToClgcl(flog) (_ltob(&flog))
#define NGClgclToFlgcl(clog) (_btol(clog))
#else
#define NGstring char *
#define NGCstrToFstr(cstr,len) (char *)cstr
#define NGFstrToCstr(fstr) fstr
#define NGFlgclToClgcl(flog) flog
#define NGClgclToFlgcl(clog) clog
#endif
#define NGSTRLEN(cstr) ((cstr)?strlen(cstr):0)
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif /* __STDC__ */
#ifdef __STDC__
typedef void * Voidptr;
#define LABS(X) labs(X)
#else
/*
* K&R C
*/
typedef caddr_t Voidptr;
#define const /* K&R C has no 'const' */
#define LABS(X) (long) (abs((int) (X)))
#endif /* __STDC__ */
/*
* C++ prototype protector
*/
#ifdef __cplusplus
#define NCARG_PROTO_BEGIN extern "C" {
#define NCARG_PROTO_END }
#else
#define NCARG_PROTO_BEGIN
#define NCARG_PROTO_END
#endif
typedef unsigned int boolean;
#ifndef TRUE
#define FALSE 0
#define TRUE !FALSE
#endif /* TRUE */
NCARG_PROTO_BEGIN
/*
**
** A R G U M E N T V E C T O R S
**
*/
extern char **AToArgv(
#ifdef NeedFuncProto
const char *str,
const char *prog_name,
int *argc
#endif
);
extern void FreeArgv(
#ifdef NeedFuncProto
char **argv
#endif
);
/*
**
** E R R O R R E P O R T I N G
**
*/
#define E_UNKNOWN 1000
#define ESPRINTF(A,B) ESprintfFirstPart(A, __FILE__, __LINE__), \
ESprintfSecondPart B
/*
* maintain backwords compatibility
*/
#define ErrorGetMessage ErrGetMsg
#define ErrorGetNumber ErrGetNum
/*ARGSUSED2*/
extern const char *ESprintf(
#ifdef NeedFuncProto
unsigned err_code,
const char *format,
...
#endif
);
extern const char *LFESprintf(
#ifdef NeedFuncProto
unsigned err_code,
const char *file,
int line,
const char *format,
...
#endif
);
extern void ESprintfFirstPart(
#ifdef NeedFuncProto
int err_code,
const char *file,
int line
#endif
);
extern const char *ESprintfSecondPart(
#ifdef NeedFuncProto
const char *format,
...
#endif
);
extern int ErrorList(
#ifdef NeedFuncProto
unsigned start,
unsigned num,
const char **err_list
#endif
);
extern const char *ErrGetMsg(void);
extern int ErrGetNum(void);
/*
**
** M I S C E L L A N Y
**
*/
extern boolean IsAsciiInt(
#ifdef NeedFuncProto
const char *s
#endif
);
extern void USleep(
#ifdef NeedFuncProto
unsigned usec
#endif
);
/*
**
** O P T I O N P A R S I N G
**
*/
/*
* structure for describing a valid option to buildOptionTable
*/
typedef struct _OptDescRec {
const char *option;/* name of option without preceeding '-' */
int arg_count; /* num args expected by option */
char *value; /* default value for the argument */
const char *help; /* help string for option */
} OptDescRec;
/*
* structure for returning the value of an option
*/
typedef struct _Option {
char *option_name; /* the options name */
/*
* option type converter
*/
int (*type_conv)(
#ifdef NeedFuncProto
const char *from, Voidptr to
#endif
);
Voidptr offset; /* offset of return address */
int size; /* size of option in bytes */
} Option;
typedef struct _EnvOpt {
char *option; /* option name */
char *env_var; /* coresponding enviroment var */
} EnvOpt;
typedef struct Dimension2D_ {
int nx, ny;
} Dimension2D;
extern int NCARGCvtToInt(
#ifdef NeedFuncProto
const char *from,
Voidptr to
#endif
);
extern int NCARGCvtToFloat(
#ifdef NeedFuncProto
const char *from,
Voidptr to
#endif
);
extern int NCARGCvtToChar(
#ifdef NeedFuncProto
const char *from,
Voidptr to
#endif
);
extern int NCARGCvtToBoolean(
#ifdef NeedFuncProto
const char *from,
Voidptr to
#endif
);
extern int NCARGCvtToString(
#ifdef NeedFuncProto
const char *from,
Voidptr to
#endif
);
extern int NCARGCvtToDimension2D(
#ifdef NeedFuncProto
const char *from,
Voidptr to
#endif
);
extern int OpenOptionTable(void);
extern int CloseOptionTable(
#ifdef NeedFuncProto
int od
#endif
);
extern int GetOptions(
#ifdef NeedFuncProto
int od,
const Option *options
#endif
);
extern int LoadOptionTable(
#ifdef NeedFuncProto
int od,
const OptDescRec *optd
#endif
);
extern void RemoveOptions(
#ifdef NeedFuncProto
int od,
const OptDescRec *optd
#endif
);
extern int ParseOptionTable(
#ifdef NeedFuncProto
int od,
int *argc,
char **argv,
const OptDescRec *optds
#endif
);
extern int ParseEnvOptions(
#ifdef NeedFuncProto
int od,
const EnvOpt *envv,
const OptDescRec *optds
#endif
);
extern void PrintOptionHelp(
#ifdef NeedFuncProto
int od,
FILE *fp
#endif
);
/*
**
** V E R S I O N
**
*/
extern void PrintVersion(
#ifdef NeedFuncProto
const char *header
#endif
);
extern const char *GetNCARGVersion(
#ifdef NeedFuncProto
void
#endif
);
extern const char *GetNCLVersion(
#ifdef NeedFuncProto
void
#endif
);
/*
**
** B I T M A N I P U L A T I O N
**
*/
#ifndef BITSPERBYTE
#define BITSPERBYTE 8
#endif
#ifndef BITS
#define BITS(type) (BITSPERBYTE * (int)sizeof(type))
#endif
#define BYTESIZE 8
#define POWER16 65536.0 /*two to the power 16 */
#define POWER32 4294967300.0 /*two to the power 32 */
#define POWER15 32768.0
#define POWER31 2147483650.0 /*two to the power 32 */
/*
* Macro for extracting N bits from TARG stating at position
* POSS counting from the left. E.g GETBITS(I, 4, 3) will
* extract bits at bit position 4, 3, 2 right adjusted.
* This macro contains a conditional for number of bits greater
* then 32 because some architechures such as Sun 4 with a sparc
* cpu or pyramids cannot shift 32.
*/
#define GETBITS(TARG,POSS,N) \
((N)<32 ? (((TARG) >> ((POSS)+1-(N))) & ~(~0 << (N))) : \
((TARG) >> ((POSS)+1-(N))) )
/*
* Inverse of the GETBITS macro. Place N bits from SRC into
* TARG at position POSS.
*/
#define PUTBITS(TARG, POSS, N, SRC) \
(TARG) &= ~(~((~0) << (N)) << (((POSS)+1) - (N))); \
(TARG) |= (((SRC) & ~((~0) << (N))) << (((POSS)+1) - (N)))
#define ZERO_INDEX(X) (X < 0 ? 0 : X)
/*
**
** N C A R G E N V I R O N M E N T
**
*/
extern const char *GetNCARGPath(
#ifdef NeedFuncProto
const char *dir
#endif
);
extern const char *_NGGetNCARGEnv(
#ifdef NeedFuncProto
const char *name
#endif
);
extern const char *_NGResolvePath(
#ifdef NeedFuncProto
const char *rawfname
#endif
);
extern char *getFcapname(
#ifdef NeedFuncProto
const char *device
#endif
);
extern char *getGcapname(
#ifdef NeedFuncProto
const char *device
#endif
);
/*
** R G B Database Support
**
*/
typedef struct _NGRGB{
unsigned short red,green,blue;
} NGRGB;
/*
* sdbm - ndbm work-alike hashed database library
* based on Per-Aake Larson's Dynamic Hashing algorithms.
* BIT 18 (1978).
*
* Copyright (c) 1991 by Ozan S. Yigit (oz@nexus.yorku.ca)
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation.
*
* This file is provided AS IS with no warranties of any kind. The author
* shall have no liability with respect to the infringement of copyrights,
* trade secrets or any patents by this file or any part thereof. In no
* event will the author be liable for any lost revenue or profits or
* other special, indirect and consequential damages.
*/
#define NGDBLKSIZ 4096
#define NGPBLKSIZ 1024
#define NGPAIRMAX 1008 /* arbitrary on PBLKSIZ-N */
#define NGSPLTMAX 10 /* maximum allowed splits */
/* for a single insertion */
#define NGDIRFEXT ".dir"
#define NGPAGFEXT ".pag"
typedef struct {
int dirf; /* directory file descriptor */
int pagf; /* page file descriptor */
int flags; /* status/error flags, see below */
long maxbno; /* size of dirfile in bits */
long curbit; /* current bit number */
long hmask; /* current hash mask */
long blkptr; /* current block for nextkey */
int keyptr; /* current key for nextkey */
long blkno; /* current page to read/write */
long pagbno; /* current page in pagbuf */
char pagbuf[NGPBLKSIZ]; /* page file block buffer */
long dirbno; /* current block in dirbuf */
char dirbuf[NGDBLKSIZ]; /* directory file block buffer */
} NGDBM;
#define NGDBM_RDONLY 0x1 /* data base open read-only */
#define NGDBM_IOERR 0x2 /* data base I/O error */
/*
* utility macros
*/
#define NGdbm_rdonly(db) ((db)->flags & NGDBM_RDONLY)
#define NGdbm_error(db) ((db)->flags & NGDBM_IOERR)
#define NGdbm_clearerr(db) ((db)->flags &= ~NGDBM_IOERR) /* ouch */
#define NGdbm_dirfno(db) ((db)->dirf)
#define NGdbm_pagfno(db) ((db)->pagf)
typedef struct {
char *dptr;
int dsize;
} NGdatum;
extern NGdatum nullitem;
#ifdef __STDC__
#define proto(p) p
#else
#define proto(p) ()
#endif
/*
* flags to dbm_store
*/
#define NGDBM_INSERT 0
#define NGDBM_REPLACE 1
/*
* ndbm interface
*/
extern NGDBM *NGdbm_open proto((char *, int, int));
extern void NGdbm_close proto((NGDBM *));
extern NGdatum NGdbm_fetch proto((NGDBM *, NGdatum));
extern int NGdbm_delete proto((NGDBM *, NGdatum));
extern int NGdbm_store proto((NGDBM *, NGdatum, NGdatum, int));
extern NGdatum NGdbm_firstkey proto((NGDBM *));
extern NGdatum NGdbm_nextkey proto((NGDBM *));
/*
* other
*/
extern NGDBM *NGdbm_prep proto((char *, char *, int, int));
extern long NGdbm_hash proto((char *, int));
#ifdef SVID
#include <unistd.h>
#endif
/*
* important tuning parms (hah)
*/
#define NGBYTESIZ (8)
#define NGSEEDUPS /* always detect duplicates */
#define NGBADMESS /* generate a message for worst case:
cannot make room after SPLTMAX splits */
/*
* misc
*/
#define debug(x)
/*
**
** M I S C E L L A N E O U S
**
*/
extern char *NmuStrdup(
#ifdef NeedFuncProto
const char *str
#endif
);
NCARG_PROTO_END
#endif /* _ncarg_c_ */
|